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=36ab101a79a40525549543869f22befef25c679a;hb=48dd1186e0020b1fba649ded2fff54430dc1e5f1;hp=52b5f5255d3e5c13f088a38c19819c8730fdf266;hpb=401efea70ea57068edb5951bcb1f32ca8ec22b23;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 52b5f5255d..36ab101a79 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 @@ -19,7 +19,6 @@ import java.util.Set; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -42,19 +41,28 @@ public class SubnetConfig implements Cloneable, Serializable { // Order matters: JSP file expects following fields in the // following order - @XmlAttribute + /** + * Name of the subnet + */ + @XmlElement private String name; - @XmlAttribute - private String subnet; // A.B.C.D/MM Where A.B.C.D is the Default - // Gateway IP (L3) or ARP Querier IP (L2 + /** + * A.B.C.D/MM Where A.B.C.D is the Default + * Gateway IP (L3) or ARP Querier IP (L2) + */ + @XmlElement + private String subnet; + /** + * node ID/port list: + */a,b,c-m,r-t,y + */ @XmlElement - private List nodePorts; // datapath ID/port list: - // xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y + private Set nodePorts; public SubnetConfig() { } - public SubnetConfig(String desc, String sub, List sp) { + public SubnetConfig(String desc, String sub, Set sp) { name = desc; subnet = sub; nodePorts = sp; @@ -63,14 +71,14 @@ public class SubnetConfig implements Cloneable, Serializable { public SubnetConfig(SubnetConfig subnetConfig) { name = subnetConfig.name; subnet = subnetConfig.subnet; - nodePorts = new ArrayList(subnetConfig.nodePorts); + nodePorts = new HashSet(subnetConfig.nodePorts); } public String getName() { return name; } - public List getNodePorts() { + public Set getNodePorts() { return nodePorts; } @@ -185,13 +193,13 @@ public class SubnetConfig implements Cloneable, Serializable { //NodeConnectors learnt from a string private void getNodeConnectorsFromString(String codedNodeConnectors, Set sp) { - if (codedNodeConnectors == null) { + if (codedNodeConnectors == null || codedNodeConnectors.isEmpty()) { return; } if (sp == null) { return; } - // codedNodeConnectors = xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y + // codedNodeConnectors = nodeId/a,b,c-m,r-t,y String pieces[] = codedNodeConnectors.split("/"); for (Short port : getPortList(pieces[1])) { Node n = Node.fromString(pieces[0]); @@ -218,7 +226,7 @@ public class SubnetConfig implements Cloneable, Serializable { } public Set getNodeConnectors(String codedNodeConnectors) { - // codedNodeConnectors = xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y + // codedNodeConnectors = nodeId/a,b,c-m,r-t,y Set sp = new HashSet(); getNodeConnectorsFromString(codedNodeConnectors, sp); return sp;