From e126a975d8c6f3970dbf87ead79fa69afe510301 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 11 Sep 2017 14:42:59 -0500 Subject: Add Support for Locking VNF Target Types Fixed the target lock to support vnf target_types. Generic-vnf.vnf-id and generic-vnf.vnf-name are also supported when retrieving the target instance from the onset. These changes are relfected in the vFW and vCPE junits as they now work with VNF target types. Issue-ID: POLICY-222 Change-Id: I92abeb02c769d35f3a9912cce6eaaec4c9cc8efb Signed-off-by: Daniel Cruz --- .../org/onap/policy/template/demo/VCPEControlLoopTest.java | 9 ++++----- .../java/org/onap/policy/template/demo/VFWControlLoopTest.java | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'controlloop/templates/template.demo/src/test/java') 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 a34ee6cd1..182e39828 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 @@ -294,7 +294,7 @@ public class VCPEControlLoopTest { /* * One final check to make sure the lock is released */ - assertFalse(PolicyGuard.isLocked(TargetType.VM, triggerSourceName, requestID)); + assertFalse(PolicyGuard.isLocked(TargetType.VNF, triggerSourceName, requestID)); } else { fail("Operation Denied by Guard"); @@ -389,13 +389,12 @@ public class VCPEControlLoopTest { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.closedLoopControlName = policy.getControlLoop().getControlLoopName(); event.requestID = requestID; - event.target = "vserver.vserver-name"; + event.target = "generic-vnf.vnf-id"; event.closedLoopAlarmStart = Instant.now(); event.AAI = new HashMap<>(); event.AAI.put("cloud-region.identity-url", "foo"); event.AAI.put("vserver.selflink", "bar"); event.AAI.put("vserver.is-closed-loop-disabled", "false"); - event.AAI.put("vserver.vserver-name", "testGenericVnfName"); event.AAI.put("generic-vnf.vnf-id", "testGenericVnfId"); event.closedLoopEventStatus = ControlLoopEventStatus.ONSET; kieSession.insert(event); @@ -415,14 +414,14 @@ public class VCPEControlLoopTest { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.closedLoopControlName = policy.getControlLoop().getControlLoopName(); event.requestID = requestID; - event.target = "vserver.vserver-name"; + event.target = "generic-vnf.vnf-id"; event.closedLoopAlarmStart = Instant.now().minusSeconds(5); event.closedLoopAlarmEnd = Instant.now(); event.AAI = new HashMap<>(); event.AAI.put("cloud-region.identity-url", "foo"); event.AAI.put("vserver.selflink", "bar"); event.AAI.put("vserver.is-closed-loop-disabled", "false"); - event.AAI.put("generic-vnf.vnf-name", "testGenericVnfName"); + event.AAI.put("generic-vnf.vnf-id", "testGenericVnfId"); event.closedLoopEventStatus = ControlLoopEventStatus.ABATED; kieSession.insert(event); } 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 25920e8b5..e2b688d5d 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 @@ -289,7 +289,7 @@ public class VFWControlLoopTest { /* * One final check to make sure the lock is released */ - assertFalse(PolicyGuard.isLocked(TargetType.VM, triggerSourceName, requestID)); + assertFalse(PolicyGuard.isLocked(TargetType.VNF, triggerSourceName, requestID)); } else { fail("Operation Denied by Guard"); @@ -384,13 +384,13 @@ public class VFWControlLoopTest { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.closedLoopControlName = policy.getControlLoop().getControlLoopName(); event.requestID = requestID; - event.target = "vserver.vserver-name"; + event.target = "generic-vnf.vnf-id"; event.closedLoopAlarmStart = Instant.now(); event.AAI = new HashMap<>(); event.AAI.put("cloud-region.identity-url", "foo"); event.AAI.put("vserver.selflink", "bar"); event.AAI.put("vserver.is-closed-loop-disabled", "false"); - event.AAI.put("vserver.vserver-name", "testGenericVnfName"); + event.AAI.put("generic-vnf.vnf-id", "testGenericVnfID"); event.closedLoopEventStatus = ControlLoopEventStatus.ONSET; kieSession.insert(event); Thread.sleep(2000); @@ -409,14 +409,14 @@ public class VFWControlLoopTest { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.closedLoopControlName = policy.getControlLoop().getControlLoopName(); event.requestID = requestID; - event.target = "vserver.vserver-name"; + event.target = "generic-vnf.vnf-id"; event.closedLoopAlarmStart = Instant.now().minusSeconds(5); event.closedLoopAlarmEnd = Instant.now(); event.AAI = new HashMap<>(); event.AAI.put("cloud-region.identity-url", "foo"); event.AAI.put("vserver.selflink", "bar"); event.AAI.put("vserver.is-closed-loop-disabled", "false"); - event.AAI.put("generic-vnf.vnf-name", "testGenericVnfName"); + event.AAI.put("generic-vnf.vnf-id", "testGenericVnfID"); event.closedLoopEventStatus = ControlLoopEventStatus.ABATED; kieSession.insert(event); } -- cgit 1.2.3-korg