diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-04-05 21:07:07 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-04-08 10:42:22 -0400 |
commit | ada55be1b59899e461dc5177782e381f89cbc407 (patch) | |
tree | 7bdb3eb5fe44e166a75a3333bf81f2293a3585de /models-interactions/model-actors | |
parent | eb7127ac85b3df30a09277721a5f9271033843e7 (diff) |
Remove drools PDP dependency
Removing working memory and use of PolicyEngine from
drools in these classes.
Cleaned up some unused imports and checkstyle.
Issue-ID: POLICY-1264
Change-Id: Id059da9689a721b0eafc6b310adcbdad43574ce7
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors')
17 files changed, 35 insertions, 125 deletions
diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml index a6da5ee23..c9f7dc144 100644 --- a/models-interactions/model-actors/actor.appc/pom.xml +++ b/models-interactions/model-actors/actor.appc/pom.xml @@ -76,11 +76,5 @@ <version>${policy.common.version}</version> <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> </dependencies> </project> diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java index e1fdd395a..fc57d50ef 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java @@ -45,7 +45,6 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.Target; import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.simulators.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,11 +94,6 @@ public class AppcServiceProviderTest { policy.setRetry(2); policy.setTimeout(300); - /* Set environment properties */ - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - } /** diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml index fd62e70fb..0fa3498a3 100644 --- a/models-interactions/model-actors/actor.appclcm/pom.xml +++ b/models-interactions/model-actors/actor.appclcm/pom.xml @@ -66,10 +66,9 @@ <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> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.8.1</version> </dependency> <dependency> <groupId>org.onap.policy.models.policy-models-interactions</groupId> diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java index 5768cd12a..21cce2fd6 100644 --- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java @@ -24,7 +24,6 @@ package org.onap.policy.controlloop.actor.appclcm; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; - import java.util.AbstractMap; import java.util.AbstractMap.SimpleEntry; import java.util.Collections; @@ -32,7 +31,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - import org.onap.policy.aai.AaiManager; import org.onap.policy.aai.AaiNqInstanceFilters; import org.onap.policy.aai.AaiNqInventoryResponseItem; @@ -52,7 +50,6 @@ 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.controlloop.policy.PolicyResult; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RestManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -144,7 +141,8 @@ public class AppcLcmActorServiceProvider implements Actor { * @return the target entities vnf id to act upon * @throws AaiException it an error occurs */ - public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AaiException { + public static String vnfNamedQuery(String resourceId, String sourceVnfId, String aaiUrl, + String aaiUser, String aaiPassword) throws AaiException { // TODO: This request id should not be hard coded in future releases UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); @@ -163,9 +161,8 @@ public class AppcLcmActorServiceProvider implements Actor { aaiRequest.setInstanceFilters(new AaiNqInstanceFilters()); aaiRequest.getInstanceFilters().getInstanceFilter().add(filter); - AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(getPeManagerEnvProperty("aai.url"), - getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiRequest, - requestId); + AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(aaiUrl, + aaiUser, aaiPassword, aaiRequest, requestId); if (aaiResponse == null) { throw new AaiException("The named query response was null"); @@ -341,20 +338,4 @@ public class AppcLcmActorServiceProvider implements Actor { } return new AbstractMap.SimpleEntry<>(result, message); } - - /** - * This method reads and validates environmental properties coming from the policy engine. Null - * properties cause an {@link IllegalArgumentException} runtime exception to be thrown - * - * @param enginePropertyName the name of the parameter to retrieve - * @return the property value - */ - private static String getPeManagerEnvProperty(String enginePropertyName) { - String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); - if (enginePropertyValue == null) { - throw new IllegalArgumentException("The value of policy engine manager environment property \"" - + enginePropertyName + "\" may not be null"); - } - return enginePropertyValue; - } } diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java index daf1af711..61394f2ab 100644 --- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java @@ -24,7 +24,7 @@ package org.onap.policy.controlloop.actor.appclcm; import com.google.common.collect.Lists; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; class AppcLcmRecipeFormatter { diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java index 39cdc43ab..da95611d4 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java @@ -49,7 +49,6 @@ import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.controlloop.policy.Target; import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.simulators.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -116,11 +115,6 @@ public class AppcLcmActorServiceProviderTest { dmaapResponse.setRpcName(policy.getRecipe().toLowerCase()); dmaapResponse.setType("response"); - /* Set environment properties */ - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - /* A sample APPC LCM request. */ LcmRequest appcRequest = new LcmRequest(); @@ -317,7 +311,8 @@ public class AppcLcmActorServiceProviderTest { String resourceId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; String targetVnfId = null; try { - targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01"); + targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01", + "http://localhost:6666", "AAI", "AAI"); } catch (AaiException e) { logger.warn(e.toString()); fail("no vnf-id found"); diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml index 225ba0d76..b4e68c480 100644 --- a/models-interactions/model-actors/actor.sdnc/pom.xml +++ b/models-interactions/model-actors/actor.sdnc/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.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java index 4de3ed96b..26e3f4e1e 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java @@ -24,12 +24,9 @@ package org.onap.policy.controlloop.actor.sdnc; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; - import java.util.Collections; import java.util.List; import java.util.UUID; - -import org.onap.policy.aai.AaiGetVnfResponse; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; @@ -43,9 +40,7 @@ import org.onap.policy.sdnc.SdncHealVfModuleParameter; import org.onap.policy.sdnc.SdncHealVfModuleParametersInfo; import org.onap.policy.sdnc.SdncHealVfModuleRequestInput; import org.onap.policy.sdnc.SdncHealVnfInfo; - import org.onap.policy.sdnc.SdncRequest; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java index 7288ec126..c80a38d77 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java @@ -33,12 +33,10 @@ import java.util.UUID; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.aai.AaiGetVnfResponse; 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.sdnc.SdncRequest; import org.onap.policy.simulators.Util; @@ -75,16 +73,12 @@ public class SdncActorServiceProviderTest { onset.getAai().put("network-information.network-id", "network-5555"); assertNull(provider.constructRequest(onset, operation, policy)); - PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); - PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); assertNull(provider.constructRequest(onset, operation, policy)); UUID requestId = UUID.randomUUID(); onset.setRequestId(requestId); assertNull(provider.constructRequest(onset, operation, policy)); - PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); assertNull(provider.constructRequest(onset, operation, policy)); onset.getAai().put("service-instance.service-instance-id", "service-instance-01"); diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml index 0cb696063..95248bc39 100644 --- a/models-interactions/model-actors/actor.sdnr/pom.xml +++ b/models-interactions/model-actors/actor.sdnr/pom.xml @@ -70,11 +70,5 @@ <version>${policy.common.version}</version> <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> </dependencies> </project> diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java index a6212d3ab..226c3da47 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java @@ -23,16 +23,12 @@ package org.onap.policy.controlloop.actor.sdnr; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; 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.common.endpoints.http.server.HttpServletServer; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.ControlLoopTargetType; @@ -40,11 +36,9 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.Target; import org.onap.policy.controlloop.policy.TargetType; -import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.sdnr.PciRequest; import org.onap.policy.sdnr.PciResponse; import org.onap.policy.sdnr.util.Serialization; -import org.onap.policy.simulators.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml index f8d91a6f9..0af56bbbc 100644 --- a/models-interactions/model-actors/actor.so/pom.xml +++ b/models-interactions/model-actors/actor.so/pom.xml @@ -55,12 +55,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.drools</groupId> - <artifactId>drools-core</artifactId> - <version>6.5.0.Final</version> - <scope>provided</scope> - </dependency> - <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <scope>provided</scope> @@ -72,12 +66,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.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java index eef6e7c12..2a14bb19a 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java @@ -28,7 +28,6 @@ import java.lang.reflect.Type; import java.util.Collections; import java.util.List; import java.util.Map; -import org.drools.core.WorkingMemory; import org.onap.policy.aai.AaiNqExtraProperty; import org.onap.policy.aai.AaiNqInventoryResponseItem; import org.onap.policy.aai.AaiNqResponseWrapper; @@ -374,12 +373,16 @@ public class SoActorServiceProvider implements Actor { * in the asyncSORestCall. * * @param requestId the request Id - * @param wm the working memory + * @param callback callback method * @param request the request + * @param url SO REST URL + * @param user username + * @param password password */ - public static void sendRequest(String requestId, WorkingMemory wm, Object request) { - SoManager soManager = new SoManager(); - soManager.asyncSoRestCall(requestId, wm, lastServiceItemServiceInstanceId, lastVNFItemVnfId, + public static void sendRequest(String requestId, SoManager.SoCallback callback, Object request, + String url, String user, String password) { + SoManager soManager = new SoManager(url, user, password); + soManager.asyncSoRestCall(requestId, callback, lastServiceItemServiceInstanceId, lastVNFItemVnfId, lastVfModuleItemVfModuleInstanceId, (SoRequest) request); } @@ -406,7 +409,7 @@ public class SoActorServiceProvider implements Actor { private void buildRequestParameters(Policy policy, SoRequestDetails request) { // assume null until proven otherwise request.setRequestParameters(null); - + if (policy.getPayload() == null) { return; } @@ -428,7 +431,7 @@ public class SoActorServiceProvider implements Actor { private void buildConfigurationParameters(Policy policy, SoRequestDetails request) { // assume null until proven otherwise request.setConfigurationParameters(null); - + if (policy.getPayload() == null) { return; } diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java index d0eab120c..a7bdf1a76 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java @@ -145,7 +145,7 @@ public class SoActorServiceProviderTest { @Test public void testSendRequest() { try { - SoActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); + SoActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null, null, null, null); } catch (Exception e) { fail("Test should not throw an exception"); } 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()); |