aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/templates')
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl21
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java1
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java3
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml2
4 files changed, 19 insertions, 8 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 a29941607..2f8d86127 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
@@ -485,13 +485,23 @@ rule "${policyName}.EVENT.MANAGER"
}
}
} catch (Exception e) {
- logger.warn("{}: {}: unexpected",
+ logger.warn("{}: {}: unexpected",
$params.getClosedLoopControlName(),
drools.getRule().getName(), e);
- //
- // TODO should we abort if we get an exception?
- //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
+ notification.message = e.getMessage();
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+
+ PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
+
+ retract($event);
+ retract($manager);
+ retract($clTimer);
}
end
@@ -651,8 +661,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
$event.closedLoopControlName,
$operation.policy.getActor().toString(),
$operation.policy.getRecipe(),
- $manager.getTargetInstance($operation.policy),
- //$event.target,
+ $operation.getTargetEntity(),
$event.requestID.toString()
));
t.start();
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 f18b440d7..8885a23c6 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
@@ -335,6 +335,7 @@ public class VCPEControlLoopTest implements TopicListener {
LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) obj;
LCMRequest appcRequest = dmaapRequest.getBody();
assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1"));
+ assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id"));
logger.debug("\n============ APPC received the request!!! ===========\n");
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 f73e3b39e..015798491 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
@@ -365,7 +365,7 @@ public class VFWControlLoopTest implements TopicListener {
logger.debug("Rule Fired: " + notification.policyName);
if ("error".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
- assertEquals("Exception in processing closed loop", notification.message);
+ assertEquals("Target vnf-id could not be found", notification.message);
}
else {
assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
@@ -381,6 +381,7 @@ public class VFWControlLoopTest implements TopicListener {
}
else if (obj instanceof Request) {
assertTrue(((Request)obj).getCommonHeader().SubRequestID.equals("1"));
+ assertNotNull(((Request)obj).getPayload().get("generic-vnf.vnf-id"));
logger.debug("\n============ APPC received the request!!! ===========\n");
diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml
index 1f3444f0e..e96c57cda 100644
--- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_vCPE.yaml
@@ -12,7 +12,7 @@ policies:
actor: APPC
recipe: Restart
target:
- type: VM
+ type: VNF
retry: 3
timeout: 30
success: final_success