aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
authordaniel <dc443y@att.com>2017-09-21 14:29:07 -0500
committerdaniel <dc443y@att.com>2017-09-22 11:48:29 -0500
commit5ee687ecedd616c3e4b83622103232a06c4783c2 (patch)
tree7d3936478b18796abe41bbcb3074f9634513da33 /controlloop/common
parent5cbb85e6bbd2ade9f35931980b55bc6bc48da9a2 (diff)
Fix Use Case Testing
These changes are necessary to get the use cases working on an actual PDP. So far vCPE, vFW, and vDNS have been tested successfully on a pdp. These are priliminary tests to just test a FINAL SUCCESS without A&AI GET queries being used. A&AI named queries for vFW and vDNS have been verified to work. Changes in the template were made for SO as there were changes in the JUnit template that did not get reflected in the archetype template. Changes in the code were made in various places to use the environment properties for REST urls, usernames, and passwords. Due to VoLTE not being tested yet, the url for VFC is still hard coded and will be changed later. It has been confirmed with APPC that LCM will have two topics: APPC-LCM-READ and APPC-LCM-WRITE. Policy needs to sink to APPC-LCM-READ and pull from source APPC-LCM-WRITE. This has been reflected in the controller properties file. Issue-ID: POLICY-259 Change-Id: Ib9a8df07ae5ad9d3052c88907c1e522952af474d Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/actors/actor.appc/pom.xml6
-rw-r--r--controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java17
-rw-r--r--controlloop/common/actors/actor.appclcm/pom.xml6
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java14
-rw-r--r--controlloop/common/actors/actor.so/pom.xml6
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java13
-rw-r--r--controlloop/common/model-impl/so/pom.xml6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java12
8 files changed, 69 insertions, 11 deletions
diff --git a/controlloop/common/actors/actor.appc/pom.xml b/controlloop/common/actors/actor.appc/pom.xml
index 36cdac6eb..cc5f3b604 100644
--- a/controlloop/common/actors/actor.appc/pom.xml
+++ b/controlloop/common/actors/actor.appc/pom.xml
@@ -64,5 +64,11 @@
<version>1.1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index dcdf59a56..9d7e46320 100644
--- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -30,6 +30,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.appc.Request;
+import org.onap.policy.appc.Response;
+import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.util.Serialization;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopOperation;
@@ -39,6 +41,7 @@ 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.http.server.HttpServletServer;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.simulators.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -87,7 +90,12 @@ public class AppcServiceProviderTest {
policy.setPayload(null);
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");
+
}
@BeforeClass
@@ -139,6 +147,13 @@ public class AppcServiceProviderTest {
assertTrue(jsonRequest.contains("Payload"));
assertTrue(jsonRequest.contains("generic-vnf.vnf-id"));
assertTrue(jsonRequest.contains("pg-streams"));
+
+ Response appcResponse = new Response(appcRequest);
+ appcResponse.getStatus().Code = ResponseCode.SUCCESS.getValue();
+ appcResponse.getStatus().Description = "AppC success";
+ /* Print out request as json to make sure serialization works */
+ String jsonResponse = Serialization.gsonPretty.toJson(appcResponse);
+ logger.debug("JSON Output: \n" + jsonResponse);
}
}
diff --git a/controlloop/common/actors/actor.appclcm/pom.xml b/controlloop/common/actors/actor.appclcm/pom.xml
index 6aa5f6439..1120df33a 100644
--- a/controlloop/common/actors/actor.appclcm/pom.xml
+++ b/controlloop/common/actors/actor.appclcm/pom.xml
@@ -41,6 +41,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index eaff2503a..9f556fa2e 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -49,6 +49,7 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -157,10 +158,17 @@ public class AppcLcmActorServiceProvider implements Actor {
aaiRequest.instanceFilters = new AAINQInstanceFilters();
aaiRequest.instanceFilters.instanceFilter.add(filter);
- //TODO: URL should not be hard coded for future releases
+ /*
+ * Obtain A&AI credentials from properties.environment file
+ * TODO: What if these are null?
+ */
+ String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
+ String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username");
+ String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
+
AAINQResponse aaiResponse = AAIManager.postQuery(
- "http://localhost:6666",
- "policy", "policy",
+ aaiUrl,
+ aaiUsername, aaiPassword,
aaiRequest, requestId);
//TODO: What if the resourceId never matches?
diff --git a/controlloop/common/actors/actor.so/pom.xml b/controlloop/common/actors/actor.so/pom.xml
index ff5b12167..f19011c6c 100644
--- a/controlloop/common/actors/actor.so/pom.xml
+++ b/controlloop/common/actors/actor.so/pom.xml
@@ -46,5 +46,11 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index a31007f32..a014c7a80 100644
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -41,6 +41,7 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
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.so.SOCloudConfiguration;
import org.onap.policy.so.SOManager;
import org.onap.policy.so.SOModelInfo;
@@ -176,12 +177,16 @@ public class SOActorServiceProvider implements Actor {
//
// insert(aainqRequestWrapper);
- String url = "http://localhost:6666";
- String username = "testUser";
- String password = "testPass";
+ /*
+ * Obtain A&AI credentials from properties.environment file
+ * TODO: What if these are null?
+ */
+ String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
+ String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username");
+ String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
//***** send the request *****\\
- AAINQResponse aainqresponse = AAIManager.postQuery(url, username, password, // TO DO: get AAI URL, username, and password
+ AAINQResponse aainqresponse = AAIManager.postQuery(aaiUrl, aaiUsername, aaiPassword,
aainqrequest, onset.requestID);
// Check AAI response
diff --git a/controlloop/common/model-impl/so/pom.xml b/controlloop/common/model-impl/so/pom.xml
index faeb12130..a18030eb7 100644
--- a/controlloop/common/model-impl/so/pom.xml
+++ b/controlloop/common/model-impl/so/pom.xml
@@ -53,5 +53,11 @@
<artifactId>rest</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
index f967414c1..2f5ffdc3e 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import org.onap.policy.so.util.Serialization;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
import org.drools.core.WorkingMemory;
@@ -134,9 +135,14 @@ public final class SOManager {
@Override
public void run()
{
- String serverRoot = "http://localhost:6667"; // TODO
- String username = "username"; // TODO
- String password = "password"; // TODO
+
+ /*
+ * TODO: What if these are null?
+ */
+ String serverRoot = PolicyEngine.manager.getEnvironmentProperty("so.url");
+ String username = PolicyEngine.manager.getEnvironmentProperty("so.username");
+ String password = PolicyEngine.manager.getEnvironmentProperty("so.password");
+
String url = serverRoot + "/serviceInstances/v2/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModulesHTTPS/1.1";
String auth = username + ":" + password;