From 1772b3793ef4e46f30290480d5b911c2f04e8c3d Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 3 Nov 2017 10:39:23 -0500 Subject: 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 --- .../controlloop/eventmanager/ControlLoopEventManager.java | 11 +++++++++-- .../controlloop/eventmanager/ControlLoopOperationManager.java | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'controlloop/common/eventmanager') 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 b1674206b..4adcff048 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 @@ -560,7 +560,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public void queryAai(VirtualControlLoopEvent event) throws AAIException { - if (event.AAI.get("vserver.is-closed-loop-disabled") == null) { + if (event.AAI.get("vserver.is-closed-loop-disabled") == null && + event.AAI.get("generic-vnf.is-closed-loop-disabled") == null) { try { if (event.AAI.get("generic-vnf.vnf-id") != null) { vnfResponse = getAAIVnfInfo(event); @@ -635,7 +636,13 @@ public class ControlLoopEventManager implements LockCallback, Serializable { "yes".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled")) || "Y".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled"))) { return true; - } + } + else if ("true".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) || + "T".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) || + "yes".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) || + "Y".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled"))) { + return true; + } return false; } diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index cebdc1e9a..26a82fe57 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -144,6 +144,14 @@ public class ControlLoopOperationManager implements Serializable { return virtualOnset.AAI.get("generic-vnf.vnf-id"); } else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) { + /* + * If the onset is enriched with the vnf-id, + * we don't need an A&AI response + */ + if (virtualOnset.AAI.containsKey("generic-vnf.vnf-id")) { + return virtualOnset.AAI.get("generic-vnf.vnf-id"); + } + /* * If the vnf-name was retrieved from the onset then the vnf-id * must be obtained from the event manager's A&AI GET query -- cgit 1.2.3-korg