本文整理汇总了Java中org.onlab.packet.MacAddress.equals方法的典型用法代码示例。如果您正苦于以下问题:Java MacAddress.equals方法的具体用法?Java MacAddress.equals怎么用?Java MacAddress.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onlab.packet.MacAddress
的用法示例。
在下文中一共展示了MacAddress.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateNextHop
import org.onlab.packet.MacAddress; //导入方法依赖的package包/类
@Override
public void updateNextHop(IpAddress ip, MacAddress mac) {
Collection<Route> routes = getDefaultRouteTable(ip).getRoutesForNextHop(ip);
if (!routes.isEmpty() && !mac.equals(nextHops.get(ip))) {
MacAddress oldMac = nextHops.put(ip, mac);
for (Route route : routes) {
if (oldMac == null) {
notifyDelegate(new RouteEvent(RouteEvent.Type.ROUTE_ADDED,
new ResolvedRoute(route, mac)));
} else {
notifyDelegate(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED,
new ResolvedRoute(route, mac)));
}
}
}
}
示例2: pickForwardPathIfPossible
import org.onlab.packet.MacAddress; //导入方法依赖的package包/类
private Path pickForwardPathIfPossible(Set<Path> paths, PortNumber notToPort,
MacAddress srcHost, MacAddress destHost) {
Path lastPath = null;
boolean match = false;
List<DeviceId> route = null;
if (destHost.equals(gateway1.mac()) || srcHost.equals(gateway1.mac())) {
route = pathForGateway1;
} else if (destHost.equals(gateway2.mac()) || srcHost.equals(gateway2.mac())) {
route = pathForGateway2;
}
for (Path path : paths) {
// for (int i = 0; i < 2; i++) {
// Path targetPath = i == 0 ? path.primary() : path.backup();
Path targetPath = path;
for (Link link : targetPath.links()) {
DeviceId srcDpid = link.src().deviceId();
DeviceId dstDpid = link.dst().deviceId();
if (route.contains(srcDpid) && route.contains(dstDpid)) {
match = true;
} else {
match = false;
break;
}
}
if (match) {
lastPath = targetPath;
break;
}
// }
// if (match) {
// break;
// }
}
return lastPath;
}