aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java5
-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.java13
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java16
4 files changed, 33 insertions, 6 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 6e88ce982..08cd82fda 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
@@ -768,8 +768,9 @@ public class ControlLoopEventManager implements Serializable {
*/
protected 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/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java
index 5f611c098..b3bd2e347 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
@@ -554,8 +554,9 @@ public class ControlLoopEventManager2 implements ManagerContext, Serializable {
*/
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 d09c2c88b..e38ef2f4e 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
@@ -193,6 +193,19 @@ public class ControlLoopEventManager2Test {
assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem))
.hasMessage("prov-status is not ACTIVE on VServer or VNF");
+ // test with both prov-status flags, with mixed case
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "active"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "active"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
// valid
event.setAai(orig);
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index db16c4528..7c89f1897 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -733,13 +733,25 @@ public class ControlLoopEventManagerTest {
aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+ // null, ACTIVE
+ aai.remove(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS);
+ aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE.toUpperCase());
+ assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+
// null, active
aai.remove(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS);
- aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE);
+ aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE.toLowerCase());
+ assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+
+ // ACTIVE, null
+ aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager.PROV_STATUS_ACTIVE.toUpperCase());
+ aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
// active, null
- aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE);
+ aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager.PROV_STATUS_ACTIVE.toLowerCase());
aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));