summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java5
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java26
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java5
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java26
4 files changed, 58 insertions, 4 deletions
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
index d92fbcfad..091b26b2d 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
@@ -707,8 +707,9 @@ public class UsecasesEventManager extends ControlLoopEventManager implements Ste
*/
private static boolean isProvStatusInactive(VirtualControlLoopEvent event) {
Map<String, String> aai = event.getAai();
- return !(PROV_STATUS_ACTIVE.equals(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
- && PROV_STATUS_ACTIVE.equals(aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
+ return !(PROV_STATUS_ACTIVE.equalsIgnoreCase(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
+ && PROV_STATUS_ACTIVE.equalsIgnoreCase(
+ aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
}
/**
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
index b87e56da6..d4979fb79 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
@@ -188,10 +188,36 @@ public class UsecasesEventManagerTest {
assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.hasMessage("is-closed-loop-disabled is set to true on VServer or VNF");
+ // vserver ACTIVE
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS,
+ UsecasesConstants.PROV_STATUS_ACTIVE.toUpperCase()));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
+
+ // vserver active
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS,
+ UsecasesConstants.PROV_STATUS_ACTIVE.toLowerCase()));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
+
+ // vserver inactive
event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS, "inactive"));
assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.hasMessage("prov-status is not ACTIVE on VServer or VNF");
+ // vnf ACTIVE
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS,
+ UsecasesConstants.PROV_STATUS_ACTIVE.toUpperCase()));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
+
+ // vnf active
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS,
+ UsecasesConstants.PROV_STATUS_ACTIVE.toLowerCase()));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
+
+ // vnf inactive
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS, "inactive"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
+ .hasMessage("prov-status is not ACTIVE on VServer or VNF");
+
// valid
event.setAai(orig);
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java
index b738cefe1..1b3ae9220 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java
@@ -545,8 +545,9 @@ public abstract class ControlLoopEventManager2 implements ManagerContext, Serial
*/
private static boolean isProvStatusInactive(VirtualControlLoopEvent event) {
Map<String, String> aai = event.getAai();
- return !(PROV_STATUS_ACTIVE.equals(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
- && PROV_STATUS_ACTIVE.equals(aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
+ return !(PROV_STATUS_ACTIVE.equalsIgnoreCase(aai.getOrDefault(VSERVER_PROV_STATUS, PROV_STATUS_ACTIVE))
+ && PROV_STATUS_ACTIVE.equalsIgnoreCase(
+ aai.getOrDefault(GENERIC_VNF_PROV_STATUS, PROV_STATUS_ACTIVE)));
}
/**
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
index da37e6fc3..d3c217c9f 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
@@ -183,10 +183,36 @@ public class ControlLoopEventManager2Test {
assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
.hasMessage("is-closed-loop-disabled is set to true on VServer or VNF");
+ // vserver ACTIVE
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS,
+ ControlLoopEventManager2.PROV_STATUS_ACTIVE.toUpperCase()));
+ assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+
+ // vserver active
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS,
+ ControlLoopEventManager2.PROV_STATUS_ACTIVE.toLowerCase()));
+ assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+
+ // vserver inactive
event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive"));
assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
.hasMessage("prov-status is not ACTIVE on VServer or VNF");
+ // vnf ACTIVE
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager2.PROV_STATUS_ACTIVE.toUpperCase()));
+ assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+
+ // vnf active
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager2.PROV_STATUS_ACTIVE.toLowerCase()));
+ assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+
+ // vnf inactive
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive"));
+ assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ .hasMessage("prov-status is not ACTIVE on VServer or VNF");
+
// valid
event.setAai(orig);
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();