diff options
author | daniel <dc443y@att.com> | 2017-10-24 06:33:31 -0500 |
---|---|---|
committer | daniel <dc443y@att.com> | 2017-10-24 13:16:10 -0500 |
commit | 1480d327ff8559c1d912108f7d3353fed03fcd2c (patch) | |
tree | 8745bec65ea2ee8962f42048ed0362961d0dfc60 /controlloop/common/eventmanager/src | |
parent | baea880ddf0564d81d61bf87ae7f124229bf08f0 (diff) |
Change vnf-id to vnf-name
These changes now allow a lookup of the source vnf-id
based on the onset's vnf-name.
Issue-Id: POLICY-366
Change-Id: I6f6bd500b892dddbbb9e12156b4486208309e21d
Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src')
2 files changed, 43 insertions, 7 deletions
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 1127bce3b..eeb724ad2 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 @@ -209,10 +209,12 @@ public class ControlLoopOperationManager implements Serializable { this.currentOperation = operation; if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) { - this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy); + this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, + operation.operation, this.policy, eventManager.getVnfResponse()); } else { - this.operationRequest = AppcLcmActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy); + this.operationRequest = AppcLcmActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, + operation.operation, this.policy, eventManager.getVnfResponse()); } // // Save the operation diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java index c5c0bc967..caa17ff38 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java @@ -29,6 +29,8 @@ import java.time.Instant; import java.util.HashMap; import java.util.UUID; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.aai.util.AAIException; import org.onap.policy.appclcm.LCMRequest; @@ -42,6 +44,8 @@ import org.onap.policy.controlloop.Util; import org.onap.policy.controlloop.policy.ControlLoopPolicy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.controlloop.processor.ControlLoopProcessor; +import org.onap.policy.drools.http.server.HttpServletServer; +import org.onap.policy.drools.system.PolicyEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,16 +55,32 @@ public class ControlLoopOperationManagerTest { static { onset = new VirtualControlLoopEvent(); onset.requestID = UUID.randomUUID(); - onset.target = "vserver.selflink"; + onset.target = "generic-vnf.vnf-name"; onset.closedLoopAlarmStart = Instant.now(); onset.AAI = new HashMap<>(); - onset.AAI.put("cloud-region.identity-url", "foo"); - onset.AAI.put("vserver.selflink", "bar"); - onset.AAI.put("vserver.is-closed-loop-disabled", "false"); onset.AAI.put("generic-vnf.vnf-name", "testTriggerSource"); onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET; + + /* Set environment properties */ + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); } + @BeforeClass + public static void setUpSimulator() { + try { + org.onap.policy.simulators.Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + @Test public void testRetriesFail() { // @@ -77,7 +97,14 @@ public class ControlLoopOperationManagerTest { // create the manager // ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID); - + try { + eventManager.checkEventSyntax(onset); + } + catch (ControlLoopException e) { + logger.warn(e.toString()); + fail("The onset failed the syntax check"); + } + ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager); logger.debug("{}",manager); // @@ -192,6 +219,13 @@ public class ControlLoopOperationManagerTest { // create the manager // ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID); + try { + eventManager.checkEventSyntax(onset); + } + catch (ControlLoopException e) { + logger.warn(e.toString()); + fail("The onset failed the syntax check"); + } ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager); // |