Fix Use Case Testing 93/14693/1
authordaniel <dc443y@att.com>
Thu, 21 Sep 2017 19:29:07 +0000 (14:29 -0500)
committerdaniel <dc443y@att.com>
Fri, 22 Sep 2017 16:48:29 +0000 (11:48 -0500)
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>
25 files changed:
controlloop/common/actors/actor.appc/pom.xml
controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
controlloop/common/actors/actor.appclcm/pom.xml
controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
controlloop/common/actors/actor.so/pom.xml
controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
controlloop/common/model-impl/so/pom.xml
controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.lcm.success.json [moved from controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.success.json with 77% similarity]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/appc.legacy.success.json [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vcpe.onset.json [moved from controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.onset.json with 94% similarity]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vdns.onset.json [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/dcae.vfw.onset.json [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/so.success.json [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vDNS.yaml [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/vFW.yaml [new file with mode: 0644]
controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
controlloop/templates/template.demo/pom.xml
controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopXacmlGuardTest.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java

index 36cdac6..cc5f3b6 100644 (file)
                        <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>
index dcdf59a..9d7e463 100644 (file)
@@ -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);
     }
 
 }
index 6aa5f64..1120df3 100644 (file)
                        <version>1.1.0-SNAPSHOT</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>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
index eaff250..9f556fa 100644 (file)
@@ -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?
index ff5b121..f19011c 100644 (file)
                        <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>
index a31007f..a014c7a 100644 (file)
@@ -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
index faeb121..a18030e 100644 (file)
                <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>
index f967414..2f5ffdc 100644 (file)
@@ -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;
index 18daf6a..b22ba98 100644 (file)
@@ -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=
index 356af7d..48d48de 100644 (file)
@@ -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",
@@ -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 (file)
index 0000000..2c6570d
--- /dev/null
@@ -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.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 (file)
index 0000000..4868c58
--- /dev/null
@@ -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 (file)
index 0000000..140e9c2
--- /dev/null
@@ -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 (file)
index 0000000..8f3387e
--- /dev/null
@@ -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 (file)
index 0000000..56426ee
--- /dev/null
@@ -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 (file)
index 0000000..8273f46
--- /dev/null
@@ -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
index a2939a0..f56a3ff 100644 (file)
@@ -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
     //
index 69c2da8..c079342 100644 (file)
                        <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>
index b506d89..64101ac 100644 (file)
@@ -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
index 5fe2f62..02066d6 100644 (file)
@@ -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;
index 182e398..878c6e8 100644 (file)
@@ -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");
index 9608f7c..419ab63 100644 (file)
@@ -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 {
index a19d926..453354d 100644 (file)
@@ -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);
             
             /*