summaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo/src/test
diff options
context:
space:
mode:
authordaniel <dc443y@att.com>2017-11-03 10:39:23 -0500
committerdaniel <dc443y@att.com>2017-11-03 10:45:07 -0500
commit1772b3793ef4e46f30290480d5b911c2f04e8c3d (patch)
tree6df5518bef78aea74d70801fd253061628346dad /controlloop/templates/template.demo/src/test
parentada3bb2cc99f741504476c7f43cc20f8dacf23e3 (diff)
Fix Generic VNF isClosedLoopDisabled
No A&AI queries will be done for enriched events. The event manager now understands prepended "generic-vnf." in front of is-closed-loop-disabled from DCAE onsets. A test case was revised to include sample data from an enriched onset with vnf data based on the VES documentation. Issue-Id: POLICY-350 Change-Id: Id7f59f8b860b9f147087067a2a9a7766f167f7e4 Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/templates/template.demo/src/test')
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java23
1 files changed, 18 insertions, 5 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 55812f154..377cff465 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
@@ -41,9 +41,11 @@ import org.onap.policy.appclcm.LCMResponse;
import org.onap.policy.appclcm.LCMResponseWrapper;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopNotificationType;
+import org.onap.policy.controlloop.ControlLoopTargetType;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.event.comm.Topic.CommInfrastructure;
import org.onap.policy.drools.event.comm.TopicEndpoint;
import org.onap.policy.drools.event.comm.TopicListener;
@@ -148,8 +150,7 @@ public class VCPEControlLoopTest implements TopicListener {
* receive from DCAE to kick off processing through
* the rules
*/
- sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET);
-
+ sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "vCPEInfraVNF13", true);
kieSession.fireUntilHalt();
@@ -187,7 +188,7 @@ public class VCPEControlLoopTest implements TopicListener {
* receive from DCAE to kick off processing through
* the rules
*/
- sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "getFail");
+ sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "getFail", false);
kieSession.fireUntilHalt();
@@ -319,7 +320,7 @@ public class VCPEControlLoopTest implements TopicListener {
kieSession.halt();
}
else {
- assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.notification);
kieSession.halt();
}
}
@@ -376,14 +377,26 @@ public class VCPEControlLoopTest implements TopicListener {
kieSession.insert(event);
}
- protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vnfName) {
+ protected void sendEvent(ControlLoopPolicy policy, UUID requestID,
+ ControlLoopEventStatus status, String vnfName, boolean isEnriched) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
event.target = "generic-vnf.vnf-name";
+ event.target_type = ControlLoopTargetType.VNF;
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
event.AAI.put("generic-vnf.vnf-name", vnfName);
+ if (isEnriched) {
+ event.AAI.put("generic-vnf.in-maint", "false");
+ event.AAI.put("generic-vnf.is-closed-loop-disabled", "false");
+ event.AAI.put("generic-vnf.orchestration-status", "Created");
+ event.AAI.put("generic-vnf.prov-status", "PREPROV");
+ event.AAI.put("generic-vnf.resource-version", "1");
+ event.AAI.put("generic-vnf.service-id", "e8cb8968-5411-478b-906a-f28747de72cd");
+ event.AAI.put("generic-vnf.vnf-id", "63b31229-9a3a-444f-9159-04ce2dca3be9");
+ event.AAI.put("generic-vnf.vnf-type", "vCPEInfraService10/vCPEInfraService10 0");
+ }
event.closedLoopEventStatus = status;
kieSession.insert(event);
}