diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-06 07:15:03 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-08 10:55:21 -0800 |
commit | 76dc892491948adae5e5e62cf94448967e8d865b (patch) | |
tree | 7a33ef05cc583946db21edad627060f280a53549 /framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java | |
parent | d333c63fdec8b064184b0a26f8d777f267577fde (diff) |
Fixes bad POM file with ONOS commit 8c68536972f63069c263635c9d9f4f31d7f3e9a2
Change-Id: I7adb5a2d3738d53dbc41db7577768b0e7ced5450
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java')
-rw-r--r-- | framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java index 9f2d4105..5246f313 100644 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java +++ b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java @@ -28,6 +28,7 @@ import org.onosproject.net.ConnectPoint; import org.onosproject.net.config.Config; import org.onosproject.net.host.InterfaceIpAddress; +import java.util.Iterator; import java.util.Set; /** @@ -35,6 +36,7 @@ import java.util.Set; */ @Beta public class InterfaceConfig extends Config<ConnectPoint> { + public static final String NAME = "name"; public static final String IPS = "ips"; public static final String MAC = "mac"; public static final String VLAN = "vlan"; @@ -52,6 +54,8 @@ public class InterfaceConfig extends Config<ConnectPoint> { try { for (JsonNode intfNode : array) { + String name = intfNode.path(NAME).asText(null); + Set<InterfaceIpAddress> ips = getIps(intfNode); String mac = intfNode.path(MAC).asText(); @@ -59,7 +63,7 @@ public class InterfaceConfig extends Config<ConnectPoint> { VlanId vlan = getVlan(intfNode); - interfaces.add(new Interface(subject, ips, macAddr, vlan)); + interfaces.add(new Interface(name, subject, ips, macAddr, vlan)); } } catch (IllegalArgumentException e) { throw new ConfigException(CONFIG_VALUE_ERROR, e); @@ -76,6 +80,8 @@ public class InterfaceConfig extends Config<ConnectPoint> { public void addInterface(Interface intf) { ObjectNode intfNode = array.addObject(); + intfNode.put(NAME, intf.name()); + if (intf.mac() != null) { intfNode.put(MAC, intf.mac().toString()); } @@ -92,12 +98,14 @@ public class InterfaceConfig extends Config<ConnectPoint> { /** * Removes an interface from the config. * - * @param intf interface to remove + * @param name name of the interface to remove */ - public void removeInterface(Interface intf) { - for (int i = 0; i < array.size(); i++) { - if (intf.vlan().equals(getVlan(node))) { - array.remove(i); + public void removeInterface(String name) { + Iterator<JsonNode> it = array.iterator(); + while (it.hasNext()) { + JsonNode node = it.next(); + if (node.path(NAME).asText().equals(name)) { + it.remove(); break; } } |