diff options
author | Charles Cole <cc847m@att.com> | 2017-10-25 10:51:42 -0500 |
---|---|---|
committer | Charles Cole <cc847m@att.com> | 2017-10-25 12:10:08 -0500 |
commit | 350d7fd09b5be5c8eff381693f5fd1d21beec4b8 (patch) | |
tree | 2f6aea915505b345a0d03431df178eee624e04d1 /controlloop/common/eventmanager/src/main | |
parent | 85b1ada7cc0883aa8b86ea6e11bf86719e1cc10e (diff) |
Ensure no AAI lookup on subsequent onset
Decoupled checking AAI data from checking an event's syntax so that new
onsets can check both while all other events can just check the syntax.
Issue-Id: POLICY-371
Change-Id: Ic76b1335b389bbec47ff0d29485ccbb249d5f18c
Signed-off-by: Charles Cole <cc847m@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r-- | controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java | 23 |
1 files changed, 14 insertions, 9 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 2a5a3d0a9..d320b75ee 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 @@ -149,6 +149,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { // Syntax check the event // checkEventSyntax(event); + checkEventAAISyntax(event); // // At this point we are good to go with this event // @@ -183,6 +184,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { // Syntax check the event // checkEventSyntax(event); + checkEventAAISyntax(event); // // Check the YAML @@ -535,6 +537,18 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (event.closedLoopEventStatus == ControlLoopEventStatus.ABATED) { return; } + if (event.target == null || event.target.length() < 1) { + throw new ControlLoopException("No target field"); + } else if (! "VM_NAME".equalsIgnoreCase(event.target) && + ! "VNF_NAME".equalsIgnoreCase(event.target) && + ! "vserver.vserver-name".equalsIgnoreCase(event.target) && + ! "generic-vnf.vnf-id".equalsIgnoreCase(event.target) && + ! "generic-vnf.vnf-name".equalsIgnoreCase(event.target) ) { + throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME"); + } + } + + public void checkEventAAISyntax(VirtualControlLoopEvent event) throws ControlLoopException { if (event.AAI == null) { throw new ControlLoopException("AAI is null"); } @@ -585,15 +599,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } else if (isClosedLoopDisabled(event)) { throw new ControlLoopException("is-closed-loop-disabled is set to true"); } - if (event.target == null || event.target.length() < 1) { - throw new ControlLoopException("No target field"); - } 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"); - } } public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) { |