Jonathan Hart
Committed by Gerrit Code Review

Remove redundant interface object from interface configuration

Change-Id: I1eb0afab750fc15dba8aa13990147235232bd8ec
......@@ -60,7 +60,8 @@ public class BasicNetworkConfigs {
},
new ConfigFactory<ConnectPoint, InterfaceConfig>(CONNECT_POINT_SUBJECT_FACTORY,
InterfaceConfig.class,
"interfaces") {
"interfaces",
true) {
@Override
public InterfaceConfig createConfig() {
return new InterfaceConfig();
......
......@@ -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 @@ public class NetworkConfigLoader {
// 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 @@ public class NetworkConfigLoader {
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 @@ public class NetworkConfigLoader {
* 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;
......
......@@ -31,7 +31,6 @@ import java.util.Set;
* 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 @@ public class InterfaceConfig extends Config<ConnectPoint> {
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);
......