aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-10 15:45:55 -0500
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-10 15:46:22 -0500
commit91abe4d991457ecb2119edd8cacb7f5fdfcaf741 (patch)
treecb362a299783206f2d488a3bb6e9da7c343b020a
parent533311a4934838b67ffd0ca49d7958f69059bccd (diff)
fixed aai response code in updateAAIVfModule
Added PUAAIVfMod_updateVfModuleResponseCode to be set to execution Added responseCode verification in unit tests Set UAAIVfMod_updateVfModuleResponseCode Change-Id: I0d429388ff49ae78241ad1b0f33815a80f749061 Issue-ID: SO-1313 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy3
3 files changed, 12 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index 8f0e481c9a..15f00ac25f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -223,7 +223,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
client.update(uri, vfModule)
-
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 200)
// Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for
// backward compatibilty, the heat-stack-id is an output
execution.setVariable('PUAAIVfMod_outVfModule', vfModule)
@@ -238,9 +238,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
msoLogger.trace('Exited ' + method)
} catch (BpmnError e) {
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
throw e;
} catch (Exception e) {
msoLogger.error(e)
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
index a6568fb80a..3c4edd21ca 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
@@ -184,11 +184,17 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
try {
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
getAAIClient().update(resourceUri, payload)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success")
}catch(NotFoundException ignored){
msoLogger.debug("VF-Module not found!!")
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 404)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', ignored.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "vf-module " + vfModuleId + " not found for under vnf " + vnfId + " in A&AI!")
}
catch(Exception ex){
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Exception occurred while executing AAI PATCH:' + ex.getMessage())
}
} catch (BpmnError e) {
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index cb9bb5c541..2d2f58b415 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -113,6 +113,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
doNothing().when(client).update(isA(AAIResourceUri.class), anyObject())
updateAAIVfModule.updateVfModule(mockExecution)
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200)
}
@Test
@@ -128,6 +129,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404)
}
@@ -144,6 +146,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500)
}
}