本文整理汇总了Java中org.onosproject.net.Host.ipAddresses方法的典型用法代码示例。如果您正苦于以下问题:Java Host.ipAddresses方法的具体用法?Java Host.ipAddresses怎么用?Java Host.ipAddresses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.Host
的用法示例。
在下文中一共展示了Host.ipAddresses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import org.onosproject.net.Host; //导入方法依赖的package包/类
@Override
public ObjectNode encode(Host host, CodecContext context) {
checkNotNull(host, "Host cannot be null");
final JsonCodec<HostLocation> locationCodec =
context.codec(HostLocation.class);
final ObjectNode result = context.mapper().createObjectNode()
.put("id", host.id().toString())
.put("mac", host.mac().toString())
.put("vlan", host.vlan().toString());
final ArrayNode jsonIpAddresses = result.putArray("ipAddresses");
for (final IpAddress ipAddress : host.ipAddresses()) {
jsonIpAddresses.add(ipAddress.toString());
}
result.set("ipAddresses", jsonIpAddresses);
result.set("location", locationCodec.encode(host.location(), context));
return annotate(result, host, context);
}
示例2: hostUpdated
import org.onosproject.net.Host; //导入方法依赖的package包/类
private void hostUpdated(Host host) {
synchronized (this) {
for (IpAddress ip : host.ipAddresses()) {
routeStore.updateNextHop(ip, host.mac());
}
}
}
示例3: hostRemoved
import org.onosproject.net.Host; //导入方法依赖的package包/类
private void hostRemoved(Host host) {
synchronized (this) {
for (IpAddress ip : host.ipAddresses()) {
routeStore.removeNextHop(ip, host.mac());
}
}
}
示例4: processHostAdded
import org.onosproject.net.Host; //导入方法依赖的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);
}
});
}
}
示例5: processHostRemoved
import org.onosproject.net.Host; //导入方法依赖的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);
}
});
}
}
示例6: description
import org.onosproject.net.Host; //导入方法依赖的package包/类
/**
* Produces a host description from the given host.
*
* @param host host to copy
* @return host description
*/
static DefaultHostDescription description(Host host) {
return new DefaultHostDescription(host.mac(), host.vlan(), host.location(),
host.ipAddresses());
}