aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java8
-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
4 files changed, 18 insertions, 11 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index b61eabc4b..0fe97bca9 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -531,6 +531,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (! event.target.equalsIgnoreCase("VM_NAME") &&
! event.target.equalsIgnoreCase("VNF_NAME") &&
! event.target.equalsIgnoreCase("vserver.vserver-name") &&
+ ! event.target.equalsIgnoreCase("generic-vnf.vnf-id") &&
! event.target.equalsIgnoreCase("generic-vnf.vnf-name") ) {
throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME");
}
@@ -556,9 +557,16 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
case PNF:
break;
case VM:
+ case VNF:
if (this.onset.target.equalsIgnoreCase("vserver.vserver-name")) {
return this.onset.AAI.get("vserver.vserver-name");
}
+ else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-id")) {
+ return this.onset.AAI.get("generic-vnf.vnf-id");
+ }
+ else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) {
+ return this.onset.AAI.get("generic-vnf.vnf-name");
+ }
break;
default:
break;
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