From 2eb23f4ac862f700f0abf6f2dc5b9fa662ec9c60 Mon Sep 17 00:00:00 2001 From: "Kuleshov, Elena" Date: Fri, 24 Jan 2020 16:33:39 -0500 Subject: 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) Change-Id: I98a84c1a489bb7b24b68e567f604aeb074fd7bf9 --- .../tasks/ExecuteBuildingBlockRainyDay.java | 38 +++++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/onap') 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; } -- cgit 1.2.3-korg