@Override public String toString() { return type + "[address = " + HexEncode.bytesToHexString(address) + "]"; } }
@Override public String toString() { return "EthernetAddress [macAddress=" + HexEncode.bytesToHexStringFormat(macAddress) + "]"; }
/** * @return the node MAC address in byte array format */ public byte[] getMacAddress() { return HexEncode.bytesFromHexString(this.address); }
(HexEncode.bytesToHexString(((byte[]) flow.getMatch() .getField(MatchType.DL_SRC).getValue())))); } else { (HexEncode.bytesToHexString(((byte[]) flow.getMatch() .getField(MatchType.DL_DST).getValue())))); } else { } else if (action instanceof SetDlSrc) { SetDlSrc ads = (SetDlSrc) action; actions.append(action.getType().toString()).append(" = ").append(HexEncode.bytesToHexStringFormat(ads.getDlAddress())).append("<br>"); } else if (action instanceof SetDlDst) { SetDlDst add = (SetDlDst) action; actions.append(action.getType().toString()).append(" = ").append(HexEncode.bytesToHexStringFormat(add.getDlAddress())).append("<br>"); } else if (action instanceof SetNwSrc) { SetNwSrc ans = (SetNwSrc) action;
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("================================================="); }
@Override public String toString() { if (this.nodeType.equals(NodeIDType.OPENFLOW)) { return this.nodeType + "|" + HexEncode.longToHexString((Long) this.nodeID); } else { return this.nodeType + "|" + this.nodeID.toString(); } }
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));
/** * Getter for the node ID in string format * * @return The nodeID in string format */ @XmlElement(name = "id") public String getNodeIDString() { if (this.nodeType.equals(NodeIDType.OPENFLOW)) { return HexEncode.longToHexString((Long) this.nodeID); } else { return this.nodeID.toString(); } }
this.nodeID = Long.valueOf(HexEncode.stringToLong(IDStr)); } else if (typeStr.equals(NodeIDType.ONEPK)) { this.nodeID = IDStr;
@Override public String toString() { return type + "[address = " + HexEncode.bytesToHexString(address) + "]"; } }
@Override public String toString() { return "Switch [dataLayerAddress=" + HexEncode.bytesToHexStringFormat(dataLayerAddress) + ", nodeConnectors=" + nodeConnectors + ", spanPorts=" + spanPorts + ", node=" + node + "]"; } }
private byte[] getSourceMACFromNodeID(String nodeId) { byte[] cid = HexEncode.bytesFromHexString(nodeId); byte[] sourceMac = new byte[6]; int pos = cid.length - sourceMac.length; if (pos >= 0) { System.arraycopy(cid, pos, sourceMac, 0, sourceMac.length); } return sourceMac; }
String remoteSwitchIDStr = HexEncode.longToHexString(HexEncode.stringToLong(remoteChassis)); myAddEdgeProdSrc(remoteSwitchIDStr, remotePortID, localSwitchID, localPortNum); return;
private void createFakeLLDPDataForSwitchIDChassisMapping(){ for(int i = 1; i <= fakeSwNum + fakeSwNum2; i++){ Long id = new Long(i); String chassis = HexEncode.longToHexString(new Long(i)); switches_ID2Chassis.put(id, chassis); switches_Chassis2ID.put(chassis, id); //System.out.println("Added LLDP data of chassis-to-swID mapping: 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]);
@XmlElement(name = "address") public String getDlAddressString() { return HexEncode.bytesToHexString(address); }
/** * Constructor to create DatalinkAddress property which contains the MAC * address. The property will be attached to a * {@link org.opendaylight.controller.sal.core.Node}. * * * @param nodeMacAddress * Data Link Address for the node in byte array format * * @return the constructed object */ public MacAddress(byte[] nodeMacAddress) { super(name); this.address = HexEncode.bytesToHexStringFormat(nodeMacAddress); }
private byte[] getSourceMACFromNodeID(String nodeId) { byte[] cid = HexEncode.bytesFromHexString(nodeId); byte[] sourceMac = new byte[6]; int pos = cid.length - sourceMac.length; if (pos >= 0) { System.arraycopy(cid, pos, sourceMac, 0, sourceMac.length); } return sourceMac; }
private void removeStatsRequestTasks(Long switchId) { log.info("Cleaning Statistics database for switch {}", HexEncode.longToHexString(switchId)); // To be safe, let's attempt removal of both VENDOR and FLOW request. It // does not hurt pendingStatsRequests.remove(new StatsRequest(switchId, OFStatisticsType.VENDOR)); pendingStatsRequests.remove(new StatsRequest(switchId, OFStatisticsType.FLOW)); pendingStatsRequests.remove(new StatsRequest(switchId, OFStatisticsType.DESC)); pendingStatsRequests.remove(new StatsRequest(switchId, OFStatisticsType.PORT)); pendingStatsRequests.remove(new StatsRequest(switchId, OFStatisticsType.TABLE)); // Take care of the TX rate databases switchPortStatsUpdated.remove(switchId); txRates.remove(switchId); }