From b2ee1e9c0b43722b3a573b08a0f60dd35cd2ef3f Mon Sep 17 00:00:00 2001 From: Enbo Wang Date: Thu, 19 Mar 2020 23:27:16 +0800 Subject: Fix PNF software upgrade workflow Fix the issue that API can not return when the workflow has ended. Issue-ID: SO-2751 Signed-off-by: Enbo Wang Change-Id: I7d140b2286ce3003a6efcd2c3891fc8142982477 --- .../main/resources/process/PNFSWUPDownload.bpmn | 221 +++++++++++++++----- .../main/resources/process/PNFSoftwareUpgrade.bpmn | 230 +++++++++++++++------ .../process/PNFSoftwareUpgradeTest.java | 18 +- 3 files changed, 353 insertions(+), 116 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn index 24ca7104a7..5d523194bb 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn @@ -1,15 +1,15 @@ - + SequenceFlow_1fdclh0 SequenceFlow_1fdclh0 - SequenceFlow_12155q6 + SequenceFlow_0kusy70 - SequenceFlow_1d2rfyx + SequenceFlow_0mjjdia @@ -32,8 +32,8 @@ SequenceFlow_1kaikh5 - SequenceFlow_1d2rfyx SequenceFlow_1gawssm + SequenceFlow_1d2rfyx SequenceFlow_1gawssm @@ -73,10 +73,7 @@ SequenceFlow_1ccldpp - - - #{execution.getVariable("ControllerStatus").equals("Success")} - + @@ -89,113 +86,229 @@ #{execution.getVariable("ControllerStatus").equals("Success")} + + + SequenceFlow_0swi04u + + + + SequenceFlow_0swi04u + SequenceFlow_1ppn4a8 + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution) + + + + + + SequenceFlow_1ppn4a8 + SequenceFlow_1ahmdun + + + SequenceFlow_1ahmdun + + + + + + + + SequenceFlow_0kusy70 + SequenceFlow_12155q6 + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution) + + + + SequenceFlow_1d2rfyx + SequenceFlow_183s0wo + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution) + + + + + + SequenceFlow_183s0wo + SequenceFlow_0mjjdia + + + + #{execution.getVariable("ControllerStatus").equals("Success")} + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - - - - - - + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - + - - + + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn index 8d59dac8ac..4ff0af4549 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1ng4b6l @@ -8,9 +8,9 @@ SequenceFlow_1ng4b6l SequenceFlow_12ejx4m - + - SequenceFlow_1atiydu + SequenceFlow_0tle5zb @@ -60,7 +60,7 @@ #{execution.getVariable("ControllerStatus").equals("Success")} - + #{execution.getVariable("ControllerStatus").equals("Success")} @@ -110,7 +110,7 @@ async - SequenceFlow_12ejx4m + SequenceFlow_0ks3p41 SequenceFlow_0j26xlx @@ -119,9 +119,59 @@ SequenceFlow_084orr1 + + SequenceFlow_12ejx4m + SequenceFlow_0ks3p41 + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution) + + + + SequenceFlow_1atiydu + SequenceFlow_0ipc3nt + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution) + + + + + + + SequenceFlow_0ipc3nt + SequenceFlow_0tle5zb + + + + + SequenceFlow_05haut5 + + + + SequenceFlow_05haut5 + SequenceFlow_09y0mpc + import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution) + + + + + + SequenceFlow_09y0mpc + SequenceFlow_1tcjlty + + + SequenceFlow_1tcjlty + + + + + + - @@ -131,142 +181,204 @@ - + - - + + - + - + - + - + - + - + - - + + - + - + - - + + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - - + + - + - - + + + + + + - + - - + + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java index a9bf4352bf..2993ed6724 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade"; private static final AAIVersion VERSION = AAIVersion.LATEST; private static final Map executionVariables = new HashMap(); + private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5"; private final String[] actionNames = new String[4]; private String requestObject; private String responseObject; @@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json"); executionVariables.put("bpmnRequest", requestObject); + executionVariables.put("requestId", REQUEST_ID); /** * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}. @@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { public void workflow_validInput_expectedOutput() throws InterruptedException { mockCatalogDb(); + mockRequestDb(); mockAai(); final String msoRequestId = UUID.randomUUID().toString(); @@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { // Layout is to reflect the bpmn visual layout assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", - "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", - "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", - "softwareUpgrade_endEvent"); + "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", + "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", + "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 4); @@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); } + private void mockRequestDb() { + /** + * Update Request DB + */ + wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID))); + + } + /** * Mock the catalobdb rest interface. */ -- cgit 1.2.3-korg