aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo/src
diff options
context:
space:
mode:
authordaniel <dc443y@att.com>2017-09-11 14:42:59 -0500
committerdaniel <dc443y@att.com>2017-09-11 15:50:32 -0500
commite126a975d8c6f3970dbf87ead79fa69afe510301 (patch)
tree037f6d44e55dd908021e72d5232a11ce41d46944 /controlloop/templates/template.demo/src
parent8d338012d725cb16ebdbff0eb3ff7f47ad08f6d1 (diff)
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 <dc443y@att.com>
Diffstat (limited to 'controlloop/templates/template.demo/src')
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java9
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java10
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml2
3 files changed, 10 insertions, 11 deletions
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);
}
diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
index e78b1ca33..d15c46126 100644
--- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vFW.yaml
@@ -17,7 +17,7 @@ policies:
recipe: ModifyConfig
target:
resourceID: Eace933104d443b496b8.nodes.heat.vpg
- type: VM
+ type: VNF
retry: 0
timeout: 300
success: final_success