CORD-73 Change the way we configure host learning in segment routing
hostLearning config
- true: enable host learning
- false or not provided: disable host learning
suppressHost config
- all connect points listed here will be ignored
- no effect if hostLearning is false
- accept all hosts if this config is not provided
Change-Id: Id4a60bd47cac1f226ab8ba5391931ad2fb798529
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
index 0ce8222..d987247 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
@@ -210,6 +210,27 @@
assertTrue(suppressHost.contains(PORT_3));
}
+ /**
+ * Tests hostLearning getter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testHostLearning() throws Exception {
+ assertFalse(config.hostLearning());
+ }
+
+ /**
+ * Tests hostLearning setter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSetHostLearning() throws Exception {
+ config.setHostLearning(true);
+ assertTrue(config.hostLearning());
+ }
+
private class MockDelegate implements ConfigApplyDelegate {
@Override
public void onApply(Config config) {
diff --git a/apps/segmentrouting/src/test/resources/sr-app-config-invalid.json b/apps/segmentrouting/src/test/resources/sr-app-config-invalid.json
index e2851d5..72def14 100644
--- a/apps/segmentrouting/src/test/resources/sr-app-config-invalid.json
+++ b/apps/segmentrouting/src/test/resources/sr-app-config-invalid.json
@@ -11,5 +11,6 @@
"suppressHost" : [
"of:1/1",
"wrongPort"
- ]
+ ],
+ "hostLearning" : false
}
diff --git a/apps/segmentrouting/src/test/resources/sr-app-config.json b/apps/segmentrouting/src/test/resources/sr-app-config.json
index 9e8b33e..de6d7fc 100644
--- a/apps/segmentrouting/src/test/resources/sr-app-config.json
+++ b/apps/segmentrouting/src/test/resources/sr-app-config.json
@@ -11,5 +11,6 @@
"suppressHost" : [
"of:1/1",
"of:1/2"
- ]
+ ],
+ "hostLearning" : false
}