当前位置: 首页>>代码示例>>Java>>正文


Java Host.vlan方法代码示例

本文整理汇总了Java中org.onosproject.net.Host.vlan方法的典型用法代码示例。如果您正苦于以下问题:Java Host.vlan方法的具体用法?Java Host.vlan怎么用?Java Host.vlan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.Host的用法示例。


在下文中一共展示了Host.vlan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
            }
        });
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:HostHandler.java

示例2: 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);
            }
        });
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:HostHandler.java

示例3: 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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:TopologySimulator.java


注:本文中的org.onosproject.net.Host.vlan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。