本文整理汇总了Java中org.onosproject.net.HostLocation.deviceId方法的典型用法代码示例。如果您正苦于以下问题:Java HostLocation.deviceId方法的具体用法?Java HostLocation.deviceId怎么用?Java HostLocation.deviceId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.HostLocation
的用法示例。
在下文中一共展示了HostLocation.deviceId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processHostAdded
import org.onosproject.net.HostLocation; //导入方法依赖的package包/类
protected void processHostAdded(Host host) {
MacAddress mac = host.mac();
VlanId vlanId = host.vlan();
HostLocation location = host.location();
DeviceId deviceId = location.deviceId();
PortNumber port = location.port();
Set<IpAddress> ips = host.ipAddresses();
log.debug("Host {}/{} is added at {}:{}", mac, vlanId, deviceId, port);
if (accepted(host)) {
// Populate bridging table entry
log.debug("Populate L2 table entry for host {} at {}:{}",
mac, deviceId, port);
ForwardingObjective.Builder fob =
hostFwdObjBuilder(deviceId, mac, vlanId, port);
if (fob == null) {
log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
return;
}
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug("Host rule for {}/{} populated", mac, vlanId),
(objective, error) ->
log.warn("Failed to populate host rule for {}/{}: {}", mac, vlanId, error));
flowObjectiveService.forward(deviceId, fob.add(context));
ips.forEach(ip -> {
// Populate IP table entry
if (ip.isIp4()) {
addPerHostRoute(location, ip.getIp4Address());
srManager.routingRulePopulator.populateIpRuleForHost(
deviceId, ip.getIp4Address(), mac, port);
}
});
}
}
示例2: processHostRemoved
import org.onosproject.net.HostLocation; //导入方法依赖的package包/类
protected void processHostRemoved(Host host) {
MacAddress mac = host.mac();
VlanId vlanId = host.vlan();
HostLocation location = host.location();
DeviceId deviceId = location.deviceId();
PortNumber port = location.port();
Set<IpAddress> ips = host.ipAddresses();
log.debug("Host {}/{} is removed from {}:{}", mac, vlanId, deviceId, port);
if (accepted(host)) {
// Revoke bridging table entry
ForwardingObjective.Builder fob =
hostFwdObjBuilder(deviceId, mac, vlanId, port);
if (fob == null) {
log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
return;
}
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug("Host rule for {} revoked", host),
(objective, error) ->
log.warn("Failed to revoke host rule for {}: {}", host, error));
flowObjectiveService.forward(deviceId, fob.remove(context));
// Revoke IP table entry
ips.forEach(ip -> {
if (ip.isIp4()) {
removePerHostRoute(location, ip.getIp4Address());
srManager.routingRulePopulator.revokeIpRuleForHost(
deviceId, ip.getIp4Address(), mac, port);
}
});
}
}
示例3: processHostUpdatedEvent
import org.onosproject.net.HostLocation; //导入方法依赖的package包/类
protected void processHostUpdatedEvent(HostEvent event) {
MacAddress mac = event.subject().mac();
VlanId vlanId = event.subject().vlan();
HostLocation prevLocation = event.prevSubject().location();
DeviceId prevDeviceId = prevLocation.deviceId();
PortNumber prevPort = prevLocation.port();
Set<IpAddress> prevIps = event.prevSubject().ipAddresses();
HostLocation newLocation = event.subject().location();
DeviceId newDeviceId = newLocation.deviceId();
PortNumber newPort = newLocation.port();
Set<IpAddress> newIps = event.subject().ipAddresses();
log.debug("Host {}/{} is updated", mac, vlanId);
if (accepted(event.prevSubject())) {
// Revoke previous IP table entry
prevIps.forEach(ip -> {
if (ip.isIp4()) {
removePerHostRoute(prevLocation, ip.getIp4Address());
srManager.routingRulePopulator.revokeIpRuleForHost(
prevDeviceId, ip.getIp4Address(), mac, prevPort);
}
});
}
if (accepted(event.subject())) {
// Populate new IP table entry
newIps.forEach(ip -> {
if (ip.isIp4()) {
addPerHostRoute(newLocation, ip.getIp4Address());
srManager.routingRulePopulator.populateIpRuleForHost(
newDeviceId, ip.getIp4Address(), mac, newPort);
}
});
}
}
示例4: nonNullFormat
import org.onosproject.net.HostLocation; //导入方法依赖的package包/类
@Override
protected String nonNullFormat(Object value) {
HostLocation loc = (HostLocation) value;
return loc.deviceId() + "/" + loc.port();
}
示例5: nonNullFormat
import org.onosproject.net.HostLocation; //导入方法依赖的package包/类
@Override
protected String nonNullFormat(Object value) {
HostLocation loc = (HostLocation) value;
return loc.deviceId() + SLASH + loc.port();
}