From 3819d5070b2a1d4599f8f3547331869d664c2bd5 Mon Sep 17 00:00:00 2001 From: Rashmi Pujar Date: Tue, 29 Oct 2019 16:17:37 -0400 Subject: PNF support changes for drools-application Conditional checks for enrichment and validation by target-types PNF specific AAI enrichment Fixed Unit Tests Issue-ID: POLICY-1187 Signed-off-by: Rashmi Pujar Change-Id: I78bf73e454828253ca69695f9196047449b4d9d6 --- .../java/org/onap/policy/template/demo/ControlLoopFailureTest.java | 2 ++ .../java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java | 3 +++ .../java/org/onap/policy/template/demo/VdnsControlLoopTest.java | 3 +++ .../java/org/onap/policy/template/demo/VfwControlLoopCdsTest.java | 6 ++++++ .../test/java/org/onap/policy/template/demo/VfwControlLoopTest.java | 3 +++ 5 files changed, 17 insertions(+) (limited to 'controlloop/templates') diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java index 1647fa0e1..e3409146f 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java @@ -39,6 +39,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; 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; @@ -267,6 +268,7 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-id", target); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java index e69e507f4..1a5bf3982 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java @@ -35,6 +35,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; 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; @@ -231,6 +232,7 @@ public class VdnsControlLoopCqTest extends ControlLoopBase implements TopicListe event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("vserver.vserver-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("vserver.vserver-name", "Ete_vFWCLvFWSNK_7ba1fbde_0"); @@ -246,6 +248,7 @@ public class VdnsControlLoopCqTest extends ControlLoopBase implements TopicListe event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("vserver.vserver-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("vserver.vserver-name", vserverName); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java index d1453f7b1..3c658c1fd 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java @@ -35,6 +35,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; 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; @@ -263,6 +264,7 @@ public class VdnsControlLoopTest extends ControlLoopBase implements TopicListene event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("vserver.vserver-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("vserver.vserver-name", "dfw1lb01lb01"); @@ -278,6 +280,7 @@ public class VdnsControlLoopTest extends ControlLoopBase implements TopicListene event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("vserver.vserver-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("vserver.vserver-name", vserverName); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopCdsTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopCdsTest.java index 435faf25d..a86f97d05 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopCdsTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopCdsTest.java @@ -30,6 +30,7 @@ import io.grpc.stub.StreamObserver; import java.io.IOException; import java.time.Instant; import java.util.HashMap; +import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; @@ -48,6 +49,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; 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; @@ -254,12 +256,16 @@ public class VfwControlLoopCdsTest extends ControlLoopBase implements TopicListe VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); + event.setTargetType(ControlLoopTargetType.VNF); event.setTarget("generic-vnf.vnf-name"); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", "testGenericVnfID"); event.getAai().put("vserver.vserver-name", "OzVServer"); event.setClosedLoopEventStatus(status); + Map map = new HashMap<>(); + map.put("my-key", "my-value"); + event.setAdditionalEventParams(map); 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 221ef5e6b..c326da145 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 @@ -38,6 +38,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; 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; @@ -280,6 +281,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", "testGenericVnfID"); @@ -300,6 +302,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-name"); + event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", vnfId); -- cgit 1.2.3-korg