diff options
author | Kuleshov, Elena <evn@att.com> | 2020-01-24 16:33:39 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-01-24 16:33:40 -0500 |
commit | 2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 (patch) | |
tree | 4f4e5ad0aa89961c4b51eaf8fd32bc9f340b8c93 /bpmn/MSOCommonBPMN/src | |
parent | 48cb43adc20ac10fa6f22c0e03fe2b6775d45b87 (diff) |
add manual handling to rainy day handling for bbs
Initial Manual Handling addition to Rainy Day BB handling.
Reenable task API, add task variable setup.
TaskTimeout will come from the configuration settings.
Update the base path for the APIH manual tasks junit.
Additional JUNIT tests for manual handling
Add Manual as a primary policy for Change Management BBs.
Error handling changes and robot tests for manual handling.
Correct failure data retrieval when serviceSubscription is unavailable.
Correct failure data retrieval when serviceSubscription is unavailable.
Keep WorkflowException when manual pause gets invoked; improved error
reporting.
Issue-ID: SO-2616
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I98a84c1a489bb7b24b68e567f604aeb074fd7bf9
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
4 files changed, 52 insertions, 110 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index ef4291d18f..615964b2a9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -45,7 +45,6 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.ruby.* import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -299,59 +298,4 @@ public class ManualHandling extends AbstractServiceTaskProcessor { logger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ") } - public void createAOTSTicket (DelegateExecution execution) { - String msg = "" - logger.trace("createAOTSTicket of ManualHandling ") - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - // This method will not be throwing an exception, but rather log the error - - try { - execution.setVariable("prefix", Prefix) - setBasicDBAuthHeader(execution,isDebugLogEnabled) - // check for required input - String requestId = execution.getVariable("msoRequestId") - logger.debug("requestId is: " + requestId) - def currentActivity = execution.getVariable("currentActivity") - logger.debug("currentActivity is: " + currentActivity) - def workStep = execution.getVariable("workStep") - logger.debug("workStep is: " + workStep) - def failedActivity = execution.getVariable("failedActivity") - logger.debug("failedActivity is: " + failedActivity) - def errorCode = execution.getVariable("errorCode") - logger.debug("errorCode is: " + errorCode) - def errorText = execution.getVariable("errorText") - logger.debug("errorText is: " + errorText) - def vnfName = execution.getVariable("vnfName") - logger.debug("vnfName is: " + vnfName) - - String rubyRequestId = UUID.randomUUID() - logger.debug("rubyRequestId: " + rubyRequestId) - String sourceName = vnfName - logger.debug("sourceName: " + sourceName) - String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode - logger.debug("reason: " + reason) - String workflowId = requestId - logger.debug("workflowId: " + workflowId) - String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId - logger.debug("notification: " + notification) - - logger.debug("Creating AOTS Ticket request") - - RubyClient rubyClient = new RubyClient() - rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification) - - } catch (BpmnError e) { - msg = "BPMN error in createAOTSTicket " + ex.getMessage() - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - } catch (Exception ex){ - msg = "Exception in createAOTSTicket " + ex.getMessage() - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - } - logger.trace("Exit createAOTSTicket of ManualHandling ") - } - - - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index ae7addcc57..99767b0405 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -49,6 +49,9 @@ public class ExecuteBuildingBlockRainyDay { private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class); public static final String HANDLING_CODE = "handlingCode"; public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState"; + public static final String RAINY_DAY_SERVICE_TYPE = "rainyDayServiceType"; + public static final String RAINY_DAY_VNF_TYPE = "rainyDayVnfType"; + public static final String RAINY_DAY_VNF_NAME = "rainyDayVnfName"; @Autowired private CatalogDbClient catalogDbClient; @@ -97,8 +100,10 @@ public class ExecuteBuildingBlockRainyDay { handlingCode = "Abort"; } else { try { - serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) - .getModelInfoServiceInstance().getServiceType(); + if (gBBInput.getCustomer().getServiceSubscription() != null) { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getModelInfoServiceInstance().getServiceType(); + } if (serviceType == null || serviceType.isEmpty()) { serviceType = ASTERISK; } @@ -106,19 +111,32 @@ public class ExecuteBuildingBlockRainyDay { // keep default serviceType value logger.error("Exception in serviceType retrieval", ex); } + execution.setVariable(RAINY_DAY_SERVICE_TYPE, serviceType); String vnfType = ASTERISK; + String vnfName = ASTERISK; try { - for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) - .getVnfs()) { - if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnfType = vnf.getVnfType(); + if (gBBInput.getCustomer().getServiceSubscription() != null) { + for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances() + .get(0).getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + vnfName = vnf.getVnfName(); + } + } + } else { + for (GenericVnf vnf : gBBInput.getServiceInstance().getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + vnfName = vnf.getVnfName(); + } } } } catch (Exception ex) { // keep default vnfType value logger.error("Exception in vnfType retrieval", ex); } - + execution.setVariable(RAINY_DAY_VNF_TYPE, vnfType); + execution.setVariable(RAINY_DAY_VNF_NAME, vnfName); String errorCode = ASTERISK; if (workflowException != null) { errorCode = "" + workflowException.getErrorCode(); @@ -151,8 +169,10 @@ public class ExecuteBuildingBlockRainyDay { String serviceRole = ASTERISK; try { - serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) - .getModelInfoServiceInstance().getServiceRole(); + if (gBBInput.getCustomer().getServiceSubscription() != null) { + serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getModelInfoServiceInstance().getServiceRole(); + } if (serviceRole == null || serviceRole.isEmpty()) { serviceRole = ASTERISK; } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn index cec3e249ea..0115c078f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/ManualHandling.bpmn @@ -43,11 +43,11 @@ def mh = new ManualHandling() mh.setTaskVariables(task)]]></camunda:script> </camunda:taskListener> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0igra4l</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_192yimz</bpmn2:outgoing> </bpmn2:userTask> <bpmn2:sequenceFlow id="SequenceFlow_0mbjrvr" sourceRef="Task_137bzdi" targetRef="Task_1kuxfdu" /> - <bpmn2:sequenceFlow id="SequenceFlow_0b84ki5" sourceRef="Task_1kuxfdu" targetRef="CreateAOTSRubyTicket" /> + <bpmn2:sequenceFlow id="SequenceFlow_0b84ki5" sourceRef="Task_1kuxfdu" targetRef="ManualHandlingUserTask" /> <bpmn2:sequenceFlow id="SequenceFlow_0zer29a" sourceRef="Task_0r60vxk" targetRef="Task_02xybqx" /> <bpmn2:sequenceFlow id="SequenceFlow_14cyk9v" sourceRef="Task_02xybqx" targetRef="EndEvent_3" /> <bpmn2:serviceTask id="Task_1kuxfdu" name="Update Infra DB Status to PENDING_MANUAL_TASK"> @@ -116,14 +116,6 @@ def mh = new ManualHandling() mh.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0zgg47r" sourceRef="Task_1qrt7xw" targetRef="Task_137bzdi" /> - <bpmn2:sequenceFlow id="SequenceFlow_0igra4l" sourceRef="CreateAOTSRubyTicket" targetRef="ManualHandlingUserTask" /> - <bpmn2:scriptTask id="CreateAOTSRubyTicket" name="Create AOTS Ruby Ticket" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0igra4l</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def mh = new ManualHandling() -mh.createAOTSTicket(execution)]]></bpmn2:script> - </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -136,9 +128,9 @@ mh.createAOTSTicket(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3"> - <dc:Bounds x="1286" y="79" width="36" height="36" /> + <dc:Bounds x="1173" y="79" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1304" y="120" width="0" height="0" /> + <dc:Bounds x="1191" y="120" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> @@ -181,14 +173,14 @@ mh.createAOTSTicket(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_192yimz_di" bpmnElement="SequenceFlow_192yimz"> - <di:waypoint xsi:type="dc:Point" x="944" y="97" /> - <di:waypoint xsi:type="dc:Point" x="982" y="97" /> + <di:waypoint xsi:type="dc:Point" x="778" y="97" /> + <di:waypoint xsi:type="dc:Point" x="839" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="963" y="82" width="0" height="0" /> + <dc:Bounds x="809" y="82" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="UserTask_1krqrz1_di" bpmnElement="ManualHandlingUserTask"> - <dc:Bounds x="844" y="57" width="100" height="80" /> + <dc:Bounds x="678" y="57" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mbjrvr_di" bpmnElement="SequenceFlow_0mbjrvr"> <di:waypoint xsi:type="dc:Point" x="483" y="97" /> @@ -199,23 +191,25 @@ mh.createAOTSTicket(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0b84ki5_di" bpmnElement="SequenceFlow_0b84ki5"> <di:waypoint xsi:type="dc:Point" x="627" y="97" /> - <di:waypoint xsi:type="dc:Point" x="689" y="97" /> + <di:waypoint xsi:type="dc:Point" x="656" y="97" /> + <di:waypoint xsi:type="dc:Point" x="656" y="97" /> + <di:waypoint xsi:type="dc:Point" x="678" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="658" y="82" width="0" height="0" /> + <dc:Bounds x="671" y="97" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0zer29a_di" bpmnElement="SequenceFlow_0zer29a"> - <di:waypoint xsi:type="dc:Point" x="1082" y="97" /> - <di:waypoint xsi:type="dc:Point" x="1128" y="97" /> + <di:waypoint xsi:type="dc:Point" x="939" y="97" /> + <di:waypoint xsi:type="dc:Point" x="995" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1105" y="82" width="0" height="0" /> + <dc:Bounds x="967" y="82" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14cyk9v_di" bpmnElement="SequenceFlow_14cyk9v"> - <di:waypoint xsi:type="dc:Point" x="1228" y="97" /> - <di:waypoint xsi:type="dc:Point" x="1286" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1095" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1173" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1257" y="82" width="0" height="0" /> + <dc:Bounds x="1134" y="82" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0c0yopb_di" bpmnElement="Task_1kuxfdu"> @@ -225,10 +219,10 @@ mh.createAOTSTicket(execution)]]></bpmn2:script> <dc:Bounds x="383" y="57" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1mjq23a_di" bpmnElement="Task_0r60vxk"> - <dc:Bounds x="982" y="57" width="100" height="80" /> + <dc:Bounds x="839" y="57" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1hc2ewj_di" bpmnElement="Task_02xybqx"> - <dc:Bounds x="1128" y="57" width="100" height="80" /> + <dc:Bounds x="995" y="57" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_055s81f_di" bpmnElement="Task_1qrt7xw"> <dc:Bounds x="238" y="57" width="100" height="80" /> @@ -240,16 +234,6 @@ mh.createAOTSTicket(execution)]]></bpmn2:script> <dc:Bounds x="361" y="82" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0igra4l_di" bpmnElement="SequenceFlow_0igra4l"> - <di:waypoint xsi:type="dc:Point" x="789" y="97" /> - <di:waypoint xsi:type="dc:Point" x="844" y="97" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="817" y="82" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0yhlgfw_di" bpmnElement="CreateAOTSRubyTicket"> - <dc:Bounds x="689" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index afdb800ffe..ba2d19b626 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -111,6 +111,9 @@ mso: rainyDay: retryDurationMultiplier: '2' defaultCode: Abort + manualTask: + taskTimeout: PT1M + validResponses: retry,abort,rollback,skip site-name: localDevEnv workflow: default: @@ -189,15 +192,6 @@ sniro: headers.patchVersion: 1 headers.minorVersion: 1 headers.latestVersion: 2 -ruby: - create-ticket-request: - dmaap: - username: m04768@mso.ecomp.att.com - password: alRyMzJ3NUNeakxl - publisher: - topic: com.att.pdas.exp.msoCMFallout-v1 - host: https://olsd004.wnsnet.attws.com:3905 - auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54 spring: datasource: jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn |