- //Utility method useful for adding to a passed Set all the
- //NodeConnectors learnt from a string
- private void getNodeConnectorsFromString(String codedNodeConnectors,
- Set<NodeConnector> sp) {
- if (codedNodeConnectors == null) {
- return;
- }
- if (sp == null) {
- return;
- }
- // codedNodeConnectors = xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y
- String pieces[] = codedNodeConnectors.split("/");
- for (Short port : getPortList(pieces[1])) {
- Node n = Node.fromString(pieces[0]);
- if (n == null) {
- continue;
- }
- NodeConnector p = NodeConnectorCreator.createOFNodeConnector(port,
- n);
- if (p == null) {
- continue;
- }
- sp.add(p);
- }
- }
-
- public Set<NodeConnector> getSubnetNodeConnectors() {
- Set<NodeConnector> sp = new HashSet<NodeConnector>();
- if (isGlobal())
- return sp;
- for (String str : nodePorts) {
- getNodeConnectorsFromString(str, sp);
- }
- return sp;
- }
-
- public Set<NodeConnector> getNodeConnectors(String codedNodeConnectors) {
- // codedNodeConnectors = xx:xx:xx:xx:xx:xx:xx:xx/a,b,c-m,r-t,y
- Set<NodeConnector> sp = new HashSet<NodeConnector>();
- getNodeConnectorsFromString(codedNodeConnectors, sp);
- return sp;