aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates
diff options
context:
space:
mode:
authorshaoqiu <tim.huang@est.tech>2019-04-02 12:33:04 +0000
committerPamela Dragosh <pdragosh@research.att.com>2019-04-08 13:47:01 -0400
commite55d256a9eeb411bb485919eb4c1d449cbae5d46 (patch)
tree6694558deac959fe295b4148ceb4438f09ad65f9 /controlloop/templates
parent93206cf9624df06a518a8016b965b9104e687f14 (diff)
update dependency to policy/models
Update the dependency of model-impl from drools-applications to policy/models. Issue-ID: POLICY-1264 Change-Id: I07fcb29501499a97689d2d27c845bf8e411e7825 Signed-off-by: shaoqiu <tim.huang@est.tech> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/templates')
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl41
-rw-r--r--controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl40
-rw-r--r--controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl27
-rw-r--r--controlloop/templates/template.demo/pom.xml7
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java2
5 files changed, 98 insertions, 19 deletions
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 5b012d3b5..6a73f8e8f 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
@@ -48,6 +48,7 @@ import org.onap.policy.sdnr.PciResponse;
import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.VfcManager;
+import org.onap.policy.so.SoManager;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponseWrapper;
import org.onap.policy.sdnc.SdncRequest;
@@ -579,14 +580,34 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if(request instanceof SoRequest) {
// Call SO. The response will be inserted into memory once it's received
- SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(),
- request);
+ class mySoCallback implements SoManager.SoCallback {
+ public void onSoResponseWrapper(SoResponseWrapper wrapper) {
+ drools.getWorkingMemory().insert(wrapper);
+ }
+ }
+ SoActorServiceProvider.sendRequest($event.getRequestId().toString(),
+ new mySoCallback(),
+ request,
+ PolicyEngine.manager.getEnvironmentProperty("so.url"),
+ PolicyEngine.manager.getEnvironmentProperty("so.username"),
+ PolicyEngine.manager.getEnvironmentProperty("so.password"));
}
break;
case "VFC":
if (request instanceof VfcRequest) {
// Start VFC thread
- Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request));
+ class myVfcCallback implements VfcManager.VfcCallback {
+
+ public void onResponse(VfcResponse responseError) {
+ drools.getWorkingMemory().insert(responseError);
+ }
+ };
+ // Start VFC thread
+ Thread t = new Thread(new VfcManager(new myVfcCallback(),
+ (VfcRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password")));
t.start();
}
break;
@@ -594,8 +615,18 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
case "SDNC":
if (request instanceof SdncRequest) {
// Start SDNC thread
- Thread t = new Thread(new SdncManager(drools.getWorkingMemory(), (SdncRequest)request));
- t.start();
+ class mySdncCallback implements SdncManager.SdncCallback {
+ public void onCallback(SdncResponse response) {
+ drools.getWorkingMemory().insert(response);
+ }
+ }
+ // Start SDNC thread
+ Thread t = new Thread(new SdncManager(new mySdncCallback(),
+ (SdncRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.password")));
+ t.start();
}
break;
case "SDNR":
diff --git a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
index b0262f989..93bc63ea7 100644
--- a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -49,6 +49,7 @@ import org.onap.policy.sdnr.PciResponse;
import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.VfcManager;
+import org.onap.policy.so.SoManager;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponseWrapper;
import org.onap.policy.sdnc.SdncRequest;
@@ -529,13 +530,33 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if(request instanceof SoRequest) {
// Call SO. The response will be inserted into memory once it's received
- SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request);
+ class mySoCallback implements SoManager.SoCallback {
+ public void onSoResponseWrapper(SoResponseWrapper wrapper) {
+ drools.getWorkingMemory().insert(wrapper);
+ }
+ }
+ SoActorServiceProvider.sendRequest($event.getRequestId().toString(),
+ new mySoCallback(),
+ request,
+ PolicyEngine.manager.getEnvironmentProperty("so.url"),
+ PolicyEngine.manager.getEnvironmentProperty("so.username"),
+ PolicyEngine.manager.getEnvironmentProperty("so.password"));
}
break;
case "VFC":
if (request instanceof VfcRequest) {
+ class myVfcCallback implements VfcManager.VfcCallback {
+
+ public void onResponse(VfcResponse responseError) {
+ drools.getWorkingMemory().insert(responseError);
+ }
+ };
// Start VFC thread
- Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request));
+ Thread t = new Thread(new VfcManager(new myVfcCallback(),
+ (VfcRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password")));
t.start();
}
break;
@@ -547,9 +568,18 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
case "SDNC":
if (request instanceof SdncRequest) {
- // Start SDNC thread
- Thread t = new Thread(new SdncManager(drools.getWorkingMemory(), (SdncRequest)request));
- t.start();
+ class mySdncCallback implements SdncManager.SdncCallback {
+ public void onCallback(SdncResponse response) {
+ drools.getWorkingMemory().insert(response);
+ }
+ }
+ // Start SDNC thread
+ Thread t = new Thread(new SdncManager(new mySdncCallback(),
+ (SdncRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("sdnc.password")));
+ t.start();
}
break;
}
diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
index f2584c063..1d8e6c511 100644
--- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
@@ -45,6 +45,7 @@ import org.onap.policy.appclcm.LcmCommonHeader;
import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.VfcManager;
+import org.onap.policy.so.SoManager;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponseWrapper;
import org.onap.policy.guard.PolicyGuard;
@@ -584,14 +585,32 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if(request instanceof SoRequest) {
// Call SO. The response will be inserted into memory once it's received
- SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(),
- request);
- }
+ class mySoCallback implements SoManager.SoCallback {
+ public void onSoResponseWrapper(SoResponseWrapper wrapper) {
+ drools.getWorkingMemory().insert(wrapper);
+ }
+ }
+ SoActorServiceProvider.sendRequest($event.getRequestId().toString(),
+ new mySoCallback(),
+ request,
+ PolicyEngine.manager.getEnvironmentProperty("so.url"),
+ PolicyEngine.manager.getEnvironmentProperty("so.username"),
+ PolicyEngine.manager.getEnvironmentProperty("so.password")); }
break;
case "VFC":
if (request instanceof VfcRequest) {
// Start VFC thread
- Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request));
+ class myVfcCallback implements VfcManager.VfcCallback {
+ public void onResponse(VfcResponse responseError) {
+ drools.getWorkingMemory().insert(responseError);
+ }
+ };
+ // Start VFC thread
+ Thread t = new Thread(new VfcManager(new myVfcCallback(),
+ (VfcRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password")));
t.start();
}
break;
diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml
index 446117e1f..2471f9200 100644
--- a/controlloop/templates/template.demo/pom.xml
+++ b/controlloop/templates/template.demo/pom.xml
@@ -126,10 +126,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
- <!-- <groupId>org.onap.policy.models.policy-models-interactions</groupId> -->
- <artifactId>policy-yaml</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.policy.models.policy-models-interactions</groupId>
+ <artifactId>model-yaml</artifactId>
+ <version>${policy.models.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java
index 00949599e..d5eb28e23 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java
@@ -332,7 +332,7 @@ public final class SupportUtil {
* Set the VFC properties.
*/
public static void setVfcProps() {
- PolicyEngine.manager.setEnvironmentProperty("vfc.url", "http://localhost:6668");
+ PolicyEngine.manager.setEnvironmentProperty("vfc.url", "http://localhost:6668/api/nslcm/v1");
PolicyEngine.manager.setEnvironmentProperty("vfc.username", "VFC");
PolicyEngine.manager.setEnvironmentProperty("vfc.password", "VFC");
}