diff options
author | Prema Bhatt <pb6115@att.com> | 2018-11-06 13:10:30 -0800 |
---|---|---|
committer | Prema Bhatt <pb6115@att.com> | 2018-11-06 13:10:30 -0800 |
commit | 2073a3b4c20965252c7f3a0c1aea8e4407e876fa (patch) | |
tree | 9e76df13d2c4281b40f47c54a16c45adc001f3cc /bpmn/so-bpmn-tasks/src/main | |
parent | 16aa0b6cc42c7287fc080c81451e301c0acc14cf (diff) |
Fixing scaleOut workflow looping issue
Updated both GenericVnfHealthCheck and ConfigurationScaleOut BB with
appropriate Exception catch block and added Exception unit test.
Issue-ID: SO-1182
Change-Id: Ia29741a4a7d8e1bb759ace4fd888864141d224d6
Signed-off-by: Prema Bhatt <pb6115@att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
2 files changed, 37 insertions, 6 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index 58dd5a1df6..615b7279dc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -37,6 +37,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -124,6 +125,9 @@ public class ConfigurationScaleOut { } public void callAppcClient(BuildingBlockExecution execution) { + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; try{ Action commandAction = Action.valueOf(execution.getVariable(ACTION)); String msoRequestId = execution.getVariable(MSO_REQUEST_ID); @@ -137,10 +141,22 @@ public class ConfigurationScaleOut { HashMap<String, String> payloadInfo = new HashMap<>(); payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID)); + msoLogger.debug("Running APP-C action: " + commandAction.toString()); + msoLogger.debug("VNFID: " + vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType); - }catch(Exception ex){ - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); + + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 61162f4d85..2dae820e95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -32,6 +32,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -78,7 +79,9 @@ public class GenericVnfHealthCheck { } public void callAppcClient(BuildingBlockExecution execution) { - + msoLogger.trace("Start runAppcCommand "); + String appcCode = "1002"; + String appcMessage = ""; try { Action action = null; action = Action.valueOf(execution.getVariable("action")); @@ -95,11 +98,23 @@ public class GenericVnfHealthCheck { payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId")); payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress")); payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress")); + + msoLogger.debug("Running APP-C action: " + action.toString()); + msoLogger.debug("VNFID: " + vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); + appcCode = appCClient.getErrorCode(); + appcMessage = appCClient.getErrorMessage(); - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + } catch (Exception e) { + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + appcMessage = e.getMessage(); + } + msoLogger.error("Error Message: " + appcMessage); + msoLogger.error("ERROR CODE: " + appcCode); + msoLogger.trace("End of runAppCommand "); + if (appcCode != null && !appcCode.equals("0")) { + exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); + } } } |