From 44ffcde54cb7d832232a32fe7a60b4849bef447a Mon Sep 17 00:00:00 2001 From: tragait Date: Fri, 4 Sep 2020 13:34:35 +0100 Subject: multiple pnf fix Signed-off-by: tragait Change-Id: I3d9d0ebb38da1fb286f097828551e981a0f95a65 Signed-off-by: tragait Issue-ID: SO-3223 Signed-off-by: tragait --- .../resources/process/GenericPnfSWUPDownload.bpmn | 192 ++++++------ .../process/GenericPnfSoftwareUpgrade.bpmn | 252 ++++++++-------- .../resources/process/ServiceLevelUpgrade.bpmn | 333 ++++++++++++--------- .../process/ServiceLevelUpgradeTest.java | 81 +++-- .../src/test/resources/response/PnfDemo1_aai.json | 42 +++ .../src/test/resources/response/PnfDemo_aai.json | 42 +++ .../src/test/resources/response/Pnf_aai.json | 42 --- .../resources/response/Service_instance_aai.json | 10 + 8 files changed, 561 insertions(+), 433 deletions(-) create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json delete mode 100644 bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json (limited to 'bpmn/so-bpmn-infrastructure-flows') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn index 8b1b8367f8..6a0b260a70 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn @@ -1,10 +1,10 @@ - + SequenceFlow_1fdclh0 - + SequenceFlow_1fdclh0 SequenceFlow_0kusy70 @@ -144,6 +144,88 @@ pnfSwUpgrade.prepareCompletion(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -186,68 +268,21 @@ pnfSwUpgrade.prepareCompletion(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -266,50 +301,15 @@ pnfSwUpgrade.prepareCompletion(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn index f4a6196fc1..9b8ce4a7b7 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn @@ -1,10 +1,10 @@ - + SequenceFlow_1ng4b6l - + SequenceFlow_1ng4b6l SequenceFlow_12ejx4m @@ -174,6 +174,110 @@ pnfSwUpgrade.prepareFalloutHandler(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -183,20 +287,12 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - - - - - - - - @@ -212,160 +308,59 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - + + + @@ -373,13 +368,18 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - - + + + + + + + + + + + - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn index 3d37430723..8ff1a1efec 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn @@ -12,19 +12,21 @@ Flow_10jgbxm - + Flow_1y3cptr Flow_0y1ebox Flow_0mbp7mv + Flow_19tmp99 Flow_0y1ebox - - Flow_0trmo7s - Flow_1z06yyv + + Flow_0zjsp5x Flow_0mxq0qe + Flow_05x2cqc + Flow_02elm5b Flow_0mxq0qe @@ -40,7 +42,7 @@ - Flow_1z06yyv + Flow_02elm5b Flow_01gwzx9 @@ -48,16 +50,9 @@ Flow_1ru18s3 - Flow_1v0mxe7 - Flow_1p4xkdj - - Flow_1b392qs - Flow_1v0mxe7 - import org.onap.so.bpmn.infrastructure.scripts.* -def pnfSwUpgrade = new GenericPnfSoftwareUpgrade() -pnfSwUpgrade.sendResponse(execution) - + Flow_1ptk2a3 + Flow_0l67uzl Flow_0frhsd0 @@ -94,24 +89,23 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - + - - - - - #{execution.getVariable("ControllerStatus").equals("Success")} + + + ${!execution.getVariable("ControllerStatus").equals("Success")} + + + ${!execution.getVariable("ControllerStatus").equals("Success")} - #{execution.getVariable("ControllerStatus").equals("Success")} - - #{execution.getVariable("ControllerStatus").equals("Success")} + ${execution.getVariable("pnfCounter") >= execution.getVariable("pnfSize")} @@ -123,10 +117,9 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - Flow_1p4xkdj - Flow_0trmo7s + Flow_0rpnl02 + Flow_0zjsp5x - @@ -137,7 +130,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution) - Flow_01gwzx9 + Flow_0g6gkgx Flow_1y3cptr @@ -151,7 +144,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution) Flow_05ohtnj Flow_0ny61qm - + #{execution.getVariable("ControllerStatus").equals("Success")} @@ -159,6 +152,29 @@ pnfSwUpgrade.prepareFalloutHandler(execution) + + + + + + ${execution.getVariable("pnfCounter") < execution.getVariable("pnfSize")} + + + ${execution.getVariable("pnfCounter") < execution.getVariable("pnfSize")} + + + ${execution.getVariable("pnfCounter") >= execution.getVariable("pnfSize")} + + + Flow_1ptk2a3 + Flow_05x2cqc + Flow_0rpnl02 + + + Flow_01gwzx9 + Flow_19tmp99 + Flow_0g6gkgx + @@ -166,212 +182,237 @@ pnfSwUpgrade.prepareFalloutHandler(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - - + + + + - + - - + + - - - - - - + + - - + + - + - - - - - - - - - - + + - - - - + + + + - + - - + + - + - - + + - - - - - - - - - + + - + - - - - - - + + - + - - + + - - + + - - + + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - + - + - + - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java index bdad46f3ca..4322ff5bdf 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java @@ -62,7 +62,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { private static final Map executionVariables = new HashMap(); private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5"; private static final String SERVICE_INSTANCE_ID = "5df8b6de-2083-11e7-93ae-92361f002676"; - private final String[] actionNames = new String[5]; + private final String[] actionNames = new String[10]; + private final String[] pnfNames = new String[10]; private final String CLASSNAME = getClass().getSimpleName(); private String requestObject; private String responseObject; @@ -73,10 +74,26 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { @Before public void setUp() throws IOException { actionNames[0] = "healthCheck"; - actionNames[1] = "preCheck"; - actionNames[2] = "downloadNESw"; - actionNames[3] = "activateNESw"; - actionNames[4] = "postCheck"; + actionNames[1] = "healthCheck"; + actionNames[2] = "preCheck"; + actionNames[3] = "downloadNESw"; + actionNames[4] = "activateNESw"; + actionNames[5] = "postCheck"; + actionNames[6] = "preCheck"; + actionNames[7] = "downloadNESw"; + actionNames[8] = "activateNESw"; + actionNames[9] = "postCheck"; + + pnfNames[0] = "PNFDemo"; + pnfNames[1] = "PNFDemo1"; + pnfNames[2] = "PNFDemo"; + pnfNames[3] = "PNFDemo"; + pnfNames[4] = "PNFDemo"; + pnfNames[5] = "PNFDemo"; + pnfNames[6] = "PNFDemo1"; + pnfNames[7] = "PNFDemo1"; + pnfNames[8] = "PNFDemo1"; + pnfNames[9] = "PNFDemo1"; executionVariables.clear(); @@ -125,22 +142,22 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_0qgmx7a", - "Activity_09bqns0", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_1q4o9fx", - "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2", "Gateway_1vq11i7", - "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); + assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_09bqns0", + "Activity_02vp5np", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_0e6w886", + "Activity_1q4o9fx", "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2", + "Gateway_1vq11i7", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); List detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 5); int count = 0; + String action = ""; try { for (ExecutionServiceInput eSI : detailedMessages) { - for (String action : actionNames) { - if (action.equals(eSI.getActionIdentifiers().getActionName()) - && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) { - checkWithActionName(eSI, action); - count++; - } + action = actionNames[count]; + if (action.equals(eSI.getActionIdentifiers().getActionName()) + && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) { + checkWithActionName(eSI, action, pnfNames[count]); + count++; } } } catch (Exception e) { @@ -155,7 +172,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { .singleResult() == null; } - private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) { + private void checkWithActionName(final ExecutionServiceInput executionServiceInput, final String action, + final String pnfName) { logger.info("Checking the " + action + " request"); ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers(); @@ -174,10 +192,10 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); + assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName); assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b"); assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) @@ -188,25 +206,42 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { final String sIUrl = "/business/customers/customer/5df8b6de-2083-11e7-93ae-92361f002676/service-subscriptions/service-subscription/pNF/service-instances/service-instance/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce"; - final String aaiPnfEntry = FileUtil.readResourceFile("response/Pnf_aai.json"); + final String aaiPnfDemoEntry = FileUtil.readResourceFile("response/PnfDemo_aai.json"); + final String aaiPnfDemo1Entry = FileUtil.readResourceFile("response/PnfDemo1_aai.json"); final String aaiServiceInstanceEntry = FileUtil.readResourceFile("response/Service_instance_aai.json"); /** - * PUT the PNF correlation ID to AAI. + * PUT the PNF correlation ID PnfDemo to AAI. */ wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); /** - * Get the PNF entry from AAI. + * PUT the PNF correlation ID PnfDemo1 to AAI. + */ + wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1"))); + + /** + * Get the PNF entry PnfDemo from AAI. + */ + wireMockServer.stubFor( + get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfDemoEntry))); + + /** + * Get the PNF entry PnfDemo1 from AAI. */ wireMockServer.stubFor( - get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry))); + get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")).willReturn(okJson(aaiPnfDemo1Entry))); /** - * Post the pnf to AAI + * Post the pnf PnfDemo to AAI */ wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); + /** + * Post the pnf PnfDemo1 to AAI + */ + wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1"))); + /** * Get the Service Instance to AAI. */ diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json new file mode 100644 index 0000000000..189d2c5a9b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json @@ -0,0 +1,42 @@ +{ + "pnf-name": "PNFDemo1", + "pnf-id": "37c6e19d-6d9f-4085-98a9-d3fcbaf3a616", + "equip-type": "val8", + "equip-vendor": "Ericsson", + "equip-model": "val6", + "ipaddress-v4-oam": "10.10.10.44", + "sw-version": "5gDUv18.05.201", + "in-maint": false, + "serial-number": "7061ZW3", + "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab", + "resource-version": "1595010038094", + "nf-role": "gNB", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "pNF" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5df8b6de-2083-11e7-93ae-92361f002676" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269" + } + ] + } + ] + } +}, \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json new file mode 100644 index 0000000000..865600c800 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json @@ -0,0 +1,42 @@ +{ + "pnf-name": "PNFDemo", + "pnf-id": "27c6e19d-6d9f-4085-98a9-d3fcbaf3a616", + "equip-type": "val8", + "equip-vendor": "Ericsson", + "equip-model": "val6", + "ipaddress-v4-oam": "10.10.10.43", + "sw-version": "5gDUv18.05.201", + "in-maint": false, + "serial-number": "6061ZW3", + "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab", + "resource-version": "1595010038094", + "nf-role": "gNB", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "pNF" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5df8b6de-2083-11e7-93ae-92361f002676" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269" + } + ] + } + ] + } +}, \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json deleted file mode 100644 index 865600c800..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "pnf-name": "PNFDemo", - "pnf-id": "27c6e19d-6d9f-4085-98a9-d3fcbaf3a616", - "equip-type": "val8", - "equip-vendor": "Ericsson", - "equip-model": "val6", - "ipaddress-v4-oam": "10.10.10.43", - "sw-version": "5gDUv18.05.201", - "in-maint": false, - "serial-number": "6061ZW3", - "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab", - "resource-version": "1595010038094", - "nf-role": "gNB", - "relationship-list": { - "relationship": [ - { - "related-to": "service-instance", - "related-link": "/aai/v11/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676", - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "pNF" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "5df8b6de-2083-11e7-93ae-92361f002676" - } - ], - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269" - } - ] - } - ] - } -}, \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json index 53fb210478..8ea4263bbe 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json @@ -29,6 +29,16 @@ "relationship-value": "PNFDemo" } ] + }, + { + "related-to": "pnf", + "related-link": "/aai/v11/network/pnfs/pnf/PNFDemo1", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "PNFDemo1" + } + ] } ] } -- cgit 1.2.3-korg