From 85b1ada7cc0883aa8b86ea6e11bf86719e1cc10e Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 24 Oct 2017 22:00:08 -0500 Subject: Fix Source/Target Lock The locking of the target is now taken care of when the operation manager is initialized. This allows us to keep the template flow the same and to ensure that for vFW we will not lock the source if it is not intended to be the target. NOTE: This will have to be revised in the future if policy chaining will support having different targets specified for each policy in the chain. Additional work was done for hardening the APPC model code to make sure exceptions are caught and we gracefully end processing the event with memory clean up and a final failure notification sent. Issue-Id: POLICY-367 Change-Id: Ic796d95eb5400067744492f810dd8069ba6241b3 Signed-off-by: Daniel Cruz Signed-off-by: daniel --- .../test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java | 1 + .../test/java/org/onap/policy/template/demo/VFWControlLoopTest.java | 3 ++- .../template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'controlloop/templates/template.demo/src/test') diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java index f18b440d7..8885a23c6 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java @@ -335,6 +335,7 @@ public class VCPEControlLoopTest implements TopicListener { LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) obj; LCMRequest appcRequest = dmaapRequest.getBody(); assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1")); + assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id")); logger.debug("\n============ APPC received the request!!! ===========\n"); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java index f73e3b39e..015798491 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java @@ -365,7 +365,7 @@ public class VFWControlLoopTest implements TopicListener { logger.debug("Rule Fired: " + notification.policyName); if ("error".equals(notification.AAI.get("generic-vnf.vnf-name"))) { assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification); - assertEquals("Exception in processing closed loop", notification.message); + assertEquals("Target vnf-id could not be found", notification.message); } else { assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification)); @@ -381,6 +381,7 @@ public class VFWControlLoopTest implements TopicListener { } else if (obj instanceof Request) { assertTrue(((Request)obj).getCommonHeader().SubRequestID.equals("1")); + assertNotNull(((Request)obj).getPayload().get("generic-vnf.vnf-id")); logger.debug("\n============ APPC received the request!!! ===========\n"); diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml index 1f3444f0e..e96c57cda 100644 --- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml +++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml @@ -12,7 +12,7 @@ policies: actor: APPC recipe: Restart target: - type: VM + type: VNF retry: 3 timeout: 30 success: final_success -- cgit 1.2.3-korg