aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-09-22 19:48:18 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 19:48:18 +0000
commitcc73cc553b4f083c8f050e29d6aec8d112b07387 (patch)
tree6b9fe622282e9756fb27b9e1286248a930421f29 /controlloop
parent24782d90bd18992c4f31b18fd534c60a4a5a3ef8 (diff)
parent5ee687ecedd616c3e4b83622103232a06c4783c2 (diff)
Merge "Fix Use Case Testing"
Diffstat (limited to 'controlloop')
-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
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties27
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json23
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.lcm.success.json (renamed from controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.success.json)4
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.legacy.success.json41
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vcpe.onset.json (renamed from controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json)2
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vdns.onset.json15
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vfw.onset.json15
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/so.success.json7
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vDNS.yaml26
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vFW.yaml28
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl12
-rw-r--r--controlloop/templates/template.demo/pom.xml10
-rw-r--r--controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl10
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java2
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java4
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java12
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java12
25 files changed, 283 insertions, 47 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;
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
index 18daf6a50..b22ba98eb 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
@@ -20,7 +20,7 @@
controller.name=${artifactId}
-ueb.source.topics=${dcaeTopic},APPC-CL
+ueb.source.topics=${dcaeTopic},APPC-CL,APPC-LCM-WRITE
ueb.source.topics.${dcaeTopic}.servers=${dcaeServers}
ueb.source.topics.${dcaeTopic}.apiKey=
@@ -32,17 +32,30 @@ ueb.source.topics.${dcaeTopic}.events.custom.gson=org.onap.policy.controlloop.ut
ueb.source.topics.APPC-CL.servers=${dmaapServers}
ueb.source.topics.APPC-CL.apiKey=
ueb.source.topics.APPC-CL.apiSecret=
-ueb.source.topics.APPC-CL.events=org.onap.policy.appclcm.LCMResponseWrapper
-ueb.source.topics.APPC-CL.events.org.onap.policy.appclcm.LCMResponseWrapper.filter=type\=response
-ueb.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+ueb.source.topics.APPC-CL.events=org.onap.policy.appc.Response
+ueb.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=CommonHeader\=.*,Status\=.*
+ueb.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
-noop.sink.topics=APPC-CL,POLICY-CL-MGT
+ueb.source.topics.APPC-LCM-WRITE.servers=${dmaapServers}
+ueb.source.topics.APPC-LCM-WRITE.apiKey=
+ueb.source.topics.APPC-LCM-WRITE.apiSecret=
+ueb.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.LCMResponseWrapper
+ueb.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LCMResponseWrapper.filter=type\=response
+ueb.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+
+noop.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT
noop.sink.topics.APPC-CL.servers=${dmaapServers}
noop.sink.topics.APPC-CL.apiKey=
noop.sink.topics.APPC-CL.apiSecret=
-noop.sink.topics.APPC-CL.events=org.onap.policy.appclcm.LCMRequestWrapper
-noop.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
+noop.sink.topics.APPC-CL.events=org.onap.policy.appc.Request
+noop.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty
+
+noop.sink.topics.APPC-LCM-READ.servers=${dmaapServers}
+noop.sink.topics.APPC-LCM-READ.apiKey=
+noop.sink.topics.APPC-LCM-READ.apiSecret=
+noop.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.LCMRequestWrapper
+noop.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
noop.sink.topics.POLICY-CL-MGT.servers=${dmaapServers}
noop.sink.topics.POLICY-CL-MGT.apiKey=
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
index 356af7d99..48d48de82 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
@@ -1,7 +1,7 @@
{
"controller.name": "${artifactId}",
- "ueb.source.topics": "${dcaeTopic},APPC-CL",
+ "ueb.source.topics": "${dcaeTopic},APPC-CL,APPC-LCM-WRITE",
"ueb.source.topics.${dcaeTopic}.servers": "${dcaeServers}",
"ueb.source.topics.${dcaeTopic}.events": "org.onap.policy.controlloop.VirtualControlLoopEvent",
@@ -9,15 +9,24 @@
"ueb.source.topics.${dcaeTopic}.events.custom.gson": "org.onap.policy.controlloop.util.Serialization,gson",
"ueb.source.topics.APPC-CL.servers": "${dmaapServers}",
- "ueb.source.topics.APPC-CL.events": "org.onap.policy.appclcm.LCMResponseWrapper",
- "ueb.source.topics.APPC-CL.events.org.onap.policy.appclcm.LCMResponseWrapper.filter": "type=response",
- "ueb.source.topics.APPC-CL.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
+ "ueb.source.topics.APPC-CL.events": "org.onap.policy.appc.Response",
+ "ueb.source.topics.APPC-CL.events.org.onap.policy.appclcm.LCMResponseWrapper.filter": "CommonHeader=.*,Status=.*",
+ "ueb.source.topics.APPC-CL.events.custom.gson": "org.onap.policy.appc.util.Serialization,gsonPretty",
- "noop.sink.topics": "APPC-CL,POLICY-CL-MGT",
+ "ueb.source.topics.APPC-LCM-WRITE.servers": "${dmaapServers}",
+ "ueb.source.topics.APPC-LCM-WRITE.events": "org.onap.policy.appclcm.LCMResponseWrapper",
+ "ueb.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LCMResponseWrapper.filter": "type=response",
+ "ueb.source.topics.APPC-LCM-WRITE.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
+
+ "noop.sink.topics": "APPC-CL,APPC-LCM-READ,POLICY-CL-MGT",
"noop.sink.topics.APPC-CL.servers": "${dmaapServers}",
- "noop.sink.topics.APPC-CL.events": "org.onap.policy.appclcm.LCMRequestWrapper",
- "noop.sink.topics.APPC-CL.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
+ "noop.sink.topics.APPC-CL.events": "org.onap.policy.appc.Request",
+ "noop.sink.topics.APPC-CL.events.custom.gson": "org.onap.policy.appc.util.Serialization,gsonPretty",
+
+ "noop.sink.topics.APPC-LCM-READ.servers": "${dmaapServers}",
+ "noop.sink.topics.APPC-LCM-READ.events": "org.onap.policy.appclcm.LCMRequestWrapper",
+ "noop.sink.topics.APPC-LCM-READ.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
"noop.sink.topics.POLICY-CL-MGT.servers": "${dmaapServers}",
"noop.sink.topics.POLICY-CL-MGT.events": "org.onap.policy.controlloop.VirtualControlLoopNotification",
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.success.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.lcm.success.json
index 6f8af9b64..985685000 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.success.json
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.lcm.success.json
@@ -4,7 +4,7 @@
"common-header": {
"timestamp": "2017-08-25T21:06:23.037Z",
"api-ver": "5.00",
- "originator-id": "a20e2073-30b1-4357-893b-f5ed57b66ef0",
+ "originator-id": "664be3d2-6c12-4f4b-a3e7-c349acced200",
"request-id": "664be3d2-6c12-4f4b-a3e7-c349acced200",
"sub-request-id": "1",
"flags": {}
@@ -17,6 +17,6 @@
},
"version": "2.0",
"rpc-name": "restart",
- "correlation-id": "a20e2073-30b1-4357-893b-f5ed57b66ef0-1",
+ "correlation-id": "664be3d2-6c12-4f4b-a3e7-c349acced200-1",
"type": "response"
} \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.legacy.success.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.legacy.success.json
new file mode 100644
index 000000000..2c6570d03
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.legacy.success.json
@@ -0,0 +1,41 @@
+{
+ "CommonHeader": {
+ "TimeStamp": 1506051879001,
+ "APIver": "1.01",
+ "RequestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
+ "SubRequestID": "1",
+ "RequestTrack": [],
+ "Flags": []
+ },
+ "Status": {
+ "Code": 400,
+ "Value": "SUCCESS"
+ },
+ "Payload": {
+ "generic-vnf.vnf-id": "jimmy-test-vnf2",
+ "pg-streams": {
+ "pg-stream": [
+ {
+ "id": "fw_udp1",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp2",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp3",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp4",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp5",
+ "is-enabled": "true"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vcpe.onset.json
index edb1e27e5..184b87787 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vcpe.onset.json
@@ -4,7 +4,7 @@
"closedLoopEventClient": "microservice.stringmatcher",
"closedLoopEventStatus": "ONSET",
"requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
- "target_type": "VNF",
+ "target_type": "VM",
"target": "generic-vnf.vnf-id",
"AAI": {
"vserver.is-closed-loop-disabled": "false",
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vdns.onset.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vdns.onset.json
new file mode 100644
index 000000000..4868c586e
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vdns.onset.json
@@ -0,0 +1,15 @@
+{
+ "closedLoopControlName": "${closedLoopControlName}",
+ "closedLoopAlarmStart": 1484677482204798,
+ "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "e4f95e0c-a013-4530-8e59-c5c5f9e539b6",
+ "target_type": "VNF",
+ "target": "vserver.vserver-name",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "vserver.vserver-name": "dfw1lb01lb01"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+} \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vfw.onset.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vfw.onset.json
new file mode 100644
index 000000000..140e9c295
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vfw.onset.json
@@ -0,0 +1,15 @@
+{
+ "closedLoopControlName": "${closedLoopControlName}",
+ "closedLoopAlarmStart": 1463679805324,
+ "closedLoopEventClient": "microservice.stringmatcher",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
+ "target_type": "VNF",
+ "target": "generic-vnf.vnf-id",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "generic-vnf.vnf-id": "fw0002vm002fw002"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+}
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/so.success.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/so.success.json
new file mode 100644
index 000000000..8f3387e4d
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/so.success.json
@@ -0,0 +1,7 @@
+{
+ "requestReferences": {
+ "instanceId": "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
+ "requestId": "e4f95e0c-a013-4530-8e59-c5c5f9e539b6"
+ },
+ "httpResponseCode": 200
+} \ No newline at end of file
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vDNS.yaml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vDNS.yaml
new file mode 100644
index 000000000..56426eebd
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vDNS.yaml
@@ -0,0 +1,26 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ${closedLoopControlName}
+ services:
+ - serviceName: d4738992-6497-4dca-9db9
+ serviceInvariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ serviceUUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 3600
+
+policies:
+ - id: unique-policy-id-1-scale-up
+ name: Create a new VF Module
+ description:
+ actor: SO
+ recipe: VF Module Create
+ target:
+ type: VNF
+ retry: 3
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vFW.yaml b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vFW.yaml
new file mode 100644
index 000000000..8273f46b9
--- /dev/null
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vFW.yaml
@@ -0,0 +1,28 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ${closedLoopControlName}
+ services:
+ - serviceInvariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
+ serviceUUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
+ serviceName: 57e66ea7-0ed6-45c7-970f
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 3600
+ abatement: true
+
+policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: modify packet gen config
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ type: VNF
+ retry: 2
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
index a2939a0bf..f56a3ff6a 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -127,7 +127,7 @@ rule "${policyName}.SETUP"
String vfcUsername = PolicyEngine.manager.getEnvironmentProperty("vfc.username");
String vfcPassword = PolicyEngine.manager.getEnvironmentProperty("vfc.password");
- String guardUrl =PolicyEngine.manager.getEnvironmentProperty("guard.url");
+ String guardUrl = PolicyEngine.manager.getEnvironmentProperty("guard.url");
String guardUsername = PolicyEngine.manager.getEnvironmentProperty("guard.username");
String guardPassword = PolicyEngine.manager.getEnvironmentProperty("guard.password");
String guardJdbcUrl = PolicyEngine.manager.getEnvironmentProperty("guard.jdbc.url");
@@ -537,9 +537,12 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
case "APPC":
- if (request instanceof Request || request instanceof LCMRequestWrapper) {
+ if (request instanceof Request) {
PolicyEngine.manager.deliver("APPC-CL", request);
}
+ else if (request instanceof LCMRequestWrapper) {
+ PolicyEngine.manager.deliver("APPC-LCM-READ", request);
+ }
break;
case "SO":
// at this point the AAI named query request should have already been made, the response recieved and used
@@ -938,15 +941,14 @@ rule "${policyName}.SO.RESPONSE"
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
$opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
$lock : TargetLock (requestID == $event.requestID)
- $request : SORequest( requestId == $event.requestID.toString() )
$response : SOResponse( request.requestId == $event.requestID.toString() )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName());
- logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} request={} response={}",
+ logger.debug("{}: {}: event={} manager={} operation={} lock={} opTimer={} response={}",
$params.getClosedLoopControlName(), drools.getRule().getName(),
- $event, $manager, $operation, $lock, $operation, $opTimer, $request, $response);
+ $event, $manager, $operation, $lock, $operation, $opTimer, $response);
// Get the result of the operation
//
diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml
index 69c2da80e..c07934207 100644
--- a/controlloop/templates/template.demo/pom.xml
+++ b/controlloop/templates/template.demo/pom.xml
@@ -204,10 +204,10 @@
<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>
+ <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/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
index b506d8910..64101ac56 100644
--- a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
+++ b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
@@ -507,10 +507,12 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
switch ($operation.policy.getActor()){
case "APPC":
-
- if (request instanceof Request || request instanceof LCMRequestWrapper) {
- Engine.deliver("UEB", "APPC-CL", request);
- }
+ if (request instanceof Request) {
+ Engine.deliver("UEB", "APPC-CL", request);
+ }
+ else if (request instanceof LCMRequestWrapper) {
+ Engine.deliver("UEB", "APPC-LCM-READ", request);
+ }
break;
case "SO":
// at this point the AAI named query request should have already been made, the response recieved and used
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
index 5fe2f6222..02066d66a 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
@@ -242,7 +242,7 @@ public class ControlLoopXacmlGuardTest {
Thread.sleep(2*1000);
- obj = engine.subscribe("UEB", "APPC-CL");
+ obj = engine.subscribe("UEB", "APPC-LCM-READ");
assertNotNull(obj);
assertTrue(obj instanceof LCMRequestWrapper);
LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) obj;
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java
index 182e39828..878c6e8c1 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java
@@ -195,7 +195,7 @@ public class VCPEControlLoopTest {
/*
* Obtain the request sent from the Policy Engine
*/
- obj = engine.subscribe("UEB", "APPC-CL");
+ obj = engine.subscribe("UEB", "APPC-LCM-READ");
assertNotNull(obj);
/*
@@ -235,7 +235,7 @@ public class VCPEControlLoopTest {
* Give time for processing
*/
try {
- Thread.sleep(4000);
+ Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
logger.debug("An interrupt Exception was thrown");
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
index 9608f7cf0..419ab63a0 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
@@ -46,6 +46,7 @@ import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.guard.PolicyGuard;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +59,17 @@ public class VDNSControlLoopTest {
private Util.Pair<ControlLoopPolicy, String> pair;
private PolicyEngineJUnitImpl engine;
+ static {
+ /* Set environment properties */
+ PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
+ PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
+ PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+
+ PolicyEngine.manager.setEnvironmentProperty("so.url", "http://localhost:6667");
+ PolicyEngine.manager.setEnvironmentProperty("so.username", "SO");
+ PolicyEngine.manager.setEnvironmentProperty("so.password", "SO");
+ }
+
@BeforeClass
public static void setUpSimulator() {
try {
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
index a19d9267c..453354dba 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
@@ -44,6 +44,7 @@ import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.guard.PolicyGuard;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,7 +55,14 @@ public class VFWControlLoopTest {
private KieSession kieSession;
private Util.Pair<ControlLoopPolicy, String> pair;
- private PolicyEngineJUnitImpl engine;
+ private PolicyEngineJUnitImpl engine;
+
+ static {
+ /* 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() {
@@ -240,7 +248,7 @@ public class VFWControlLoopTest {
*/
Response appcResponse = new Response((Request)obj);
appcResponse.getStatus().Code = ResponseCode.SUCCESS.getValue();
- appcResponse.getStatus().Description = "AppC success";
+ appcResponse.getStatus().Value = "SUCCESS";
kieSession.insert(appcResponse);
/*