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


Java RouteEntry.nextHop方法代码示例

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


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

示例1: getEgressConnectPoint

import org.onosproject.routing.RouteEntry; //导入方法依赖的package包/类
@Override
public ConnectPoint getEgressConnectPoint(IpAddress dstIpAddress) {
    LocationType type = getLocationType(dstIpAddress);
    if (type == LocationType.LOCAL) {
        Set<Host> hosts = hostService.getHostsByIp(dstIpAddress);
        if (!hosts.isEmpty()) {
            return hosts.iterator().next().location();
        } else {
            hostService.startMonitoringIp(dstIpAddress);
            return null;
        }
    } else if (type == LocationType.INTERNET) {
        IpAddress nextHopIpAddress = null;
        RouteEntry routeEntry = getLongestMatchableRouteEntry(dstIpAddress);
        if (routeEntry != null) {
            nextHopIpAddress = routeEntry.nextHop();
            Interface it = routingConfigurationService
                    .getMatchingInterface(nextHopIpAddress);
            if (it != null) {
                return it.connectPoint();
            } else {
                return null;
            }
        } else {
            return null;
        }
    } else {
        return null;
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:31,代码来源:Router.java

示例2: processRouteAdd

import org.onosproject.routing.RouteEntry; //导入方法依赖的package包/类
/**
 * Processes adding a route entry.
 * <p>
 * The route entry is added to the radix tree. If there was an existing
 * next hop for this prefix, but the next hop was different, then the
 * old route entry is deleted.
 * </p>
 * <p>
 * NOTE: Currently, we don't handle routes if the next hop is within the
 * SDN domain.
 * </p>
 *
 * @param routeEntry the route entry to add
 * @param withdrawPrefixes the collection of accumulated prefixes whose
 * intents will be withdrawn
 * @return the corresponding FIB entry change, or null
 */
private FibEntry processRouteAdd(RouteEntry routeEntry,
                                 Collection<IpPrefix> withdrawPrefixes) {
    log.debug("Processing route add: {}", routeEntry);

    // Find the old next-hop if we are updating an old route entry
    IpAddress oldNextHop = null;
    RouteEntry oldRouteEntry = findRibRoute(routeEntry.prefix());
    if (oldRouteEntry != null) {
        oldNextHop = oldRouteEntry.nextHop();
    }

    // Add the new route to the RIB
    addRibRoute(routeEntry);

    if (oldNextHop != null) {
        if (oldNextHop.equals(routeEntry.nextHop())) {
            return null;            // No change
        }
        //
        // Update an existing nexthop for the prefix.
        // We need to remove the old flows for this prefix from the
        // switches before the new flows are added.
        //
        withdrawPrefixes.add(routeEntry.prefix());
    }

    if (routingConfigurationService.isIpPrefixLocal(routeEntry.prefix())) {
        // Route originated by local SDN domain
        // We don't handle these here, reactive routing APP will handle
        // these
        log.debug("Own route {} to {}",
                routeEntry.prefix(), routeEntry.nextHop());
        return null;
    }

    //
    // Find the MAC address of next hop router for this route entry.
    // If the MAC address can not be found in ARP cache, then this prefix
    // will be put in routesWaitingOnArp queue. Otherwise, generate
    // a new route intent.
    //

    // Monitor the IP address for updates of the MAC address
    hostService.startMonitoringIp(routeEntry.nextHop());

    // Check if we know the MAC address of the next hop
    MacAddress nextHopMacAddress = ip2Mac.get(routeEntry.nextHop());
    if (nextHopMacAddress == null) {
        Set<Host> hosts = hostService.getHostsByIp(routeEntry.nextHop());
        if (!hosts.isEmpty()) {
            nextHopMacAddress = hosts.iterator().next().mac();
        }
        if (nextHopMacAddress != null) {
            ip2Mac.put(routeEntry.nextHop(), nextHopMacAddress);
        }
    }
    if (nextHopMacAddress == null) {
        routesWaitingOnArp.put(routeEntry.nextHop(), routeEntry);
        return null;
    }
    return new FibEntry(routeEntry.prefix(), routeEntry.nextHop(),
            nextHopMacAddress);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:81,代码来源:DefaultRouter.java


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