diff options
author | Charles Cole <cc847m@att.com> | 2017-10-24 09:31:03 -0500 |
---|---|---|
committer | Charles Cole <cc847m@att.com> | 2017-10-24 10:02:35 -0500 |
commit | baea880ddf0564d81d61bf87ae7f124229bf08f0 (patch) | |
tree | 39e77eecf6a376a4ae9c0fece9f7d6625351369f /controlloop/common/eventmanager/src/main/java | |
parent | d0bbf403e259c97cd174fd3deebcb6ab5796cc61 (diff) |
Ensure no AAI lookup on abatements
Changed check event syntax in the event manager so that it only looks
for AAI info if the event is an onset.
Issue-Id: POLICY-368
Change-Id: I241e9a110cc5fc4553a5e9cd842d51f76a800368
Signed-off-by: Charles Cole <cc847m@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main/java')
-rw-r--r-- | controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java | 67 |
1 files changed, 34 insertions, 33 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 9b2960e42..91db147c8 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,48 +531,51 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (event.requestID == null) { throw new ControlLoopException("No request ID"); } + if (event.closedLoopEventStatus == ControlLoopEventStatus.ABATED) { + return; + } if (event.AAI == null) { throw new ControlLoopException("AAI is null"); } if (event.AAI.get("generic-vnf.vnf-id") == null && event.AAI.get("vserver.vserver-name") == null && - event.AAI.get("generic-vnf.vnf-name") == null) { + event.AAI.get("generic-vnf.vnf-name") == null) { throw new ControlLoopException("generic-vnf.vnf-id or generic-vnf.vnf-name or vserver.vserver-name information missing"); } if (event.AAI.get("vserver.is-closed-loop-disabled") == null) { try { if (event.AAI.get("generic-vnf.vnf-id") != null) { - vnfResponse = getAAIVnfInfo(event); - if (vnfResponse == null) { - throw new ControlLoopException("AAI Response is null (query by vnf-id)"); - } - if (vnfResponse.requestError != null) { - throw new ControlLoopException("AAI Responded with a request error (query by vnf-id)"); - } - if (isClosedLoopDisabled(vnfResponse) == true) { - throw new ControlLoopException("is-closed-loop-disabled is set to true"); - } + vnfResponse = getAAIVnfInfo(event); + if (vnfResponse == null) { + throw new ControlLoopException("AAI Response is null (query by vnf-id)"); + } + if (vnfResponse.requestError != null) { + throw new ControlLoopException("AAI Responded with a request error (query by vnf-id)"); + } + if (isClosedLoopDisabled(vnfResponse) == true) { + throw new ControlLoopException("is-closed-loop-disabled is set to true"); + } } else if (event.AAI.get("generic-vnf.vnf-name") != null) { - vnfResponse = getAAIVnfInfo(event); - if (vnfResponse == null) { - throw new ControlLoopException("AAI Response is null (query by vnf-name)"); - } - if (vnfResponse.requestError != null) { - throw new ControlLoopException("AAI Responded with a request error (query by vnf-name)"); - } - if (isClosedLoopDisabled(vnfResponse) == true) { + vnfResponse = getAAIVnfInfo(event); + if (vnfResponse == null) { + throw new ControlLoopException("AAI Response is null (query by vnf-name)"); + } + if (vnfResponse.requestError != null) { + throw new ControlLoopException("AAI Responded with a request error (query by vnf-name)"); + } + if (isClosedLoopDisabled(vnfResponse) == true) { throw new ControlLoopException("is-closed-loop-disabled is set to true"); - } + } } else if (event.AAI.get("vserver.vserver-name") != null) { - vserverResponse = getAAIVserverInfo(event); - if (vserverResponse == null) { - throw new ControlLoopException("AAI Response is null (query by vserver-name)"); - } - if (vserverResponse.requestError != null) { - throw new ControlLoopException("AAI responded with a request error (query by vserver-name)"); - } - if (isClosedLoopDisabled(vserverResponse) == true) { + vserverResponse = getAAIVserverInfo(event); + if (vserverResponse == null) { + throw new ControlLoopException("AAI Response is null (query by vserver-name)"); + } + if (vserverResponse.requestError != null) { + throw new ControlLoopException("AAI responded with a request error (query by vserver-name)"); + } + if (isClosedLoopDisabled(vserverResponse) == true) { throw new ControlLoopException("is-closed-loop-disabled is set to true"); - } + } } } catch (Exception e) { logger.error("Exception from getAAIInfo: ", e); @@ -583,14 +586,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } if (event.target == null || event.target.length() < 1) { throw new ControlLoopException("No target field"); - } else { - if (! event.target.equalsIgnoreCase("VM_NAME") && + } else 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"); - } + throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME"); } } |