diff options
Diffstat (limited to 'bpmn')
204 files changed, 4350 insertions, 1846 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index b98e395228..81d0e678ac 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -134,13 +135,13 @@ class AaiUtil { } logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId) }else{ - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Call AAI Cloud Region is NOT Successful.", "BPMN", ErrorCode.UnknownError.getValue()); throw new BpmnError("MSOWorkflowException") } }catch(Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while getting the Cloud Reqion.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index e0e85e9629..37b7aa6d60 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.logger.ErrorCode @@ -195,7 +196,7 @@ class AllottedResourceUtils { AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) getAAIClient().update(uri,allottedResource) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index 4a59b9789a..03598060d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils @@ -120,7 +121,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{ appcMessage = client.getErrorMessage() } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); appcMessage = e.getMessage() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index d5b0b31a39..d7bf357dbb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray @@ -80,7 +81,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -118,7 +119,7 @@ class CatalogDbUtils { return getResponseFromCatalogDb(execution, endPoint) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -142,7 +143,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -168,7 +169,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -218,7 +219,7 @@ class CatalogDbUtils { logger.debug("Returning networks JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -297,7 +298,7 @@ class CatalogDbUtils { logger.debug("Returning vnfs JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -351,7 +352,7 @@ class CatalogDbUtils { logger.debug("Returning allottedResources JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -380,7 +381,7 @@ class CatalogDbUtils { logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -428,7 +429,7 @@ class CatalogDbUtils { modelJson.put("modelInfo", modelInfo) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception while parsing model information", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index a9e01c7191..c7de756789 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.logger.ErrorCode @@ -74,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -236,7 +237,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -269,7 +270,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { logger.debug("Rethrowing MSOWorkflowException") throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -307,7 +308,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 6a82512d88..da952ce6d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -130,7 +130,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200/404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(com.google.common.base.Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", ErrorCode.UnknownError.getValue(), "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); @@ -140,7 +140,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " + "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}" - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", + logger.error(com.google.common.base.Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 7c1c0a0490..011fcb68e6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -105,7 +106,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(BpmnError b){ throw b }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") @@ -127,7 +128,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ logger.debug("Volume Heat Stack Id is: " + heatStackId) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignVolumeHeatId.", "BPMN", ErrorCode.UnknownError.getValue(), e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") @@ -147,7 +148,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignWorkflowException.", "BPMN", ErrorCode.UnknownError.getValue(), e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index e9e7d1ed7c..c496adfe83 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -423,7 +424,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") @@ -475,7 +476,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ errorCode = 2000 } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during CreateAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 4bce23eff7..93307867a0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.client.aai.AAIObjectType @@ -204,7 +206,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); def errorCode = 5000 @@ -251,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during DeleteAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) @@ -261,7 +263,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - the A&AI Generic Vnf DELETE returns a response code other than 200 public void handleDeleteGenericVnfFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index 30dbeb09d5..b4f6f36876 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* @@ -91,7 +92,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { buildWorkflowException(execution, 5000, modifiedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } else { @@ -104,7 +105,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } catch(Exception ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 2ceec3cb44..a979ceab31 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode @@ -97,7 +98,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_ResponseCode", "") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -210,7 +211,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_content_type", "text/xml") } } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -244,7 +245,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_updateRequestPayload", payload) return execution.getVariable("FH_updateRequestPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -275,7 +276,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestInfraPayload: " + payload) return execution.getVariable("FH_updateRequestInfraPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -306,7 +307,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestGammaPayload: " + payload) return execution.getVariable("FH_updateRequestGammaPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -335,7 +336,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateResponseStatusPayload: " + payload) return execution.getVariable("FH_updateResponseStatusPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -355,7 +356,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { def errorCode = responseCode == null ? 7000 : 7020 // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -390,7 +391,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) } catch (Exception e) { // Do NOT throw WorkflowException! - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index f008130c32..cee1e2ab0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -158,7 +159,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) 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 27fe33f5ea..78fa1de861 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 @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -289,7 +290,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -341,11 +342,11 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { msg = "BPMN error in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex){ msg = "Exception in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } logger.trace("Exit createAOTSTicket of ManualHandling ") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index f371ccef4d..5a328a5c72 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -294,10 +295,10 @@ class MsoUtils { if ("INFO"==logmode) { logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN"); } else if ("WARN"==logmode) { - logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", + logger.warn (Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else if ("ERROR"==logmode) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else { logger.debug(logtxt); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index a0da6870ae..84ab8fbb5d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import groovy.json.* import org.apache.commons.lang3.* @@ -66,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((timeout == null) || (timeout.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -77,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((messageType == null) || (messageType.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -88,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((correlator == null) || (correlator.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -100,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index a7bb707dff..abd43289ad 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -20,7 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode; @@ -73,7 +75,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValue",encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unable to encode username password string", "BPMN", ErrorCode.UnknownError.getValue()); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index fdd53b2f05..9bda572d58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -86,7 +87,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -107,7 +108,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -122,7 +123,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -139,7 +140,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -154,7 +155,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -163,7 +164,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -195,7 +196,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -243,7 +244,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -257,7 +258,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg, e) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -394,7 +395,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index e56091ad65..1c1c1f82b9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -85,7 +86,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -121,7 +122,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -132,7 +133,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -150,7 +151,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -159,7 +160,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -191,7 +192,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index eb832224db..bcf53344e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network @@ -257,7 +258,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? @@ -395,7 +396,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") @@ -468,7 +469,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") @@ -973,7 +974,7 @@ class SDNCAdapterUtils { } }else { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ') @@ -983,7 +984,7 @@ class SDNCAdapterUtils { } if (response == null || response.trim().equals("")) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", ErrorCode.UnknownError, 'sdncAdapter workflow response is empty') execution.setVariable("L3HLAB_rollback", true) @@ -996,7 +997,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + 'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable(prefix+"ResponseCode",400) execution.setVariable("L3HLAB_rollback", true) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index 615c977a1e..ed222d9ac6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.onap.so.logger.ErrorCode @@ -215,7 +216,7 @@ class TrinityExceptionUtil { if(message != null) { execution.setVariable(prefix+"ErrorResponse",message) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message @@ -311,7 +312,7 @@ class TrinityExceptionUtil { execution.setVariable(prefix+"err", myErr) execution.setVariable(prefix+"errTxt", messageTxt) execution.setVariable(prefix+"errVariables", msgVars) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index ebab6ad0ac..fb662f627f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -182,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { if (newPersonaModelId != null || newPersonaModelVersion != null) { if (newPersonaModelId != genericVnf.getModelInvariantId()) { def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()) throw new Exception(msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index e261fb9fdd..bbb5fc7a7b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import javax.xml.parsers.DocumentBuilder @@ -110,7 +111,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming network params to vnfNetworks', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); } @@ -149,7 +150,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { entries = entries + entry } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } @@ -195,7 +196,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 9215eabc57..6cdd3f39db 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -78,7 +79,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (messageId == null || messageId.isEmpty()) { String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -92,7 +93,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (notificationUrl == null || notificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -124,7 +125,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -137,7 +138,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -146,7 +147,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -160,7 +161,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -169,7 +170,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -183,7 +184,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleRollbackNode == null) { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -192,7 +193,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -201,7 +202,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -222,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -238,7 +239,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -254,7 +255,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -267,7 +268,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -284,7 +285,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -292,7 +293,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -303,7 +304,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -355,7 +356,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { response = httpClient.delete(vnfAdapterRequest) } else { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index c947bf2e65..42f1b6f1ba 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException @@ -86,7 +87,7 @@ class VnfAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java index c087d586e7..83a44cfe8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java @@ -9,7 +9,7 @@ * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java index 31fef7c6f7..734262aa55 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java @@ -112,10 +112,6 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab return this.get("flowToBeCalled"); } - @JsonIgnore - public DelegateExecution getDelegateExecution() { - return this.execution; - } public void setDelegateExecution(final DelegateExecution execution) { this.execution = execution; @@ -126,6 +122,11 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab }); } + @JsonIgnore + public DelegateExecution getDelegateExecution() { + return this.execution; + } + @SuppressWarnings("unchecked") protected <T> T get(final String key) { final Object value = this.execution.getVariable(key); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index b9200e0640..654dabb0c4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.recipe; import java.io.IOException; import java.security.GeneralSecurityException; import javax.xml.bind.DatatypeConverter; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -62,16 +63,12 @@ public class BpmnRestClient { public static final String CAMUNDA_AUTH = "mso.camundaAuth"; - private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @Autowired private UrnPropertiesReader urnPropertiesReader; private static boolean noProperties = true; - // because for NS it will take a long time the time out of the resouce will be 2 hours. - private static final String DEFAULT_TIME_OUT = "7200"; - - public synchronized final boolean getNoPropertiesState() { + public final synchronized boolean getNoPropertiesState() { return noProperties; } @@ -93,7 +90,7 @@ public class BpmnRestClient { */ public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { + throws IOException { HttpClient client = HttpClientBuilder.create().build(); @@ -163,7 +160,7 @@ public class BpmnRestClient { BpmnParam recipeParamsInput = new BpmnParam(); BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam(); recipeTimeoutInput.setValue(recipeTimeout); - // host.setValue(parseURL()); + requestIdInput.setValue(requestId); requestActionInput.setValue(requestAction); serviceInstanceIdInput.setValue(serviceInstanceId); @@ -181,8 +178,8 @@ public class BpmnRestClient { jsonReq = recipeRequest.toString(); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", + "wrapVIDRequest", ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 340addcabf..91049a8d0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -85,6 +85,30 @@ public class ResourceInput implements Serializable { @JsonProperty("operationType") private String operationType; + @JsonProperty("vfModelInfo") + private ModelInfo vfModelInfo; + + + @JsonProperty("vnf-Id") + private String vnfId; + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public ModelInfo getVfModelInfo() { + return vfModelInfo; + } + + public void setVfModelInfo(ModelInfo vfModelInfo) { + this.vfModelInfo = vfModelInfo; + } + + /** * @return Returns the requestsInputs. */ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java new file mode 100644 index 0000000000..2b650e1eed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java @@ -0,0 +1,173 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.resource; + +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import org.onap.so.bpmn.core.domain.VnfResource; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +public class InstanceResourceList { + + private InstanceResourceList() { + throw new IllegalStateException("Utility class"); + } + + private static Map<String, List<List<GroupResource>>> convertUUIReqTOStd(final JsonObject reqInputJsonObj, + List<Resource> seqResourceList) { + + Map<String, List<List<GroupResource>>> normalizedRequest = new HashMap<>(); + Resource lastVfProcessed = null; + for (Resource r : seqResourceList) { + + if (r.getResourceType() == ResourceType.VNF) { + String pk = getPrimaryKey(r); + + JsonElement vfNode = reqInputJsonObj.get(pk); + lastVfProcessed = r; + + // if the service property is type of array then it + // means it is a VF resource + if (vfNode instanceof JsonArray) { + + for (int i = 0; i < ((JsonArray) vfNode).size(); i++) { + List<List<GroupResource>> groupsList = normalizedRequest.get(pk); + if (groupsList == null) { + groupsList = new ArrayList<>(); + normalizedRequest.put(pk, groupsList); + } + + groupsList.add(new ArrayList<>()); + } + } + + } else if (r.getResourceType() == ResourceType.GROUP) { + String sk = getPrimaryKey(r); + + // if sk is empty that means it is not list type + if (sk.isEmpty()) { + List<List<GroupResource>> vfList = normalizedRequest.get(getPrimaryKey(lastVfProcessed)); + for (List<GroupResource> grpList : vfList) { + grpList.add((GroupResource) r); + } + continue; + } + + String pk = getPrimaryKey(lastVfProcessed); + JsonArray vfs = reqInputJsonObj.getAsJsonArray(pk); + + for (int i = 0; i < vfs.size(); i++) { + + JsonElement vfcsNode = vfs.get(i).getAsJsonObject().get(sk); + if (vfcsNode instanceof JsonArray) { + + List<GroupResource> groupResources = normalizedRequest.get(pk).get(i); + + if (groupResources == null) { + groupResources = new ArrayList<>(); + normalizedRequest.get(pk).add(i, groupResources); + } + + for (int j = 0; j < ((JsonArray) vfcsNode).size(); j++) { + groupResources.add((GroupResource) r); + } + } + } + + } + } + return normalizedRequest; + } + + // this method returns key from resource input + // e.g. {\"sdwansite_emails\" : \"[sdwansiteresource_list(PK), INDEX, sdwansite_emails]|default\", + // ....} + // it will return sdwansiteresource_list + private static String getPrimaryKey(Resource resource) { + String resourceInput = ""; + if (resource instanceof VnfResource) { + resourceInput = ((VnfResource) resource).getResourceInput(); + } else if (resource instanceof GroupResource) { + resourceInput = ((GroupResource) resource).getVnfcs().get(0).getResourceInput(); + } + + Gson gson = new Gson(); + Type type = new TypeToken<Map<String, String>>() {}.getType(); + Map<String, String> map = gson.fromJson(resourceInput, type); + + if (map != null) { + Optional<String> pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", "")) + .map(e -> e.split(",")[0]).findFirst(); + + return pkOpt.isPresent() ? pkOpt.get() : ""; + } else { + // TODO: handle the case if VNF resource is not list + // e.g. { resourceInput + return ""; + } + } + + private static List<Resource> convertToInstanceResourceList(Map<String, List<List<GroupResource>>> normalizedReq, + List<Resource> seqResourceList) { + List<Resource> flatResourceList = new ArrayList<>(); + for (Resource r : seqResourceList) { + if (r.getResourceType() == ResourceType.VNF) { + String primaryKey = getPrimaryKey(r); + for (String pk : normalizedReq.keySet()) { + + if (primaryKey.equalsIgnoreCase(pk)) { + + List<List<GroupResource>> vfs = normalizedReq.get(pk); + + vfs.stream().forEach(e -> { + flatResourceList.add(r); + flatResourceList.addAll(e); + }); + } + } + } + } + return flatResourceList; + } + + public static List<Resource> getInstanceResourceList(final List<Resource> seqResourceList, + final String uuiRequest) { + + Gson gson = new Gson(); + JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class); + JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters") + .getAsJsonObject("requestInputs"); + + // this will convert UUI request to normalized form + Map<String, List<List<GroupResource>>> normalizedRequest = convertUUIReqTOStd(reqInputJsonObj, seqResourceList); + return convertToInstanceResourceList(normalizedRequest, seqResourceList); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java new file mode 100644 index 0000000000..a3c75dbd41 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.resource; + +public enum ResourceLevel { + FIRST, SECOND +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 0dbf2c2a75..faa3d74dba 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,6 +22,9 @@ package org.onap.so.bpmn.common.resource; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; @@ -31,8 +34,13 @@ import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; +import org.apache.commons.lang.StringUtils; import org.camunda.bpm.engine.runtime.Execution; import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; @@ -47,14 +55,16 @@ import org.slf4j.LoggerFactory; public class ResourceRequestBuilder { - private static String CUSTOMIZATION_UUID = "cuserviceResourcesstomizationUUID"; - private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources"; private static Logger logger = LoggerFactory.getLogger(ResourceRequestBuilder.class); static JsonUtils jsonUtil = new JsonUtils(); + private ResourceRequestBuilder() { + throw new IllegalStateException("Utility class"); + } + public static List<String> getResourceSequence(String serviceUuid) { List<String> resourceSequence = new ArrayList(); @@ -82,133 +92,275 @@ public class ResourceRequestBuilder { * "requestInputs":{K,V} } <br> * * @param execution Execution context - * - * @param serviceUuid The service template uuid - * - * @param resourceCustomizationUuid The resource customization uuid - * - * @param serviceParameters the service parameters passed from the API - * + * + * @param resource The current Service Resource Object + * + * @param uuiServiceParameters the service parameters passed from the API + * + * @param currentVFData The object to hold the sequence of execution level for fetching data from UUI inputs + * * @return the resource instantiate parameters - * + * * @since ONAP Beijing Release */ @SuppressWarnings("unchecked") - public static String buildResourceRequestParameters(Execution execution, String serviceUuid, - String resourceCustomizationUuid, String serviceParameters) { - List<String> resourceList = - jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources")); + public static String buildResourceRequestParameters(Execution execution, Resource resource, + String uuiServiceParameters, Map<String, Object> currentVFData) { + List<String> resourceList = jsonUtil.StringArrayToList(execution, + (String) JsonUtils.getJsonValue(uuiServiceParameters, "resources")); // Get the right location str for resource. default is an empty array. String locationConstraints = "[]"; - String resourceInputsFromUui = ""; - for (String resource : resourceList) { - String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if (resourceCustomizationUuid.equals(resCusUuid)) { - String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); - locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); - resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); + if (resource.getResourceType() == ResourceType.VNF) { + for (String eachResource : resourceList) { + String resCusUuid = JsonUtils.getJsonValue(eachResource, "resourceCustomizationUuid"); + if ((null != resCusUuid) && resCusUuid.equals(resource.getModelInfo().getModelCustomizationUuid())) { + String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters"); + locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); + } } } - Map<String, Object> serviceInput = null; - if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { - serviceInput = - getJsonObject((String) JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); - } - - Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); - if (serviceInput == null) { - serviceInput = new HashMap(); + Map<String, Object> uuiRequestInputs = null; + if (JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs") != null) { + uuiRequestInputs = + getJsonObject((String) JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs"), Map.class); } - if (resourceInputsFromUuiMap == null) { - resourceInputsFromUuiMap = new HashMap(); + if (uuiRequestInputs == null) { + uuiRequestInputs = new HashMap(); } - Map<String, Object> resourceInputsFromServiceDeclaredLevel = - buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); - resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); - String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); + Map<String, Object> resourceInputsAfterMerge = + ResourceRequestBuilder.buildResouceRequest(resource, uuiRequestInputs, currentVFData); + + String resourceInputsStr = getJsonString(resourceInputsAfterMerge); String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":" + resourceInputsStr + "\n" + "}"; return result; } @SuppressWarnings("unchecked") - public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, - Map<String, Object> serviceInputs) { + public static Map<String, Object> buildResouceRequest(Resource resource, Map<String, Object> uuiRequestInputs, + Map<String, Object> currentVFData) { try { - Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid); - // find match of customization uuid in vnf - Map<String, Map<String, Object>> serviceResources = - (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources"); - - List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs"); - String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid); - - // find match in network resource - if (resourceInputStr == null) { - List<Map<String, Object>> serviceNetworkCust = - (List<Map<String, Object>>) serviceResources.get("serviceNetworks"); - resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid); - - // find match in AR resource - if (resourceInputStr == null) { - List<Map<String, Object>> serviceArCust = - (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources"); - resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid); - } + String resourceInputStr = null; + // Resource Level is considered as first level by default + ResourceLevel resourceLevel = ResourceLevel.FIRST; + switch (resource.getResourceType()) { + case VNF: + resourceInputStr = ((VnfResource) resource).getResourceInput(); + resourceLevel = ResourceLevel.FIRST; + break; + case GROUP: + resourceInputStr = ((GroupResource) resource).getVnfcs().get(0).getResourceInput(); + resourceLevel = ResourceLevel.SECOND; + break; } - if (resourceInputStr != null && !resourceInputStr.isEmpty()) { - return getResourceInput(resourceInputStr, serviceInputs); + if (StringUtils.isNotEmpty(resourceInputStr)) { + return getResourceInput(resourceInputStr, uuiRequestInputs, resourceLevel, currentVFData); } } catch (Exception e) { - logger.error("not able to retrieve service instance"); + logger.error("not able to retrieve service resource input ", e); } return new HashMap(); } - private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) { + // this method combines resource input with service input + private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> uuiRequestInputs, + ResourceLevel resourceLevel, Map<String, Object> currentVFData) { + try { + Gson gson = new Gson(); + Type type = new TypeToken<Map<String, String>>() {}.getType(); + Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type); + JsonParser parser = new JsonParser(); + + Map<String, Object> uuiServiceInput = uuiRequestInputs; + + int firstLevelIndex = 0; + int secondLevelIndex = 0; + String firstLevelKey = null; + String secondLevelKey = null; + boolean levelKeyNameUpdated = false; + int indexToPick = 0; + + if (null != currentVFData) { + firstLevelIndex = getIntValue(currentVFData.get("currentFirstLevelIndex"), 0); + secondLevelIndex = getIntValue(currentVFData.get("currentSecondLevelIndex"), 0); + final String lastFirstLevelKey = firstLevelKey = (String) currentVFData.get("currentFirstLevelKey"); + final String lastSecondLevelKey = secondLevelKey = (String) currentVFData.get("currentSecondLevelKey"); + + if (null != currentVFData.get("lastNodeTypeProcessed")) { + ResourceLevel lastResourceLevel = + ResourceLevel.valueOf(currentVFData.get("lastNodeTypeProcessed").toString()); + switch (resourceLevel) { + case FIRST: + // if it is next request for same group then increment first level index + boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> { + JsonElement tree = parser.parse(((String) item).split("\\|")[0]); + return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString() + .equalsIgnoreCase(lastFirstLevelKey); + }); + if (isSameLevelRequest) { + firstLevelIndex++; + } else { + firstLevelIndex = 0; + } + if (lastResourceLevel == ResourceLevel.SECOND) { + secondLevelKey = null; + } + indexToPick = firstLevelIndex; + break; + case SECOND: + // if it is next request for same group then increment second level index + switch (lastResourceLevel) { + case FIRST: + secondLevelIndex = 0; + break; + case SECOND: + boolean isSameSecondLevelRequest = + resourceInput.values().stream().anyMatch(item -> { + JsonElement tree = parser.parse(((String) item).split("\\|")[0]); + return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString() + .equalsIgnoreCase(lastSecondLevelKey); + }); + if (isSameSecondLevelRequest) { + secondLevelIndex++; + } + break; + } + // get actual parent object to search for second level objects + if (null != lastFirstLevelKey) { + Object currentObject = uuiRequestInputs.get(lastFirstLevelKey); + if ((null != currentObject) && (currentObject instanceof List)) { + List currentFirstLevelList = (List) currentObject; + if (currentFirstLevelList.size() > firstLevelIndex) { + uuiServiceInput = + (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex); + } + + } + } + indexToPick = secondLevelIndex; + break; + + } + } + + + } - for (Map<String, Object> resource : resources) { - Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo"); + // replace value if key is available in service input + for (String key : resourceInput.keySet()) { + String value = (String) resourceInput.get(key); + + if (value.contains("|")) { + + // check which level + + // node it type of getinput + String[] split = value.split("\\|"); + String tmpKey = split[0]; + + JsonElement jsonTree = parser.parse(tmpKey); + + // check if it is a list type + if (jsonTree.isJsonArray()) { + JsonArray jsonArray = jsonTree.getAsJsonArray(); + boolean matchFound = false; + if (jsonArray.size() == 3) { + String keyName = jsonArray.get(0).getAsString(); + String keyType = jsonArray.get(2).getAsString(); + if (!levelKeyNameUpdated) { + switch (resourceLevel) { + case FIRST: + firstLevelKey = keyName; + break; + case SECOND: + secondLevelKey = keyName; + break; + } + levelKeyNameUpdated = true; + } + + if ((null != uuiServiceInput) && (uuiServiceInput.containsKey(keyName))) { + Object vfcLevelObject = uuiServiceInput.get(keyName); + // it will be always list + if (vfcLevelObject instanceof List) { + List vfcObject = (List) vfcLevelObject; + if (vfcObject.size() > indexToPick) { + Map<String, Object> vfMap = (Map<String, Object>) vfcObject.get(indexToPick); + if (vfMap.containsKey(keyType)) { + if (vfMap.get(keyType) instanceof String) { + value = (String) vfMap.get(keyType); + } else { + value = getJsonString(vfMap.get(keyType)); + } + matchFound = true; + } + } + } + } + } + + if (!matchFound) { + if (split.length == 1) { // means value is empty e.g. "a":"key1|" + value = ""; + } else { + value = split[1]; + } + } + + } else { - if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) { - return (String) resource.get("resourceInput"); + // if not a list type + if ((null != uuiServiceInput) && (uuiServiceInput.containsKey(tmpKey))) { + value = (String) uuiServiceInput.get(tmpKey); + } else { + if (split.length == 1) { // means value is empty e.g. "a":"key1|" + value = ""; + } else { + value = split[1]; + } + } + } + + } + resourceInput.put(key, value); + } + // store current processed details into map + if (null != currentVFData) { + currentVFData.put("currentFirstLevelKey", firstLevelKey); + currentVFData.put("currentFirstLevelIndex", firstLevelIndex); + currentVFData.put("currentSecondLevelKey", secondLevelKey); + currentVFData.put("currentSecondLevelIndex", secondLevelIndex); + currentVFData.put("lastNodeTypeProcessed", resourceLevel.toString()); } + + return resourceInput; + + } catch (Exception e) { + logger.error("not able to parse and modify service resource input value against UUI ", e); } - return null; + return new HashMap(); } - // this method combines resource input with service input - private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) { - Gson gson = new Gson(); - Type type = new TypeToken<Map<String, String>>() {}.getType(); - Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type); - - // replace value if key is available in service input - for (String key : resourceInput.keySet()) { - String value = (String) resourceInput.get(key); - - if (value.contains("|")) { - // node it type of getinput - String[] split = value.split("\\|"); - String tmpKey = split[0]; - if (serviceInputs.containsKey(tmpKey)) { - value = (String) serviceInputs.get(tmpKey); - } else { - if (split.length == 1) { // means value is empty e.g. "a":"key1|" - value = ""; - } else { - value = split[1]; - } + private static int getIntValue(Object inputObj, int defaultValue) { + if (null != inputObj) { + if (inputObj instanceof Integer) { + return ((Integer) inputObj).intValue(); + } + if (StringUtils.isNotEmpty(inputObj.toString())) { + try { + int val = Integer.parseInt(inputObj.toString()); + return val; + } catch (NumberFormatException e) { + logger.warn("Unable to parse to int", e.getMessage()); } } - resourceInput.put(key, value); } - return resourceInput; + return defaultValue; } public static Map<String, Object> getServiceInstnace(String uuid) throws Exception { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java index a8e43c51e5..7777584b80 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java @@ -20,24 +20,11 @@ package org.onap.so.bpmn.common.validation; -import java.lang.annotation.Annotation; import java.util.ArrayList; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import javax.annotation.PostConstruct; -import javax.annotation.Priority; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.javatuples.Pair; -import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.client.exception.ExceptionBuilder; -import org.reflections.Reflections; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java index 66a8de9f8b..05d7a1f417 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.common.validation; import java.util.Optional; -import java.util.Set; import org.onap.so.bpmn.common.BuildingBlockExecution; public interface FlowValidator { @@ -30,6 +29,7 @@ public interface FlowValidator { * Should this validator run for given bb * * @return + * */ public boolean shouldRunFor(String bbName); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java index 6950618953..493bb0e89b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java @@ -20,23 +20,11 @@ package org.onap.so.bpmn.common.validation; -import java.lang.annotation.Annotation; import java.util.ArrayList; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import javax.annotation.PostConstruct; -import javax.annotation.Priority; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.javatuples.Pair; -import org.onap.so.client.exception.ExceptionBuilder; -import org.reflections.Reflections; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 33fb78b306..f4df010b08 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -130,7 +131,7 @@ public class WorkflowContextHolder { Thread.currentThread().interrupt(); } catch (Exception e) { logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java index 6c3a0c43ed..b9f5a6af8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -78,6 +78,8 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc private ModelInfoServiceInstance modelInfoServiceInstance; @JsonProperty("instance-groups") private List<InstanceGroup> instanceGroups = new ArrayList<>(); + @JsonProperty("service-proxies") + private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); public List<GenericVnf> getVnfs() { return vnfs; @@ -211,6 +213,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc this.instanceGroups = instanceGroups; } + public List<ServiceProxy> getServiceProxies() { + return serviceProxies; + } + @Override public boolean equals(final Object other) { if (!(other instanceof ServiceInstance)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java index 9e95e79b70..8608fee244 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -21,5 +21,15 @@ package org.onap.so.bpmn.servicedecomposition.entities; public enum ResourceKey { - SERVICE_INSTANCE_ID, GENERIC_VNF_ID, NETWORK_ID, VOLUME_GROUP_ID, VF_MODULE_ID, ALLOTTED_RESOURCE_ID, CONFIGURATION_ID, NETWORK_COLLECTION_ID, VPN_ID, VPN_BONDING_LINK_ID, INSTANCE_GROUP_ID; + SERVICE_INSTANCE_ID, + GENERIC_VNF_ID, + NETWORK_ID, + VOLUME_GROUP_ID, + VF_MODULE_ID, + ALLOTTED_RESOURCE_ID, + CONFIGURATION_ID, + NETWORK_COLLECTION_ID, + VPN_ID, + VPN_BONDING_LINK_ID, + INSTANCE_GROUP_ID; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java index db5c11a954..4c91ad38a0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,6 @@ public class SolutionCandidates implements Serializable { private List<Candidate> requiredCandidates = new ArrayList<Candidate>(); @JsonProperty("excludedCandidates") private List<Candidate> excludedCandidates = new ArrayList<Candidate>(); - // TODO figure out best way to do this @JsonProperty("existingCandidates") private List<Candidate> existingCandidates = new ArrayList<Candidate>(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java index 7ca6076b21..2d6ce0fad7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java @@ -22,10 +22,14 @@ package org.onap.so.bpmn.servicedecomposition.tasks; public enum AssignFlows { - SERVICE_INSTANCE("AssignServiceInstanceBB"), VNF("AssignVnfBB"), VF_MODULE("AssignVfModuleBB"), NETWORK_A_LA_CARTE( - "AssignNetwork1802BB"), NETWORK_MACRO("AssignNetworkBB"), VOLUME_GROUP( - "AssignVolumeGroupBB"), NETWORK_COLLECTION( - "CreateNetworkCollectionBB"), FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); + SERVICE_INSTANCE("AssignServiceInstanceBB"), + VNF("AssignVnfBB"), + VF_MODULE("AssignVfModuleBB"), + NETWORK_A_LA_CARTE("AssignNetwork1802BB"), + NETWORK_MACRO("AssignNetworkBB"), + VOLUME_GROUP("AssignVolumeGroupBB"), + NETWORK_COLLECTION("CreateNetworkCollectionBB"), + FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); private final String flowName; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 6f3710835c..2fc84b5dde 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -40,6 +40,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement; import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc; import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; @@ -131,7 +132,21 @@ public class BBInputSetupMapperLayer { } protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) { - return modelMapper.map(aaiSubnet, Subnet.class); + Subnet subnet = modelMapper.map(aaiSubnet, Subnet.class); + mapAllHostRoutesIntoSubnet(aaiSubnet, subnet); + return subnet; + } + + protected void mapAllHostRoutesIntoSubnet(org.onap.aai.domain.yang.Subnet aaiSubnet, Subnet subnet) { + if (aaiSubnet.getHostRoutes() != null) { + for (org.onap.aai.domain.yang.HostRoute aaiHostRoute : aaiSubnet.getHostRoutes().getHostRoute()) { + subnet.getHostRoutes().add(mapAAIHostRoute(aaiHostRoute)); + } + } + } + + protected HostRoute mapAAIHostRoute(org.onap.aai.domain.yang.HostRoute aaiHostRoute) { + return modelMapper.map(aaiHostRoute, HostRoute.class); } protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) { 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 c8e296d5ac..122e71851f 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 @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -81,15 +81,13 @@ public class ExecuteBuildingBlockRainyDay { String serviceType = ASTERISK; boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); - String handlingCode = ""; - WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); - try { - // Extract error data to be returned to WorkflowAction + if (workflowException != null) { execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); - } catch (Exception e) { - logger.error("No WorkflowException Found", e); + } else { + logger.debug("WorkflowException is null, unable to set WorkflowExceptionErrorMessage"); } + String handlingCode = ""; if (suppressRollback) { handlingCode = "Abort"; @@ -97,6 +95,9 @@ public class ExecuteBuildingBlockRainyDay { try { serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) .getModelInfoServiceInstance().getServiceType(); + if (serviceType == null || serviceType.isEmpty()) { + serviceType = ASTERISK; + } } catch (Exception ex) { // keep default serviceType value } @@ -118,6 +119,7 @@ public class ExecuteBuildingBlockRainyDay { } catch (Exception ex) { // keep default errorCode value } + try { errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode"); } catch (Exception ex) { @@ -131,29 +133,19 @@ public class ExecuteBuildingBlockRainyDay { // keep default workStep value } - RainyDayHandlerStatus rainyDayHandlerStatus; - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - serviceType, vnfType, errorCode, workStep); - if (rainyDayHandlerStatus == null) { - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - ASTERISK, ASTERISK, errorCode, ASTERISK); + String errorMessage = ASTERISK; + try { + errorMessage = workflowException.getErrorMessage(); + } catch (Exception ex) { + // keep default workStep value } + RainyDayHandlerStatus rainyDayHandlerStatus; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType, + errorCode, workStep, errorMessage); + if (rainyDayHandlerStatus == null) { - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - ASTERISK, ASTERISK, ASTERISK, ASTERISK); - if (rainyDayHandlerStatus == null) { - handlingCode = "Abort"; - } else { - if (primaryPolicy) { - handlingCode = rainyDayHandlerStatus.getPolicy(); - } else { - handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); - } - } + handlingCode = "Abort"; } else { if (primaryPolicy) { handlingCode = rainyDayHandlerStatus.getPolicy(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java index 333d99ed2e..7b1066d48c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java @@ -22,10 +22,21 @@ package org.onap.so.client.exception; public class BadResponseException extends Exception { + String responseCode; + public BadResponseException() {} public BadResponseException(String message) { super(message); } + public BadResponseException(String message, String responseCode) { + super(message); + this.responseCode = responseCode; + } + + public String getResponseCode() { + return responseCode; + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index ae5e41f7ce..52bec2e14f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -22,21 +22,41 @@ package org.onap.so.client.exception; +import java.io.IOException; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.aai.domain.yang.LInterface; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.ErrorCode; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.logger.MessageEnum; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; + @Component public class ExceptionBuilder { private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); + + protected ExtractPojosForBB getExtractPojosForBB() { + return new ExtractPojosForBB(); + } + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try { @@ -56,7 +76,7 @@ public class ExceptionBuilder { } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { @@ -87,7 +107,7 @@ public class ExceptionBuilder { break; } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { @@ -132,4 +152,69 @@ public class ExceptionBuilder { return execution.getProcessEngineServices().getRepositoryService() .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } + + public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { + logger.debug("Processing Audit Results"); + String auditListString = (String) execution.getVariable("auditInventoryResult"); + if (auditListString != null) { + StringBuilder errorMessage = new StringBuilder(); + String processKey = getProcessKey(execution.getDelegateExecution()); + try { + ExtractPojosForBB extractPojosForBB = getExtractPojosForBB(); + VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + String cloudRegionId = execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + AAIObjectAuditList auditList = + objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class); + + errorMessage = errorMessage.append(auditList.getAuditType() + " VF-Module " + module.getVfModuleId() + + " failed due to incomplete AAI vserver inventory population after stack " + + auditList.getHeatStackName() + " was successfully " + auditList.getAuditType() + + "d in cloud region " + cloudRegionId + ". MSO Audit indicates that the following was not " + + auditList.getAuditType() + "d in AAI: "); + + Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream() + .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) + || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())); + List<AAIObjectAudit> filteredAuditStream = + vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList()); + + for (AAIObjectAudit object : filteredAuditStream) { + if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) { + LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class); + errorMessage = errorMessage + .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); + } else { + Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class); + errorMessage = + errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", "); + } + } + + if (errorMessage.length() > 0) { + errorMessage.setLength(errorMessage.length() - 2); + errorMessage = errorMessage.append("."); + } + + } catch (IOException | BBObjectNotFoundException e) { + errorMessage = errorMessage.append("process objects in AAI. "); + } + + if (flowShouldContinue) { + execution.setVariable("StatusMessage", errorMessage.toString()); + } else { + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); + } + + } else { + logger.debug("Unable to process audit results due to auditInventoryResult being null"); + } + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java new file mode 100644 index 0000000000..12ab165c3a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java @@ -0,0 +1,17 @@ +package org.onap.so.client.exception; + + +public class ExpectedDataException extends Exception { + + public ExpectedDataException() {} + + public ExpectedDataException(String message, String system) { + super("Expected data not found in " + system + ". " + message); + } + + public ExpectedDataException(String message) { + super("Expected data not found. " + message); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java new file mode 100644 index 0000000000..84cf491355 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java @@ -0,0 +1,17 @@ +package org.onap.so.client.exception; + + +public class UnexpectedDataException extends Exception { + + public UnexpectedDataException() {} + + public UnexpectedDataException(String message, String system) { + super("Unexpected data found in " + system + ". " + message); + } + + public UnexpectedDataException(String message) { + super("Unexpected data found. " + message); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index 79a94d5298..3bb417741f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -325,6 +325,7 @@ public class BuildingBlockTestDataSetup { gBBInput.setCustomer(buildCustomer()); } gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setServiceInstance(serviceInstance); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); return serviceInstance; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java new file mode 100644 index 0000000000..3be67c965c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java @@ -0,0 +1,46 @@ +package org.onap.so.bpmn.common.resource; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.bpmn.core.domain.VnfcResource; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class InstnaceResourceListTest { + + public static String RESOURCE_PATH = "src/test/resources/__files/InstanceResourceList/"; + + @Test + public void testInstanceResourceList() throws IOException { + String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json"))); + List<Resource> instanceResourceList = + InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest); + Assert.assertEquals(4, instanceResourceList.size()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(2).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType()); + } + + private List<Resource> createResourceSequence() { + List<Resource> resourceList = new ArrayList<>(); + VnfResource vnfResource = new VnfResource(); + vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}"); + + VnfcResource vnfcResource = new VnfcResource(); + vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}"); + + GroupResource groupResource = new GroupResource(); + groupResource.setVnfcs(Arrays.asList(vnfcResource)); + + return Arrays.asList(vnfResource, groupResource); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java index c7c181744f..557ae6df51 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java @@ -19,232 +19,93 @@ */ package org.onap.so.bpmn.common.resource; +import java.util.ArrayList; +import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.onap.so.BaseTest; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.bpmn.core.domain.GroupResource; +import org.onap.so.bpmn.core.domain.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.bpmn.core.domain.VnfcResource; +import org.onap.so.bpmn.mock.FileUtil; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.ok; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; - +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; public class ResourceRequestBuilderTest extends BaseTest { - @Test - public void getResourceInputTest() throws Exception { + private Map<String, Object> userInputMap = null; + private Map<String, Object> serviceInput = null; + @Before + public void initializeMockObjects() { - wireMockServer.stubFor(get(urlEqualTo( - "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) - .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" - + "\t\t\"modelName\" : \"demoVFWCL\",\n" - + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" - + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" - + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n" - + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n" - + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n" - + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n" - + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" - + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" - + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" - + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" - + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n" - + "\t\"serviceAllottedResources\": []\n" + "\t}}"))); + if (null == this.userInputMap) { + ObjectMapper mapper = new ObjectMapper(); - // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + try { + String serviceInputRequest = FileUtil.readResourceFile("__files/UUI-SO-REQ.json"); + this.userInputMap = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {}); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + + if (null == this.serviceInput) { + + try { + ObjectMapper mapper = new ObjectMapper(); + String serviceInputRequest = FileUtil.readResourceFile("__files/SERVICE-SO-REQ-INPUT.json"); + this.serviceInput = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {}); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + + } + + @Test + public void getResourceInputTest() throws Exception { + + VnfResource resource = new VnfResource(); + resource.setResourceType(ResourceType.VNF); + resource.setResourceInput("{\"a\":\"key|default_value\"}"); HashMap serviceInput = new HashMap(); serviceInput.put("key", "value"); - Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest( - "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null); assertEquals(stringObjectMap.get("a"), "value"); } @Test public void getResourceInputDefaultValueTest() throws Exception { - - wireMockServer.stubFor(get(urlEqualTo( - "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) - .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" - + "\t\t\"modelName\" : \"demoVFWCL\",\n" - + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" - + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" - + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n" - + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n" - + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n" - + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" - + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" - + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" - + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" - + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\"," - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n" - + "\t\"serviceAllottedResources\": []\n" + "\t}}"))); - - // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + VnfResource resource = new VnfResource(); + resource.setResourceType(ResourceType.VNF); + resource.setResourceInput("{\"a\":\"key|default_value\"}"); HashMap serviceInput = new HashMap(); serviceInput.put("key1", "value"); - Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest( - "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null); assertEquals(stringObjectMap.get("a"), "default_value"); } @Test public void getResourceInputValueNoDefaultTest() throws Exception { - - wireMockServer.stubFor(get(urlEqualTo( - "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) - .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" - + "\t\t\"modelName\" : \"demoVFWCL\",\n" - + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" - + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" - + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n" - + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n" - + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n" - + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" - + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" - + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\"," - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n" - + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n" - + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\"," - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n" - + "\t\"serviceAllottedResources\": []\n" + "\t}}"))); - - // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080"); + VnfResource resource = new VnfResource(); + resource.setResourceType(ResourceType.VNF); + resource.setResourceInput("{\"a\":\"value\"}"); HashMap serviceInput = new HashMap(); serviceInput.put("key1", "value"); - Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest( - "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null); assertEquals(stringObjectMap.get("a"), "value"); } @@ -322,68 +183,138 @@ public class ResourceRequestBuilderTest extends BaseTest { @Test public void getResourceInputWithEmptyServiceResourcesTest() throws Exception { - wireMockServer.stubFor(get(urlEqualTo( - "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) - .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" - + "\t\t\"modelName\" : \"demoVFWCL\",\n" - + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" - + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" - + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n" - + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n" - + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n" - + "\t\"serviceVnfs\": [], \n" + "\t\"serviceNetworks\": [],\n" - + "\t\"serviceAllottedResources\": []\n" + "\t}}"))); + VnfResource resource = new VnfResource(); + resource.setResourceType(ResourceType.VNF); + resource.setResourceInput(null); HashMap serviceInput = new HashMap(); serviceInput.put("key1", "value"); - Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest( - "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null); assertEquals(0, stringObjectMap.size()); } @Test public void testGetResourceInputEmptyValue() { - wireMockServer.stubFor(get(urlEqualTo( - "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) - .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" - + "\t\t\"modelName\" : \"demoVFWCL\",\n" - + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" - + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" - + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n" - + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n" - + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n" - + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n" - + "\t\t{ \"modelInfo\" : {\n" - + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n" - + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n" - + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n" - + "\t\t\t\"modelVersion\" : \"1.0\",\n" - + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n" - + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n" - + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n" - + "\t\t\"nfFunction\" \t: null,\n" - + "\"resourceInput\":\"{\\\"a\\\":\\\"key1|\\\"}\"," - + "\t\t\"nfType\" \t\t: null,\n" - + "\t\t\"nfRole\" \t\t: null,\n" - + "\t\t\"nfNamingCode\" \t: null,\n" - + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n" - + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n" - + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n" - + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n" - + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n" - + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n" - + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n" - + "\t\t\t\t\t},\t\t\"isBase\" : true,\n" - + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n" - + "\t\t\t\t\t\"initialCount\" : 1,\n" - + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n" - + "\t\t}]}}"))); + + VnfResource resource = new VnfResource(); + resource.setResourceType(ResourceType.VNF); + resource.setResourceInput("{\"a\":\"key1|\"}"); HashMap serviceInput = new HashMap(); serviceInput.put("key2", "value"); - Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest( - "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput); + Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null); assertEquals(stringObjectMap.get("a"), ""); } + @Test + public void getListResourceInputTest() throws Exception { + + List<Map> vnfdata = null; + + List<Resource> resources = new ArrayList<>(); + if (this.serviceInput.containsKey("serviceResources")) { + vnfdata = (List<Map>) ((Map) this.serviceInput.get("serviceResources")).get("serviceVnfs"); + } + assertNotNull(vnfdata); + vnfdata.forEach(e -> { + if (e.get("resourceType").equals("VNF")) { + VnfResource r = new VnfResource(); + r.setResourceInput(e.get("resourceInput").toString()); + resources.add(r); + } else if (e.get("resourceType").equals("GROUP")) { + GroupResource r = new GroupResource(); + VnfcResource vfc = new VnfcResource(); + vfc.setResourceInput(e.get("resourceInput").toString()); + List<VnfcResource> vfcList = new ArrayList(); + vfcList.add(vfc); + r.setVnfcs(vfcList); + resources.add(r); + } + }); + + assertEquals(9, resources.size()); + + // VF level request + Map<String, Object> currentVFData = new HashMap<>(); + Map<String, Object> stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(0), this.userInputMap, currentVFData); + assertEquals("b", stringObjectMap.get("a")); + assertEquals("hub_spoke", stringObjectMap.get("topology")); + assertEquals("defaultvpn", stringObjectMap.get("name")); + assertTrue(((String) stringObjectMap.get("sitelist")).contains("[")); + + // vfc level request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(1), this.userInputMap, currentVFData); + assertEquals("", stringObjectMap.get("a")); + assertEquals("layer3-port", stringObjectMap.get("portswitch")); + assertEquals("192.168.10.1", stringObjectMap.get("ipAddress")); + assertEquals("vCPE", stringObjectMap.get("deviceName")); + + // vfc level request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(2), this.userInputMap, currentVFData); + assertEquals("", stringObjectMap.get("a")); + assertEquals("layer2-port", stringObjectMap.get("portswitch")); + assertEquals("192.168.11.1", stringObjectMap.get("ipAddress")); + assertEquals("CPE_Beijing", stringObjectMap.get("deviceName")); + + // VF level request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(3), this.userInputMap, currentVFData); + assertEquals("Huawei Private Cloud", stringObjectMap.get("address")); + assertEquals("dsvpn_hub1", stringObjectMap.get("role")); + assertTrue(((String) stringObjectMap.get("wanlist")).contains("[")); + assertTrue(((String) stringObjectMap.get("devlist")).contains("[")); + + // VFC request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(4), this.userInputMap, currentVFData); + assertEquals("Huawei Private Cloud", stringObjectMap.get("address")); + assertEquals("20000", stringObjectMap.get("postcode")); + assertEquals("single_gateway", stringObjectMap.get("type")); + assertEquals("vCPE", stringObjectMap.get("deviceName")); + assertEquals("DHCP", stringObjectMap.get("ipMode")); + + // VFC request again + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(5), this.userInputMap, currentVFData); + assertEquals("Huawei Private Cloud", stringObjectMap.get("address")); + assertEquals("20000", stringObjectMap.get("postcode")); + assertEquals("single_gateway", stringObjectMap.get("type")); + assertEquals("20.20.20.1", stringObjectMap.get("systemip")); + assertEquals("default_ipv6", stringObjectMap.get("systemipv6")); + assertEquals("VNF", stringObjectMap.get("devclass")); + + // VF level request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(6), this.userInputMap, currentVFData); + assertEquals("Huawei Public Cloud", stringObjectMap.get("address")); + assertEquals("dsvpn_hub", stringObjectMap.get("role")); + assertTrue(((String) stringObjectMap.get("wanlist")).contains("[")); + assertTrue(((String) stringObjectMap.get("devlist")).contains("[")); + + // VFC request + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(7), this.userInputMap, currentVFData); + assertEquals("Huawei Public Cloud", stringObjectMap.get("address")); + assertEquals("20001", stringObjectMap.get("postcode")); + assertEquals("multiple_gateway", stringObjectMap.get("type")); + assertEquals("CPE_Beijing", stringObjectMap.get("deviceName")); + assertEquals("Static", stringObjectMap.get("ipMode")); + + // VFC request again + stringObjectMap = + ResourceRequestBuilder.buildResouceRequest(resources.get(8), this.userInputMap, currentVFData); + assertEquals("Huawei Public Cloud", stringObjectMap.get("address")); + assertEquals("20001", stringObjectMap.get("postcode")); + assertEquals("multiple_gateway", stringObjectMap.get("type")); + assertEquals("20.20.20.2", stringObjectMap.get("systemip")); + assertEquals("default_ipv6", stringObjectMap.get("systemipv6")); + assertEquals("PNF", stringObjectMap.get("devclass")); + + + } + + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 39650a2142..13d2b7d3d3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -398,10 +398,12 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapAAIL3NetworkIntoL3Network() throws IOException { - L3Network expected = mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class); + L3Network expected = + mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpectedWithSubnet.json"), L3Network.class); - org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue( - new File(RESOURCE_PATH + "aaiL3NetworkInput.json"), org.onap.aai.domain.yang.L3Network.class); + org.onap.aai.domain.yang.L3Network aaiL3Network = + mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"), + org.onap.aai.domain.yang.L3Network.class); L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index e8d597a823..c5da3cbd51 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -68,6 +68,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, "")); delegateExecution.setVariable("buildingBlock", executeBuildingBlock); delegateExecution.setVariable("lookupKeyMap", lookupKeyMap); + + delegateExecution.setVariable("WorkflowException", new WorkflowException("processKey", 7000, "errorMessage")); } @Test @@ -101,12 +103,10 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setPolicy("Rollback"); rainyDayHandlerStatus.setWorkStep(ASTERISK); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); - assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); } @@ -126,15 +126,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setPolicy("Rollback"); rainyDayHandlerStatus.setWorkStep(ASTERISK); - doReturn(null).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", "st1", "vnft1", "7000", ASTERISK); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", ASTERISK, ASTERISK, ASTERISK, ASTERISK); - + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); - assertEquals("Rollback", delegateExecution.getVariable("handlingCode")); assertEquals(5, delegateExecution.getVariable("maxRetries")); } @@ -145,9 +139,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); vnf.setVnfType("vnft1"); delegateExecution.setVariable("aLaCarte", true); - doReturn(null).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), - isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class), + isA(String.class), isA(String.class), isA(String.class), isA(String.class)); delegateExecution.setVariable("suppressRollback", false); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -157,9 +150,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { @Test public void queryRainyDayTableExceptionTest() { - doThrow(RuntimeException.class).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class), - isA(String.class), isA(String.class), isA(String.class), isA(String.class)); + doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), + isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class)); delegateExecution.setVariable("aLaCarte", true); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); delegateExecution.setVariable("suppressRollback", false); @@ -184,9 +176,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setWorkStep(ASTERISK); rainyDayHandlerStatus.setSecondaryPolicy("Abort"); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false); @@ -210,9 +201,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setWorkStep(ASTERISK); rainyDayHandlerStatus.setSecondaryPolicy("Abort"); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); @@ -236,9 +226,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { rainyDayHandlerStatus.setWorkStep(ASTERISK); rainyDayHandlerStatus.setSecondaryPolicy("Abort"); - doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient) - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*"); + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", + "st1", "vnft1", "7000", "*", "errorMessage"); executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index ef066853ca..5f9aef67e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,17 +21,67 @@ package org.onap.so.client.exception; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; import org.junit.Test; -import org.onap.so.bpmn.mock.FileUtil; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.BaseTest; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; +import org.springframework.beans.BeanUtils; +import com.fasterxml.jackson.core.JsonProcessingException; public class ExceptionBuilderTest extends BaseTest { private static final String RESOURCE_PATH = "__files/"; private static final String VALID_ERROR_MESSAGE = "{test error message}"; + @Mock + protected ExtractPojosForBB extractPojosForBB; + + @Spy + @InjectMocks + private ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + + @Before + public void before() throws BBObjectNotFoundException, JsonProcessingException { + setCloudRegion(); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))) + .thenReturn(buildVfModule()); + AAIObjectAuditList auditList = new AAIObjectAuditList(); + auditList.setAuditType("create"); + auditList.setHeatStackName("testStackName"); + AAIObjectAudit vserver = new AAIObjectAudit(); + vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName()); + vserver.setDoesObjectExist(false); + Vserver vs = new Vserver(); + vs.setVserverId("testVServerId"); + Vserver vServerShallow = new Vserver(); + BeanUtils.copyProperties(vs, vServerShallow, "LInterfaces"); + vserver.setAaiObject(vServerShallow); + auditList.getAuditList().add(vserver); + + execution.setVariable("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditList)); + } + @Test public void buildAndThrowWorkflowExceptionTest() { @@ -77,4 +127,35 @@ public class ExceptionBuilderTest extends BaseTest { assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); } } + + @Test + public void processAuditExceptionTest() { + try { + Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB(); + exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, false); + } catch (BpmnError bpmnException) { + assertEquals("AAIInventoryFailure", bpmnException.getErrorCode()); + WorkflowException we = execution.getVariable("WorkflowException"); + assertNotNull(we); + assertEquals( + "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.", + we.getErrorMessage()); + } + } + + @Test + public void processAuditExceptionContinueTest() { + try { + Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB(); + exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, true); + String sm = execution.getVariable("StatusMessage"); + assertNotNull(sm); + assertEquals( + "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.", + sm); + } catch (BpmnError bpmnException) { + fail(); + } + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json new file mode 100644 index 0000000000..418396f290 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json @@ -0,0 +1,73 @@ +{ + "networkId": "networkId", + "networkName": "networkName", + "networkType": null, + "networkRole": null, + "networkTechnology": null, + "neutronNetworkId": null, + "isBoundToVpn": true, + "serviceId": "serviceId", + "networkRoleInstance": 1234, + "resourceVersion": null, + "orchestrationStatus": "Assigned", + "heatStackId": "heatStackId", + "msoCatalogKey": null, + "contrailNetworkFqdn": "contrailNetworkFqdn", + "modelInvariantId": null, + "modelVersionId": null, + "personaModelVersion": null, + "modelCustomizationId": null, + "widgetModelId": "widgetModelId", + "widgetModelVersion": "widgetModelVersion", + "physicalNetworkName": "physicalNetworkName", + "isProviderNetwork": true, + "isSharedNetwork": true, + "isExternalNetwork": true, + "selflink": "selflink", + "operationalStatus": "operationalStatus", + "subnets": { + "subnet": [ + { + "subnetId": "subnetId", + "subnetName": "subnetName", + "neutronSubnetId": "neutronSubnetId", + "gatewayAddress": "10.80.12.1", + "networkStartAddress": "10.80.12.0", + "cidrMask": "23", + "ipVersion": "4", + "orchestrationStatus": "Active", + "dhcpEnabled": true, + "dhcpStart": "10.80.12.3", + "dhcpEnd": "10.80.13.254", + "subnetRole": "s1", + "ipAssignmentDirection": "true", + "resourceVersion": "1557499815393", + "hostRoutes": { + "hostRoute": [ + { + "hostRouteId": "91324351-01bf-43f8-a302-8c873451b4f1", + "routePrefix": "10.0.0.0/16", + "nextHop": "10.80.12.1", + "resourceVersion": "1557499777501" + } + ] + } + } + ] + }, + "ctagAssignments": { + "ctagAssignment": [ + { + "vlanIdInner": 1234 + } + ] + }, + "segmentationAssignments": { + "segmentationAssignment": [ + { + "segmentationId": "segmentationId" + } + ] + }, + "relationshipList": null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json new file mode 100644 index 0000000000..ccefe195c9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json @@ -0,0 +1,56 @@ +{ + "network-id": "networkId", + "cascaded": null, + "cloud-params": { + + }, + "network-name": "networkName", + "is-bound-to-vpn": true, + "service-id": "serviceId", + "network-role-instance": 1234, + "orchestration-status": "ASSIGNED", + "heat-stack-id": "heatStackId", + "contrail-network-fqdn": "contrailNetworkFqdn", + "widget-model-id": "widgetModelId", + "widget-model-version": "widgetModelVersion", + "physical-network-name": "physicalNetworkName", + "is-provider-network": true, + "is-shared-network": true, + "is-external-network": true, + "self-link": "selflink", + "operational-status": "operationalStatus", + "subnets": [ + { + "subnet-id": "subnetId", + "subnet-name": "subnetName", + "neutron-subnet-id": "neutronSubnetId", + "gateway-address": "10.80.12.1", + "network-start-address": "10.80.12.0", + "cidr-mask": "23", + "ip-version": "4", + "dhcp-enabled": true, + "dhcp-start": "10.80.12.3", + "dhcp-end": "10.80.13.254", + "subnet-role": "s1", + "ip-assignment-direction": "true", + "host-routes": [ + { + "host-route-id": "91324351-01bf-43f8-a302-8c873451b4f1", + "route-prefix": "10.0.0.0/16", + "next-hop": "10.80.12.1" + } + ] + } + ], + "ctag-assignments": [ + { + "vlan-id-inner": 1234 + } + ], + "segmentation-assignments": [ + { + "segmentation-id": "segmentationId" + } + ], + "model-info-network": null +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json new file mode 100644 index 0000000000..0b3d9f0bbe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json @@ -0,0 +1,175 @@ +{ + "service":{ + "name":"SiteService", + "description":"SiteService", + "serviceInvariantUuid":"5c13f3fb-2744-4635-9f1f-c59c92dc8f70", + "serviceUuid":"3a76b1f5-fb0d-4b6b-82d5-0e8a4ebc3838", + "globalSubscriberId":"test_custormer", + "serviceType":"example-service-type", + "parameters":{ + "locationConstraints":[ + + ], + "resources":[ + { + "resourceIndex":"1", + "resourceName":"sdwanvpnresource", + "resourceInvariantUuid":"0c0e1cbe-6e01-4f9e-8c45-a9700ebc14df", + "resourceUuid":"4ad2d390-5c51-45f5-9710-b467a4ec7a73", + "resourceCustomizationUuid":"66590e07-0777-415c-af44-36347cf3ddd3", + "parameters":{ + "locationConstraints":[ + + ], + "resources":[ + + ], + "requestInputs":{ + + } + } + }, + { + "resourceIndex":"1", + "resourceName":"sdwansiteresource", + "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e", + "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2", + "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042", + "parameters":{ + "locationConstraints":[ + + ], + "resources":[ + + ], + "requestInputs":{ + + } + } + }, + { + "resourceIndex":"2", + "resourceName":"sdwansiteresource", + "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e", + "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2", + "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042", + "parameters":{ + "locationConstraints":[ + + ], + "resources":[ + + ], + "requestInputs":{ + + } + } + } + ], + "requestInputs":{ + "sdwanvpnresource_list":[ + { + "sdwanvpn_topology":"hub_spoke", + "sdwanvpn_name":"defaultvpn", + "sdwansitelan_list":[ + { + "role":"Hub", + "portType":"GE", + "portSwitch":"layer3-port", + "vlanId":"", + "ipAddress":"192.168.10.1", + "deviceName":"vCPE", + "portNumer":"0/0/1" + }, + { + "role":"Hub", + "portType":"GE", + "portSwitch":"layer2-port", + "vlanId":"55", + "ipAddress":"192.168.11.1", + "deviceName":"CPE_Beijing", + "portNumer":"0/0/1" + } + ] + } + ], + "sdwansiteresource_list":[ + { + "sdwansite_emails":"chenchuanyu@huawei.com", + "sdwansite_address":"Huawei Public Cloud", + "sdwansite_description":"DC Site", + "sdwansite_role":"dsvpn_hub", + "sdwansite_postcode":"20000", + "sdwansite_type":"single_gateway", + "sdwansite_latitude":"", + "sdwansite_controlPoint":"", + "sdwansite_longitude":"", + "sdwansitewan_list":[ + { + "providerIpAddress":"", + "portType":"GE", + "inputBandwidth":"1000", + "ipAddress":"", + "name":"10000", + "transportNetworkName":"internet", + "outputBandwidth":"10000", + "deviceName":"vCPE", + "portNumber":"0/0/0", + "ipMode":"DHCP", + "publicIP":"119.3.7.113" + } + ], + "sdwandevice_list":[ + { + "esn":"XXXXXXX", + "vendor":"Huawei", + "name":"vCPE", + "type":"AR1000V", + "version":"1.0", + "class":"VNF", + "systemIp":"20.20.20.1" + } + ] + }, + { + "sdwansite_emails":"chenchuanyu@huawei.com", + "sdwansite_address":"Huawei Public Cloud", + "sdwansite_description":"DC Site", + "sdwansite_role":"dsvpn_hub", + "sdwansite_postcode":"20000", + "sdwansite_type":"single_gateway", + "sdwansite_latitude":"", + "sdwansite_controlPoint":"", + "sdwansite_longitude":"", + "sdwansitewan_list":[ + { + "providerIpAddress":"", + "portType":"GE", + "inputBandwidth":"1000", + "ipAddress":"172.18.1.2/24", + "name":"10000", + "transportNetworkName":"internet", + "outputBandwidth":"10000", + "deviceName":"CPE_Beijing", + "portNumber":"0/0/0", + "ipMode":"Static", + "publicIP":"" + } + ], + "sdwandevice_list":[ + { + "esn":"XXXXXXX", + "vendor":"Huawei", + "name":"CPE_Beijing", + "type":"AR161", + "version":"1.0", + "class":"PNF", + "systemIp":"20.20.20.2" + } + ] + } + ] + } + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json new file mode 100644 index 0000000000..4803fca355 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json @@ -0,0 +1,299 @@ +{ + "serviceResources": { + "modelInfo": { + "modelName": "demoVFWCL", + "modelUuid": "c3954379-4efe-431c-8258-f84905b158e5", + "modelInvariantUuid": "0cbff61e-3b0a-4eed-97ce-b1b4faa03493", + "modelVersion": "1.0" + }, + "serviceType": "", + "serviceRole": "", + "environmentContext": null, + "resourceOrder": "res1,res2", + "workloadContext": "Production", + "serviceVnfs": [ + + { + "modelInfo": { + "modelName": "15968a6e-2fe5-41bf-a481", + "modelUuid": "808abda3-2023-4105-92d2-e62644b61d53", + "modelInvariantUuid": "6e4ffc7c-497e-4a77-970d-af966e642d31", + "modelVersion": "1.0", + "modelCustomizationUuid": "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", + "modelInstanceName": "15968a6e-2fe5-41bf-a481 0" + }, + "toscaNodeType": "org.openecomp.resource.vf.15968a6e2fe541bfA481", + "nfFunction": null, + "resourceInput": "{\"a\":\"b\",\"topology\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_topology]|default_topo\",\"name\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_name]|default_name\",\"sitelist\":\"[sdwanvpnresource_list,INDEX,sdwansitelan_list]|default_sitelist\"}", + "resourceType": "VNF", + "nfRole": null, + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "15968a6e2fe541bfA481..base_vfw..module-0", + "modelUuid": "ec7fadde-1e5a-42f7-8255-cb19e475ff45", + "modelInvariantUuid": "61ab8b64-a014-4cf3-8a5a-b5ef388f8819", + "modelVersion": "1", + "modelCustomizationUuid": "123aff6b-854f-4026-ae1e-cc74a3924576" + }, + "isBase": true, + "vfModuleLabel": "base_vfw", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d1f", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7e", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a0", + "modelInstanceName": "f971106a-248f-4202-9d1f 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d1e", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7d", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f2", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a1", + "modelInstanceName": "f971106a-248f-4202-9d1e 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d2e", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add8d", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c2", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c1", + "modelInstanceName": "f971106a-248f-4202-9d2e 0" + }, + "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "VNF", + "nfRole": null, + "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d3e", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add9d", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a1", + "modelInstanceName": "f971106a-248f-4202-9d3e 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d5e", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add3d", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8393", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f1", + "modelInstanceName": "f971106a-248f-4202-9d5e 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d23", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add83", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c3", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c3", + "modelInstanceName": "f971106a-248f-4202-9d23 0" + }, + "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "VNF", + "nfRole": null, + "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d34", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add94", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f4", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a4", + "modelInstanceName": "f971106a-248f-4202-9d34 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + }, + + { + "modelInfo": { + "modelName": "f971106a-248f-4202-9d55", + "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add35", + "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8395", + "modelVersion": "1.0", + "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f5", + "modelInstanceName": "f971106a-248f-4202-9d55 0" + }, + "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f", + "nfFunction": null, + "resourceType": "GROUP", + "nfRole": null, + "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}", + "nfNamingCode": null, + "multiStageDesign": "false", + "vfModules": [{ + "modelInfo": { + "modelName": "F971106a248f42029d1f..base_vpkg..module-0", + "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35", + "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15", + "modelVersion": "1", + "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc" + }, + "isBase": true, + "vfModuleLabel": "base_vpkg", + "initialCount": 1, + "hasVolumeGroup": true + }] + } + + ], + "serviceNetworks": [], + "serviceAllottedResources": [] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json new file mode 100644 index 0000000000..e6161862ae --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json @@ -0,0 +1 @@ +{
"sdwanvpnresource_list":[
{
"sdwanvpn_topology":"hub_spoke",
"sdwanvpn_name":"defaultvpn",
"sdwansitelan_list":[
{
"role":"Hub",
"portType":"GE",
"portSwitch":"layer3-port",
"vlanId":"",
"ipAddress":"192.168.10.1",
"deviceName":"vCPE",
"portNumer":"0/0/1"
},
{
"role":"Hub",
"portType":"GE",
"portSwitch":"layer2-port",
"vlanId":"55",
"ipAddress":"192.168.11.1",
"deviceName":"CPE_Beijing",
"portNumer":"0/0/1"
}
]
}
],
"sdwansiteresource_list":[
{
"sdwansite_emails":"chenchuanyu@huawei.com",
"sdwansite_address":"Huawei Private Cloud",
"sdwansite_description":"DC Site",
"sdwansite_role":"dsvpn_hub1",
"sdwansite_postcode":"20000",
"sdwansite_type":"single_gateway",
"sdwansite_latitude":"",
"sdwansite_controlPoint":"",
"sdwansite_longitude":"",
"sdwansitewan_list":[
{
"providerIpAddress":"",
"portType":"GE",
"inputBandwidth":"1000",
"ipAddress":"",
"name":"10000",
"transportNetworkName":"internet",
"outputBandwidth":"10000",
"deviceName":"vCPE",
"portNumber":"0/0/0",
"ipMode":"DHCP",
"publicIP":"119.3.7.113"
}
],
"sdwandevice_list":[
{
"esn":"XXXXXXX",
"vendor":"Huawei",
"name":"vCPE",
"type":"AR1000V",
"version":"1.0",
"class":"VNF",
"systemIp":"20.20.20.1"
}
]
},
{
"sdwansite_emails":"chenchuanyu@huawei.com",
"sdwansite_address":"Huawei Public Cloud",
"sdwansite_description":"DC Site",
"sdwansite_role":"dsvpn_hub",
"sdwansite_postcode":"20001",
"sdwansite_type":"multiple_gateway",
"sdwansite_latitude":"",
"sdwansite_controlPoint":"",
"sdwansite_longitude":"",
"sdwansitewan_list":[
{
"providerIpAddress":"",
"portType":"GE",
"inputBandwidth":"1000",
"ipAddress":"172.18.1.2/24",
"name":"10000",
"transportNetworkName":"internet",
"outputBandwidth":"10000",
"deviceName":"CPE_Beijing",
"portNumber":"0/0/0",
"ipMode":"Static",
"publicIP":""
}
],
"sdwandevice_list":[
{
"esn":"XXXXXXX",
"vendor":"Huawei",
"name":"CPE_Beijing",
"type":"AR161",
"version":"1.0",
"class":"PNF",
"systemIp":"20.20.20.2"
}
]
}
]
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java index a3f5253765..6f8d34e760 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java @@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory; */ public class ResponseBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; + private static final String WORKFLOWEXCEPTION = "WorkflowException"; private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class); /** @@ -61,7 +62,7 @@ public class ResponseBuilder implements java.io.Serializable { logger.debug("processKey=" + processKey); // See if there"s already a WorkflowException object in the execution. - WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); + WorkflowException theException = (WorkflowException) execution.getVariable(WORKFLOWEXCEPTION); if (theException != null) { logger.debug("Exited " + method + " - propagated " + theException); @@ -138,7 +139,7 @@ public class ResponseBuilder implements java.io.Serializable { // Create a new WorkflowException object theException = new WorkflowException(processKey, intResponseCode, errorResponse); - execution.setVariable("WorkflowException", theException); + execution.setVariable(WORKFLOWEXCEPTION, theException); logger.debug("Exited " + method + " - created " + theException); return theException; } @@ -163,7 +164,7 @@ public class ResponseBuilder implements java.io.Serializable { Object theResponse = null; - WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); + WorkflowException theException = (WorkflowException) execution.getVariable(WORKFLOWEXCEPTION); String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); @@ -222,7 +223,7 @@ public class ResponseBuilder implements java.io.Serializable { } String s = String.valueOf(object).trim(); - return s.equals("") ? emptyStringValue : s; + return "".equals(s) ? emptyStringValue : s; } /** diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java index 841eaee675..c37b77d332 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.core.domain; import java.util.UUID; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; /** @@ -35,14 +34,6 @@ public class AllottedResource extends Resource { private static final long serialVersionUID = 1L; /* - * set resourceType for this object - */ - public AllottedResource() { - resourceType = ResourceType.ALLOTTED_RESOURCE; - setResourceId(UUID.randomUUID().toString()); - } - - /* * fields specific to Allotted Resource resource type */ private String allottedResourceType; @@ -60,6 +51,14 @@ public class AllottedResource extends Resource { private String resourceInput; /* + * set resourceType for this object + */ + public AllottedResource() { + resourceType = ResourceType.ALLOTTED_RESOURCE; + setResourceId(UUID.randomUUID().toString()); + } + + /* * GET and SET */ public String getAllottedResourceType() { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java new file mode 100644 index 0000000000..79714d0f0e --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.core.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class GroupResource extends Resource { + private static final long serialVersionUID = 1L; + + @JsonProperty("vnfcs") + private List<VnfcResource> vnfcs; + + public GroupResource() { + resourceType = ResourceType.GROUP; + setResourceId(UUID.randomUUID().toString()); + } + + public List<VnfcResource> getVnfcs() { + return vnfcs; + } + + public void setVnfcs(List<VnfcResource> vnfcs) { + this.vnfcs = vnfcs; + } +} diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java index 897cbe3573..309b053589 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.core.domain; import java.io.Serializable; -import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java index 602172f8a4..bf53c880e9 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; */ @JsonInclude(Include.NON_NULL) public abstract class JsonWrapper implements Serializable { + private static final String EXCEPTION = "Exception :"; private static final Logger logger = LoggerFactory.getLogger(JsonWrapper.class); @@ -63,7 +64,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } @@ -76,14 +77,10 @@ public abstract class JsonWrapper implements Serializable { JSONObject json = new JSONObject(); try { json = new JSONObject(mapper.writeValueAsString(this)); - } catch (JsonGenerationException e) { - logger.debug("Exception :", e); - } catch (JsonMappingException e) { - logger.debug("Exception :", e); - } catch (JSONException e) { - logger.debug("Exception :", e); + } catch (JsonGenerationException | JsonMappingException | JSONException e) { + logger.debug(EXCEPTION, e); } catch (IOException e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return json; } @@ -95,12 +92,10 @@ public abstract class JsonWrapper implements Serializable { String jsonString = ""; try { jsonString = mapper.writeValueAsString(list); - } catch (JsonGenerationException e) { - logger.debug("Exception :", e); - } catch (JsonMappingException e) { - logger.debug("Exception :", e); + } catch (JsonGenerationException | JsonMappingException e) { + logger.debug(EXCEPTION, e); } catch (IOException e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } @@ -118,7 +113,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java index a30d0df825..0e17d4c826 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java @@ -22,5 +22,5 @@ package org.onap.so.bpmn.core.domain; public enum ResourceType { - VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc. + VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION, GROUP, VNFC // etc. } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java index 419f545cdf..b3439d58e3 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java @@ -245,7 +245,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { */ @JsonIgnore public List<Resource> getServiceResources() { - ArrayList serviceResources = new ArrayList(); + ArrayList<Resource> serviceResources = new ArrayList(); if (this.getAllottedResources() != null) { serviceResources.addAll(this.getAllottedResources()); } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java index f66ad36058..9688a57630 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; * Encapsulates VNF resource data set * */ +@JsonIgnoreProperties(ignoreUnknown = true) @JsonRootName("vnfResource") public class VnfResource extends Resource { @@ -50,6 +51,13 @@ public class VnfResource extends Resource { */ @JsonProperty("vfModules") private List<ModuleResource> vfModules; + + @JsonProperty("groups") + private List<GroupResource> groups; + + @JsonProperty("vnfcInstGroupOrder") + private String groupOrder; + private String vnfHostname; private String vnfType; private String nfFunction; @@ -59,7 +67,7 @@ public class VnfResource extends Resource { private String multiStageDesign; private String orchestrationStatus; - @JsonIgnore + @JsonProperty("resourceInput") private String resourceInput; /* @@ -150,6 +158,22 @@ public class VnfResource extends Resource { this.resourceInput = resourceInput; } + public List<GroupResource> getGroups() { + return groups; + } + + public void setGroups(List<GroupResource> groups) { + this.groups = groups; + } + + public String getGroupOrder() { + return groupOrder; + } + + public void setGroupOrder(String groupOrder) { + this.groupOrder = groupOrder; + } + /** * Returns a list of all VfModule objects. Base module is first entry in the list * diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java new file mode 100644 index 0000000000..50bd3e2355 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.core.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class VnfcResource extends Resource { + private static final long serialVersionUID = 1L; + + @JsonProperty("resourceInput") + private String resourceInput; + + public VnfcResource() { + resourceType = ResourceType.VNFC; + setResourceId(UUID.randomUUID().toString()); + } + + public String getResourceInput() { + return resourceInput; + } + + public void setResourceInput(String resourceInput) { + this.resourceInput = resourceInput; + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java index 5db277628e..7ef7deea30 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java @@ -52,6 +52,22 @@ public class ServiceDecompositionTest { configResource.setResourceId("configResourceId"); } + + @Test + public void serviceDecompositionWithGroupandVnfc() throws IOException { + String sericeStr = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceWithGroupandVnfc.json"))); + ServiceDecomposition serviceDecomposition = new ServiceDecomposition(sericeStr); + + assertEquals(1, serviceDecomposition.getVnfResources().size()); + assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().size()); + assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().size()); + + VnfcResource vnfcResource = serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().get(0); + + assertEquals("xfs", vnfcResource.getModelInfo().getModelName()); + assertEquals("22", vnfcResource.getModelInfo().getModelUuid()); + } + @Test public void serviceDecompositionTest() throws JsonProcessingException, IOException { // covering methods not covered by openpojo test diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java index 09bcfe8470..de7b21ed73 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java @@ -14,12 +14,13 @@ */ package org.onap.so.bpmn.core.domain; -import static org.junit.Assert.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class VnfResourceTest { @@ -58,6 +59,19 @@ public class VnfResourceTest { VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class); assertTrue(vnfResource != null); + assertEquals("sample", vnfResource.getResourceInput()); + assertEquals("home", vnfResource.getVnfHostname()); + } + + @Test + public void vnfResourceMapperTestNoResourceInput() throws IOException { + String jsonStr = "{\"vnfHostname\": \"home\"}"; + ObjectMapper objectMapper = new ObjectMapper(); + VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class); + + assertTrue(vnfResource != null); + assertEquals(null, vnfResource.getResourceInput()); + assertEquals("home", vnfResource.getVnfHostname()); } @Test diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json new file mode 100644 index 0000000000..9d0326e66a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json @@ -0,0 +1,58 @@ +{ + "serviceResources": { + "modelInfo": { + "modelName": "NSService", + "modelUuid": "0bad8c92-7d22-49f0-b092-b64e6ca564a7", + "modelInvariantUuid": "69161960-515b-4bf3-91f1-313b813f5e1d", + "modelVersion": "1.0" + }, + "serviceType": "", + "serviceRole": "", + "environmentContext": "General_Revenue-Bearing", + "resourceOrder": "NF", + "workloadContext": "Production", + "serviceVnfs": [ + { + "modelInfo": { + "modelName": "", + "modelUuid": "123", + "modelInvariantUuid": "", + "modelVersion": "", + "modelCustomizationUuid": "1234", + "modelInstanceName": "test" + }, + "toscaNodeType": "", + "nfFunction": "", + "nfType": "", + "nfRole": "", + "nfNamingCode": "", + "multiStageDesign": "", + "resourceInput": "", + "vfModules": [], + "groups": [ + { + "modelInfo": { + "modelName": "test", + "modelUuid": "11", + "modelInvariantUuid": "11", + "modelVersion": "2" + }, + "vnfcs": [ + { + "modelInfo": { + "modelName": "xfs", + "modelUuid": "22", + "modelInvariantUuid": "2222", + "modelVersion": "22222", + "modelCustomizationUuid": "2222" + } + } + ] + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [] + } +}
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java index cd4257ec60..e0760b5d4a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -160,12 +162,4 @@ public class DeleteVnfNotification { return deleteVnfNotification; } - /* - * public String toString() { StringWriter writer = new StringWriter(); try { JAXBContext context = JAXBContext - * .newInstance(DeleteVnfNotification.class); Marshaller m = context.createMarshaller(); - * m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(this, writer); - * //System.out.println("toString() - " + writer.getBuffer().toString()); return writer.getBuffer().toString(); } - * catch (JAXBException e) { //System.out.println("JAXBException - " + e.getStackTrace()); return ""; } } - */ - } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 7c0c2f20b3..c3349dd9e2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.common.base.Strings; import org.camunda.bpm.engine.MismatchingMessageCorrelationException; import org.camunda.bpm.engine.OptimisticLockingException; import org.camunda.bpm.engine.RuntimeService; @@ -207,7 +208,7 @@ public class CallbackHandlerService { + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'; last exception was:" + queryException; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, queryException); } @@ -245,8 +246,8 @@ public class CallbackHandlerService { String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + ole; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - ErrorCode.UnknownError.getValue(), msg, ole); + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, ole); // Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -279,7 +280,7 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; logger.debug(strMsg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; @@ -287,7 +288,7 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; logger.debug(strMsg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), strMsg, excep); } @@ -300,7 +301,7 @@ public class CallbackHandlerService { + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { @@ -309,8 +310,8 @@ public class CallbackHandlerService { String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - ErrorCode.UnknownError.getValue(), msg, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -345,10 +346,10 @@ public class CallbackHandlerService { */ protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { - logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg); } else { - logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index 1e9ebdf0b2..da18ac2f40 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -32,6 +32,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.google.common.base.Strings; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; import org.onap.so.logger.ErrorCode; @@ -78,7 +79,7 @@ public class WorkflowMessageResource { if (messageType == null || messageType.isEmpty()) { String msg = "Missing message type"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -86,7 +87,7 @@ public class WorkflowMessageResource { if (correlator == null || correlator.isEmpty()) { String msg = "Missing correlator"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index 9d63e8eaf1..ef6a27b0fc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -36,6 +36,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.google.common.base.Strings; import org.camunda.bpm.engine.HistoryService; import org.camunda.bpm.engine.ProcessEngineException; import org.camunda.bpm.engine.ProcessEngineServices; @@ -195,7 +196,7 @@ public class WorkflowResource extends ProcessEngineAwareService { if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); @@ -581,7 +582,7 @@ public class WorkflowResource extends ProcessEngineAwareService { response.setResponse("Failed to retrieve the variables," + ex.getMessage()); response.setProcessInstanceID(processInstanceId); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); logger.debug("Exception :", ex); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index 8168d2a4b8..2aa433ba5a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure; import java.util.List; import java.util.concurrent.Executor; +import com.google.common.base.Strings; import javax.annotation.PostConstruct; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; @@ -131,12 +132,12 @@ public class MSOInfrastructureApplication { workflowName += BPMN_SUFFIX; } if (workflowBody != null) { - logger.info("{} {}", "Deploying custom workflow", workflowName); + logger.info(Strings.repeat("{} ", 2), "Deploying custom workflow", workflowName); deploymentBuilder.addString(workflowName, workflowBody); } + deploymentBuilder.enableDuplicateFiltering(true); + deploymentBuilder.deploy(); } - deploymentBuilder.enableDuplicateFiltering(true); - deploymentBuilder.deploy(); } } catch (Exception e) { logger.warn("Unable to deploy custom workflows, " + e.getMessage()); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 3734510eed..3ff240ebc2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -34,6 +34,8 @@ import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; import org.junit.Test; import org.onap.so.BaseIntegrationTest; +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; import org.springframework.beans.factory.annotation.Autowired; public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { @@ -61,6 +63,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() { // given variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY); + variables.put("resourceInput", getUpdateResInputObj("OLT").toString()); // when ProcessInstance instance = runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -79,6 +82,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() { // given variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY); + variables.put("resourceInput", getUpdateResInputObj("OLT").toString()); // when ProcessInstance instance = runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -93,4 +97,31 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()) .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY)); } + + private ResourceInput getUpdateResInputObj(String modelName) { + + String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" + + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n" + + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" + + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n" + + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" + + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" + + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n" + + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \"" + + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" + + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" + + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n" + + "\t\"resourceInstancenUuid\": null,\n" + + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" + + "\t\"operationType\": \"createInstance\",\n" + + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" + + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" + + "}"; + + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class); + return resourceInputObj; + } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index e7ff69ab3b..dd993bca51 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -20,7 +20,9 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import java.util.HashMap; import java.util.Objects; +import java.util.Optional; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @@ -33,7 +35,8 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, + Optional<HashMap<String, String>> updateInfo) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 85a45db6ba..f09cfaa38c 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -24,8 +24,8 @@ <xmlunit.version>2.4.0</xmlunit.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <sdnc.northbound.version>1.5.1</sdnc.northbound.version> - <appc.client.version>1.5.0</appc.client.version> + <sdnc.northbound.version>1.5.2-SNAPSHOT</sdnc.northbound.version> + <appc.client.version>1.6.0-SNAPSHOT</appc.client.version> </properties> <modules> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index 289ab6e155..ff37874978 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> @@ -9,9 +9,7 @@ <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming> - <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1b63lv4</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -40,13 +38,8 @@ <bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik"> - <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_07ybdik" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ActivateVfModule" /> - <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit"> + <bpmn:sequenceFlow id="SequenceFlow_07ybdik" name="No" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ExclusiveGateway_0sqvzll" /> + <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" name="Yes" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ExclusiveGateway_1h8avxn" /> @@ -55,154 +48,252 @@ <bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1h8avxn" default="SequenceFlow_1bo83qk"> - <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_109oxx2" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ActivateVfModule"> + <bpmn:sequenceFlow id="SequenceFlow_109oxx2" name="No" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ExclusiveGateway_0y0ek7t"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful")== true }]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="If Audit Fails" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" /> - <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="Yes" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" /> + <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ExclusiveGateway_0y0ek7t" /> <bpmn:serviceTask id="Create_AAI_Inventory" name="Create A&AI Inventory" camunda:type="external" camunda:topic="InventoryCreate"> <bpmn:incoming>SequenceFlow_1bo83qk</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0arwo1o</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1b63lv4" sourceRef="ExclusiveGateway_0sqvzll" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_18faffa" sourceRef="ExclusiveGateway_0y0ek7t" targetRef="ExclusiveGateway_0sqvzll" /> + <bpmn:subProcess id="SubProcess_0bpsptg" name="Audit Exception Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="catchInventoryException"> + <bpmn:outgoing>SequenceFlow_19gbhlj</bpmn:outgoing> + <bpmn:errorEventDefinition errorRef="Error_1s3kxze" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_067jv1n"> + <bpmn:incoming>SequenceFlow_0l4jzc5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_19gbhlj" sourceRef="catchInventoryException" targetRef="processAuditException" /> + <bpmn:sequenceFlow id="SequenceFlow_0l4jzc5" sourceRef="processAuditException" targetRef="EndEvent_067jv1n" /> + <bpmn:serviceTask id="processAuditException" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), false)}"> + <bpmn:incoming>SequenceFlow_19gbhlj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0l4jzc5</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:subProcess> + <bpmn:inclusiveGateway id="ExclusiveGateway_1v8bmbu" name="Audit Enabled?" default="SequenceFlow_07ybdik"> + <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_0sqvzll"> + <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming> + <bpmn:incoming>SequenceFlow_18faffa</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b63lv4</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_1h8avxn" name="Audit Failed?" default="SequenceFlow_1bo83qk"> + <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_0y0ek7t"> + <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18faffa</bpmn:outgoing> + </bpmn:inclusiveGateway> </bpmn:process> <bpmn:error id="Error_0q258vt" errorCode="7000" /> + <bpmn:error id="Error_0zgccif" name="org.onap.so.adapters.inventory.create.InventoryException" errorCode="org.onap.so.adapters.inventory.create.InventoryException" /> + <bpmn:error id="Error_1s3kxze" name="Error_3q664s5" errorCode="AAIInventoryFailure" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVfModuleBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ActivateVfModuleBB_Start"> - <dc:Bounds x="73" y="102" width="36" height="36" /> + <dc:Bounds x="85" y="234" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="46" y="138" width="90" height="12" /> + <dc:Bounds x="58" y="270" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> - <di:waypoint xsi:type="dc:Point" x="109" y="120" /> - <di:waypoint xsi:type="dc:Point" x="161" y="120" /> + <di:waypoint xsi:type="dc:Point" x="121" y="252" /> + <di:waypoint xsi:type="dc:Point" x="201" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="90" y="99" width="90" height="12" /> + <dc:Bounds x="116" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="1104" y="102" width="36" height="36" /> + <dc:Bounds x="1404" y="235" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="935" y="142" width="90" height="12" /> + <dc:Bounds x="1235" y="275" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="647" y="80" width="100" height="80" /> + <dc:Bounds x="958" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="952" y="80" width="100" height="80" /> + <dc:Bounds x="1214" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="1052" y="120" /> - <di:waypoint xsi:type="dc:Point" x="1104" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1314" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1404" y="253" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1033" y="99" width="90" height="12" /> + <dc:Bounds x="1314" y="231.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler"> - <dc:Bounds x="794" y="80" width="100" height="80" /> + <dc:Bounds x="1086" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm"> - <di:waypoint xsi:type="dc:Point" x="747" y="120" /> - <di:waypoint xsi:type="dc:Point" x="794" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1086" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="725.5" y="99" width="90" height="12" /> + <dc:Bounds x="1027" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> - <di:waypoint xsi:type="dc:Point" x="894" y="120" /> - <di:waypoint xsi:type="dc:Point" x="952" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1186" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1214" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="99" width="90" height="12" /> + <dc:Bounds x="1155" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi"> - <di:waypoint xsi:type="dc:Point" x="365" y="256" /> - <di:waypoint xsi:type="dc:Point" x="408" y="256" /> + <di:waypoint xsi:type="dc:Point" x="491" y="175" /> + <di:waypoint xsi:type="dc:Point" x="513" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="341.5" y="234.5" width="90" height="13" /> + <dc:Bounds x="457" y="153.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit"> - <dc:Bounds x="265" y="216" width="100" height="80" /> + <dc:Bounds x="391" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory"> - <dc:Bounds x="408" y="216" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true"> - <dc:Bounds x="290" y="95" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="315" y="148" width="0" height="13" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="513" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik"> - <di:waypoint xsi:type="dc:Point" x="340" y="120" /> - <di:waypoint xsi:type="dc:Point" x="647" y="120" /> + <di:waypoint xsi:type="dc:Point" x="355" y="277" /> + <di:waypoint xsi:type="dc:Point" x="355" y="315" /> + <di:waypoint xsi:type="dc:Point" x="881" y="315" /> + <di:waypoint xsi:type="dc:Point" x="881" y="277" /> <bpmndi:BPMNLabel> - <dc:Bounds x="448.5" y="98.5" width="90" height="13" /> + <dc:Bounds x="364" y="294" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo"> - <di:waypoint xsi:type="dc:Point" x="315" y="145" /> - <di:waypoint xsi:type="dc:Point" x="315" y="216" /> + <di:waypoint xsi:type="dc:Point" x="355" y="227" /> + <di:waypoint xsi:type="dc:Point" x="355" y="175" /> + <di:waypoint xsi:type="dc:Point" x="391" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="330" y="174" width="0" height="13" /> + <dc:Bounds x="362" y="185" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq"> - <di:waypoint xsi:type="dc:Point" x="508" y="256" /> - <di:waypoint xsi:type="dc:Point" x="566" y="256" /> + <di:waypoint xsi:type="dc:Point" x="613" y="175" /> + <di:waypoint xsi:type="dc:Point" x="638" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="492" y="234.5" width="90" height="13" /> + <dc:Bounds x="580.5" y="153.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable"> - <dc:Bounds x="161" y="80" width="100" height="80" /> + <dc:Bounds x="201" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xqyur9_di" bpmnElement="SequenceFlow_1xqyur9"> - <di:waypoint xsi:type="dc:Point" x="261" y="120" /> - <di:waypoint xsi:type="dc:Point" x="290" y="120" /> + <di:waypoint xsi:type="dc:Point" x="301" y="252" /> + <di:waypoint xsi:type="dc:Point" x="330" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="275.5" y="98.5" width="0" height="13" /> + <dc:Bounds x="270.5" y="230.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1h8avxn_di" bpmnElement="ExclusiveGateway_1h8avxn" isMarkerVisible="true"> - <dc:Bounds x="566" y="231" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="591" y="284" width="0" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_109oxx2_di" bpmnElement="SequenceFlow_109oxx2"> - <di:waypoint xsi:type="dc:Point" x="616" y="256" /> - <di:waypoint xsi:type="dc:Point" x="670" y="256" /> - <di:waypoint xsi:type="dc:Point" x="670" y="160" /> + <di:waypoint xsi:type="dc:Point" x="663" y="200" /> + <di:waypoint xsi:type="dc:Point" x="663" y="230" /> + <di:waypoint xsi:type="dc:Point" x="834" y="230" /> + <di:waypoint xsi:type="dc:Point" x="834" y="200" /> <bpmndi:BPMNLabel> - <dc:Bounds x="643" y="234.5" width="0" height="13" /> + <dc:Bounds x="670" y="207" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1bo83qk_di" bpmnElement="SequenceFlow_1bo83qk"> - <di:waypoint xsi:type="dc:Point" x="591" y="281" /> - <di:waypoint xsi:type="dc:Point" x="591" y="345" /> - <di:waypoint xsi:type="dc:Point" x="656" y="345" /> + <di:waypoint xsi:type="dc:Point" x="663" y="150" /> + <di:waypoint xsi:type="dc:Point" x="663" y="101" /> + <di:waypoint xsi:type="dc:Point" x="691" y="101" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="358" width="61" height="12" /> + <dc:Bounds x="667" y="111" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0arwo1o_di" bpmnElement="SequenceFlow_0arwo1o"> - <di:waypoint xsi:type="dc:Point" x="706" y="305" /> - <di:waypoint xsi:type="dc:Point" x="706" y="160" /> + <di:waypoint xsi:type="dc:Point" x="791" y="101" /> + <di:waypoint xsi:type="dc:Point" x="834" y="101" /> + <di:waypoint xsi:type="dc:Point" x="834" y="150" /> <bpmndi:BPMNLabel> - <dc:Bounds x="721" y="226" width="0" height="13" /> + <dc:Bounds x="767.5" y="79.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1eb09gr_di" bpmnElement="Create_AAI_Inventory"> - <dc:Bounds x="656" y="305" width="100" height="80" /> + <dc:Bounds x="691" y="61" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1b63lv4_di" bpmnElement="SequenceFlow_1b63lv4"> + <di:waypoint xsi:type="dc:Point" x="906" y="252" /> + <di:waypoint xsi:type="dc:Point" x="958" y="252" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="887" y="231" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18faffa_di" bpmnElement="SequenceFlow_18faffa"> + <di:waypoint xsi:type="dc:Point" x="859" y="175" /> + <di:waypoint xsi:type="dc:Point" x="881" y="175" /> + <di:waypoint xsi:type="dc:Point" x="881" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="825" y="154" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0mbkb7v_di" bpmnElement="SubProcess_0bpsptg" isExpanded="true"> + <dc:Bounds x="293" y="449" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_12r96di_di" bpmnElement="catchInventoryException"> + <dc:Bounds x="324" y="532" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="341.15269461077844" y="571.6127744510978" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_067jv1n_di" bpmnElement="EndEvent_067jv1n"> + <dc:Bounds x="572.1526946107784" y="532" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="590.1526946107784" y="572" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_19gbhlj_di" bpmnElement="SequenceFlow_19gbhlj"> + <di:waypoint xsi:type="dc:Point" x="360" y="550" /> + <di:waypoint xsi:type="dc:Point" x="415" y="550" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="387.5" y="529" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0l4jzc5_di" bpmnElement="SequenceFlow_0l4jzc5"> + <di:waypoint xsi:type="dc:Point" x="515" y="550" /> + <di:waypoint xsi:type="dc:Point" x="572" y="550" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543.5" y="529" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_08xffml_di" bpmnElement="processAuditException"> + <dc:Bounds x="415" y="510" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_03pi9y4_di" bpmnElement="ExclusiveGateway_1v8bmbu"> + <dc:Bounds x="330" y="227" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="383" y="246" width="73" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_16ap4e3_di" bpmnElement="ExclusiveGateway_0sqvzll"> + <dc:Bounds x="856" y="227" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="836" y="281" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_00n600s_di" bpmnElement="ExclusiveGateway_1h8avxn"> + <dc:Bounds x="638" y="150" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="693" y="169" width="63" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_0xx6c29_di" bpmnElement="ExclusiveGateway_0y0ek7t"> + <dc:Bounds x="809" y="150" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="789" y="204" width="0" height="12" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index e1b36cfe65..33335ab2c4 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> @@ -51,22 +51,22 @@ <bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" /> <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> <bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> - <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming> + <bpmn:serviceTask id="DeleteNetworkPolicies" name=" AAI Delete (net policies) " camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_179btn2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVnfManagementV6Address" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0jtem3b</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0khqfnc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0jtem3b" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" /> - <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0xyu3pk</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0jtem3b</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0khqfnc" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" /> <bpmn:sequenceFlow id="SequenceFlow_0yuz21z" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> - <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing> </bpmn:serviceTask> @@ -79,15 +79,10 @@ <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes " sourceRef="ExclusiveGateway_1h2ystu" targetRef="Setup_Audit_Variable"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="ExclusiveGateway_1pydilb" /> - <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="DeleteNetworkPolicies" /> - <bpmn:parallelGateway id="ExclusiveGateway_1yvh16a"> - <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing> - </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" /> + <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="aaiThrow" /> <bpmn:sequenceFlow id="SequenceFlow_1mgunf3" name="No" sourceRef="ExclusiveGateway_1h2ystu" targetRef="ExclusiveGateway_1pydilb" /> - <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isDeleteAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1v3jgqe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1odt2wt</bpmn:outgoing> </bpmn:serviceTask> @@ -109,240 +104,359 @@ <bpmn:outgoing>SequenceFlow_1mgunf3</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:exclusiveGateway id="ExclusiveGateway_1pydilb"> - <bpmn:incoming>SequenceFlow_0qfmmgt</bpmn:incoming> <bpmn:incoming>SequenceFlow_1mgunf3</bpmn:incoming> + <bpmn:incoming>SequenceFlow_17cd9e2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ut7n32</bpmn:outgoing> </bpmn:exclusiveGateway> + <bpmn:subProcess id="SubProcess_0grvkj2" name="Audit Exception Sub Process" triggeredByEvent="true"> + <bpmn:endEvent id="EndEvent_1gzq57j"> + <bpmn:incoming>SequenceFlow_1fhst92</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="ServiceTask_1isbxvo" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), true)}"> + <bpmn:incoming>SequenceFlow_0xuodpy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fhst92</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0xuodpy" sourceRef="StartEvent_1euiddy" targetRef="ServiceTask_1isbxvo" /> + <bpmn:sequenceFlow id="SequenceFlow_1fhst92" sourceRef="ServiceTask_1isbxvo" targetRef="EndEvent_1gzq57j" /> + <bpmn:startEvent id="StartEvent_1euiddy" isInterrupting="false"> + <bpmn:outgoing>SequenceFlow_0xuodpy</bpmn:outgoing> + <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" camunda:escalationCodeVariable="test" /> + </bpmn:startEvent> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_179btn2" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" /> + <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI"> + <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming> + <bpmn:linkEventDefinition name="AAI" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI"> + <bpmn:outgoing>SequenceFlow_179btn2</bpmn:outgoing> + <bpmn:linkEventDefinition name="AAI" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_17cd9e2" name="Yes/No" sourceRef="auditSuccessfulCheck" targetRef="ExclusiveGateway_1pydilb"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false || execution.getVariable("auditIsSuccessful") == true}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1gdyk9j" name="No" sourceRef="auditSuccessfulCheck" targetRef="EndEvent_0b0ocu0"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:inclusiveGateway id="ExclusiveGateway_1yvh16a"> + <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="auditSuccessfulCheck" name="Audit Successful?"> + <bpmn:incoming>SequenceFlow_0qfmmgt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17cd9e2</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1gdyk9j</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:endEvent id="EndEvent_0b0ocu0"> + <bpmn:incoming>SequenceFlow_1gdyk9j</bpmn:incoming> + <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" /> + </bpmn:endEvent> </bpmn:process> + <bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" /> + <bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start"> - <dc:Bounds x="159" y="241" width="36" height="36" /> + <dc:Bounds x="159" y="266" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="132" y="277" width="90" height="12" /> + <dc:Bounds x="132" y="302" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter"> - <dc:Bounds x="382" y="278" width="100" height="80" /> + <dc:Bounds x="382" y="303" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1537yw5_di" bpmnElement="SequenceFlow_1537yw5"> - <di:waypoint xsi:type="dc:Point" x="195" y="259" /> - <di:waypoint xsi:type="dc:Point" x="282" y="259" /> + <di:waypoint xsi:type="dc:Point" x="195" y="284" /> + <di:waypoint xsi:type="dc:Point" x="282" y="284" /> <bpmndi:BPMNLabel> - <dc:Bounds x="193.5" y="238" width="90" height="12" /> + <dc:Bounds x="194" y="263" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="840" y="443" width="100" height="80" /> + <dc:Bounds x="907" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> - <di:waypoint xsi:type="dc:Point" x="482" y="318" /> - <di:waypoint xsi:type="dc:Point" x="511" y="318" /> + <di:waypoint xsi:type="dc:Point" x="482" y="343" /> + <di:waypoint xsi:type="dc:Point" x="511" y="343" /> <bpmndi:BPMNLabel> - <dc:Bounds x="451.5" y="297" width="90" height="12" /> + <dc:Bounds x="452" y="322" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="1087" y="465" width="36" height="36" /> + <dc:Bounds x="1136" y="490" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1060" y="505" width="90" height="0" /> + <dc:Bounds x="1109" y="530" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="511" y="278" width="100" height="80" /> + <dc:Bounds x="511" y="303" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> - <di:waypoint xsi:type="dc:Point" x="611" y="318" /> - <di:waypoint xsi:type="dc:Point" x="836" y="318" /> - <di:waypoint xsi:type="dc:Point" x="836" y="284" /> + <di:waypoint xsi:type="dc:Point" x="611" y="343" /> + <di:waypoint xsi:type="dc:Point" x="925" y="343" /> + <di:waypoint xsi:type="dc:Point" x="925" y="309" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678.5" y="303" width="90" height="0" /> + <dc:Bounds x="723" y="328" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> - <dc:Bounds x="294" y="618" width="231" height="135" /> + <dc:Bounds x="290" y="878" width="231" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt"> - <dc:Bounds x="337" y="680" width="36" height="36" /> + <dc:Bounds x="333" y="940" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="265" y="716" width="90" height="0" /> + <dc:Bounds x="261" y="976" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau"> - <dc:Bounds x="466" y="680" width="36" height="36" /> + <dc:Bounds x="462" y="940" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="394" y="716" width="90" height="0" /> + <dc:Bounds x="390" y="976" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0"> - <di:waypoint xsi:type="dc:Point" x="373" y="698" /> - <di:waypoint xsi:type="dc:Point" x="466" y="698" /> + <di:waypoint xsi:type="dc:Point" x="369" y="958" /> + <di:waypoint xsi:type="dc:Point" x="462" y="958" /> <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="677" width="90" height="0" /> + <dc:Bounds x="371" y="937" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="706" y="443" width="100" height="80" /> + <dc:Bounds x="779" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> - <di:waypoint xsi:type="dc:Point" x="806" y="483" /> - <di:waypoint xsi:type="dc:Point" x="840" y="483" /> + <di:waypoint xsi:type="dc:Point" x="879" y="508" /> + <di:waypoint xsi:type="dc:Point" x="907" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="778" y="468" width="90" height="0" /> + <dc:Bounds x="848" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> - <di:waypoint xsi:type="dc:Point" x="940" y="483" /> - <di:waypoint xsi:type="dc:Point" x="1087" y="483" /> + <di:waypoint xsi:type="dc:Point" x="1007" y="508" /> + <di:waypoint xsi:type="dc:Point" x="1136" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="968.5" y="468" width="90" height="0" /> + <dc:Bounds x="1027" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> - <di:waypoint xsi:type="dc:Point" x="998" y="259" /> - <di:waypoint xsi:type="dc:Point" x="1072" y="259" /> - <di:waypoint xsi:type="dc:Point" x="1072" y="399" /> - <di:waypoint xsi:type="dc:Point" x="233" y="399" /> - <di:waypoint xsi:type="dc:Point" x="233" y="483" /> - <di:waypoint xsi:type="dc:Point" x="280" y="483" /> + <di:waypoint xsi:type="dc:Point" x="376" y="508" /> + <di:waypoint xsi:type="dc:Point" x="404" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="607.5" y="384" width="90" height="0" /> + <dc:Bounds x="345" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies"> - <dc:Bounds x="898" y="219" width="100" height="80" /> + <dc:Bounds x="276" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address"> - <dc:Bounds x="421" y="443" width="100" height="80" /> + <dc:Bounds x="531" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b"> - <di:waypoint xsi:type="dc:Point" x="380" y="483" /> - <di:waypoint xsi:type="dc:Point" x="421" y="483" /> + <di:waypoint xsi:type="dc:Point" x="504" y="508" /> + <di:waypoint xsi:type="dc:Point" x="531" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="355.5" y="468" width="90" height="0" /> + <dc:Bounds x="473" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress"> - <dc:Bounds x="280" y="443" width="100" height="80" /> + <dc:Bounds x="404" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc"> - <di:waypoint xsi:type="dc:Point" x="521" y="483" /> - <di:waypoint xsi:type="dc:Point" x="561" y="483" /> + <di:waypoint xsi:type="dc:Point" x="631" y="508" /> + <di:waypoint xsi:type="dc:Point" x="654" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="496" y="468" width="90" height="0" /> + <dc:Bounds x="598" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z"> - <di:waypoint xsi:type="dc:Point" x="661" y="483" /> - <di:waypoint xsi:type="dc:Point" x="706" y="483" /> + <di:waypoint xsi:type="dc:Point" x="754" y="508" /> + <di:waypoint xsi:type="dc:Point" x="779" y="508" /> <bpmndi:BPMNLabel> - <dc:Bounds x="638.5" y="468" width="90" height="0" /> + <dc:Bounds x="722" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> - <dc:Bounds x="561" y="443" width="100" height="80" /> + <dc:Bounds x="654" y="468" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1n8gab5_di" bpmnElement="SequenceFlow_1n8gab5"> - <di:waypoint xsi:type="dc:Point" x="307" y="284" /> - <di:waypoint xsi:type="dc:Point" x="307" y="318" /> - <di:waypoint xsi:type="dc:Point" x="382" y="318" /> + <di:waypoint xsi:type="dc:Point" x="307" y="309" /> + <di:waypoint xsi:type="dc:Point" x="307" y="343" /> + <di:waypoint xsi:type="dc:Point" x="382" y="343" /> <bpmndi:BPMNLabel> - <dc:Bounds x="277" y="294.5" width="90" height="13" /> + <dc:Bounds x="277" y="320" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ParallelGateway_18x6mx2_di" bpmnElement="ExclusiveGateway_0xrgzm7"> - <dc:Bounds x="282" y="234" width="50" height="50" /> + <dc:Bounds x="282" y="259" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="262" y="287" width="90" height="13" /> + <dc:Bounds x="262" y="312" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j"> - <di:waypoint xsi:type="dc:Point" x="492" y="149" /> - <di:waypoint xsi:type="dc:Point" x="492" y="108" /> - <di:waypoint xsi:type="dc:Point" x="531" y="108" /> + <di:waypoint xsi:type="dc:Point" x="492" y="174" /> + <di:waypoint xsi:type="dc:Point" x="492" y="133" /> + <di:waypoint xsi:type="dc:Point" x="531" y="133" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="114" width="18" height="25" /> + <dc:Bounds x="499" y="139" width="19" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qfmmgt_di" bpmnElement="SequenceFlow_0qfmmgt"> - <di:waypoint xsi:type="dc:Point" x="754" y="108" /> - <di:waypoint xsi:type="dc:Point" x="784" y="108" /> - <di:waypoint xsi:type="dc:Point" x="784" y="149" /> + <di:waypoint xsi:type="dc:Point" x="754" y="133" /> + <di:waypoint xsi:type="dc:Point" x="780" y="133" /> <bpmndi:BPMNLabel> - <dc:Bounds x="724" y="86.5" width="90" height="13" /> + <dc:Bounds x="722" y="111.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys"> - <di:waypoint xsi:type="dc:Point" x="861" y="259" /> - <di:waypoint xsi:type="dc:Point" x="898" y="259" /> + <di:waypoint xsi:type="dc:Point" x="950" y="284" /> + <di:waypoint xsi:type="dc:Point" x="1100" y="283" /> <bpmndi:BPMNLabel> - <dc:Bounds x="834.5" y="237.5" width="90" height="13" /> + <dc:Bounds x="980" y="262" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_02fjfb8_di" bpmnElement="ExclusiveGateway_1yvh16a"> - <dc:Bounds x="811" y="234" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="790" y="287" width="90" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mgunf3_di" bpmnElement="SequenceFlow_1mgunf3"> - <di:waypoint xsi:type="dc:Point" x="492" y="199" /> - <di:waypoint xsi:type="dc:Point" x="492" y="232" /> - <di:waypoint xsi:type="dc:Point" x="784" y="232" /> - <di:waypoint xsi:type="dc:Point" x="784" y="199" /> + <di:waypoint xsi:type="dc:Point" x="492" y="224" /> + <di:waypoint xsi:type="dc:Point" x="492" y="257" /> + <di:waypoint xsi:type="dc:Point" x="868" y="257" /> + <di:waypoint xsi:type="dc:Point" x="868" y="224" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="212" width="15" height="13" /> + <dc:Bounds x="503.9261744966443" y="237" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit"> - <dc:Bounds x="339" y="134" width="100" height="80" /> + <dc:Bounds x="339" y="159" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1v3jgqe_di" bpmnElement="SequenceFlow_1v3jgqe"> - <di:waypoint xsi:type="dc:Point" x="307" y="234" /> - <di:waypoint xsi:type="dc:Point" x="307" y="174" /> - <di:waypoint xsi:type="dc:Point" x="339" y="174" /> + <di:waypoint xsi:type="dc:Point" x="307" y="259" /> + <di:waypoint xsi:type="dc:Point" x="307" y="199" /> + <di:waypoint xsi:type="dc:Point" x="339" y="199" /> <bpmndi:BPMNLabel> - <dc:Bounds x="277" y="197.5" width="90" height="13" /> + <dc:Bounds x="277" y="223" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1odt2wt_di" bpmnElement="SequenceFlow_1odt2wt"> - <di:waypoint xsi:type="dc:Point" x="439" y="174" /> - <di:waypoint xsi:type="dc:Point" x="467" y="174" /> + <di:waypoint xsi:type="dc:Point" x="439" y="199" /> + <di:waypoint xsi:type="dc:Point" x="467" y="199" /> <bpmndi:BPMNLabel> - <dc:Bounds x="408" y="152.5" width="90" height="13" /> + <dc:Bounds x="408" y="178" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1swistn_di" bpmnElement="SequenceFlow_1swistn"> - <di:waypoint xsi:type="dc:Point" x="631" y="108" /> - <di:waypoint xsi:type="dc:Point" x="654" y="108" /> + <di:waypoint xsi:type="dc:Point" x="631" y="133" /> + <di:waypoint xsi:type="dc:Point" x="654" y="133" /> <bpmndi:BPMNLabel> - <dc:Bounds x="597.5" y="86.5" width="90" height="13" /> + <dc:Bounds x="598" y="112" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory"> - <dc:Bounds x="654" y="68" width="100" height="80" /> + <dc:Bounds x="654" y="93" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable"> - <dc:Bounds x="531" y="68" width="100" height="80" /> + <dc:Bounds x="531" y="93" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ut7n32_di" bpmnElement="SequenceFlow_1ut7n32"> - <di:waypoint xsi:type="dc:Point" x="809" y="174" /> - <di:waypoint xsi:type="dc:Point" x="836" y="174" /> - <di:waypoint xsi:type="dc:Point" x="836" y="234" /> + <di:waypoint xsi:type="dc:Point" x="893" y="199" /> + <di:waypoint xsi:type="dc:Point" x="925" y="199" /> + <di:waypoint xsi:type="dc:Point" x="925" y="259" /> <bpmndi:BPMNLabel> - <dc:Bounds x="777.5" y="152.5" width="90" height="13" /> + <dc:Bounds x="864" y="177.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1olwkdn_di" bpmnElement="ExclusiveGateway_1h2ystu" isMarkerVisible="true"> - <dc:Bounds x="467" y="149" width="50" height="50" /> + <dc:Bounds x="467" y="174" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="518" y="162" width="47" height="25" /> + <dc:Bounds x="519" y="187" width="45" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1d1pmqz_di" bpmnElement="ExclusiveGateway_1pydilb" isMarkerVisible="true"> - <dc:Bounds x="759" y="149" width="50" height="50" /> + <dc:Bounds x="843" y="174" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="733" y="227" width="90" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0grvkj2_di" bpmnElement="SubProcess_0grvkj2" isExpanded="true"> + <dc:Bounds x="231" y="642" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1gzq57j_di" bpmnElement="EndEvent_1gzq57j"> + <dc:Bounds x="510" y="725" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="438" y="765" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1isbxvo_di" bpmnElement="ServiceTask_1isbxvo"> + <dc:Bounds x="353" y="703" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xuodpy_di" bpmnElement="SequenceFlow_0xuodpy"> + <di:waypoint xsi:type="dc:Point" x="298" y="743" /> + <di:waypoint xsi:type="dc:Point" x="353" y="743" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="280.5" y="722" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fhst92_di" bpmnElement="SequenceFlow_1fhst92"> + <di:waypoint xsi:type="dc:Point" x="453" y="743" /> + <di:waypoint xsi:type="dc:Point" x="510" y="743" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="393" y="722" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_179btn2_di" bpmnElement="SequenceFlow_179btn2"> + <di:waypoint xsi:type="dc:Point" x="195" y="508" /> + <di:waypoint xsi:type="dc:Point" x="276" y="508" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="191" y="487" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow"> + <dc:Bounds x="1100" y="266" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1092" y="305" width="55" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch"> + <dc:Bounds x="159" y="490" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="150" y="530" width="55" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17cd9e2_di" bpmnElement="SequenceFlow_17cd9e2"> + <di:waypoint xsi:type="dc:Point" x="830" y="133" /> + <di:waypoint xsi:type="dc:Point" x="868" y="133" /> + <di:waypoint xsi:type="dc:Point" x="868" y="174" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="830" y="114" width="36" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1gdyk9j_di" bpmnElement="SequenceFlow_1gdyk9j"> + <di:waypoint xsi:type="dc:Point" x="805" y="108" /> + <di:waypoint xsi:type="dc:Point" x="805" y="56" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="812" y="77" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="InclusiveGateway_0cjvlht_di" bpmnElement="ExclusiveGateway_1yvh16a"> + <dc:Bounds x="900" y="259" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="879" y="312" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_0i6rdd1_di" bpmnElement="auditSuccessfulCheck"> + <dc:Bounds x="780" y="108" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="775" y="162" width="60" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_04qhoba_di" bpmnElement="StartEvent_1euiddy"> + <dc:Bounds x="262" y="725" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="189" y="765" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1onxfk1_di" bpmnElement="EndEvent_0b0ocu0"> + <dc:Bounds x="787" y="20" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="694" y="202" width="0" height="13" /> + <dc:Bounds x="760" y="59" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 83363d48ba..0a6a7731ce 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true"> <bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start"> <bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing> @@ -10,6 +10,7 @@ <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" /> + <camunda:out source="StatusMessage" target="StatusMessage" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_19wuics</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01h9qmz</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 76ca2a89cc..35b77d9189 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -22,6 +22,7 @@ <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="RetryDuration" target="RetryDuration" /> <camunda:in source="suppressRollback" target="suppressRollback" /> + <camunda:out source="StatusMessage" target="StatusMessage" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index e88df73f39..d9166c9138 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -37,6 +37,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest { @Before public void before() { variables.put("auditInventoryNeeded", true); + variables.put("auditIsSuccessful", true); } @Test diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index f4bdde5e80..0338647ce7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -33,6 +33,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.slf4j.Logger @@ -52,7 +54,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { @@ -83,49 +85,15 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdnc_svcAction = "activate" - switch (resourceInputObj.getResourceModelInfo().getModelName()) { - case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : - operationType = "SOTNConnectivity" - break - - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - operationType = "SOTNAttachment" - break - - case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : - operationType = "Site" - break - - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - operationType = "SDWANDevice" - execution.setVariable("isActivateRequired", "true") - break + String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - operationType = "SDWANPort" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : - operationType = "SDWANConnectivity" - break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - operationType = "SDWANAttachment" - break - - default: - break - } - - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() logger.debug(msg) @@ -174,20 +142,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String customizeResourceParam(String networkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); + List<Map<String, Object>> paramList = new ArrayList() JSONObject jsonObject = new JSONObject(networkInputParametersJson); - Iterator iterator = jsonObject.keys(); + Iterator iterator = jsonObject.keys() while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); + String key = iterator.next() + HashMap<String, String> hashMap = new HashMap() hashMap.put("name", key); hashMap.put("value", jsonObject.get(key)) paramList.add(hashMap) } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); + Map<String, List<Map<String, Object>>> paramMap = new HashMap() + paramMap.put("param", paramList) - return new JSONObject(paramMap).toString(); + return new JSONObject(paramMap).toString() } public void prepareSDNCRequest (DelegateExecution execution) { @@ -206,7 +174,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) - String networkInstanceId = execution.getVariable("networkInstanceId") + String resourceInstanceId = execution.getVariable("resourceInstanceId") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -224,11 +192,28 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson))) // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyActivateRequest = "" + String modelType = resourceInputObj.getResourceModelInfo().getModelType() + + //When a new resource creation request reaches SO, the parent resources information needs to be provided + //while creating the child resource. + String vnfid = "" + String vnfmodelInvariantUuid = "" + String vnfmodelCustomizationUuid = "" + String vnfmodelUuid = "" + String vnfmodelVersion = "" + String vnfmodelName = "" + if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) { + vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + vnfmodelUuid = vfModelInfo.getModelUuid() + vnfmodelVersion = vfModelInfo.getModelVersion() + vnfmodelName = vfModelInfo.getModelName() + } - switch (modelName) { - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + switch (modelType) { + case "VNF" : sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -263,7 +248,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id>${msoUtils.xmlEscape(networkInstanceId)}</vnf-id> + <vnf-id>${msoUtils.xmlEscape(resourceInstanceId)}</vnf-id> <vnf-type></vnf-type> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> @@ -286,17 +271,15 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: - sdncTopologyActivateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + case "GROUP" : + sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -320,23 +303,34 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </onap-model-information> <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> - <allotted-resource-information> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id>${msoUtils.xmlEscape(networkInstanceId)}</allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <vnf-information> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id> + </vnf-information> + <vf-module-information> + <from-preload>false</from-preload> + <vf-module-id>${msoUtils.xmlEscape(resourceInstanceId)}</vf-module-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> - </allotted-resource-information> - <connection-attachment-request-input> - $netowrkInputParameters - </connection-attachment-request-input> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> + $netowrkInputParameters + </vf-module-input-parameters> + </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break @@ -378,7 +372,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </service-information> <network-information> <!-- TODO: to be filled by response from create --> - <network-id>${msoUtils.xmlEscape(networkInstanceId)}</network-id> + <network-id>${msoUtils.xmlEscape(resourceInstanceId)}</network-id> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> @@ -434,4 +428,4 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } logger.info("exited send sync Resp") } -} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index a771741e18..ef0dba83df 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -23,30 +23,28 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.aai.domain.yang.ServiceInstance -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.VnfResource -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode; - import static org.apache.commons.lang3.StringUtils.* - import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils - +import com.google.common.base.Strings import groovy.json.* /** @@ -332,7 +330,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b70797c63b..d431bdc3b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.gson.Gson import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution @@ -39,6 +40,8 @@ import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.aai.AAIObjectPlurals @@ -86,6 +89,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest)){ @@ -97,83 +101,18 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - //For sdnc, generate svc_action and request_action String sdnc_svcAction = "create" - switch (resourceInputObj.getResourceInstanceName()) { - - case ~/[\w\s\W]*overlay[\w\s\W]*/ : - //This will be resolved in R3. - sdnc_svcAction ="activate" - operationType = "NCINetwork" - break - - case ~/[\w\s\W]*underlay[\w\s\W]*/ : - //This will be resolved in R3. - operationType ="Network" - break - - case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : - operationType = "SOTNConnectivity" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - operationType = "SOTNAttachment" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : - operationType = "Site" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - operationType = "SDWANDevice" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - operationType = "SDWANPort" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : - operationType = "SDWANConnectivity" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - operationType = "SDWANAttachment" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*wanconnection[\w\s\W]*/ : - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ : - operationType = "AccessConnectivity" - execution.setVariable("isActivateRequired", "false") - break + String sdnc_requestAction = sdnc_svcAction.capitalize() + UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".operation-type") + "Instance" + String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required") + execution.setVariable("isActivateRequired", isActivateRequired) - case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : - operationType = "InternetProfile" - execution.setVariable("isActivateRequired", "false") - break - - default: - break - } - - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() logger.debug(msg) @@ -216,7 +155,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { * This method updates the resource input by collecting required info from AAI * @param execution */ - public void updateResourceInput(DelegateExecution execution) { + public ResourceInput updateResourceInput(DelegateExecution execution) { ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) String modelName = resourceInputObj.getResourceModelInfo().getModelName() @@ -225,19 +164,36 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String serInput = jsonUtil.getJsonValue(resourceInputTmp, "requestsInputs") switch (modelName) { - case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ : + case ~/[\w\s\W]*OLT[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() String incomingRequest = resourceInputObj.getRequestsInputs() String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") - String cvlan = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.cvlan") - String svlan = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.svlan") - String remoteId = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") + String cvlan + String svlan + String remoteId + + List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(), + resourceInputObj.getServiceType(), + resourceInputObj.getServiceInstanceId()) + for(Metadatum datum: metadatum) { + if (datum.getMetaname().equalsIgnoreCase("cvlan")) { + cvlan = datum.getMetaval() + } + + if (datum.getMetaname().equalsIgnoreCase("svlan")) { + svlan = datum.getMetaval() + } + + if (datum.getMetaname().equalsIgnoreCase("remoteId")) { + remoteId = datum.getMetaval() + } + } + + logger.debug("cvlan: "+cvlan+" | svlan: "+svlan+" | remoteId: "+remoteId) + String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") String ontsn = jsonUtil.getJsonValue(serInput, @@ -254,7 +210,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { logger.debug("new resource Input :" + resourceInputObj.toString()) break - case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : + case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() String incomingRequest = resourceInputObj.getRequestsInputs() @@ -262,34 +218,37 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") JSONObject inputParameters = new JSONObject(requestInputs) - String cvlan = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.cvlan") - String svlan = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.svlan") + String cvlan + String svlan + String remoteId String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") - String remoteId = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") + String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") - String serviceType = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_service_type") - String macAddr = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_rg_mac_addr") - String upStream = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_upstream_speed") - String downStream = jsonUtil.getJsonValue(serInput, - "service.parameters.requestInputs.edgeinternetprofile_ip_downstream_speed") + + List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(), + resourceInputObj.getServiceType(), + resourceInputObj.getServiceInstanceId()) + for(Metadatum datum: metadatum) { + if (datum.getMetaname().equalsIgnoreCase("cvlan")) { + cvlan = datum.getMetaval() + } + + if (datum.getMetaname().equalsIgnoreCase("svlan")) { + svlan = datum.getMetaval() + } + + if (datum.getMetaname().equalsIgnoreCase("remoteId")) { + remoteId = datum.getMetaval() + } + } String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_service_type", serviceType) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_rg_mac_addr", macAddr) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_upstream_speed", upStream) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_downstream_speed", downStream) logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) @@ -337,6 +296,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { default: break } + return resourceInputObj } /** @@ -377,12 +337,31 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //here convert json string to xml string String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson))) // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sdncTopologyCreateRequest = "" + String sdncTopologyCreateRequest = ""; + + + + //When a new resource creation request reaches SO, the parent resources information needs to be provided + //while creating the child resource. + String vnfid = "" + String vnfmodelInvariantUuid = "" + String vnfmodelCustomizationUuid = "" + String vnfmodelUuid = "" + String vnfmodelVersion = "" + String vnfmodelName = "" + String modelType = resourceInputObj.getResourceModelInfo().getModelType() + if(modelType.equalsIgnoreCase(ResourceType.GROUP.toString())) { + vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + vnfmodelUuid = vfModelInfo.getModelUuid() + vnfmodelVersion = vfModelInfo.getModelVersion() + vnfmodelName = vfModelInfo.getModelName() + } - switch (modelName) { - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + switch (modelType) { + case "VNF" : sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -417,7 +396,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> <vnf-information> - <vnf-id></vnf-id> <vnf-type></vnf-type> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> @@ -439,9 +417,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + case "GROUP" : sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -449,7 +425,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -475,22 +451,31 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> - <allotted-resource-information> - <!-- TODO: to be filled as per the request input --> - <allotted-resource-id></allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <vnf-information> <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id> + </vnf-information> + <vf-module-information> + <from-preload>false</from-preload> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> - </allotted-resource-information> - <connection-attachment-request-input> - $netowrkInputParameters - </connection-attachment-request-input> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> + $netowrkInputParameters + </vf-module-input-parameters> + </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break @@ -498,13 +483,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <network-information> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <network-request-input> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> + </network-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + + + } + + + + + //switch (modelName) { + // case ~/[\w\s\W]*deviceVF[\w\s\W]*/ + // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + // case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -528,8 +570,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </onap-model-information> <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> - <network-information> + <vnf-information> + <vnf-id></vnf-id> + <vnf-type></vnf-type> <onap-model-information> <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> @@ -537,13 +582,147 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> <model-name>${msoUtils.xmlEscape(modelName)}</model-name> </onap-model-information> - </network-information> - <network-request-input> - <network-input-parameters>$netowrkInputParameters</network-input-parameters> - </network-request-input> + </vnf-information> + <vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() - } + + + break + + //case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ + //case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + /* sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + </service-information><vnf-information> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </vnf-information> + <vnf-request-input> + <vnf-input-parameters> + $netowrkInputParameters + </vnf-input-parameters> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + </vnf-networks> + </vnf-request-input> + <allotted-resource-information> + <!-- TODO: to be filled as per the request input --> + <allotted-resource-id></allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + $netowrkInputParameters + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + // for SDWANConnectivity and SOTNConnectivity: + default: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <network-information> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <network-request-input> + <network-input-parameters>$netowrkInputParameters</network-input-parameters> + </network-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } + + **/ String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) @@ -634,11 +813,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - def isActivateRequried = execution.getVariable("isActivateRequired") - if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) { - def instnaceId = getInstnaceId(execution) - execution.setVariable("networkInstanceId", instnaceId) - } + def instnaceId = getInstnaceId(execution) + execution.setVariable("resourceInstanceId", instnaceId) logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) logger.info(" ***** Exit prepareSDNCRequest *****") @@ -651,24 +827,38 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelName = resourceInputObj.getResourceModelInfo().getModelName() def val = "" - switch (modelName) { - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - case ~/[\w\s\W]*Site[\w\s\W]*/: - val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id" - break - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: - val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" - break + //switch (modelName) { + // case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + // case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + // case ~/[\w\s\W]*Site[\w\s\W]*/: + // val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id" + // break + + // case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + // case ~/[\w\s\W]*sotnvpprepareUpdateAfterCreateSDNCResourcenattachment[\w\s\W]*/: + // val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" + // break // for SDWANConnectivity and SOTNConnectivity and default: + // default: + // val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" + // break + //} + + + String modelType = resourceInputObj.getResourceModelInfo().getModelType() + switch (modelType) { + case "VNF" : + val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id" + break + case "GROUP": + val = response."response-data"."RequestData"."output"."vf-module-response-information"."instance-id" + break default: val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" break } - return val.toString() } @@ -678,7 +868,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { try { String operationStatus = "finished" // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + String vnfid=execution.getVariable("resourceInstanceId"); + String resourceOperationResp = """{"operationStatus":"${operationStatus}","vnf-id":"${vnfid}"}""".trim() logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index fa9fe62df4..3084fe5717 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.v12.GenericVnf; @@ -251,7 +252,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { String restFaultMessage = e.getMessage() //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage) //execution.setVariable("CVFMODVOL2_isDataOk", false) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") @@ -301,7 +302,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -402,7 +403,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing MsoCompletionRequest: \n" + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) @@ -479,7 +480,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") @@ -528,7 +529,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) @@ -584,7 +585,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 5ba90eb989..1dfb87b42d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -306,7 +307,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " + "going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index e941d50155..aa524f1e28 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.logger.ErrorCode @@ -168,7 +169,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -194,7 +195,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " + "CreateVnfInfra PreProcessRequest method", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest") @@ -220,7 +221,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { execution.setVariable("CREVI_sentSyncResponse", true) } catch (Exception ex) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") @@ -246,7 +247,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } @@ -270,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing preProcessSDNCActivateRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } @@ -461,7 +462,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("obtained VNF list: " + vnfs) if (vnfs == null) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " + "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -470,7 +471,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { JSONObject vnf = vnfs.get(0) if (vnf == null) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" + " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -543,7 +544,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) }catch(Exception ex){ String msg = "Exception in LineOfBusiness. " + ex.getMessage(); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index 4233147f83..3d62a6ca90 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -31,6 +31,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.slf4j.Logger @@ -80,45 +81,14 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - - // TODO: based on the resource type decide action and operation type - String sdnc_svcAction = "deactivate" - switch (resourceInputObj.getResourceModelInfo().getModelName()) { - case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : - operationType = "SOTNConnectivity" - break - - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - operationType = "SOTNAttachment" - break - - case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : - operationType = "Site" - break - - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - operationType = "SDWANDevice" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : - operationType = "SDWANConnectivity" - break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - operationType = "SDWANAttachment" - break - - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - operationType = "SDWANPort" - execution.setVariable("isActivateRequired", "true") - break - - default: - break + String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type") + if (StringUtils.isNotEmpty(operationTypeFromConfig)) { + // highest priority if operation type configured + operationType = operationTypeFromConfig } + // based on the resource type decide action and operation type + String sdnc_svcAction = "deactivate" String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) @@ -161,13 +131,12 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() + String modelType = resourceInputObj.getResourceModelInfo().getModelType() // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyDeleteRequest = "" - switch (modelName) { - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + switch (modelType) { + case "VNF" : sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -224,8 +193,17 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + case "GROUP" : + //When a new resource creation request reaches SO, the parent resources information needs to be provided + //while creating the child resource. + String vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + String vnfmodelUuid = vfModelInfo.getModelUuid() + String vnfmodelVersion = vfModelInfo.getModelVersion() + String vnfmodelName = vfModelInfo.getModelName() + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -233,7 +211,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -257,26 +235,40 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </onap-model-information> <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> </service-information> - <allotted-resource-information> - <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id></parent-service-instance-id> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </allotted-resource-information> - <connection-attachment-request-input> - </connection-attachment-request-input> + <vnf-information> + <vnf-id>$vnfid</vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + </vnf-information> + <vf-module-information> + <vf-module-id>$resourceInstnaceId</vf-module-id> + <vf-module-type></vf-module-type> + <from-preload>false</from-preload> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> + </vf-module-input-parameters> + </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" @@ -325,6 +317,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index 1e2f50148c..e98cb1c119 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -354,7 +355,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { logger.debug(falloutHandlerRequest) execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN", ErrorCode.UnknownError.getValue()) @@ -377,7 +378,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index dd9991bbd4..49f0e14d17 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -31,6 +31,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.slf4j.Logger @@ -52,7 +54,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - + MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution){ @@ -84,62 +86,18 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } + String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type") + if (StringUtils.isNotEmpty(operationTypeFromConfig)) { + // highest priority if operation type configured + operationType = operationTypeFromConfig + } //For sdnc, generate svc_action and request_action String sdnc_svcAction = "delete" - switch (resourceInputObj.getResourceModelInfo().getModelName()) { - - case ~/[\w\s\W]*overlay[\w\s\W]*/ : - ///This will be resolved in R3. - sdnc_svcAction ="deactivate" - operationType = "NCINetwork" - break - - case ~/[\w\s\W]*underlay[\w\s\W]*/ : - //This will be resolved in R3. - operationType ="Network" - break - - case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : - operationType = "SOTNConnectivity" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - operationType = "SOTNAttachment" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : - operationType = "Site" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - operationType = "SDWANDevice" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : - operationType = "SDWANConnectivity" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - operationType = "SDWANAttachment" - execution.setVariable("isActivateRequired", "true") - break - - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - operationType = "SDWANPort" - execution.setVariable("isActivateRequired", "true") - break - - default: - break - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType + "Instance" + String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".activation-required") + execution.setVariable("isActivateRequired", isActivateRequired) execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) @@ -190,13 +148,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() + String modelType = resourceInputObj.getResourceModelInfo().getModelType() + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyDeleteRequest = "" - switch (modelName) { - case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : - case ~/[\w\s\W]*SiteVF[\w\s\W]*/: + switch (modelType) { + case "VNF": sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> @@ -252,60 +210,82 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() break - - case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : - case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : - sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> - <sdncadapter:RequestHeader> + case "GROUP" : + //When a new resource creation request reaches SO, the parent resources information needs to be provided + //while creating the child resource. + String vnfid = resourceInputObj.getVnfId() + ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo() + String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid() + String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid() + String vnfmodelUuid = vfModelInfo.getModelUuid() + String vnfmodelVersion = vfModelInfo.getModelVersion() + String vnfmodelName = vfModelInfo.getModelName() + + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> - <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> - <source>${msoUtils.xmlEscape(source)}</source> - <notification-url></notification-url> - <order-number></order-number> - <order-version></order-version> - </request-information> - <service-information> - <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> - <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> - <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> - </onap-model-information> - <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> - <subscriber-name></subscriber-name> - </service-information> - <allotted-resource-information> - <allotted-resource-id>$resourceInstnaceId</allotted-resource-id> - <allotted-resource-type></allotted-resource-type> - <parent-service-instance-id></parent-service-instance-id> - <onap-model-information> - <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> - <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> - <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> - <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> - <model-name>${msoUtils.xmlEscape(modelName)}</model-name> - </onap-model-information> - </allotted-resource-information> - <connection-attachment-request-input> - </connection-attachment-request-input> - </sdncadapterworkflow:SDNCRequestData> - </aetgt:SDNCAdapterWorkflowRequest>""".trim() + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${msoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + </service-information> + <vnf-information> + <vnf-id>$vnfid</vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name> + </onap-model-information> + </vnf-information> + <vf-module-information> + <vf-module-id>$resourceInstnaceId</vf-module-id> + <vf-module-type></vf-module-type> + <from-preload>false</from-preload> + <onap-model-information> + <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${msoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </vf-module-information> + <vf-module-request-input> + <vf-module-input-parameters> + </vf-module-input-parameters> + </vf-module-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" @@ -376,7 +356,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { - logger.debug( " *** prepareUpdateBeforeDeleteSDNCResource *** ") + logger.debug(" *** prepareUpdateBeforeDeleteSDNCResource *** ") String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() @@ -412,7 +392,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { - logger.debug( " *** prepareUpdateAfterDeleteSDNCResource *** ") + logger.debug(" *** prepareUpdateAfterDeleteSDNCResource *** ") String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 3a1815cfe6..ba8027cb1b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -126,7 +127,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") @@ -159,7 +160,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -202,7 +203,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -229,7 +230,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) } @@ -277,7 +278,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) @@ -322,7 +323,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') @@ -375,7 +376,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index cf53aff878..b0f4dd6dab 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -463,7 +464,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { logger.debug(xmlHandlerRequest) execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } @@ -484,7 +485,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", ErrorCode.UnknownError.getValue()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 7ad929b1c2..9f378e567c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -184,7 +184,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) addedResourceList.add(rmodel) - Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) + Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(rc, null, null) requestInputs.addAll(resourceParameters.keySet()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 125c3e4504..67dbdac38d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -443,7 +444,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index b49f00a247..587337b647 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,15 @@ package org.onap.so.bpmn.infrastructure.scripts + +import com.google.common.reflect.TypeToken +import com.google.gson.Gson +import org.apache.http.util.EntityUtils +import org.onap.so.bpmn.common.resource.InstanceResourceList import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.bpmn.core.domain.GroupResource +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.infrastructure.properties.BPMNProperties import org.apache.commons.lang3.StringUtils import org.apache.http.HttpResponse @@ -44,11 +52,12 @@ import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.slf4j.Logger import org.slf4j.LoggerFactory +import java.lang.reflect.Type /** * This groovy class supports the <class>DoCreateResources.bpmn</class> process. - * + * * Inputs: * @param - msoRequestId * @param - globalSubscriberId - O @@ -56,7 +65,7 @@ import org.slf4j.LoggerFactory * @param - serviceInstanceId * @param - serviceInstanceName - O * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) - * @param - sdncVersion + * @param - sdncVersion * * @param - addResourceList * @@ -87,9 +96,19 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ logger.trace("Exit preProcessRequest ") } + // this method will convert resource list to instance_resource_list + public void prepareInstanceResourceList(DelegateExecution execution) { + + String uuiRequest = execution.getVariable("uuiRequest") + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(sequencedResourceList, uuiRequest) + + execution.setVariable("instanceResourceList", instanceResourceList) + } + public void sequenceResoure(DelegateExecution execution) { logger.trace("Start sequenceResoure Process ") - + String incomingRequest = execution.getVariable("uuiRequest") String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid") @@ -102,10 +121,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ String serviceDecompose = execution.getVariable("serviceDecomposition") String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") - // get Sequence from properties + // get Sequence from properties def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) - // get Sequence from csar(model) + // get Sequence from csar(model) if(resourceSequence == null) { resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid) logger.info("Get Sequence from csar : " + resourceSequence) @@ -117,6 +136,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { sequencedResourceList.add(resource) + // if resource type is vnfResource then check for groups also + // Did not use continue because if same model type is used twice + // then we would like to add it twice for processing + // e.g. S{ V1{G1, G2, G1}} --> S{ V1{G1, G1, G2}} + if (resource instanceof VnfResource) { + if (resource.getGroupOrder() != null && !StringUtils.isEmpty(resource.getGroupOrder())) { + String[] grpSequence = resource.getGroupOrder().split(",") + for (String grpType in grpSequence) { + for (GroupResource gResource in resource.getGroups()) { + if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) { + sequencedResourceList.add(gResource) + } + } + } + } + } if (resource instanceof NetworkResource) { networkResourceList.add(resource) } @@ -126,7 +161,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ } else { //define sequenced resource list, we deploy vf first and then network and then ar - //this is defaule sequence + //this is default sequence List<VnfResource> vnfResourceList = new ArrayList<VnfResource>() List<AllottedResource> arResourceList = new ArrayList<AllottedResource>() @@ -181,11 +216,11 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ public void getCurrentResoure(DelegateExecution execution){ logger.trace("Start getCurrentResoure Process ") def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) + List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") + Resource currentResource = instanceResourceList.get(currentIndex) execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) - logger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName()) - logger.trace("COMPLETED getCurrentResoure Process ") + logger.info("Now we deal with resource:" + currentResource.getModelInfo().getModelName()) + logger.trace("COMPLETED getCurrentResource Process ") } public void parseNextResource(DelegateExecution execution){ @@ -193,8 +228,8 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) - List<String> sequencedResourceList = execution.getVariable("sequencedResourceList") - if(nextIndex >= sequencedResourceList.size()){ + List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") + if(nextIndex >= instanceResourceList.size()){ execution.setVariable("allResourceFinished", "true") }else{ execution.setVariable("allResourceFinished", "false") @@ -221,22 +256,43 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ resourceInput.setOperationId(operationId) resourceInput.setOperationType(operationType); def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + List<Resource> sequencedResourceList = execution.getVariable("instanceResourceList") Resource currentResource = sequencedResourceList.get(currentIndex) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + resourceInput.setResourceModelInfo(currentResource.getModelInfo()) + resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString()) ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid(); + + if (currentResource.getResourceType() == ResourceType.VNF) { + execution.setVariable("vfModelInfo", currentResource.getModelInfo()) + } + + resourceInput.setVfModelInfo(execution.getVariable("vfModelInfo") as ModelInfo) + String vnfId = execution.getVariable("vnf-id") + if (vnfId != null) { + resourceInput.setVnfId(vnfId) + } + + + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()) String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) + //set the requestInputs from template To Be Done + String uuiServiceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + + // current vfdata holds information for preparing input for resource + // e.g. it will hold + // { top_level_list_name, second_level_list_name, top_index, second_index, last processed node} + Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData") + + if (null == currentVFData) { + currentVFData = new HashMap<>() + } + String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, currentResource, uuiServiceParameters, currentVFData) resourceInput.setResourceParameters(resourceParameters) resourceInput.setRequestsInputs(incomingRequest) execution.setVariable("resourceInput", resourceInput.toString()) execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid()) + execution.setVariable("currentVFData",currentVFData) logger.trace("COMPLETED prepareResourceRecipeRequest Process ") } @@ -262,6 +318,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ BpmnRestClient bpmnRestClient = new BpmnRestClient() HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd) + + def currentIndex = execution.getVariable("currentResourceIndex") + List<Resource> instanceResourceList = execution.getVariable("instanceResourceList") as List<Resource> + Resource currentResource = instanceResourceList.get(currentIndex) + if(ResourceType.VNF == currentResource.getResourceType()) { + if (resp.getStatusLine().getStatusCode() > 199 && resp.getStatusLine().getStatusCode() < 300) { + String responseString = EntityUtils.toString(resp.getEntity(), "UTF-8") + if (responseString != null) { + Gson gson = new Gson() + Type type = new TypeToken<Map<String, String>>() {}.getType() + Map<String, Object> map = gson.fromJson(responseString, type) + Map<String, String> map1 = gson.fromJson(map.get("response"), type) + execution.setVariable("vnf-id",map1.get("vnf-id")) + } + } + } } else { String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID logger.trace(exceptionMessage) @@ -286,4 +358,4 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ } execution.setVariable("serviceDecomposition", serviceDecomposition) } -} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 468f603ef6..68554ec376 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri @@ -234,7 +235,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces getAAIClient().connect(nsUri,relatedServiceUri) logger.info("NS relationship to Service added successfully") }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing AAI Put Call", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index ea9987e2ec..c65d97145a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -568,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -620,7 +621,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); @@ -747,7 +748,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -827,7 +828,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 6), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) @@ -863,7 +864,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) @@ -957,7 +958,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -1165,7 +1166,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") @@ -1556,7 +1557,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) @@ -1586,7 +1587,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) @@ -1616,7 +1617,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) @@ -1696,7 +1697,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -1818,14 +1819,14 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood")) } catch(BpmnError b){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); throw b }catch (Exception ex) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed " + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") @@ -1888,7 +1889,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) @@ -2021,7 +2022,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); @@ -2066,7 +2067,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -2119,7 +2120,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in queryCatalogDB', "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 65f6f76a21..1de18c9507 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.infrastructure.scripts + +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.NetworkPolicies @@ -263,7 +265,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -448,7 +450,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); String processKey = getProcessKey(execution); @@ -609,7 +611,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) @@ -627,7 +629,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackError", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) @@ -647,7 +649,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackData", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index fb5c0fa0aa..84931aa6d4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.ErrorCode @@ -215,7 +216,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -406,7 +407,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) @@ -624,7 +625,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -663,7 +664,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 725a139b59..c9328c10e1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.json.JSONObject; import org.json.JSONArray; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -308,7 +309,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) @@ -326,7 +327,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) @@ -356,7 +357,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing validateBaseModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) @@ -387,7 +388,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}") execution.setVariable("rollbackData", rollbackData) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index 7ea32d2a60..819c428aa9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -163,7 +164,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) @@ -183,14 +184,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } if (rolledBack == false) { logger.debug("Failure on DoCreateVfModuleRollback") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unsuccessful rollback of DoCreateVfModule ", "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") @@ -216,7 +217,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -339,7 +340,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackError", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing setSuccessfulRollbackStatus ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } @@ -361,7 +362,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing setFailedRollbackStatus. ", "BPMN",ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index f1b7328bcc..c4b706c7b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.*; @@ -532,7 +533,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 1912d65ce3..3a98bf8a26 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.AllottedResource import org.onap.so.logger.ErrorCode @@ -944,7 +945,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index e5b8d52376..e24597aab3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -21,9 +21,11 @@ */ package org.onap.so.bpmn.infrastructure.scripts + import groovy.json.JsonOutput import groovy.json.JsonSlurper import org.apache.commons.lang3.StringUtils +import org.apache.commons.lang3.tuple.ImmutablePair import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray @@ -36,9 +38,12 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.GroupResource import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.bpmn.core.domain.VnfcResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory @@ -51,14 +56,10 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Node -import org.xml.sax.InputSource import javax.ws.rs.NotFoundException import javax.ws.rs.core.Response -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory + import static org.apache.commons.lang3.StringUtils.isBlank @@ -171,23 +172,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String msg = "" try { - String serviceInstanceId = execution.getVariable('serviceInstanceId') String globalSubscriberId = execution.getVariable('globalSubscriberId') String serviceType = execution.getVariable('serviceType') - - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) - if (!resourceClient.exists(serviceInstanceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - // found in AAI if (si.isPresent() && StringUtils.isNotEmpty(si.get().getServiceInstanceName())) { logger.debug("Found Service-instance in AAI") @@ -196,12 +190,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // Get Template uuid and version if ((null != si.get().getModelInvariantId()) && (null != si.get().getModelVersionId())) { logger.debug("SI Data model-invariant-id and model-version-id exist") - // Set Original Template info execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId()) execution.setVariable("model-version-id-original", si.get().getModelVersionId()) } - if ((null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) { logger.debug("SI Data relationship-list exists") List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship() @@ -210,12 +202,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def jObj = getRelationShipData(relationship) jArray.put(jObj) } - execution.setVariable("serviceRelationShip", jArray.toString()) } - } else { - msg = "Service-instance: " + serviceInstanceId + " NOT found in AAI." logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) @@ -235,18 +224,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { private JSONObject getRelationShipData(Relationship relationship) { JSONObject jObj = new JSONObject() - - def rt = relationship.getRelatedTo() - def rl = relationship.getRelatedLink() logger.debug("ServiceInstance Related NS/Configuration :" + rl) - List<RelationshipData> rl_datas = relationship.getRelationshipData() for (RelationshipData rl_data : rl_datas) { def eKey = rl_data.getRelationshipKey() def eValue = rl_data.getRelationshipValue() - if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-id")) //for overlay/underlay || (rt.equals("configuration") && eKey.equals("configuration.configuration-id") @@ -259,10 +243,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String resourceName = rt + eValue; jObj.put("resourceType", resourceName) } - jObj.put("resourceLinkUrl", rl) } - List<RelatedToProperty> rl_props = relationship.getRelatedToProperty() for (RelatedToProperty rl_prop : rl_props) { def eKey = rl_prop.getPropertyKey() @@ -273,11 +255,66 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { jObj.put("resourceType", eValue) } } - logger.debug("Relationship related to Resource:" + jObj.toString()) return jObj } + private Relationship getRelationShipFromNode(groovy.util.slurpersupport.Node relationshipNode) { + Relationship relationship = new Relationship() + def rtn = relationshipNode.childNodes() + List<RelationshipData> relationshipDatas = new ArrayList<>() + List<RelatedToProperty> relationshipProperties = new ArrayList<>() + while (rtn.hasNext()) { + groovy.util.slurpersupport.Node node = rtn.next() + def key = node.name() + + if(key.equals("related-to")){ + def rt = node.text() + relationship.setRelatedTo(rt) + } else if (key.equals("related-link")){ + def rl = node.text() + relationship.setRelatedLink(rl) + } else if (key.equals("relationship-label")){ + def label = node.text() + relationship.setRelationshipLabel(label) + } else if (key.equals("relationship-data")){ + def rData = node.childNodes() + RelationshipData relationshipData = new RelationshipData() + while(rData.hasNext()){ + groovy.util.slurpersupport.Node datanode = rData.next() + def dataKey = datanode.name() + if(dataKey.equals("relationship-key")) { + relationshipData.setRelationshipKey(datanode.text()) + } else if(dataKey.equals("relationship-value")) { + relationshipData.setRelationshipValue(datanode.text()) + } + } + relationshipDatas.add(relationshipData) + } else if (key.equals("related-to-property")){ + def rProperty = node.childNodes() + RelatedToProperty relationshipProperty = new RelatedToProperty() + while(rProperty.hasNext()){ + groovy.util.slurpersupport.Node propnode = rProperty.next() + + def dataKey = propnode.name() + if(dataKey.equals("property-key")) { + relationshipProperty.setPropertyKey(propnode.text()) + } else if(dataKey.equals("property-value")) { + relationshipProperty.setPropertyValue(propnode.text()) + } + + } + relationshipProperties.add(relationshipProperty) + } + + } + relationship.getRelationshipData().addAll(relationshipDatas) + relationship.getRelatedToProperty().addAll(relationshipProperties) + + logger.debug("Relationship related to Resource:" + relationship.toString()) + return relationship + } + public void getCurrentNS(DelegateExecution execution){ logger.info( "======== Start getCurrentNS Process ======== ") @@ -315,19 +352,31 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } - private void generateRelatedResourceInfo(String response, JSONObject jObj){ + private void generateRelatedResourceInfo(String response, JSONObject jObj, boolean processRelationship){ def xml = new XmlSlurper().parseText(response) def rtn = xml.childNodes() while (rtn.hasNext()) { groovy.util.slurpersupport.Node node = rtn.next() def key = node.name() - def value = node.text() - jObj.put(key, value) + if (key.equals("relationship-list") && processRelationship) { + def relns = node.childNodes() + JSONArray jArray = new JSONArray() + while (relns.hasNext()) { + groovy.util.slurpersupport.Node relNode = relns.next() + Relationship relationship = getRelationShipFromNode(relNode) + def relationObj = getRelationShipData(relationship) + jArray.put(relationObj) + } + jObj.put(key, jArray) + } else { + def value = node.text() + jObj.put(key, value) + } } } - private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) + private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj, boolean processRelationship) { logger.debug(" ***** Started getRelatedResourceInAAI *****") @@ -355,7 +404,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) - generateRelatedResourceInfo(aaiResponse, jObj) + generateRelatedResourceInfo(aaiResponse, jObj, processRelationship) //get model-invariant-uuid and model-uuid String modelInvariantId = "" @@ -399,7 +448,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { relationShipList = jsonSlurper.parseText(serviceRelationShip) } - List<Resource> deleteRealResourceList = new ArrayList<Resource>() + List<ImmutablePair<Resource, List<Resource>>> deleteRealResourceList = new ArrayList<ImmutablePair<Resource, List<Resource>>>() //Set the real resource instance id to the decomosed resource list //reset the resource instance id , because in the decompose flow ,its a random one. @@ -407,21 +456,27 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (relationShipList != null) { relationShipList.each { - JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it) + JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it, true) for (Resource resource : deleteResourceList) { - String modelName = resource.getModelInfo().getModelName() - - String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid() - if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) { - resource.setResourceId(obj.get("resourceInstanceId")) - deleteRealResourceList.add(resource) - } - else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) { - resource.setResourceId(obj.get("resourceInstanceId")) - resource.setResourceInstanceName(obj.get("resourceType")) - deleteRealResourceList.add(resource) + boolean matches = processMatchingResource(resource, obj) + if((matches) && resource.getResourceType().equals(ResourceType.VNF)) { + List<Resource> delGroupList = new ArrayList<Resource>() + JSONArray vfRelationship = obj.getJSONArray("relationship-list") + for (int idx = 0; idx < vfRelationship.length(); idx++) { + JSONObject vfItem = vfRelationship.getJSONObject(idx) + JSONObject groupObject = getRelatedResourceInAAI(execution, vfItem, false) + List<GroupResource> groups = ((VnfResource)resource).getGroups() + for (GroupResource group : groups){ + if(processMatchingResource(group, groupObject)){ + delGroupList.add(group) + } + } + } + def delMap = new ImmutablePair(resource, delGroupList) + + deleteRealResourceList.add(delMap) } } } @@ -429,7 +484,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) - + boolean isDeleteResourceListValid = false if(deleteRealResourceList.size() > 0) { isDeleteResourceListValid = true @@ -442,7 +497,25 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - logger.debug( " ***** exit postDecomposeService() of delete generic e2e service flow ***** ") + logger.debug(" ***** exit postDecomposeService() of delete generic e2e service flow ***** ") + } + + private boolean processMatchingResource(Resource resource, JSONObject obj) { + boolean matches = false + String modelName = resource.getModelInfo().getModelName() + + String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid() + if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) { + resource.setResourceId(obj.get("resourceInstanceId")) + //deleteRealResourceList.add(resource) + matches = true; + } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) { + resource.setResourceId(obj.get("resourceInstanceId")) + resource.setResourceInstanceName(obj.get("resourceType")) + //deleteRealResourceList.add(resource) + matches = true; + } + return matches } public void preInitResourcesOperStatus(DelegateExecution execution){ @@ -461,11 +534,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - List<Resource> deleteResourceList = execution.getVariable("deleteResourceList") + List<ImmutablePair<Resource, List<Resource>>> deleteResourceList = execution.getVariable("deleteResourceList") String serviceRelationShip = execution.getVariable("serviceRelationShip") - for(Resource resource : deleteResourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + for (ImmutablePair rc : deleteResourceList) { + Resource resource = rc.getKey() + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) @@ -496,7 +570,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ") } - + public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ") try{ @@ -507,7 +581,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = execution.getVariable("progress") String reason = "" String operationContent = execution.getVariable("operationContent") - + serviceId = UriUtils.encode(serviceId,"UTF-8") def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) @@ -550,5 +624,4 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { //to do } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 2558f7eff5..3a212d9cea 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network @@ -465,7 +466,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -517,7 +518,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -558,7 +559,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -998,7 +999,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 0d096f3b16..2dcfcaa4f4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -22,7 +22,12 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.apache.commons.lang3.tuple.ImmutablePair +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.bpmn.core.domain.GroupResource +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ResourceType import static org.apache.commons.lang3.StringUtils.isBlank @@ -151,17 +156,61 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { List<Resource> wanResources = new ArrayList<Resource>() // get delete resource list and order list - List<Resource> delResourceList = execution.getVariable("deleteResourceList") + List<ImmutablePair<Resource, List<Resource>>> delResourceList = execution.getVariable("deleteResourceList") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String serviceModelName = serviceDecomposition.getModelInfo().getModelName(); - + String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid(); + + Map<String, Map<String, Object>> parentVNF = new HashMap<>() + + // get Sequence from properties def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) + // get Sequence from catalog db csar(model) + if(resourceSequence == null) { + resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid) + logger.info("Get Sequence from catalog db csar : " + resourceSequence) + } + if(resourceSequence != null) { for (resourceType in resourceSequence.reverse()) { - for (resource in delResourceList) { + + boolean vfFound = false + + for (ImmutablePair resourceTuple : delResourceList) { + Resource resource = resourceTuple.getKey() + List<Resource> groupResources = resourceTuple.getValue() + if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) { + + + + // if resource type is vnfResource then check for groups also + // Did not use continue because if same model type is used twice + // then we would like to add it twice for processing + // e.g. S{ V1{G1, G2, G1}} --> S{ {G2, G1, G1}V1} + // we will add in reverse order for deletion + if (resource instanceof VnfResource) { + if (resource.getGroupOrder() != null && !StringUtils.isEmpty(resource.getGroupOrder())) { + String[] grpSequence = resource.getGroupOrder().split(",") + + Map<String, Object> parentVNFData = new HashMap<>() + parentVNFData.put("vfModelInfo", resource.getModelInfo()) + parentVNFData.put("vnf-id", resource.getResourceId()) + + for (String grpType in grpSequence.reverse()) { + for (GroupResource gResource in groupResources) { + if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) { + sequencedResourceList.add(gResource) + // Store parent VNF info for the group resource id + parentVNF.put(gResource.getResourceId(), parentVNFData) + } + } + } + } + } + sequencedResourceList.add(resource) if (resource instanceof NetworkResource) { @@ -173,11 +222,32 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { }else { //define sequenced resource list, we deploy vf first and then network and then ar //this is defaule sequence + // While deleting we will delete in resource order group resource, ar, network, then VF. List<VnfResource> vnfResourceList = new ArrayList<VnfResource>() List<AllottedResource> arResourceList = new ArrayList<AllottedResource>() - for (Resource rc : delResourceList) { + for (ImmutablePair resourceTuple : delResourceList) { + Resource rc = resourceTuple.getKey() + List<Resource> groupResources = resourceTuple.getValue() + if (rc instanceof VnfResource) { vnfResourceList.add(rc) + if (rc.getGroupOrder() != null && !StringUtils.isEmpty(rc.getGroupOrder())) { + String[] grpSequence = rc.getGroupOrder().split(",") + + Map<String, Object> parentVNFData = new HashMap<>() + parentVNFData.put("vfModelInfo", rc.getModelInfo()) + parentVNFData.put("vnf-id", rc.getResourceId()) + + for (String grpType in grpSequence.reverse()) { + for (GroupResource gResource in groupResources) { + if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) { + sequencedResourceList.add(gResource) + // Store parent VNF info for the group resource id + parentVNF.put(gResource.getResourceId(), parentVNFData) + } + } + } + } } else if (rc instanceof NetworkResource) { wanResources.add(rc) } else if (rc instanceof AllottedResource) { @@ -199,6 +269,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) + execution.setVariable("parentVNF", parentVNF) logger.debug("resourceSequence: " + resourceSequence) logger.debug(" ======== END sequenceResource Process ======== ") } @@ -235,46 +306,58 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { */ public void executeResourceDelete(DelegateExecution execution) { logger.debug("======== Start executeResourceDelete Process ======== ") - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - - String resourceInstanceId = execution.getVariable("resourceInstanceId") - - Resource currentResource = execution.getVariable("currentResource") - String action = "deleteInstance" - JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) - String recipeUri = resourceRecipe.getString("orchestrationUri") - int recipeTimeout = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - - - ResourceInput resourceInput = new ResourceInput(); - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) - resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) - resourceInput.setOperationId(execution.getVariable("operationId")) - resourceInput.setOperationType(execution.getVariable("operationType")) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - resourceInput.setServiceType(serviceType) - - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + + String resourceInstanceId = execution.getVariable("resourceInstanceId") + + Resource currentResource = execution.getVariable("currentResource") + String action = "deleteInstance" + JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) + String recipeUri = resourceRecipe.getString("orchestrationUri") + int recipeTimeout = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + + + ResourceInput resourceInput = new ResourceInput(); + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) + resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) + resourceInput.setOperationId(execution.getVariable("operationId")) + resourceInput.setOperationType(execution.getVariable("operationType")) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + resourceInput.setServiceType(serviceType) + resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString()) + if (currentResource.getResourceType() == ResourceType.GROUP) { + Map<String, Map<String, Object>> parentVNF = execution.getVariable("parentVNF") + if((null != parentVNF) && (null!=parentVNF.get(currentResource.getResourceId()))){ + Map<String, Object> parentVNFData = parentVNF.get(currentResource.getResourceId()) + ModelInfo parentVNFModel = parentVNFData.get("vfModelInfo") + String parentResourceId = parentVNFData.get("vnf-id") + resourceInput.setVfModelInfo(parentVNFModel) + resourceInput.setVnfId(parentResourceId) + } + } + + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri BpmnRestClient bpmnRestClient = new BpmnRestClient() - HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - logger.debug(" ======== END executeResourceDelete Process ======== ") - }catch(BpmnError b){ - logger.error("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") - } + + HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + logger.debug(" ======== END executeResourceDelete Process ======== ") + } catch (BpmnError b) { + logger.error("Rethrowing MSOWorkflowException") + throw b + } catch (Exception e) { + logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index b21dcf3433..992a257809 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.so.logger.ErrorCode @@ -359,7 +360,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); @@ -580,7 +581,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -628,7 +629,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index e5306c40de..7dfa408fa7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy @@ -114,7 +115,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -160,7 +161,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) @@ -213,7 +214,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) @@ -239,7 +240,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -403,7 +404,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 9bd3388b79..22be22baa4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.camunda.bpm.engine.delegate.BpmnError @@ -110,7 +111,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -238,7 +239,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) @@ -338,7 +339,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -366,7 +367,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) @@ -392,7 +393,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index ce3b243533..a9b2278fbe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.*; @@ -138,7 +139,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 1b089d2a2b..a728ed72e8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject; @@ -182,7 +183,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try { Thread.sleep(5000) } catch (InterruptedException e) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Time Delay exception" + e, "BPMN", ErrorCode.UnknownError.getValue()); } @@ -216,7 +217,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) logger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " + "while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e); throw new BpmnError("MSOWorkflowException") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index abbcf66323..e6fdc53d8d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -333,7 +334,7 @@ public class DoUpdateVfModule extends VfModuleBase { def sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -342,7 +343,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -383,7 +384,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) @@ -434,14 +435,14 @@ public class DoUpdateVfModule extends VfModuleBase { logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood")) } catch(BpmnError b){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + b); throw b }catch (Exception e) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) @@ -548,7 +549,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) @@ -612,7 +613,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) @@ -716,7 +717,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) @@ -764,7 +765,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -838,7 +839,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) @@ -941,7 +942,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) @@ -962,7 +963,7 @@ public class DoUpdateVfModule extends VfModuleBase { try { def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", ErrorCode.UnknownError.getValue()); @@ -970,7 +971,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) @@ -1048,7 +1049,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index eb788a85b7..1e36ccbf49 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -272,7 +273,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -328,7 +329,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) @@ -404,7 +405,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 4321dbadd5..99c9454021 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.appc.client.lcm.model.Action; @@ -233,7 +234,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) @@ -276,7 +277,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -327,7 +328,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) @@ -369,7 +370,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -413,7 +414,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -461,7 +462,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -531,19 +532,19 @@ public class ReplaceVnfInfra extends VnfCmBase { logger.trace('Exited ' + method) } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index ef4a78ffde..bf7f26a731 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.camunda.bpm.engine.delegate.DelegateExecution @@ -87,7 +88,7 @@ public class RollbackVnf extends VnfCmBase { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("rollbackErrorCode", "1") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 0afa34bdec..49eeb2247c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* @@ -294,7 +295,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index 9db5b7366a..596c0454e5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -96,7 +97,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -151,7 +152,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) @@ -181,7 +182,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) @@ -237,7 +238,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) @@ -278,7 +279,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') @@ -333,7 +334,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 0344206145..dd356e8a13 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import groovy.json.JsonException import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError @@ -482,7 +483,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion ExceptionUtil exceptionUtil = new ExceptionUtil() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } @@ -501,7 +502,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " ExceptionUtil exceptionUtil = new ExceptionUtil() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 05aff713bc..8ead316a29 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import groovy.json.JsonOutput import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError @@ -351,7 +352,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -396,7 +397,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -441,7 +442,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -520,17 +521,17 @@ public class VnfInPlaceUpdate extends VnfCmBase { logger.trace('Exited ' + method) } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 9829419128..e3cac9d4e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -420,7 +421,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -847,7 +848,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") } catch (BpmnError b) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue()); throw b diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index a1cdacaf08..efdc61475f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -419,7 +420,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(BpmnError b){ - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue()); throw b diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 2c5b6430e6..8e3238fdd0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -585,7 +586,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 58c0ef2dcf..1ded058dfa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -205,7 +206,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 61dd13b4e2..6177812083 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -520,7 +521,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 44e27d99cf..e79758f3a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.AllottedResource; import org.onap.so.bpmn.common.scripts.*; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -206,7 +207,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index 9dcee3dfb2..b8ae461ce7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AllottedResourceUtils @@ -351,7 +352,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 43e095859e..31f8eb42dd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AllottedResourceUtils @@ -355,7 +356,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 94ceddae97..2ababac7e3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -24,11 +24,17 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.camunda.bpm.engine.runtime.Execution; +import org.onap.aai.domain.yang.v13.Metadatum; +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; +import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.HashMap; +import java.util.Optional; @Component public class InformDmaapClient implements JavaDelegate { @@ -41,8 +47,25 @@ public class InformDmaapClient implements JavaDelegate { String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); String processBusinessKey = execution.getProcessBusinessKey(); - dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey(processBusinessKey).correlateWithResult()); + HashMap<String, String> updateInfo = createUpdateInfo(execution); + updateInfo.put("pnfCorrelationId", pnfCorrelationId); + dmaapClient + .registerForUpdate(pnfCorrelationId, + () -> runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(processBusinessKey).correlateWithResult(), + Optional.of(updateInfo)); + } + + private HashMap<String, String> createUpdateInfo(DelegateExecution execution) { + HashMap<String, String> map = new HashMap(); + + ResourceInput resourceInputObj = ResourceRequestBuilder + + .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class); + map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId()); + map.put("serviceType", resourceInputObj.getServiceType()); + map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId()); + return map; } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java index fbf86cc411..d513684659 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -20,9 +20,13 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; +import java.util.HashMap; +import java.util.Optional; + public interface DmaapClient { - void registerForUpdate(String pnfCorrelationId, Runnable informConsumer); + void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, + Optional<HashMap<String, String>> updateInfo); Runnable unregister(String pnfCorrelationId); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 96562fe90f..357b571a5c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -40,6 +38,10 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.AAIObjectType; @Component public class PnfEventReadyDmaapClient implements DmaapClient { @@ -53,6 +55,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient { private volatile ScheduledThreadPoolExecutor executor; private volatile boolean dmaapThreadListenerIsRunning; + public volatile List<HashMap<String, String>> updateInfoMap; + @Autowired public PnfEventReadyDmaapClient(Environment env) { httpClient = HttpClientBuilder.create().build(); @@ -64,11 +68,19 @@ public class PnfEventReadyDmaapClient implements DmaapClient { .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName")) .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId")) .build()); + updateInfoMap = new ArrayList<>(); } @Override - public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, + Optional<HashMap<String, String>> updateInfo) { logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); + HashMap<String, String> map = updateInfo.get(); + if (map != null && map.size() > 0) { + synchronized (updateInfoMap) { + updateInfoMap.add(map); + } + } pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer); if (!dmaapThreadListenerIsRunning) { startDmaapThreadListener(); @@ -78,7 +90,17 @@ public class PnfEventReadyDmaapClient implements DmaapClient { @Override public synchronized Runnable unregister(String pnfCorrelationId) { logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); - Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); + Runnable runnable = runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); + synchronized (updateInfoMap) { + for (int i = updateInfoMap.size() - 1; i >= 0; i--) { + if (!updateInfoMap.get(i).containsKey("pnfCorrelationId")) + continue; + String id = updateInfoMap.get(i).get("pnfCorrelationId"); + if (id != pnfCorrelationId) + continue; + updateInfoMap.remove(i); + } + } if (pnfCorrelationIdToThreadMap.isEmpty()) { stopDmaapThreadListener(); } @@ -111,7 +133,17 @@ public class PnfEventReadyDmaapClient implements DmaapClient { try { logger.debug("dmaap listener starts listening pnf ready dmaap topic"); HttpResponse response = httpClient.execute(getRequest); - getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); + List<String> idList = getPnfCorrelationIdListFromResponse(response); + + // idList is never null + if (!idList.isEmpty()) { + // send only body of response + registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8")); + } + + if (idList != null) { + idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); + } } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); } finally { @@ -136,5 +168,36 @@ public class PnfEventReadyDmaapClient implements DmaapClient { runnable.run(); } } + + private void registerClientResponse(String pnfCorrelationId, String response) { + + String customerId = null; + String serviceType = null; + String serId = null; + synchronized (updateInfoMap) { + for (HashMap<String, String> map : updateInfoMap) { + if (!map.containsKey("pnfCorrelationId")) + continue; + if (pnfCorrelationId != map.get("pnfCorrelationId")) + continue; + if (!map.containsKey("globalSubscriberID")) + continue; + if (!map.containsKey("serviceType")) + continue; + if (!map.containsKey("serviceInstanceId")) + continue; + customerId = map.get("pnfCorrelationId"); + serviceType = map.get("serviceType"); + serId = map.get("serviceInstanceId"); + } + } + if (customerId == null || serviceType == null || serId == null) + return; + AAIResourcesClient client = new AAIResourcesClient(); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA, customerId, + serviceType, serId); + client.update(uri, response); + } + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 5451f9ff57..1b32029fd6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -282,7 +283,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } catch (Exception exception) { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.GENERAL_EXCEPTION.toString(), " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(), exception.getClass().toString()); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 4d58439fda..4703dddf54 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; +import com.google.common.base.Strings; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -78,7 +79,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 4fb6817a39..bdc0e2952b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; +import com.google.common.base.Strings; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -77,7 +78,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java index 21b14c35f9..2418479da6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -38,31 +38,23 @@ public abstract class AbstractBuilder<I, O> { public static final String RESOURCE_TYPE = "resourceType"; public enum RequestAction { - CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), ACTIVATE_NETWORK_INSTANCE(1, - "ActivateNetworkInstance"), CREATE_SERVICE_INSTANCE(2, - "CreateServiceInstance"), DELETE_SERVICE_INSTANCE(3, - "DeleteServiceInstance"), DELETE_NETWORK_INSTANCE(4, - "DeleteNetworkInstance"), CREATE_VNF_INSTANCE(5, - "CreateVnfInstance"), ACTIVATE_VNF_INSTANCE(6, - "ActivateVnfInstance"), DELETE_VNF_INSTANCE(7, - "DeleteVnfInstance"), CREATE_VF_MODULE_INSTANCE(8, - "CreateVfModuleInstance"), ACTIVATE_VF_MODULE_INSTANCE( - 9, - "ActivateVfModuleInstance"), DELETE_VF_MODULE_INSTANCE( - 10, - "DeleteVfModuleInstance"), CREATE_CONTRAIL_ROUTE_INSTANCE( - 11, - "CreateContrailRouteInstance"), DELETE_CONTRAIL_ROUTE_INSTANCE( - 12, - "DeleteContrailRouteInstance"), CREATE_SECURITY_ZONE_INSTANCE( - 13, - "CreateSecurityZoneInstance"), DELETE_SECURITY_ZONE_INSTANCE( - 14, - "DeleteSecurityZoneInstance"), ACTIVATE_DCI_NETWORK_INSTANCE( - 15, - "ActivateDCINetworkInstance"), DEACTIVATE_DCI_NETWORK_INSTANCE( - 16, - "DeActivateDCINetworkInstance"); + CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), + ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"), + CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"), + DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"), + DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"), + CREATE_VNF_INSTANCE(5, "CreateVnfInstance"), + ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"), + DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"), + CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"), + ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"), + DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"), + CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"), + DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"), + CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"), + DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"), + ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"), + DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance"); String name; int value; @@ -82,9 +74,16 @@ public abstract class AbstractBuilder<I, O> { } public enum SvcAction { - RESERVE(0, "reserve"), ASSIGN(1, "assign"), ACTIVATE(2, "activate"), DELETE(3, "delete"), CHANGEASSIGN(4, - "changeassign"), CHANGEDELETE(5, "changedelete"), ROLLBACK(6, - "rollback"), DEACTIVATE(7, "deactivate"), UNASSIGN(8, "unassign"), CREATE(9, "create"); + RESERVE(0, "reserve"), + ASSIGN(1, "assign"), + ACTIVATE(2, "activate"), + DELETE(3, "delete"), + CHANGEASSIGN(4, "changeassign"), + CHANGEDELETE(5, "changedelete"), + ROLLBACK(6, "rollback"), + DEACTIVATE(7, "deactivate"), + UNASSIGN(8, "unassign"), + CREATE(9, "create"); String name; int value; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy index 8dde45be81..e547981b2d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy @@ -27,6 +27,7 @@ import org.junit.Test import org.mockito.MockitoAnnotations import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.json.JsonUtils import static org.mockito.Mockito.* /** @@ -106,6 +107,46 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase { return resourceInputObj } + private ResourceInput getUpdateResInputObj(String modelName) { + + String resourceInput = "{\n" + + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" + + "\t\"resourceInstanceDes\": null,\n" + + "\t\"globalSubscriberId\": \"sdwandemo\",\n" + + "\t\"serviceType\": \"CCVPN\",\n" + + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" + + "\t\"serviceModelInfo\": {\n" + + "\t\t\"modelName\": \"WanConnectionSvc03\",\n" + + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" + + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" + + "\t\t\"modelVersion\": \"1.0\",\n" + + "\t\t\"modelCustomizationUuid\": \"\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"\",\n" + + "\t\t\"modelType\": \"\"\n" + + "\t},\n" + + "\t\"resourceModelInfo\": {\n" + + "\t\t\"modelName\": \"" + + modelName + + "\",\n" + + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" + + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" + + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + + "\t\t\"modelType\": \"\"\n" + + "\t},\n" + + "\t\"resourceInstancenUuid\": null,\n" + + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" + + "\t\"operationType\": \"createInstance\",\n" + + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" + + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" + + "}" + + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + return resourceInputObj + } + @Test void testAfterCreateSDNCCall() { init() @@ -132,4 +173,30 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase { def instanceId = response."response-data"."RequestData"."output"."network-response-information"."instance-id" return instanceId } + + @Test + void testUpdateResourceInput() { + init() + + def execution = getExecutionDelegate("OLT") + CreateSDNCNetworkResource createSDNCNetworkResource = new CreateSDNCNetworkResource() + def inputObject = createSDNCNetworkResource.updateResourceInput(execution) + + println(inputObject.getResourceParameters()) + assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.SVLAN") + assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.CVLAN") + assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.manufacturer") + assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.ONTSN") + } + + private ExecutionEntity getExecutionDelegate(String modelName) { + def input = getUpdateResInputObj(modelName) + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable(Prefix + "sdncCreateReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "SuccessIndicator")).thenReturn("false") + when(mockExecution.getVariable("isActivateRequired")).thenReturn("true") + when(mockExecution.getVariable("CRENWKI_createSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable(Prefix + "resourceInput")).thenReturn(input.toString()) + return mockExecution + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index e755214362..bfaf9cfee0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -42,7 +42,7 @@ public class CancelDmaapSubscriptionTest { .thenReturn(TEST_PNF_CORRELATION_ID); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> { - }); + }, null); // when delegate.execute(delegateExecution); // then diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index 19ba18f6de..2634f03d4b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -21,7 +21,9 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import java.util.HashMap; import java.util.Objects; +import java.util.Optional; public class DmaapClientTestImpl implements DmaapClient { @@ -29,7 +31,8 @@ public class DmaapClientTestImpl implements DmaapClient { private Runnable informConsumer; @Override - public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, + Optional<HashMap<String, String>> updateInfo) { this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index df060ed014..93a71b31ec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -34,10 +34,12 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder; public class InformDmaapClientTest { @Before - public void setUp() throws Exception { + public void setUp() { informDmaapClient = new InformDmaapClient(); dmaapClientTest = new DmaapClientTestImpl(); informDmaapClient.setDmaapClient(dmaapClientTest); @@ -53,7 +55,7 @@ public class InformDmaapClientTest { private MessageCorrelationBuilder messageCorrelationBuilder; @Test - public void shouldSendListenerToDmaapClient() throws Exception { + public void shouldSendListenerToDmaapClient() { // when informDmaapClient.execute(delegateExecution); // then @@ -63,7 +65,7 @@ public class InformDmaapClientTest { } @Test - public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception { + public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() { // when informDmaapClient.execute(delegateExecution); dmaapClientTest.getInformConsumer().run(); @@ -74,11 +76,41 @@ public class InformDmaapClientTest { inOrder.verify(messageCorrelationBuilder).correlateWithResult(); } + private ResourceInput getUpdateResInputObj(String modelName) { + + String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" + + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n" + + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" + + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n" + + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" + + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" + + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n" + + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \"" + + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" + + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" + + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" + + "\t\t\"modelCustomizationName\": \"\",\n" + + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n" + + "\t\"resourceInstancenUuid\": null,\n" + + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" + + "\t\"operationType\": \"createInstance\",\n" + + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" + + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" + + "}"; + + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class); + return resourceInputObj; + } + private DelegateExecution mockDelegateExecution() { + ResourceInput input = getUpdateResInputObj("OLT"); DelegateExecution delegateExecution = mock(DelegateExecution.class); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))) .thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); + when(delegateExecution.getVariable("resourceInput")).thenReturn(input.toString()); ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); RuntimeService runtimeService = mock(RuntimeService.class); @@ -86,6 +118,7 @@ public class InformDmaapClientTest { messageCorrelationBuilder = mock(MessageCorrelationBuilder.class); when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder); when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder); + return delegateExecution; } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn index 8cde4f6c56..e5b361643f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> <bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent_activate" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing> </bpmn:startEvent> <bpmn:endEvent id="EndEvent_1x6k78c_activate" name="create SDNC call end"> - <bpmn:incoming>SequenceFlow_17md60u_activate</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="ScriptTask_1g5zyi6_activate" /> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="EndEvent_1x6k78c_activate" /> <bpmn:scriptTask id="Task_023hred_activate" name="post SDNC activate call"> <bpmn:incoming>SequenceFlow_1vnx1pp_activate</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ow44q0_activate</bpmn:outgoing> @@ -54,14 +54,6 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0_activate" sourceRef="Task_0uwlr22_activate" targetRef="ServiceTask_1cm8iwr_activate" /> <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp_activate" sourceRef="ServiceTask_1cm8iwr_activate" targetRef="Task_023hred_activate" /> - <bpmn:scriptTask id="ScriptTask_1g5zyi6_activate" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17md60u_activate</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new ActivateSDNCNetworkResource() -csi.sendSyncResponse(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_17md60u_activate" sourceRef="ScriptTask_1g5zyi6_activate" targetRef="EndEvent_1x6k78c_activate" /> <bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_activate" targetRef="Task_13sx2bp_activate" /> <bpmn:scriptTask id="ScriptTask_1gih50a_activate" name="Prepare SDNC Actiate request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_18l3crb_activate</bpmn:incoming> @@ -96,14 +88,14 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_activate"> - <dc:Bounds x="930" y="306" width="36" height="36" /> + <dc:Bounds x="776" y="306" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="893" y="348" width="85" height="27" /> + <dc:Bounds x="740" y="348" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_activate"> <di:waypoint x="694" y="324" /> - <di:waypoint x="765" y="324" /> + <di:waypoint x="776" y="324" /> <bpmndi:BPMNLabel> <dc:Bounds x="780.5" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -141,16 +133,6 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script> <dc:Bounds x="641" y="314" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6_activate"> - <dc:Bounds x="765" y="284" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u_activate"> - <di:waypoint x="865" y="324" /> - <di:waypoint x="930" y="324" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="998" y="313" width="0" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3_activate"> <di:waypoint x="-239" y="324" /> <di:waypoint x="-205" y="324" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index 0bdc6dc0bd..5a4b3ac348 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -137,8 +137,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script> <camunda:in source="requestAction" target="requestAction" /> <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> <camunda:in source="networkRequest" target="networkRequest" /> - <camunda:in source="networkInstanceId" target="networkInstanceId" /> - <camunda:in source="parentServiceInstanceId" target="parentServiceInstanceId" /> + <camunda:in source="resourceInstanceId" target="resourceInstanceId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1dww8ye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> @@ -309,4 +308,4 @@ dcsi.afterCreateSDNCCall(execution)</bpmn:script> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn index dc2cf9b676..75767929aa 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateResourcesV3" name="DoCreateResourcesV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -7,17 +7,17 @@ <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1qiiycn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateResources() dcsi.preProcessRequest(execution) -]]></bpmn2:script> +</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0epxs3b</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateResources() -csi.postConfigRequest(execution)]]></bpmn2:script> +csi.postConfigRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.onap.so.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> <bpmn2:incoming>SequenceFlow_0k0f7lm</bpmn2:incoming> @@ -27,9 +27,9 @@ csi.postConfigRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1y0los4" name="Sequence Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13d9g1n</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.sequenceResoure(execution)]]></bpmn2:script> +ddsi.sequenceResoure(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_13d9g1n" sourceRef="ScriptTask_1y0los4" targetRef="ExclusiveGateway_07rr3wp" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_0n9y4du" name="All ResourceFinished?" default="SequenceFlow_0q6uy30"> @@ -41,18 +41,18 @@ ddsi.sequenceResoure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_0y4u2ty" name="Parse Next Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_13c7bhn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jenxlp</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.parseNextResource(execution)]]></bpmn2:script> +ddsi.parseNextResource(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" /> <bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1obf0cq</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.getCurrentResoure(execution)]]></bpmn2:script> +ddsi.getCurrentResoure(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="ExclusiveGateway_07rr3wp" name="Is SDN-C Service Needed" default="SequenceFlow_18wj44x"> <bpmn2:incoming>SequenceFlow_13d9g1n</bpmn2:incoming> @@ -63,16 +63,16 @@ ddsi.getCurrentResoure(execution)]]></bpmn2:script> <bpmn2:scriptTask id="Task_0qlkmvt" name="Prepare resource recipe Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0uiygod</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1u9k0dm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script> +ddsi.prepareResourceRecipeRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.executeResourceRecipe(execution)]]></bpmn2:script> +ddsi.executeResourceRecipe(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to StratPrepareService"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> @@ -86,7 +86,7 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script> <bpmn2:linkEventDefinition name="ResourceLoop" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_1blaq0f"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("isContainsWanResource" ) == "true" )}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> @@ -98,12 +98,12 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script> <bpmn2:linkEventDefinition name="ResourceLoop" /> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_16nxl6h" name="yes" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_1xdjlzm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "true" )}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("allResourceFinished" ) == "true" )}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" /> <bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" /> <bpmn2:sequenceFlow id="SequenceFlow_13c7bhn" sourceRef="Task_12ghoph" targetRef="ScriptTask_0y4u2ty" /> - <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="ScriptTask_0l4nkqr" /> + <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="Task_0g7zo7b" /> <bpmn2:endEvent id="EndEvent_1ddg1di"> <bpmn2:incoming>SequenceFlow_0epxs3b</bpmn2:incoming> </bpmn2:endEvent> @@ -119,9 +119,9 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1648adp" name="Log / Print Unexpected Error" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0gr9xqj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0a6l29p</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + <bpmn2:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn2:script> +ex.processJavaException(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0gr9xqj" name="" sourceRef="StartEvent_0x7o2ug" targetRef="ScriptTask_1648adp" /> <bpmn2:sequenceFlow id="SequenceFlow_0a6l29p" name="" sourceRef="ScriptTask_1648adp" targetRef="EndEvent_0lgdyyb" /> @@ -129,11 +129,19 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:scriptTask id="Task_1blaq0f" name="Prepare SDNC service Create" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0k0f7lm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateResources() -ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> +ddsi.prepareServiceTopologyRequest(execution)</bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0k0f7lm" sourceRef="Task_1blaq0f" targetRef="Task_0io5qby" /> + <bpmn2:sequenceFlow id="SequenceFlow_1obf0cq" sourceRef="Task_0g7zo7b" targetRef="ScriptTask_0l4nkqr" /> + <bpmn2:scriptTask id="Task_0g7zo7b" name="Prepare Instnace ResourceList" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1obf0cq</bpmn2:outgoing> + <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateResources() +ddsi.prepareInstanceResourceList(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" /> @@ -155,10 +163,10 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> <dc:Bounds x="1047" y="353" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu"> - <di:waypoint xsi:type="dc:Point" x="1147" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1219" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1219" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> + <di:waypoint x="1147" y="393" /> + <di:waypoint x="1219" y="393" /> + <di:waypoint x="1219" y="300" /> + <di:waypoint x="1315" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="1189" y="340.5" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -167,8 +175,8 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> <dc:Bounds x="444" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n"> - <di:waypoint xsi:type="dc:Point" x="544" y="300" /> - <di:waypoint xsi:type="dc:Point" x="753" y="300" /> + <di:waypoint x="544" y="300" /> + <di:waypoint x="753" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="603.5" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -180,10 +188,10 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30"> - <di:waypoint xsi:type="dc:Point" x="954" y="550" /> - <di:waypoint xsi:type="dc:Point" x="954" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="565" /> + <di:waypoint x="954" y="550" /> + <di:waypoint x="954" y="691" /> + <di:waypoint x="246" y="691" /> + <di:waypoint x="246" y="565" /> <bpmndi:BPMNLabel> <dc:Bounds x="593" y="670" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -192,8 +200,8 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> <dc:Bounds x="728" y="485" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp"> - <di:waypoint xsi:type="dc:Point" x="828" y="525" /> - <di:waypoint xsi:type="dc:Point" x="929" y="525" /> + <di:waypoint x="828" y="525" /> + <di:waypoint x="929" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="833.5" y="504" width="90" height="12" /> </bpmndi:BPMNLabel> @@ -208,8 +216,8 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x"> - <di:waypoint xsi:type="dc:Point" x="803" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> + <di:waypoint x="803" y="300" /> + <di:waypoint x="1315" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="831" y="294" width="15" height="12" /> </bpmndi:BPMNLabel> @@ -227,17 +235,17 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn"> - <di:waypoint xsi:type="dc:Point" x="54" y="-189" /> - <di:waypoint xsi:type="dc:Point" x="126" y="-189" /> + <di:waypoint x="54" y="-189" /> + <di:waypoint x="126" y="-189" /> <bpmndi:BPMNLabel> <dc:Bounds x="90" y="-210" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc"> - <di:waypoint xsi:type="dc:Point" x="226" y="-189" /> - <di:waypoint xsi:type="dc:Point" x="771" y="-189" /> - <di:waypoint xsi:type="dc:Point" x="771" y="-189" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="-189" /> + <di:waypoint x="226" y="-189" /> + <di:waypoint x="771" y="-189" /> + <di:waypoint x="771" y="-189" /> + <di:waypoint x="1315" y="-189" /> <bpmndi:BPMNLabel> <dc:Bounds x="786" y="-195" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -249,9 +257,9 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9"> - <di:waypoint xsi:type="dc:Point" x="778" y="325" /> - <di:waypoint xsi:type="dc:Point" x="778" y="393" /> - <di:waypoint xsi:type="dc:Point" x="861" y="394" /> + <di:waypoint x="778" y="325" /> + <di:waypoint x="778" y="393" /> + <di:waypoint x="861" y="394" /> <bpmndi:BPMNLabel> <dc:Bounds x="784" y="353" width="20" height="12" /> </bpmndi:BPMNLabel> @@ -263,49 +271,49 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9"> - <di:waypoint xsi:type="dc:Point" x="54" y="300" /> - <di:waypoint xsi:type="dc:Point" x="444" y="300" /> + <di:waypoint x="54" y="300" /> + <di:waypoint x="444" y="300" /> <bpmndi:BPMNLabel> <dc:Bounds x="204" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m"> - <dc:Bounds x="18" y="507" width="36" height="36" /> + <dc:Bounds x="-26" y="507" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2" y="543" width="73" height="12" /> + <dc:Bounds x="-41" y="543" width="72" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h"> - <di:waypoint xsi:type="dc:Point" x="979" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1119" y="525" /> + <di:waypoint x="979" y="525" /> + <di:waypoint x="1119" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="1040" y="504" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod"> - <di:waypoint xsi:type="dc:Point" x="296" y="525" /> - <di:waypoint xsi:type="dc:Point" x="357" y="525" /> + <di:waypoint x="296" y="525" /> + <di:waypoint x="357" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="326.5" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm"> - <di:waypoint xsi:type="dc:Point" x="457" y="525" /> - <di:waypoint xsi:type="dc:Point" x="551" y="525" /> + <di:waypoint x="457" y="525" /> + <di:waypoint x="551" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="504" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn"> - <di:waypoint xsi:type="dc:Point" x="651" y="525" /> - <di:waypoint xsi:type="dc:Point" x="728" y="525" /> + <di:waypoint x="651" y="525" /> + <di:waypoint x="728" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="689.5" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66"> - <di:waypoint xsi:type="dc:Point" x="54" y="525" /> - <di:waypoint xsi:type="dc:Point" x="196" y="525" /> + <di:waypoint x="10" y="525" /> + <di:waypoint x="52" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="125" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -317,8 +325,8 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0epxs3b_di" bpmnElement="SequenceFlow_0epxs3b"> - <di:waypoint xsi:type="dc:Point" x="1219" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="525" /> + <di:waypoint x="1219" y="525" /> + <di:waypoint x="1315" y="525" /> <bpmndi:BPMNLabel> <dc:Bounds x="1267" y="504" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -342,15 +350,15 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> <dc:Bounds x="511" y="863" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0gr9xqj_di" bpmnElement="SequenceFlow_0gr9xqj"> - <di:waypoint xsi:type="dc:Point" x="443" y="903" /> - <di:waypoint xsi:type="dc:Point" x="511" y="903" /> + <di:waypoint x="443" y="903" /> + <di:waypoint x="511" y="903" /> <bpmndi:BPMNLabel> <dc:Bounds x="387" y="888" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0a6l29p_di" bpmnElement="SequenceFlow_0a6l29p"> - <di:waypoint xsi:type="dc:Point" x="611" y="903" /> - <di:waypoint xsi:type="dc:Point" x="700" y="903" /> + <di:waypoint x="611" y="903" /> + <di:waypoint x="700" y="903" /> <bpmndi:BPMNLabel> <dc:Bounds x="567.5" y="888" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -359,12 +367,19 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script> <dc:Bounds x="861" y="354" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0k0f7lm_di" bpmnElement="SequenceFlow_0k0f7lm"> - <di:waypoint xsi:type="dc:Point" x="961" y="394" /> - <di:waypoint xsi:type="dc:Point" x="1047" y="393" /> + <di:waypoint x="961" y="394" /> + <di:waypoint x="1047" y="393" /> <bpmndi:BPMNLabel> <dc:Bounds x="1004" y="372.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1obf0cq_di" bpmnElement="SequenceFlow_1obf0cq"> + <di:waypoint x="152" y="525" /> + <di:waypoint x="196" y="525" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0iag9tv_di" bpmnElement="Task_0g7zo7b"> + <dc:Bounds x="52" y="485" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index 35f8f45999..5b095a9983 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -27,14 +27,15 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import com.google.protobuf.Struct; import java.io.IOException; import java.util.List; import java.util.UUID; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; @@ -45,6 +46,7 @@ import org.onap.so.bpmn.mock.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.protobuf.Struct; /** @@ -102,6 +104,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { } + @Ignore @Test public void workflow_validInput_expectedOuput() throws InterruptedException { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java index 513ff74180..4e74e5d414 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -55,7 +55,7 @@ public class HomingV2 { private boolean isOof(BuildingBlockExecution execution) { for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() .getUserParams()) { - if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) { + if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) { return true; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java index 2696313daf..d5a085aba7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java @@ -81,6 +81,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; @Component("OofHoming") public class OofHomingV2 { + public static final String ERROR_WHILE_PREPARING_OOF_REQUEST = " Error - while preparing oof request: "; private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class); private JsonUtils jsonUtils = new JsonUtils(); @Autowired @@ -91,13 +92,9 @@ public class OofHomingV2 { private OofValidator oofValidator; @Autowired private ExceptionBuilder exceptionUtil; - private static final String MODEL_NAME = "modelName"; private static final String MODEL_INVARIANT_ID = "modelInvariantId"; private static final String MODEL_VERSION_ID = "modelVersionId"; - private static final String MODEL_VERSION = "modelVersion"; private static final String SERVICE_RESOURCE_ID = "serviceResourceId"; - private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; - private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; private static final String IDENTIFIER_TYPE = "identifierType"; private static final String SOLUTIONS = "solutions"; private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; @@ -128,7 +125,7 @@ public class OofHomingV2 { OofRequest oofRequest = new OofRequest(); - RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout); + RequestInfo requestInfo = buildRequestInfo(requestId, timeout); oofRequest.setRequestInformation(requestInfo); ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); @@ -157,13 +154,13 @@ public class OofHomingV2 { logger.trace("Completed Oof Homing Call Oof"); } catch (BpmnError e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); } catch (BadResponseException e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); } catch (Exception e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while " + "preparing oof request: " + e + " Stack:" + ExceptionUtils.getFullStackTrace(e)); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 2f898b6697..2b9729f7c7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -334,6 +334,18 @@ public class SniroHomingV2 { } } } + List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies(); + if (!serviceProxies.isEmpty()) { + logger.debug("Adding service proxies to placement demands list"); + for (ServiceProxy sp : serviceProxies) { + if (isBlank(sp.getId())) { + sp.setId(UUID.randomUUID().toString()); + } + Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + addCandidates(sp, demand); + placementDemands.add(demand); + } + } return placementDemands; } @@ -400,6 +412,7 @@ public class SniroHomingV2 { private void addCandidates(SolutionCandidates candidates, Demand demand) { List<Candidate> required = candidates.getRequiredCandidates(); List<Candidate> excluded = candidates.getExcludedCandidates(); + List<Candidate> existing = candidates.getExistingCandidates(); if (!required.isEmpty()) { List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); @@ -424,7 +437,18 @@ public class SniroHomingV2 { } demand.setExcludedCandidates(cans); } - // TODO support existing candidates + if (!existing.isEmpty()) { + List<org.onap.so.client.sniro.beans.Candidate> cans = + new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for (Candidate c : existing) { + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + can.setIdentifierType(c.getIdentifierType()); + can.setIdentifiers(c.getIdentifiers()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setExistingCandidates(cans); + } } /** @@ -462,6 +486,7 @@ public class SniroHomingV2 { List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks(); List<AllottedResource> allottes = serviceInstance.getAllottedResources(); List<GenericVnf> vnfs = serviceInstance.getVnfs(); + List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies(); logger.debug("Processing placement solution " + i + 1); for (int p = 0; p < placements.length(); p++) { @@ -502,6 +527,12 @@ public class SniroHomingV2 { break search; } } + for (ServiceProxy proxy : serviceProxies) { + if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) { + proxy.setServiceInstance(setSolution(solutionInfo, placement)); + break search; + } + } } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index d23f9c52ea..79672404d2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -29,6 +29,7 @@ import java.util.TreeSet; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -122,8 +123,8 @@ public class AAICreateTasks { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId(); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", - ErrorCode.UnknownError.getValue(), errorMessage); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, + "BPMN", ErrorCode.UnknownError.getValue(), errorMessage); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); } aaiSIResources.createServiceSubscription(customer); @@ -169,15 +170,15 @@ public class AAICreateTasks { if (owningEntityName == null || "".equals(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, + "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { if (aaiSIResources.existsOwningEntityName(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)"; - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, - "BPMN", ErrorCode.UnknownError.getValue(), msg); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + msg, "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 28186528e4..18ba91263b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,8 +58,8 @@ import org.springframework.stereotype.Component; public class AAIDeleteTasks { private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class); - private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; - private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn"; + private static String contrailNetworkPolicyFqdnList = "contrailNetworkPolicyFqdnList"; + private static String networkPolicyFqdnParam = "network-policy-fqdn"; @Autowired private ExceptionBuilder exceptionUtil; @@ -176,15 +176,15 @@ public class AAIDeleteTasks { public void deleteNetworkPolicies(BuildingBlockExecution execution) { try { - String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST); + String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList); if (fqdns != null && !fqdns.isEmpty()) { - String fqdnList[] = fqdns.split(","); + String[] fqdnList = fqdns.split(","); int fqdnCount = fqdnList.length; if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); - uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); + uri.queryParam(networkPolicyFqdnParam, fqdn); Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri); if (oNetPolicies.isPresent()) { NetworkPolicies networkPolicies = oNetPolicies.get(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 426ef931b6..cea9d54631 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.infrastructure.activity; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import com.google.common.base.Strings; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -94,7 +95,7 @@ public class ExecuteActivity implements JavaDelegate { Map<String, Object> variables = new HashMap<>(); variables.put("buildingBlock", executeBuildingBlock); - variables.put("mso-request-id", requestId); + variables.put(G_REQUEST_ID, requestId); variables.put("retryCount", 1); variables.put("aLaCarte", true); @@ -144,7 +145,7 @@ public class ExecuteActivity implements JavaDelegate { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg, ex); execution.setVariable("ExecuteActivityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java index 77898dd5cc..428f5e703d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -32,7 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.client.orchestration.NetworkAdapterResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class NetworkAdapterUpdateTasks { - private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class); @Autowired private ExtractPojosForBB extractPojosForBB; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 849465e787..b257e91165 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.*; @Component public class VnfAdapterCreateTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class); + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired @@ -73,7 +73,7 @@ public class VnfAdapterCreateTasks { try { vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { - sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -109,8 +109,8 @@ public class VnfAdapterCreateTasks { CloudRegion cloudRegion = gBBInput.getCloudRegion(); RequestContext requestContext = gBBInput.getRequestContext(); OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); - String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); - String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); + String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); + String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId()); CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest( requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java index 116dc30d63..5fe80b79f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterDeleteTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class); + private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index bfa76c5053..f009404f7a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; @@ -63,6 +64,7 @@ public class VnfAdapterImpl { private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address"; private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address"; private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; + public static final String HEAT_STACK_ID = "heatStackId"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -77,7 +79,7 @@ public class VnfAdapterImpl { extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null); execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null); execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null); @@ -97,7 +99,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); if (!StringUtils.isEmpty(heatStackId)) { vfModule.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } Map<String, String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); @@ -110,7 +112,7 @@ public class VnfAdapterImpl { Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); if (null != vfModuleDelete && vfModuleDelete) { vfModule.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); Map<String, String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); if (vfModuleOutputs != null) { @@ -134,7 +136,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId(); if (!StringUtils.isEmpty(heatStackId)) { volumeGroup.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } else { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); @@ -144,7 +146,7 @@ public class VnfAdapterImpl { Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted(); if (null != volumeGroupDelete && volumeGroupDelete) { volumeGroup.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); } } } @@ -170,8 +172,8 @@ public class VnfAdapterImpl { SAXSource source = new SAXSource(xmlReader, inputSource); return jaxbUnmarshaller.unmarshal(source); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e); } @@ -184,7 +186,7 @@ public class VnfAdapterImpl { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>(); + List<String> contrailNetworkPolicyFqdnList = new ArrayList<>(); Iterator<String> keys = vfModuleOutputs.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index 01519fab6e..4cf5131747 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -2,6 +2,8 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,8 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static com.google.common.collect.Sets.newHashSet; -import java.util.Set; +import com.google.common.collect.ImmutableSet; import org.onap.vnfmadapter.v1.model.OperationStateEnum; import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum; @@ -51,11 +52,11 @@ public class Constants { public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/"; - public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES = - newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK); + public static final ImmutableSet<OperationStateEnum> OPERATION_FINISHED_STATES = + ImmutableSet.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK); - public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet( - OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS); + public static final ImmutableSet<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = ImmutableSet + .of(OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS); public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus"; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index 4a51891184..32516c1dcb 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -42,6 +42,7 @@ import com.google.common.base.Optional; public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class); + public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}"; private final VnfmAdapterUrlProvider urlProvider; private final HttpRestServiceProvider httpServiceProvider; @@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } @@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } final DeleteVnfResponse deleteVnfResponse = response.getBody(); @@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } return Optional.of(response.getBody()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index ef882b4694..a7cb729c46 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks; import java.util.HashMap; import java.util.Optional; +import com.google.common.base.Strings; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -47,6 +48,9 @@ import org.springframework.stereotype.Component; @Component public class AppcRunTasks { private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class); + public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop"; + public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock"; + public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +75,9 @@ public class AppcRunTasks { execution.setVariable("actionHealthCheck", Action.HealthCheck); execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic); execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck); - execution.setVariable("rollbackVnfStop", false); - execution.setVariable("rollbackVnfLock", false); - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } public void runAppcCommand(BuildingBlockExecution execution, Action action) { @@ -137,7 +141,7 @@ public class AppcRunTasks { appcMessage = appCClient.getErrorMessage(); mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } @@ -153,17 +157,17 @@ public class AppcRunTasks { protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) { if (appcCode.equals("0") && action != null) { if (action.equals(Action.Lock)) { - execution.setVariable("rollbackVnfLock", true); + execution.setVariable(ROLLBACK_VNF_LOCK, true); } else if (action.equals(Action.Unlock)) { - execution.setVariable("rollbackVnfLock", false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); } else if (action.equals(Action.Start)) { - execution.setVariable("rollbackVnfStop", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); } else if (action.equals(Action.Stop)) { - execution.setVariable("rollbackVnfStop", true); + execution.setVariable(ROLLBACK_VNF_STOP, true); } else if (action.equals(Action.QuiesceTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", true); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true); } else if (action.equals(Action.ResumeTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java index a223259d4d..62878fd4f7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -60,6 +60,16 @@ public class AuditTasks { } } + public void isDeleteAuditNeeded(BuildingBlockExecution execution) { + try { + logger.debug("deleteAuditInventoryNeeded Value: {}", env.getProperty("mso.infra.deleteAuditInventory")); + execution.setVariable("auditInventoryNeeded", + Boolean.parseBoolean(env.getProperty("mso.infra.deleteAuditInventory"))); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void setupAuditVariable(BuildingBlockExecution execution) { try { execution.setVariable("auditInventory", createAuditInventory(execution)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java index ab8818f682..4b88f741de 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java @@ -54,9 +54,9 @@ public class AssignNetworkBBUtils { * @return */ public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception { - boolean found = false; + // TODO - populate logic after iTrack MSO-2143 implemented - return found; + return false; } /** @@ -71,7 +71,7 @@ public class AssignNetworkBBUtils { CloudRegion cloudRegion = gBBInput.getCloudRegion(); String cloudRegionSdnc; String cloudRegionPo = cloudRegion.getLcpCloudRegionId(); - if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) { + if ("2.5".equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) { cloudRegionSdnc = "AAIAIC25"; } else { cloudRegionSdnc = cloudRegionPo; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java index 6e7ca5f4e5..dd36900139 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java @@ -40,9 +40,9 @@ import org.springframework.stereotype.Component; @Component public class ConfigDeployVnf { private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class); - private final static String ORIGINATOR_ID = "SO"; - private final static String ACTION_NAME = "config-deploy"; - private final static String MODE = "async"; + private static final String ORIGINATOR_ID = "SO"; + private static final String ACTION_NAME = "config-deploy"; + private static final String MODE = "async"; @Autowired private ExceptionBuilder exceptionUtil; 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 1925d8b69f..e8687f25dc 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 @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import com.google.common.base.Strings; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload; import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut; @@ -152,7 +153,7 @@ public class ConfigurationScaleOut { appcMessage = appCClient.getErrorMessage(); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); @@ -160,7 +161,7 @@ public class ConfigurationScaleOut { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java index c2d9c6e7bb..b7ddc11f35 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java @@ -39,7 +39,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetwork { - private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index 4eaec381e9..36eab8f981 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -36,7 +36,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetworkCollection { - private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired 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 98b602eca1..8aeba490d1 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 @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.HashMap; import java.util.Optional; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -45,6 +46,9 @@ import org.springframework.stereotype.Component; public class GenericVnfHealthCheck { private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class); + public static final String VNF_NAME = "vnfName"; + public static final String OAM_IP_ADDRESS = "oamIpAddress"; + public static final String VNF_HOST_IP_ADDRESS = "vnfHostIpAddress"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +75,9 @@ public class GenericVnfHealthCheck { String controllerName = controllerSelectionReference.getControllerName(); execution.setVariable("vnfId", vnfId); - execution.setVariable("vnfName", vnfName); - execution.setVariable("oamIpAddress", oamIpAddress); - execution.setVariable("vnfHostIpAddress", oamIpAddress); + execution.setVariable(VNF_NAME, vnfName); + execution.setVariable(OAM_IP_ADDRESS, oamIpAddress); + execution.setVariable(VNF_HOST_IP_ADDRESS, oamIpAddress); execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("action", actionCategory); execution.setVariable("controllerType", controllerName); @@ -98,11 +102,11 @@ public class GenericVnfHealthCheck { payload = Optional.of(pay); } String controllerType = execution.getVariable("controllerType"); - HashMap<String, String> payloadInfo = new HashMap<String, String>(); - payloadInfo.put("vnfName", execution.getVariable("vnfName")); + HashMap<String, String> payloadInfo = new HashMap<>(); + payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId")); - payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress")); - payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress")); + payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS)); + payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS)); logger.debug("Running APP-C action: {}", action.toString()); logger.debug("VNFID: {}", vnfId); @@ -111,19 +115,19 @@ public class GenericVnfHealthCheck { appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); } catch (BpmnError ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex); appcMessage = ex.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } catch (Exception e) { if (e instanceof java.util.concurrent.TimeoutException) { appcMessage = "Request to APPC timed out. "; - logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONNECTION_EXCEPTION.toString(), "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); throw e; } else { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); @@ -133,7 +137,7 @@ public class GenericVnfHealthCheck { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index 27415190cc..7466df53b2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -38,11 +38,10 @@ import org.springframework.stereotype.Component; @Component public class UnassignNetworkBB { - private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class); - private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = + private static String messageCannotPerformUnassign = "Cannot perform Unassign Network. Network is still related to "; - private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually."; + private static String messageErrorRollback = " Rollback is not possible. Please restore data manually."; @Autowired private ExceptionBuilder exceptionUtil; @@ -72,7 +71,7 @@ public class UnassignNetworkBB { Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { - String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; + String msg = messageCannotPerformUnassign + relatedToValue; execution.setVariable("ErrorUnassignNetworkBB", msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } @@ -109,7 +108,7 @@ public class UnassignNetworkBB { boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false; if (isRollbackNeeded == true) { - msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK; + msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback; } else { msg = execution.getVariable("ErrorUnassignNetworkBB"); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index b906b8a662..75acf10d97 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -2,6 +2,7 @@ package org.onap.so.bpmn.infrastructure.manualhandling.tasks; import java.util.Map; import java.util.HashMap; +import com.google.common.base.Strings; import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateTask; @@ -23,6 +24,14 @@ public class ManualHandlingTasks { private static final String TASK_TYPE_PAUSE = "pause"; private static final String TASK_TYPE_FALLOUT = "fallout"; + public static final String VNF_TYPE = "vnfType"; + public static final String SERVICE_TYPE = "serviceType"; + public static final String MSO_REQUEST_ID = "msoRequestId"; + public static final String REQUESTOR_ID = "requestorId"; + public static final String ERROR_CODE = "errorCode"; + public static final String VALID_RESPONSES = "validResponses"; + public static final String DESCRIPTION = "description"; + public static final String BPMN_EXCEPTION = "BPMN exception: "; @Autowired private ExceptionBuilder exceptionUtil; @@ -37,39 +46,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_FALLOUT; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); String description = ""; String timeout = ""; String errorSource = (String) execution.getVariable("failedActivity"); - String errorCode = (String) execution.getVariable("errorCode"); + String errorCode = (String) execution.getVariable(ERROR_CODE); String errorMessage = (String) execution.getVariable("errorText"); String buildingBlockName = (String) execution.getVariable("currentActivity"); String buildingBlockStep = (String) execution.getVariable("workStep"); - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); taskVariables.put("tmeout", timeout); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created fallout task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setFalloutTaskVariables " + ex.getMessage(); @@ -86,39 +95,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_PAUSE; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); - String description = (String) execution.getVariable("description"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); + String description = (String) execution.getVariable(DESCRIPTION); String timeout = (String) execution.getVariable("taskTimeout"); String errorSource = ""; String errorCode = ""; String errorMessage = ""; String buildingBlockName = ""; String buildingBlockStep = ""; - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); taskVariables.put("timeout", timeout); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created pause task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setPauseTaskVariables " + ex.getMessage(); @@ -149,7 +158,7 @@ public class ManualHandlingTasks { execution.setVariable("responseValueTask", responseValueUppercaseStart); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in completeManualTask " + ex.getMessage(); @@ -164,26 +173,26 @@ public class ManualHandlingTasks { try { ExternalTicket ticket = new ExternalTicket(); - ticket.setRequestId((String) execution.getVariable("msoRequestId")); + ticket.setRequestId((String) execution.getVariable(MSO_REQUEST_ID)); ticket.setCurrentActivity((String) execution.getVariable("currentActivity")); - ticket.setNfRole((String) execution.getVariable("vnfType")); - ticket.setDescription((String) execution.getVariable("description")); - ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType")); - ticket.setRequestorId((String) execution.getVariable("requestorId")); + ticket.setNfRole((String) execution.getVariable(VNF_TYPE)); + ticket.setDescription((String) execution.getVariable(DESCRIPTION)); + ticket.setSubscriptionServiceType((String) execution.getVariable(SERVICE_TYPE)); + ticket.setRequestorId((String) execution.getVariable(REQUESTOR_ID)); ticket.setTimeout((String) execution.getVariable("taskTimeout")); ticket.setErrorSource((String) execution.getVariable("failedActivity")); - ticket.setErrorCode((String) execution.getVariable("errorCode")); + ticket.setErrorCode((String) execution.getVariable(ERROR_CODE)); ticket.setErrorMessage((String) execution.getVariable("errorText")); ticket.setWorkStep((String) execution.getVariable("workStep")); ticket.createTicket(); } catch (BpmnError e) { String msg = "BPMN error in createAOTSTicket " + e.getMessage(); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex) { String msg = "Exception in createExternalTicket " + ex.getMessage(); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } @@ -191,7 +200,7 @@ public class ManualHandlingTasks { public void updateRequestDbStatus(DelegateExecution execution, String status) { try { - String requestId = (String) execution.getVariable("msoRequestId"); + String requestId = (String) execution.getVariable(MSO_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); request.setRequestStatus(status); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index 7a0008d5a2..32276891c7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -50,7 +50,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -103,7 +104,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index d3878f06b7..111f008159 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -54,6 +54,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCAssignTasks { private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -79,7 +80,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -99,7 +100,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -152,7 +153,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index 50cf0fb074..4ffb397707 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -47,6 +47,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCChangeAssignTasks { + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -70,7 +71,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -87,7 +88,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -104,7 +105,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -125,7 +126,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 3a1528946d..e587830c74 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -80,7 +81,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -107,7 +108,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -132,7 +133,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -157,7 +158,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 7ae6117c61..fcc67d0ef7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -39,7 +39,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCQueryTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class); + + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -61,7 +62,7 @@ public class SDNCQueryTasks { genericVnf.setSelflink(selfLink); } String response = sdncVnfResources.queryVnf(genericVnf); - execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -82,7 +83,7 @@ public class SDNCQueryTasks { } if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -97,7 +98,7 @@ public class SDNCQueryTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index e9848d1646..fba189fcfc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -94,7 +95,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -114,7 +115,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -136,7 +137,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 4fc4d85b97..35ceef0473 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; +import java.sql.Timestamp; import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -53,6 +54,9 @@ public class WorkflowActionBBFailure { errorMsg = "Failed to determine error message"; } request.setStatusMessage(errorMsg); + request.setProgress(Long.valueOf(100)); + request.setLastModifiedBy("CamundaBPMN"); + request.setEndTime(new Timestamp(System.currentTimeMillis())); requestDbclient.updateInfraActiveRequests(request); } catch (Exception e) { logger.error( @@ -113,6 +117,7 @@ public class WorkflowActionBBFailure { request.setProgress(Long.valueOf(100)); request.setRequestStatus("FAILED"); request.setLastModifiedBy("CamundaBPMN"); + request.setEndTime(new Timestamp(System.currentTimeMillis())); requestDbclient.updateInfraActiveRequests(request); } catch (Exception e) { workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 8ec283032f..e1c0d57b10 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -226,11 +226,16 @@ public class WorkflowActionBBTasks { final String action = (String) execution.getVariable(G_ACTION); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); final String resourceName = (String) execution.getVariable("resourceName"); + String statusMessage = (String) execution.getVariable("StatusMessage"); String macroAction = ""; - if (aLaCarte) { - macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + if (statusMessage == null) { + if (aLaCarte) { + macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + } else { + macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + } } else { - macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + macroAction = statusMessage; } execution.setVariable("finalStatusMessage", macroAction); Timestamp endTime = new Timestamp(System.currentTimeMillis()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java index af8f93b92b..05a51797dd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java @@ -22,9 +22,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; public enum WorkflowType { - SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK( - "VirtualLink"), NETWORKCOLLECTION( - "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup"); + SERVICE("Service"), + VNF("Vnf"), + VFMODULE("VfModule"), + VOLUMEGROUP("VolumeGroup"), + NETWORK("Network"), + VIRTUAL_LINK("VirtualLink"), + NETWORKCOLLECTION("NetworkCollection"), + CONFIGURATION("Configuration"), + INSTANCE_GROUP("InstanceGroup"); private final String type; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 4fee1f909b..173e776af9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -34,7 +34,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.ProviderVlanNetwork; import org.onap.so.adapters.nwrest.RollbackNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; @@ -261,7 +260,7 @@ public class NetworkAdapterObjectMapper { * @param L3Network * @return List<org.onap.so.openstack.beans.Subnet> */ - private List<Subnet> buildOpenstackSubnetList(L3Network l3Network) { + protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) { List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets(); List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>(); @@ -292,9 +291,10 @@ public class NetworkAdapterObjectMapper { .setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask())); List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes(); List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>(); - org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute(); + org.onap.so.openstack.beans.HostRoute openstackHostRoute = null; // TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) { + openstackHostRoute = new org.onap.so.openstack.beans.HostRoute(); openstackHostRoute.setNextHop(hostRoute.getNextHop()); openstackHostRoute.setPrefix(hostRoute.getRoutePrefix()); // add host route to the list diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index 717bb04099..5bf531753e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -24,6 +24,7 @@ package org.onap.so.client.namingservice; import java.io.IOException; import java.util.List; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.namingservice.model.NameGenDeleteResponse; import org.onap.namingservice.model.NameGenResponse; @@ -51,8 +52,9 @@ public class NamingClientResponseValidator { public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -60,7 +62,7 @@ public class NamingClientResponseValidator { String generatedName = ""; NameGenResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); @@ -90,7 +92,7 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -99,8 +101,9 @@ public class NamingClientResponseValidator { public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -108,7 +111,7 @@ public class NamingClientResponseValidator { String responseMessage = ""; NameGenDeleteResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); @@ -121,7 +124,7 @@ public class NamingClientResponseValidator { String errorMessageString = NAMING_SERVICE_ERROR; String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -141,7 +144,7 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); return errorMessage; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index e391349d2c..f84afbe4a2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -61,9 +61,9 @@ public class AAIServiceInstanceResources { AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId()); serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); - injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance)); + injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance)); } /** @@ -87,24 +87,24 @@ public class AAIServiceInstanceResources { public void createProject(Project project) { AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); - org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); - injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)); + org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)); } public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) { AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); - injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI, + org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI, serviceInstanceURI); } public void createOwningEntity(OwningEntity owningEntity) { AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); - injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)); + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)); } public boolean existsOwningEntity(OwningEntity owningEntity) { @@ -134,8 +134,8 @@ public class AAIServiceInstanceResources { AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); - injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)) + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)) .connect(owningEntityURI, serviceInstanceURI); } @@ -152,9 +152,9 @@ public class AAIServiceInstanceResources { public void updateServiceInstance(ServiceInstance serviceInstance) { AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); - injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance); + injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index 83fe31a116..514f48ffc8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -40,7 +40,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVfModuleResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class); @Autowired private InjectionHelper injectionHelper; @@ -97,8 +96,8 @@ public class AAIVfModuleResources { public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); - org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); - injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index fc61d862aa..eb66f6bef5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -43,7 +43,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVnfResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index c24d1483e2..f4c285fdb3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -38,7 +38,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVolumeGroupResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 3ac61dff60..168d370521 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -21,7 +21,6 @@ package org.onap.so.client.orchestration; import java.util.Optional; -import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.VpnBindings; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java index ca32130c23..4aa6a1026a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java @@ -28,9 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java index 54a9cabb57..d4a4cfbd8a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java @@ -39,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCNetworkResources { - private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class); @Autowired private NetworkTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index 954cbc1b1d..0e32955eed 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -42,7 +42,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCVnfResources { - private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class); @Autowired private VnfTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index 939f53727d..efe5f34824 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -40,7 +40,6 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterVfModuleResources { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class); @Autowired private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java index c97ca8e0ea..2ec63182a0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java @@ -39,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterVolumeGroupResources { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class); @Autowired private VnfAdapterObjectMapper vnfAdapterObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index f02d5e48ee..2e7877fe3b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -39,8 +39,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCClient { - private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class); - @Autowired private SDNCProperties properties; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index e21f64accd..9170d8bdf0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -25,6 +25,7 @@ package org.onap.so.client.sdnc; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.onap.so.client.exception.BadResponseException; @@ -52,6 +53,7 @@ public class SdnCommonTasks { private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s"; private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON = "ERROR: Could not convert SDNC pojo to json string."; + private static final String BRACKETS = Strings.repeat("{} ", 5); /*** * @@ -66,8 +68,8 @@ public class SdnCommonTasks { try { jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); } catch (JsonProcessingException e) { - logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, - "BPMN", ErrorCode.DataError.getValue(), e.getMessage()); + logger.error(BRACKETS, MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN", + ErrorCode.DataError.getValue(), e.getMessage()); throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); } jsonRequest = "{\"input\":" + jsonRequest + "}"; @@ -84,7 +86,7 @@ public class SdnCommonTasks { HttpHeaders httpHeader = new HttpHeaders(); httpHeader.set("Authorization", auth); httpHeader.setContentType(MediaType.APPLICATION_JSON); - List<MediaType> acceptMediaTypes = new ArrayList<MediaType>(); + List<MediaType> acceptMediaTypes = new ArrayList<>(); acceptMediaTypes.add(MediaType.APPLICATION_JSON); httpHeader.setAccept(acceptMediaTypes); return httpHeader; @@ -98,7 +100,7 @@ public class SdnCommonTasks { */ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } @@ -125,7 +127,7 @@ public class SdnCommonTasks { return jsonResponse; } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -139,7 +141,7 @@ public class SdnCommonTasks { */ public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } @@ -149,7 +151,7 @@ public class SdnCommonTasks { try { stringOutput = objMapper.writeValueAsString(output); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC); throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java index 5910975051..12d1b0be95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java @@ -21,7 +21,6 @@ package org.onap.so.client.sdnc.beans; import java.io.Serializable; -import java.time.Duration; import java.util.UUID; import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -35,8 +34,8 @@ public class SDNCRequest implements Serializable { private static final long serialVersionUID = 4679678988657593282L; private String timeOut = "PT1H"; private SDNCTopology topology; - private String CorrelationValue = UUID.randomUUID().toString(); - private String CorrelationName = "SDNCCallback"; + private String correlationValue = UUID.randomUUID().toString(); + private String correlationName = "SDNCCallback"; private Object SDNCPayload; @@ -57,19 +56,19 @@ public class SDNCRequest implements Serializable { } public String getCorrelationValue() { - return CorrelationValue; + return correlationValue; } public void setCorrelationValue(String correlationValue) { - CorrelationValue = correlationValue; + this.correlationValue = correlationValue; } public String getCorrelationName() { - return CorrelationName; + return correlationName; } public void setCorrelationName(String correlationName) { - CorrelationName = correlationName; + this.correlationName = correlationName; } public Object getSDNCPayload() { @@ -86,13 +85,13 @@ public class SDNCRequest implements Serializable { return false; } SDNCRequest castOther = (SDNCRequest) other; - return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue) - .append(CorrelationName, castOther.CorrelationName).isEquals(); + return new EqualsBuilder().append(correlationValue, castOther.correlationValue) + .append(correlationName, castOther.correlationName).isEquals(); } @Override public int hashCode() { - return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode(); + return new HashCodeBuilder().append(correlationValue).append(correlationName).toHashCode(); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java index 1718de9fe0..d6216c509d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java @@ -23,22 +23,17 @@ package org.onap.so.client.sdnc.beans; import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; public enum SDNCSvcAction { - ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), DELETE("delete", - GenericResourceApiSvcActionEnumeration.DELETE), ASSIGN("assign", - GenericResourceApiSvcActionEnumeration.ASSIGN), ROLLBACK("rollback", - GenericResourceApiSvcActionEnumeration.ROLLBACK), UNASSIGN("unassign", - GenericResourceApiSvcActionEnumeration.UNASSIGN), DEACTIVATE("deactivate", - GenericResourceApiSvcActionEnumeration.DEACTIVATE), CHANGE_DELETE( - "changedelete", - GenericResourceApiSvcActionEnumeration.CHANGEDELETE), CHANGE_ASSIGN( - "changeassign", - GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), CREATE( - "create", - GenericResourceApiSvcActionEnumeration.CREATE), ENABLE( - "enable", - GenericResourceApiSvcActionEnumeration.ENABLE), DISABLE( - "disable", - GenericResourceApiSvcActionEnumeration.DISABLE); + ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), + DELETE("delete", GenericResourceApiSvcActionEnumeration.DELETE), + ASSIGN("assign", GenericResourceApiSvcActionEnumeration.ASSIGN), + ROLLBACK("rollback", GenericResourceApiSvcActionEnumeration.ROLLBACK), + UNASSIGN("unassign", GenericResourceApiSvcActionEnumeration.UNASSIGN), + DEACTIVATE("deactivate", GenericResourceApiSvcActionEnumeration.DEACTIVATE), + CHANGE_DELETE("changedelete", GenericResourceApiSvcActionEnumeration.CHANGEDELETE), + CHANGE_ASSIGN("changeassign", GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), + CREATE("create", GenericResourceApiSvcActionEnumeration.CREATE), + ENABLE("enable", GenericResourceApiSvcActionEnumeration.ENABLE), + DISABLE("disable", GenericResourceApiSvcActionEnumeration.DISABLE); private final String name; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java index b9b04bc7b7..4edbf37bad 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java @@ -22,14 +22,14 @@ package org.onap.so.client.sdnc.beans; public enum SDNCSvcOperation { - VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), NETWORK_TOPOLOGY_OPERATION( - "network-topology-operation"), VNF_TOPOLOGY_OPERATION( - "vnf-topology-operation"), CONTRAIL_ROUTE_TOPOLOGY_OPERATION( - "contrail-route-topology-operation"), SECURITY_ZONE_TOPOLOGY_OPERATION( - "security-zone-topology-operation"), PORT_MIRROR_TOPOLOGY_OPERATION( - "port-mirror-topology-operation"), SERVICE_TOPOLOGY_OPERATION( - "service-topology-operation"), GENERIC_CONFIGURATION_TOPOLOGY_OPERATION( - "generic-configuration-topology-operation"); + VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), + NETWORK_TOPOLOGY_OPERATION("network-topology-operation"), + VNF_TOPOLOGY_OPERATION("vnf-topology-operation"), + CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"), + SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"), + PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"), + SERVICE_TOPOLOGY_OPERATION("service-topology-operation"), + GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation"); private final String name; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java index fb5f24694b..ae9fe6ad70 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java @@ -22,11 +22,14 @@ package org.onap.so.client.sdnc.endpoint; public enum SDNCTopology { - SERVICE("service-topology-operation"), VNF("vnf-topology-operation"), VFMODULE( - "vf-module-topology-operation"), CONTRAILROUTE("contrail-route-topology-operation"), PORTMIRROR( - "port-mirror-topology-operation"), NETWORK("network-topology-operation"), SECURITYZONE( - "security-zone-topology-operation"), CONFIGURATION( - "generic-configuration-topology-operation"); + SERVICE("service-topology-operation"), + VNF("vnf-topology-operation"), + VFMODULE("vf-module-topology-operation"), + CONTRAILROUTE("contrail-route-topology-operation"), + PORTMIRROR("port-mirror-topology-operation"), + NETWORK("network-topology-operation"), + SECURITYZONE("security-zone-topology-operation"), + CONFIGURATION("generic-configuration-topology-operation"); private final String topology; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 6627625d62..da44f2f8cb 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -24,6 +24,7 @@ package org.onap.so.client.sdnc.mapper; import java.util.Map; import java.util.UUID; +import com.google.common.base.Strings; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; @@ -188,8 +189,8 @@ public class VfModuleTopologyOperationRequestMapper { mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class); objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", - ErrorCode.UnknownError.getValue(), e.getMessage()); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), + "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); } } return objectPath; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index f31bff988a..e39e202aa3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -126,7 +126,7 @@ public class VnfTopologyOperationRequestMapper { } List<InstanceGroup> instanceGroups = vnf.getInstanceGroups(); List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = - new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>(); + new ArrayList<>(); for (InstanceGroup instanceGroup : instanceGroups) { if (ModelInfoInstanceGroup.TYPE_L3_NETWORK diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java index a448082cfe..eb73001f42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java @@ -49,7 +49,7 @@ public class SniroValidator { JSONObject jsonResponse = new JSONObject(response); if (jsonResponse.has("requestStatus")) { String status = jsonResponse.getString("requestStatus"); - if (status.equals("accepted")) { + if ("accepted".equals(status)) { logger.debug("Sniro Managers synchronous response indicates accepted"); } else { String message = jsonResponse.getString("statusMessage"); @@ -111,7 +111,7 @@ public class SniroValidator { if (!response.isEmpty()) { String status = (String) response.get("status"); if (isNotBlank(status)) { - if (status.equals("success")) { + if ("success".equals(status)) { logger.debug("Sniro Conductors synchronous response indicates success"); } else { String message = (String) response.get("message"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java index 19378cdbfa..fe2b63ff92 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,6 +38,8 @@ public class Demand implements Serializable { private List<Candidate> requiredCandidates; @JsonProperty("excludedCandidates") private List<Candidate> excludedCandidates; + @JsonProperty("existingCandidates") + private List<Candidate> existingCandidates; public List<Candidate> getRequiredCandidates() { @@ -80,4 +82,12 @@ public class Demand implements Serializable { this.modelInfo = modelInfo; } + public List<Candidate> getExistingCandidates() { + return existingCandidates; + } + + public void setExistingCandidates(List<Candidate> existingCandidates) { + this.existingCandidates = existingCandidates; + } + } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java index d71b4ec5fc..9ab3ae673a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java @@ -30,7 +30,7 @@ public class LicenseInfo implements Serializable { private static final long serialVersionUID = 6878164369491185856L; @JsonProperty("licenseDemands") - private List<Demand> demands = new ArrayList<Demand>(); + private List<Demand> demands = new ArrayList<>(); public List<Demand> getDemands() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java index ae13903a22..bbbbf9cfd6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java @@ -37,7 +37,7 @@ public class PlacementInfo implements Serializable { @JsonProperty("subscriberInfo") private SubscriberInfo subscriberInfo; @JsonProperty("placementDemands") - private List<Demand> demands = new ArrayList<Demand>(); + private List<Demand> demands = new ArrayList<>(); @JsonRawValue @JsonProperty("requestParameters") private String requestParameters; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java index f632424c26..b8896a2bab 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java @@ -40,7 +40,7 @@ public class SniroConductorRequest implements Serializable { private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class); @JsonProperty("release-locks") - private List<Resource> resources = new ArrayList<Resource>(); + private List<Resource> resources = new ArrayList<>(); public List<Resource> getResources() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java index eaf8b6e379..35a4cac459 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java @@ -22,7 +22,6 @@ package org.onap.so.client.sniro.beans; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("subscriberInfo") diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java index 8d51ceb65f..b5a8318ce9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.isA; @@ -53,6 +53,7 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.sniro.beans.SniroManagerRequest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; public class SniroHomingV2IT extends BaseIntegrationTest { @@ -107,6 +108,18 @@ public class SniroHomingV2IT extends BaseIntegrationTest { serviceInstance.getAllottedResources().add(setAllottedResource("3")); } + public void beforeServiceProxy() { + ServiceProxy sp = setServiceProxy("1", "infrastructure"); + Candidate requiredCandidate = new Candidate(); + requiredCandidate.setIdentifierType(CandidateType.CLOUD_REGION_ID); + List<String> c = new ArrayList<String>(); + c.add("testCloudRegionId"); + requiredCandidate.setCloudOwner("att"); + requiredCandidate.setIdentifiers(c); + sp.addRequiredCandidates(requiredCandidate); + serviceInstance.getServiceProxies().add(sp); + } + public void beforeVnf() { setGenericVnf(); } @@ -191,6 +204,23 @@ public class SniroHomingV2IT extends BaseIntegrationTest { verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class)); } + @Test + public void testCallSniro_success_1ServiceProxy() throws JsonProcessingException, BadResponseException { + beforeServiceProxy(); + + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( + aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); + + sniroHoming.callSniro(execution); + + String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1SP.json"); + request = request.replace("28080", wireMockPort); + + ArgumentCaptor<SniroManagerRequest> argument = ArgumentCaptor.forClass(SniroManagerRequest.class); + verify(sniroClient, times(1)).postDemands(argument.capture()); + assertEquals(request, argument.getValue().toJsonString()); + } + @Test(expected = Test.None.class) public void testProcessSolution_success_1VpnLink_1Solution() { beforeVpnBondingLink("1"); @@ -563,10 +593,57 @@ public class SniroHomingV2IT extends BaseIntegrationTest { assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size()); assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0)); assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0)); + } + + @Test + public void testProcessSolution_success_1ServiceProxy_1Solutions() { + beforeServiceProxy(); + + JSONObject asyncResponse = new JSONObject(); + asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", + "completed"); + JSONArray solution1 = new JSONArray(); + solution1 + .put(new JSONObject() + .put("serviceResourceId", "testProxyId1").put( + "solution", + new JSONObject() + .put("identifierType", "serviceInstanceId") + .put("identifiers", new JSONArray().put("testServiceInstanceId1"))) + .put("assignmentInfo", + new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) + .put(new JSONObject().put("key", "cloudOwner").put("value", "")) + .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")) + .put(new JSONObject().put("key", "aicVersion").put("value", "3")) + .put(new JSONObject().put("key", "cloudRegionId").put("value", "")) + .put(new JSONObject().put("key", "primaryPnfName").put("value", + "testPrimaryPnfName")) + .put(new JSONObject().put("key", "secondaryPnfName").put("value", + "testSecondaryPnfName")))); + + asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)) + .put("licenseSolutions", new JSONArray())); + sniroHoming.processSolution(execution, asyncResponse.toString()); + ServiceInstance si = + execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); + + ServiceProxy sp = si.getServiceProxies().get(0); + assertNotNull(sp); + assertNotNull(sp.getServiceInstance()); + + assertEquals("testServiceInstanceId1", sp.getServiceInstance().getServiceInstanceId()); + assertNotNull(sp.getServiceInstance().getSolutionInfo()); + + assertFalse(sp.getServiceInstance().getPnfs().isEmpty()); + assertEquals("testPrimaryPnfName", sp.getServiceInstance().getPnfs().get(0).getPnfName()); + assertEquals("primary", sp.getServiceInstance().getPnfs().get(0).getRole()); + assertEquals("testSecondaryPnfName", sp.getServiceInstance().getPnfs().get(1).getPnfName()); + assertEquals("secondary", sp.getServiceInstance().getPnfs().get(1).getRole()); } + @Test(expected = BpmnError.class) public void testCallSniro_error_0Resources() throws BadResponseException, JsonProcessingException { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java index a6ce88f164..c683303a41 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java @@ -21,11 +21,13 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; +import java.sql.Timestamp; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Before; @@ -84,6 +86,7 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest { Mockito.verify(reqMock, Mockito.times(1)).setRequestStatus("FAILED"); Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100)); Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN"); + Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class)); } @Test @@ -142,4 +145,19 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest { String errorMsg = (String) execution.getVariable("ErrorMessage"); assertEquals("error in test case", errorMsg); } + + @Test + public void updateRequestErrorStatusMessageTest() { + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); + WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case"); + execution.setVariable("WorkflowException", we); + + doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); + Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case"); + Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100)); + Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN"); + Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index ccd677c80e..d6485bd57f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -21,8 +21,7 @@ package org.onap.so.client.adapter.network.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.isA; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; import java.io.UnsupportedEncodingException; import java.nio.file.Files; @@ -39,7 +38,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.ProviderVlanNetwork; import org.onap.so.adapters.nwrest.RollbackNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; @@ -385,4 +383,19 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup { assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId") .ignoring("msoRequest.requestId").ignoring("networkParams")); } + + @Test + public void buildOpenstackSubnetListMultipleHostRoutesTest() throws Exception { + + ObjectMapper omapper = new ObjectMapper(); + String l3NetworkJson = + new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "l3-network-multiple-subnets.json"))); + L3Network l3Network = omapper.readValue(l3NetworkJson, L3Network.class); + + List<org.onap.so.openstack.beans.Subnet> subnets = + SPY_networkAdapterObjectMapper.buildOpenstackSubnetList(l3Network); + assertEquals("192.168.0.0/16", subnets.get(0).getHostRoutes().get(0).getPrefix()); + assertEquals("192.168.1.5/16", subnets.get(0).getHostRoutes().get(1).getPrefix()); + + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json new file mode 100644 index 0000000000..e9b25ff266 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json @@ -0,0 +1,53 @@ +{ + "network-id" : "aNetworkId", + "cascaded" : false, + "cloud-params" : { }, + "network-name" : "aNetworkName", + "neutron-network-id" : null, + "network-type" : "aNetworkType", + "network-technology" : "aNetworkTechnology", + "network-role" : "", + "is-bound-to-vpn" : false, + "service-id" : "aServiceId", + "network-role-instance" : 0, + "orchestration-status" : "ACTIVE", + "heat-stack-id" : null, + "contrail-network-fqdn" : null, + "network-policies" : [ ], + "contrail-network-route-table-references" : [ ], + "widget-model-id" : null, + "widget-model-version" : null, + "physical-network-name" : "pNetworkName", + "is-provider-network" : false, + "is-shared-network" : false, + "is-external-network" : false, + "self-link" : "/", + "operational-status" : null, + "subnets" : [ { + "subnet-id" : "subnetId1", + "subnet-name" : "aSubnetName1", + "neutron-subnet-id" : null, + "gateway-address" : "192.168.1.1", + "network-start-address" : "192.168.1.2", + "cidr-mask" : "10", + "ip-version" : "4", + "orchestration-status" : "ACTIVE", + "dhcp-enabled" : true, + "dhcp-start" : "192.168.1.2", + "dhcp-end" : "192.168.1.16", + "subnet-role" : "", + "ip-assignment-direction" : "true", + "subnet-sequence" : null, + "host-routes": [{ + "host-route-id": "hrId1", + "route-prefix": "192.168.0.0/16", + "next-hop": "192.168.1.1", + "next-hop-type": null + }, { + "host-route-id": "hrId2", + "route-prefix": "192.168.1.5/16", + "next-hop": "192.168.1.1", + "next-hop-type": null + }] + }] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json new file mode 100644 index 0000000000..27463350ab --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json @@ -0,0 +1,46 @@ +{ + "requestInfo" : { + "transactionId" : "testRequestId", + "requestId" : "testRequestId", + "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId", + "sourceId" : "mso", + "requestType" : "create", + "timeout" : 1800 + }, + "serviceInfo" : { + "modelInfo" : { + "modelName" : "testModelName1", + "modelVersionId" : "testModelUUID1", + "modelVersion" : "testModelVersion1", + "modelInvariantId" : "testModelInvariantUUID1" + }, + "serviceRole" : "testServiceRole1", + "serviceInstanceId" : "testServiceInstanceId1", + "serviceName" : "testServiceType1" + }, + "placementInfo" : { + "subscriberInfo" : { + "globalSubscriberId" : "testCustomerId", + "subscriberName" : "testCustomerName" + }, + "placementDemands" : [ { + "serviceResourceId" : "testProxyId1", + "resourceModuleName" : "testProxyInstanceName1", + "resourceModelInfo" : { + "modelName" : "testProxyModelName1", + "modelVersionId" : "testProxyModelUuid1", + "modelVersion" : "testProxyModelVersion1", + "modelInvariantId" : "testProxyModelInvariantUuid1" + }, + "requiredCandidates" : [ { + "identifierType" : "cloudRegionId", + "identifiers" : [ "testCloudRegionId" ], + "cloudOwner" : "att" + } ] + } ], + "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false} + }, + "licenseInfo" : { + "licenseDemands" : [ ] + } +}
\ No newline at end of file |