X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fswitchmanager%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fswitchmanager%2FSubnetConfig.java;h=4ed9934b27a3f6d3105c2854c86c48f131fe40c6;hb=refs%2Fchanges%2F24%2F824%2F1;hp=87dd99da7f80736c76fc2e31765e84d46667fd35;hpb=9e43cfabdc83df4c5db51ce6e22e0cecca12aa9a;p=controller.git diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java index 87dd99da7f..4ed9934b27 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java @@ -34,7 +34,7 @@ import org.opendaylight.controller.sal.utils.NodeConnectorCreator; */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class SubnetConfig implements Serializable { +public class SubnetConfig implements Cloneable, Serializable { //static fields are by default excluded by Gson parser private static final long serialVersionUID = 1L; private static final String prettyFields[] = { GUIField.NAME.toString(), @@ -48,23 +48,29 @@ public class SubnetConfig implements Serializable { private String subnet; // A.B.C.D/MM Where A.B.C.D is the Default // Gateway IP (L3) or ARP Querier IP (L2 @XmlElement - private List nodePorts; // datapath ID/port list: + private Set nodePorts; // datapath ID/port list: // xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y public SubnetConfig() { } - public SubnetConfig(String desc, String sub, List sp) { + public SubnetConfig(String desc, String sub, Set sp) { name = desc; subnet = sub; nodePorts = sp; } + public SubnetConfig(SubnetConfig subnetConfig) { + name = subnetConfig.name; + subnet = subnetConfig.subnet; + nodePorts = new HashSet(subnetConfig.nodePorts); + } + public String getName() { return name; } - public List getNodePorts() { + public Set getNodePorts() { return nodePorts; } @@ -231,8 +237,18 @@ public class SubnetConfig implements Serializable { nodePorts.remove(sp); } + @Override public String toString() { - return ("Subnet Config [Description=" + name + " Subnet=" + subnet - + " NodeConnectors=" + nodePorts + "]"); + return ("SubnetConfig [Description=" + name + ", Subnet=" + subnet + + ", NodeConnectors=" + nodePorts + "]"); } + + /** + * Implement clonable interface + */ + @Override + public SubnetConfig clone() { + return new SubnetConfig(this); + } + }