[ONOS-3205] Migrate LLDP Link Discovery configuration to Network Configuration System
- deviceIds under suppression will be moved out to different location. (See ONOS-3461)
Change-Id: I6ebe0ce7f5f2d26e7ee7175974e19305f7c17fad
diff --git a/core/api/src/main/java/org/onosproject/net/config/Config.java b/core/api/src/main/java/org/onosproject/net/config/Config.java
index 3757d32..5f2c9f3 100644
--- a/core/api/src/main/java/org/onosproject/net/config/Config.java
+++ b/core/api/src/main/java/org/onosproject/net/config/Config.java
@@ -333,6 +333,26 @@
}
/**
+ * Gets the specified array property as a list of items.
+ *
+ * @param name property name
+ * @param function mapper from string to item
+ * @param defaultValue default value if property not set
+ * @param <T> type of item
+ * @return list of items
+ */
+ protected <T> List<T> getList(String name, Function<String, T> function, List<T> defaultValue) {
+ List<T> list = Lists.newArrayList();
+ JsonNode jsonNode = object.path(name);
+ if (jsonNode.isMissingNode()) {
+ return defaultValue;
+ }
+ ArrayNode arrayNode = (ArrayNode) jsonNode;
+ arrayNode.forEach(i -> list.add(function.apply(i.asText())));
+ return list;
+ }
+
+ /**
* Sets the specified property as an array of items in a given collection or
* clears it if null is given.
*