private void resolveProdPortsAndAddEdges(){//TODO: not yet check null for variables in this function... //System.out.println("==========================================="); //System.out.println("===== Resolve the PR ports, and add edges correspondingly ====="); //System.out.println("\tNumber of switches to resolve: " + portToRemoteChassisOnSwitches.size()); for(Map.Entry<Long, Map<Short, String>> entryS : portToRemoteChassisOnSwitches.entrySet()){ Long localSwitchID = entryS.getKey(); Map<Short, String> remotePortIDs = portToRemotePortIDOnSwitchesTmp.get(localSwitchID); //System.out.println(localSwitchID + "'s size3="+ remotePortIDs.size()); for(Map.Entry<Short, String> entryR : remotePortIDs.entrySet()){ //logger.trace("...compare with remote port of id: " + entryR.getValue()); Short localPortNum = entryR.getKey(); String remotePortID = entryR.getValue(); String remoteSwitchID = entryS.getValue().get(localPortNum); //TODO: the following line is specifically for OF which needs xx:xx:xx:xx:xx:xx:xx:xx format, can't deal with other case well remoteSwitchID = HexEncode.longToHexString(HexEncode.stringToLong(remoteSwitchID)); //Memo: no worry whether the port on/off state is updated before we call isPortUp(), the port on/off state is updated and saved before edge resolving starts (see in SwitchHandler.handleMessages(), processPortStatusMsg() is called before notifyMessageListener()) if(!isPortUp(localSwitchID, localPortNum)){ logger.trace("\t\tThe local port is DOWN, so ignore this edge (local switch {} port {}, remote switch {} port {})", localSwitchID, localPortNum, remoteSwitchID, remotePortID); break; } logger.trace("\t\tPR edge discovered: remote (ip " + remoteSwitchID + ", portID " + remotePortID +") --> local (ip " + localSwitchID + ", port " + localPortNum + ")"); addDiscoveredEdgeProdSrc(remoteSwitchID, remotePortID, localSwitchID, localPortNum); } } //System.out.println("===== end of Resolve the PR ports, and add edges correspondingly ====="); //System.out.println("================================================="); }
this.nodeID = Long.valueOf(HexEncode.stringToLong(IDStr)); } else if (typeStr.equals(NodeIDType.ONEPK)) { this.nodeID = IDStr;
ofNodeID = Long.valueOf(HexEncode.stringToLong(numStr)); } catch (Exception ex) { ofNodeID = null;
String remoteChassis; if(swStr.indexOf(":") >= 0)//use input remoteChassisStr in hex format localChassis = HexEncode.longToHexString(HexEncode.stringToLong(swStr)); else localChassis = HexEncode.longToHexString(Long.parseLong(swStr)); if(remoteChassisStr.indexOf(":") >= 0)//use input remoteChassisStr in hex format remoteChassis = HexEncode.longToHexString(HexEncode.stringToLong(remoteChassisStr)); else remoteChassis = HexEncode.longToHexString(Long.parseLong(remoteChassisStr)); switches_ID2Chassis.put(HexEncode.stringToLong(remoteChassis), remoteChassis); switches_Chassis2ID.put(remoteChassis, HexEncode.stringToLong(remoteChassis)); System.out.println("Added LLDP data of chassis-to-swID mapping (the remote switch): chassis " + remoteChassis + " as switch ID " + HexEncode.stringToLong(remoteChassis));
Set<String> dpids = bridge.getDatapathIdColumn().getData(); if (dpids != null && !dpids.isEmpty()) { dpid = HexEncode.stringToLong((String) dpids.toArray()[0]);
String remoteSwitchIDStr = HexEncode.longToHexString(HexEncode.stringToLong(remoteChassis)); myAddEdgeProdSrc(remoteSwitchIDStr, remotePortID, localSwitchID, localPortNum); return;
public void _px2r(CommandInterpreter ci) { String st = ci.nextArgument(); if (st == null) { ci.println("Please enter a valid node id"); return; } long sid; try { sid = HexEncode.stringToLong(st); } catch (NumberFormatException e) { ci.println("Please enter a valid node id"); return; } Map<Integer, Long> swxid2rid = this.xid2rid.get(sid); if (swxid2rid == null) { ci.println("The node id entered does not exist"); return; } ci.println("xid rid"); Set<Integer> xidSet = swxid2rid.keySet(); if (xidSet == null) { return; } for (Integer xid : xidSet) { ci.println(xid + " " + swxid2rid.get(xid)); } }
Long ID = Long.valueOf(HexEncode.stringToLong(IDStr)); return new Node(typeStr, ID); } catch (Exception ex) {