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;
// 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:
+ *<node-id>/a,b,c-m,r-t,y
+ */
@XmlElement
- private List<String> nodePorts; // datapath ID/port list:
- // xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y
+ private Set<String> nodePorts;
public SubnetConfig() {
}
- public SubnetConfig(String desc, String sub, List<String> sp) {
+ public SubnetConfig(String desc, String sub, Set<String> sp) {
name = desc;
subnet = sub;
nodePorts = sp;
public SubnetConfig(SubnetConfig subnetConfig) {
name = subnetConfig.name;
subnet = subnetConfig.subnet;
- nodePorts = new ArrayList<String>(subnetConfig.nodePorts);
+ nodePorts = new HashSet<String>(subnetConfig.nodePorts);
}
public String getName() {
return name;
}
- public List<String> getNodePorts() {
+ public Set<String> getNodePorts() {
return nodePorts;
}
//NodeConnectors learnt from a string
private void getNodeConnectorsFromString(String codedNodeConnectors,
Set<NodeConnector> 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]);
}
public Set<NodeConnector> 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<NodeConnector> sp = new HashSet<NodeConnector>();
getNodeConnectorsFromString(codedNodeConnectors, sp);
return sp;