diff options
Diffstat (limited to 'bpmn')
10 files changed, 298 insertions, 80 deletions
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 100887dbbc..729f5c95c4 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 @@ -244,9 +244,9 @@ public class ExceptionBuilder { public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { logger.debug("Processing Audit Results"); String auditListString = (String) execution.getVariable("auditInventoryResult"); + String processKey = getProcessKey(execution.getDelegateExecution()); 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); @@ -302,7 +302,13 @@ public class ExceptionBuilder { } } else { - logger.debug("Unable to process audit results due to auditInventoryResult being null"); + String errorMessage = "Unable to process audit results due to auditInventoryResult being null"; + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index de44caa120..525307a5df 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -1,22 +1,22 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T 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========================================================= - */ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T 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.scripts @@ -32,6 +32,7 @@ import org.junit.runner.RunWith import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.HttpClient import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient @@ -47,54 +48,56 @@ abstract class MsoGroovyTest { @Rule public ExpectedException thrown = ExpectedException.none() - protected ExecutionEntity mockExecution - protected AAIResourcesClient client + protected ExecutionEntity mockExecution + protected AAIResourcesClient client protected AllottedResourceUtils allottedResourceUtils_MOCK - protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA = - FileUtil.readResourceFile("__files/aai/searchResults.json") - protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); - - protected void init(String procName){ - mockExecution = setupMock(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - client = mock(AAIResourcesClient.class) - } - - protected ExecutionEntity setupMock(String procName) { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn(procName) - - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - - return mockExecution - } - - protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("prefix")).thenReturn(prefix) - - ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) - RepositoryService repositoryService = mock(RepositoryService.class) - ProcessDefinition processDefinition = mock(ProcessDefinition.class) - - when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) - when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) - when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) - when(processDefinition.getKey()).thenReturn(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - return mockExecution - } - + protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA = + FileUtil.readResourceFile("__files/aai/searchResults.json") + protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); + + protected void init(String procName){ + mockExecution = setupMock(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + client = mock(AAIResourcesClient.class) + } + + protected ExecutionEntity setupMock(String procName) { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(procName) + + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + + HttpClient httpClient = mock(HttpClient.class) + + return mockExecution + } + + protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) + RepositoryService repositoryService = mock(RepositoryService.class) + ProcessDefinition processDefinition = mock(ProcessDefinition.class) + + when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) + when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) + when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) + when(processDefinition.getKey()).thenReturn(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + return mockExecution + } + protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){ String json = FileUtil.readResourceFile(file) AAIResultWrapper resultWrapper = new AAIResultWrapper(json) 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 18ba91263b..15f8c5e4ef 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 @@ -80,6 +80,16 @@ public class AAIDeleteTasks { @Autowired private AAIInstanceGroupResources aaiInstanceGroupResources; + /** + * BPMN access method to delete the VfModule from A&AI. + * + * It will extract the genericVnf & VfModule from the BBObject. + * + * Before deleting it set the aaiVfModuleRollback as false & then it will delete the VfModule. + * + * @param execution + * @throws Exception + */ public void deleteVfModule(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -89,10 +99,21 @@ public class AAIDeleteTasks { aaiVfModuleResources.deleteVfModule(vfModule, genericVnf); execution.setVariable("aaiVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVfModule process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Vnf from A&AI. + * + * It will extract the genericVnf from the BBObject. + * + * Before deleting it set the aaiVnfRollback as false & then it will delete the Vnf. + * + * @param execution + * @throws Exception + */ public void deleteVnf(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -101,79 +122,154 @@ public class AAIDeleteTasks { aaiVnfResources.deleteVnf(genericVnf); execution.setVariable("aaiVnfRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the ServiceInstance from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * @param execution + * @throws Exception + */ public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiSIResources.deleteServiceInstance(serviceInstance); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteServiceInstance process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the l3network from A&AI. + * + * It will extract the l3network from the BBObject. + * + * After deleting the l3network it set the isRollbackNeeded as true. + * + * @param execution + * @throws Exception + */ public void deleteNetwork(BuildingBlockExecution execution) throws Exception { try { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.deleteNetwork(l3network); execution.setVariable("isRollbackNeeded", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteNetwork process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Collection from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * Then it will get the collection from serviceinstance. + * + * @param execution + * @throws Exception + */ public void deleteCollection(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteCollection(serviceInstance.getCollection()); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteCollection process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the InstanceGroup from A&AI. + * + * It will extract the serviceInstance from the BBObject. + * + * Then it will get the Instance group from serviceInstance. + * + * @param execution + * @throws Exception + */ public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception { try { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroup process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the VolumeGroup from A&AI. + * + * It will extract the volumeGroup from the BBObject and cloudRegion from execution object . + * + * Then it will delete from A&AI. + * + * @param execution + * @throws Exception + */ public void deleteVolumeGroup(BuildingBlockExecution execution) { try { VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion(); aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteVolumeGroup process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the Configuration from A&AI. + * + * It will extract the configuration from the BBObject. + * + * Then it will delete from A&AI. + * + * @param execution + */ public void deleteConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.deleteConfiguration(configuration); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * BPMN access method to delete the InstanceGroupVnf from A&AI. + * + * It will extract the instanceGroup from the BBObject. + * + * Then it will delete from A&AI. + * + * @param execution + */ public void deleteInstanceGroupVnf(BuildingBlockExecution execution) { try { InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); } catch (Exception ex) { + logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void deleteNetworkPolicies(BuildingBlockExecution execution) { try { String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 20f4443291..86645391b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -92,6 +92,7 @@ public class AAIUpdateTasks { OrchestrationStatus.ASSIGNED); execution.setVariable("aaiServiceInstanceRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -108,6 +109,7 @@ public class AAIUpdateTasks { aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -122,6 +124,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -136,6 +139,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -155,6 +159,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -174,6 +179,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -193,6 +199,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -215,6 +222,7 @@ public class AAIUpdateTasks { aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVolumeGroup", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -231,6 +239,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -247,6 +256,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.PENDING_ACTIVATION); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -273,6 +283,9 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); } } catch (Exception ex) { + logger.error( + "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -281,7 +294,7 @@ public class AAIUpdateTasks { * BPMN access method to update status of VfModule to Created in AAI * * @param execution - * + * */ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { try { @@ -289,6 +302,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -307,6 +321,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED); execution.setVariable("aaiDeactivateVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -346,6 +361,7 @@ public class AAIUpdateTasks { L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); updateNetworkAAI(l3Network, status); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -386,6 +402,7 @@ public class AAIUpdateTasks { aaiCollectionResources.updateCollection(copiedNetworkCollection); execution.setVariable("aaiNetworkCollectionActivateRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveNetworkCollection", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -403,6 +420,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); execution.setVariable("aaiActivateVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -423,6 +441,7 @@ public class AAIUpdateTasks { vfModule.setHeatStackId(heatStackId); aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -466,6 +485,7 @@ public class AAIUpdateTasks { execution.setVariable("aaiNetworkActivateRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetworkCreated", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -495,6 +515,7 @@ public class AAIUpdateTasks { } } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateNetworkUpdated", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -509,6 +530,7 @@ public class AAIUpdateTasks { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.updateNetwork(l3network); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateObjectNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -524,6 +546,7 @@ public class AAIUpdateTasks { extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiServiceInstanceResources.updateServiceInstance(serviceInstance); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -538,6 +561,7 @@ public class AAIUpdateTasks { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateObjectVnf(genericVnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateObjectVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -559,6 +583,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); execution.setVariable("aaiDeleteVfModuleRollback", true); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeleteVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -574,6 +599,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateModelVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -589,6 +615,7 @@ public class AAIUpdateTasks { aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignFabricConfiguration", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -603,6 +630,8 @@ public class AAIUpdateTasks { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateFabricConfiguration", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -618,6 +647,8 @@ public class AAIUpdateTasks { aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateFabricConfiguration", + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -640,6 +671,7 @@ public class AAIUpdateTasks { aaiVnfResources.updateObjectVnf(copiedGenericVnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateIpv4OamAddressVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -662,6 +694,7 @@ public class AAIUpdateTasks { aaiVnfResources.updateObjectVnf(copiedGenericVnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateManagementV6AddressVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -681,6 +714,7 @@ public class AAIUpdateTasks { aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf); } } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateContrailServiceInstanceFqdnVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -695,6 +729,7 @@ public class AAIUpdateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigAssignedVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } @@ -704,12 +739,13 @@ public class AAIUpdateTasks { * * @param execution */ - public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) { + public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -720,12 +756,13 @@ public class AAIUpdateTasks { * * @param execution */ - public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) { + public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED); } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } 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 cdbe0db57c..6a8058938f 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 @@ -62,7 +62,7 @@ public class ConfigDeployVnf { * @param execution */ public void updateAAIConfigure(BuildingBlockExecution execution) { - aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution); + aaiUpdateTask.updateOrchestrationStatusConfigDeployConfigureVnf(execution); } @@ -129,7 +129,7 @@ public class ConfigDeployVnf { * @param execution */ public void updateAAIConfigured(BuildingBlockExecution execution) { - aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution); + aaiUpdateTask.updateOrchestrationStatusConfigDeployConfiguredVnf(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java index e51774c12c..0afca71b99 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java @@ -30,12 +30,15 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component() public class UnassignVnf { + private static final Logger logger = LoggerFactory.getLogger(UnassignVnf.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -45,6 +48,17 @@ public class UnassignVnf { @Autowired private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator; + /** + * BPMN access method to deleting instanceGroup in AAI. + * + * It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list. + * + * Then iterate that list and check the ModelInfoInstanceGroup type. + * + * Then it will delete that. + * + * @param execution + */ public void deleteInstanceGroups(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -56,6 +70,7 @@ public class UnassignVnf { } } } catch (Exception ex) { + logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } 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 b85e33144f..f61b40ad23 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 @@ -52,6 +52,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCVnfResources sdncVnfResources; @@ -66,6 +67,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for activate the vnf. + * + * @param execution + */ public void activateVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -82,13 +90,14 @@ public class SDNCActivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCActivateTasks activateVnf process", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to perform Assign action on SDNC for L3Network - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -112,6 +121,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask { } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for activate the activateVfModule. + * + * @param execution + */ public void activateVfModule(BuildingBlockExecution execution) { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); @@ -131,6 +147,7 @@ public class SDNCActivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", 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 3c42f76d73..96b656ff95 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 @@ -53,6 +53,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @@ -69,6 +70,12 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate + * VfModule. + * + * @param execution + */ public void deactivateVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -86,13 +93,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf - * + * * @param execution * @throws Exception */ @@ -113,15 +121,16 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /* * BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance - * + * * @param execution - * + * * @throws Exception */ public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception { @@ -138,13 +147,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.SERVICE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } /** * BPMN access method to invoke deactivate on a L3Network object - * + * * @param execution */ public void deactivateNetwork(BuildingBlockExecution execution) { @@ -163,6 +173,7 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.NETWORK); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } 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 e3c9785ab2..4817ba8b61 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 @@ -53,6 +53,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks extends AbstractSDNCTask { + private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @@ -69,6 +70,13 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the ServiceInstance. + * + * @param execution + */ public void unassignServiceInstance(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -83,10 +91,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.SERVICE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignServiceInstance", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the VfModule. + * + * @param execution + */ public void unassignVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -102,10 +118,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the Vnf. + * + * @param execution + */ public void unassignVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -122,10 +146,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.VNF); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + /** + * This method is used to prepare a SDNC request and set it to the execution Object. + * + * Which is used for unassign the Network. + * + * @param execution + */ public void unassignNetwork(BuildingBlockExecution execution) throws Exception { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -144,6 +176,7 @@ public class SDNCUnassignTasks extends AbstractSDNCTask { sdncRequest.setTopology(SDNCTopology.NETWORK); execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { + logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 905f244278..c337f7f1b5 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -733,7 +733,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE); - aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution); + aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfigureVnf(execution); } @Test @@ -741,6 +741,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED); - aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution); + aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfiguredVnf(execution); } } |