aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java11
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java8
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java23
3 files changed, 35 insertions, 7 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index b1674206b..4adcff048 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -560,7 +560,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public void queryAai(VirtualControlLoopEvent event) throws AAIException {
- if (event.AAI.get("vserver.is-closed-loop-disabled") == null) {
+ if (event.AAI.get("vserver.is-closed-loop-disabled") == null &&
+ event.AAI.get("generic-vnf.is-closed-loop-disabled") == null) {
try {
if (event.AAI.get("generic-vnf.vnf-id") != null) {
vnfResponse = getAAIVnfInfo(event);
@@ -635,7 +636,13 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
"yes".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled")) ||
"Y".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled"))) {
return true;
- }
+ }
+ else if ("true".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
+ "T".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
+ "yes".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
+ "Y".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled"))) {
+ return true;
+ }
return false;
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index cebdc1e9a..26a82fe57 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -145,6 +145,14 @@ public class ControlLoopOperationManager implements Serializable {
}
else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) {
/*
+ * If the onset is enriched with the vnf-id,
+ * we don't need an A&AI response
+ */
+ if (virtualOnset.AAI.containsKey("generic-vnf.vnf-id")) {
+ return virtualOnset.AAI.get("generic-vnf.vnf-id");
+ }
+
+ /*
* If the vnf-name was retrieved from the onset then the vnf-id
* must be obtained from the event manager's A&AI GET query
*/
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 55812f154..377cff465 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
@@ -41,9 +41,11 @@ import org.onap.policy.appclcm.LCMResponse;
import org.onap.policy.appclcm.LCMResponseWrapper;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopNotificationType;
+import org.onap.policy.controlloop.ControlLoopTargetType;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.event.comm.Topic.CommInfrastructure;
import org.onap.policy.drools.event.comm.TopicEndpoint;
import org.onap.policy.drools.event.comm.TopicListener;
@@ -148,8 +150,7 @@ public class VCPEControlLoopTest implements TopicListener {
* receive from DCAE to kick off processing through
* the rules
*/
- sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET);
-
+ sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "vCPEInfraVNF13", true);
kieSession.fireUntilHalt();
@@ -187,7 +188,7 @@ public class VCPEControlLoopTest implements TopicListener {
* receive from DCAE to kick off processing through
* the rules
*/
- sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "getFail");
+ sendEvent(pair.a, requestID, ControlLoopEventStatus.ONSET, "getFail", false);
kieSession.fireUntilHalt();
@@ -319,7 +320,7 @@ public class VCPEControlLoopTest implements TopicListener {
kieSession.halt();
}
else {
- assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.notification);
kieSession.halt();
}
}
@@ -376,14 +377,26 @@ public class VCPEControlLoopTest implements TopicListener {
kieSession.insert(event);
}
- protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vnfName) {
+ protected void sendEvent(ControlLoopPolicy policy, UUID requestID,
+ ControlLoopEventStatus status, String vnfName, boolean isEnriched) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
event.target = "generic-vnf.vnf-name";
+ event.target_type = ControlLoopTargetType.VNF;
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
event.AAI.put("generic-vnf.vnf-name", vnfName);
+ if (isEnriched) {
+ event.AAI.put("generic-vnf.in-maint", "false");
+ event.AAI.put("generic-vnf.is-closed-loop-disabled", "false");
+ event.AAI.put("generic-vnf.orchestration-status", "Created");
+ event.AAI.put("generic-vnf.prov-status", "PREPROV");
+ event.AAI.put("generic-vnf.resource-version", "1");
+ event.AAI.put("generic-vnf.service-id", "e8cb8968-5411-478b-906a-f28747de72cd");
+ event.AAI.put("generic-vnf.vnf-id", "63b31229-9a3a-444f-9159-04ce2dca3be9");
+ event.AAI.put("generic-vnf.vnf-type", "vCPEInfraService10/vCPEInfraService10 0");
+ }
event.closedLoopEventStatus = status;
kieSession.insert(event);
}