diff options
Diffstat (limited to 'models-interactions/model-actors/actor.vfc')
3 files changed, 14 insertions, 29 deletions
diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml index 7dfeb201b..10ef89f5f 100644 --- a/models-interactions/model-actors/actor.vfc/pom.xml +++ b/models-interactions/model-actors/actor.vfc/pom.xml @@ -61,12 +61,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.policy.drools-pdp</groupId> - <artifactId>policy-management</artifactId> - <version>${policy.drools-pdp.version}</version> - <scope>provided</scope> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java index 52902cb61..23eb71996 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java @@ -33,7 +33,6 @@ import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RestManager; import org.onap.policy.vfc.VfcHealActionVmInfo; import org.onap.policy.vfc.VfcHealAdditionalParams; @@ -88,7 +87,7 @@ public class VfcActorServiceProvider implements Actor { * @return the constructed request */ public static VfcRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, - Policy policy, AaiGetVnfResponse vnfResponse) { + Policy policy, AaiGetVnfResponse vnfResponse, String aaiUrl, String aaiUsername, String aaiPassword) { // Construct an VFC request VfcRequest request = new VfcRequest(); @@ -97,7 +96,7 @@ public class VfcActorServiceProvider implements Actor { AaiGetVnfResponse tempVnfResp = vnfResponse; if (tempVnfResp == null) { // if the response is null, we haven't queried // This does the AAI query since we haven't already - tempVnfResp = getAaiServiceInstance(onset); + tempVnfResp = getAaiServiceInstance(onset, aaiUrl, aaiUsername, aaiPassword); if (tempVnfResp == null) { return null; } @@ -124,14 +123,12 @@ public class VfcActorServiceProvider implements Actor { return request; } - private static AaiGetVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event) { + private static AaiGetVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event, String aaiUrl, + String aaiUsername, String aaiPassword) { AaiGetVnfResponse response = null; UUID requestId = event.getRequestId(); String vnfName = event.getAai().get("generic-vnf.vnf-name"); String vnfId = event.getAai().get("generic-vnf.vnf-id"); - String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url"); - String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username"); - String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); try { if (vnfName != null) { String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java index 5d4447b8b..80ec3476e 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java @@ -38,7 +38,6 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.simulators.Util; import org.onap.policy.vfc.VfcRequest; @@ -69,37 +68,32 @@ public class VfcActorServiceProviderTest { Policy policy = new Policy(); policy.setRecipe("GoToOz"); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, null, null, null)); onset.getAai().put("generic-vnf.vnf-id", "dorothy.gale.1939"); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, null, null, null)); - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, "http://localhost:6666", "AAI", "AAI")); UUID requestId = UUID.randomUUID(); onset.setRequestId(requestId); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, "http://localhost:6666", "AAI", "AAI")); onset.getAai().put("generic-vnf.vnf-name", "Dorothy"); - PolicyEngine.manager.getEnvironment().remove("aai.password"); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, "http://localhost:6666", "AAI", null)); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, "http://localhost:6666", "AAI", "AAI")); onset.getAai().put("service-instance.service-instance-id", ""); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null, "http://localhost:6666", "AAI", "AAI")); - assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse(), "http://localhost:6666", "AAI", "AAI")); policy.setRecipe("Restart"); - assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse(), "http://localhost:6666", "AAI", "AAI")); VfcRequest request = - VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()); + VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse(), "http://localhost:6666", "AAI", "AAI"); assertEquals(requestId, Objects.requireNonNull(request).getRequestId()); assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId()); |