Remove redundant interface object from interface configuration
Change-Id: I1eb0afab750fc15dba8aa13990147235232bd8ec
diff --git a/core/net/src/main/java/org/onosproject/net/config/impl/BasicNetworkConfigs.java b/core/net/src/main/java/org/onosproject/net/config/impl/BasicNetworkConfigs.java
index 7480462..de2f5c3 100644
--- a/core/net/src/main/java/org/onosproject/net/config/impl/BasicNetworkConfigs.java
+++ b/core/net/src/main/java/org/onosproject/net/config/impl/BasicNetworkConfigs.java
@@ -60,7 +60,8 @@
},
new ConfigFactory<ConnectPoint, InterfaceConfig>(CONNECT_POINT_SUBJECT_FACTORY,
InterfaceConfig.class,
- "interfaces") {
+ "interfaces",
+ true) {
@Override
public InterfaceConfig createConfig() {
return new InterfaceConfig();
diff --git a/core/net/src/main/java/org/onosproject/net/config/impl/NetworkConfigLoader.java b/core/net/src/main/java/org/onosproject/net/config/impl/NetworkConfigLoader.java
index 810ca6c..01348c1 100644
--- a/core/net/src/main/java/org/onosproject/net/config/impl/NetworkConfigLoader.java
+++ b/core/net/src/main/java/org/onosproject/net/config/impl/NetworkConfigLoader.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.config.impl;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Maps;
@@ -50,7 +51,7 @@
// FIXME: Add mutual exclusion to make sure this happens only once per startup.
- private final Map<InnerConfigPosition, ObjectNode> jsons = Maps.newConcurrentMap();
+ private final Map<InnerConfigPosition, JsonNode> jsons = Maps.newConcurrentMap();
private final NetworkConfigListener configListener = new InnerConfigListener();
@@ -163,7 +164,7 @@
private void saveSubjectJson(String sk,
String s, ObjectNode node) {
node.fieldNames().forEachRemaining(c ->
- this.jsons.put(new InnerConfigPosition(sk, s, c), (ObjectNode) node.path(c)));
+ this.jsons.put(new InnerConfigPosition(sk, s, c), node.path(c)));
}
/**
@@ -180,11 +181,11 @@
* are imported and have not yet been applied.
*/
private void applyConfigurations() {
- Iterator<Map.Entry<InnerConfigPosition, ObjectNode>> iter = jsons.entrySet().iterator();
+ Iterator<Map.Entry<InnerConfigPosition, JsonNode>> iter = jsons.entrySet().iterator();
- Map.Entry<InnerConfigPosition, ObjectNode> entry;
+ Map.Entry<InnerConfigPosition, JsonNode> entry;
InnerConfigPosition key;
- ObjectNode node;
+ JsonNode node;
String subjectKey;
String subjectString;
String configKey;
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java b/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java
index acda179..47adf5c 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java
@@ -31,7 +31,6 @@
* Configuration for interfaces.
*/
public class InterfaceConfig extends Config<ConnectPoint> {
- public static final String INTERFACES = "interfaces";
public static final String IPS = "ips";
public static final String MAC = "mac";
public static final String VLAN = "vlan";
@@ -50,8 +49,7 @@
Set<Interface> interfaces = Sets.newHashSet();
try {
- // TODO: rework this to take advantage of ArrayNode backing
- for (JsonNode intfNode : object.path(INTERFACES)) {
+ for (JsonNode intfNode : array) {
Set<InterfaceIpAddress> ips = getIps(intfNode);
if (ips.isEmpty()) {
throw new ConfigException(IP_MISSING_ERROR);