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


Java FibEntry类代码示例

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


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

示例1: testIpv4RouteAdd

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests adding a IPv4 route entry.
 */
@Test
public void testIpv4RouteAdd() {
    // Construct a route entry
    IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
    IpAddress nextHopIp = Ip4Address.valueOf("192.168.10.1");

    RouteEntry routeEntry = new RouteEntry(prefix, nextHopIp);

    // Expected FIB entry
    FibEntry fibEntry = new FibEntry(prefix, nextHopIp,
            MacAddress.valueOf("00:00:00:00:00:01"));

    fibListener.update(Collections.singletonList(new FibUpdate(
            FibUpdate.Type.UPDATE, fibEntry)), Collections.emptyList());

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.UPDATE, routeEntry)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:RouterTest.java

示例2: testIpv6RouteAdd

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests adding a IPv6 route entry.
 */
@Test
public void testIpv6RouteAdd() {
    // Construct a route entry
    IpPrefix prefix = Ip6Prefix.valueOf("4000::/64");
    IpAddress nextHopIp = Ip6Address.valueOf("1000::1");

    RouteEntry routeEntry = new RouteEntry(prefix, nextHopIp);

    // Expected FIB entry
    FibEntry fibEntry = new FibEntry(prefix, nextHopIp,
            MacAddress.valueOf("00:00:00:00:00:04"));

    fibListener.update(Collections.singletonList(new FibUpdate(
            FibUpdate.Type.UPDATE, fibEntry)), Collections.emptyList());

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.UPDATE, routeEntry)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:RouterTest.java

示例3: testIpv4RouteDelete

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests deleting a IPv4 route entry.
 */
@Test
public void testIpv4RouteDelete() {
    // Firstly add a route
    testIpv4RouteAdd();

    RouteEntry deleteRouteEntry = new RouteEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.10.1"));

    FibEntry deleteFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"), null, null);

    reset(fibListener);
    fibListener.update(Collections.emptyList(), Collections.singletonList(
            new FibUpdate(FibUpdate.Type.DELETE, deleteFibEntry)));

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.DELETE, deleteRouteEntry)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:RouterTest.java

示例4: testIpv6RouteDelete

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests deleting a IPv6 route entry.
 */
@Test
public void testIpv6RouteDelete() {
    // Firstly add a route
    testIpv6RouteAdd();

    RouteEntry deleteRouteEntry = new RouteEntry(
            Ip6Prefix.valueOf("4000::/64"),
            Ip6Address.valueOf("1000::1"));

    FibEntry deleteFibEntry = new FibEntry(
            Ip6Prefix.valueOf("4000::/64"), null, null);

    reset(fibListener);
    fibListener.update(Collections.emptyList(), Collections.singletonList(
            new FibUpdate(FibUpdate.Type.DELETE, deleteFibEntry)));

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.DELETE, deleteRouteEntry)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:RouterTest.java

示例5: deleteFibEntry

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
private synchronized void deleteFibEntry(Collection<FibUpdate> withdraws) {
    FlowRuleOperations.Builder builder = FlowRuleOperations.builder();

    for (FibUpdate update : withdraws) {
        FibEntry entry = update.entry();

        Group group = deleteNextHop(entry.prefix());
        if (group == null) {
            log.warn("Group not found when deleting {}", entry);
            return;
        }

        FlowRule flowRule = generateRibFlowRule(entry.prefix(), group);

        builder.remove(flowRule);
    }

    flowService.apply(builder.build());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:20,代码来源:BgpRouter.java

示例6: testRouteAdd

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests adding a route entry.
 */
@Test
public void testRouteAdd() {
    // Construct a route entry
    IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
    IpAddress nextHopIp = Ip4Address.valueOf("192.168.10.1");

    RouteEntry routeEntry = new RouteEntry(prefix, nextHopIp);

    // Expected FIB entry
    FibEntry fibEntry = new FibEntry(prefix, nextHopIp,
                                     MacAddress.valueOf("00:00:00:00:00:01"));

    fibListener.update(Collections.singletonList(new FibUpdate(
            FibUpdate.Type.UPDATE, fibEntry)), Collections.emptyList());

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.UPDATE, routeEntry)));

    verify(fibListener);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:26,代码来源:RouterTest.java

示例7: testRouteDelete

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests deleting a route entry.
 */
@Test
public void testRouteDelete() {
    // Firstly add a route
    testRouteAdd();

    RouteEntry deleteRouteEntry = new RouteEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.10.1"));

    FibEntry deleteFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"), null, null);

    reset(fibListener);
    fibListener.update(Collections.emptyList(), Collections.singletonList(
            new FibUpdate(FibUpdate.Type.DELETE, deleteFibEntry)));

    replay(fibListener);

    router.processRouteUpdates(Collections.singletonList(
            new RouteUpdate(RouteUpdate.Type.DELETE, deleteRouteEntry)));

    verify(fibListener);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:27,代码来源:RouterTest.java

示例8: processRouteUpdates

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Processes route updates.
 *
 * @param routeUpdates the route updates to process
 */
void processRouteUpdates(Collection<RouteUpdate> routeUpdates) {
    synchronized (this) {
        Collection<IpPrefix> withdrawPrefixes = new LinkedList<>();
        Collection<FibUpdate> fibUpdates = new LinkedList<>();
        Collection<FibUpdate> fibWithdraws = new LinkedList<>();

        for (RouteUpdate update : routeUpdates) {
            switch (update.type()) {
            case UPDATE:

                FibEntry fib = processRouteAdd(update.routeEntry(),
                        withdrawPrefixes);
                if (fib != null) {
                    fibUpdates.add(new FibUpdate(FibUpdate.Type.UPDATE, fib));
                }

                break;
            case DELETE:
                processRouteDelete(update.routeEntry(), withdrawPrefixes);

                break;
            default:
                log.error("Unknown update Type: {}", update.type());
                break;
            }
        }

        withdrawPrefixes.forEach(p -> fibWithdraws.add(new FibUpdate(
                FibUpdate.Type.DELETE, new FibEntry(p, null, null))));

        if (!fibUpdates.isEmpty() || !fibWithdraws.isEmpty()) {
            fibComponent.update(fibUpdates, fibWithdraws);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:DefaultRouter.java

示例9: testRouteUpdate

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests updating a IPv4 route entry.
 */
@Test
public void testRouteUpdate() {
    // Firstly add a route
    testIpv4RouteAdd();

    // Route entry with updated next hop for the original prefix
    RouteEntry routeEntryUpdate = new RouteEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.20.1"));

    // The old FIB entry will be withdrawn
    FibEntry withdrawFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"), null, null);

    // A new FIB entry will be added
    FibEntry updateFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.20.1"),
            MacAddress.valueOf("00:00:00:00:00:02"));

    reset(fibListener);
    fibListener.update(Collections.singletonList(new FibUpdate(
                                FibUpdate.Type.UPDATE, updateFibEntry)),
                       Collections.singletonList(new FibUpdate(
                                FibUpdate.Type.DELETE, withdrawFibEntry)));
    replay(fibListener);

    reset(routingConfigurationService);
    expect(routingConfigurationService.isIpPrefixLocal(
            anyObject(IpPrefix.class))).andReturn(false);
    replay(routingConfigurationService);

    router.processRouteUpdates(Collections.singletonList(new RouteUpdate(
            RouteUpdate.Type.UPDATE, routeEntryUpdate)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:RouterTest.java

示例10: testIpv6RouteUpdate

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests updating a IPv6 route entry.
 */
@Test
public void testIpv6RouteUpdate() {
    // Firstly add a route
    testIpv6RouteAdd();

    // Route entry with updated next hop for the original prefix
    RouteEntry routeEntryUpdate = new RouteEntry(
            Ip6Prefix.valueOf("4000::/64"),
            Ip6Address.valueOf("2000::1"));

    // The old FIB entry will be withdrawn
    FibEntry withdrawFibEntry = new FibEntry(
            Ip6Prefix.valueOf("4000::/64"), null, null);

    // A new FIB entry will be added
    FibEntry updateFibEntry = new FibEntry(
            Ip6Prefix.valueOf("4000::/64"),
            Ip6Address.valueOf("2000::1"),
            MacAddress.valueOf("00:00:00:00:00:05"));

    reset(fibListener);
    fibListener.update(Collections.singletonList(new FibUpdate(
                               FibUpdate.Type.UPDATE, updateFibEntry)),
                       Collections.singletonList(new FibUpdate(
                               FibUpdate.Type.DELETE, withdrawFibEntry)));
    replay(fibListener);

    reset(routingConfigurationService);
    expect(routingConfigurationService.isIpPrefixLocal(
            anyObject(IpPrefix.class))).andReturn(false);
    replay(routingConfigurationService);

    router.processRouteUpdates(Collections.singletonList(new RouteUpdate(
            RouteUpdate.Type.UPDATE, routeEntryUpdate)));

    verify(fibListener);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:RouterTest.java

示例11: updateFibEntry

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
private void updateFibEntry(Collection<FibUpdate> updates) {
    Map<FibEntry, Group> toInstall = new HashMap<>(updates.size());

    for (FibUpdate update : updates) {
        FibEntry entry = update.entry();

        addNextHop(entry);

        Group group;
        synchronized (pendingUpdates) {
            NextHop nextHop = nextHops.get(entry.nextHopIp());
            group = groupService.getGroup(deviceId,
                                          new DefaultGroupKey(
                                          appKryo.serialize(nextHop.group())));

            if (group == null) {
                log.debug("Adding pending flow {}", update.entry());
                pendingUpdates.put(nextHop.group(), update.entry());
                continue;
            }
        }

        toInstall.put(update.entry(), group);
    }

    installFlows(toInstall);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:28,代码来源:BgpRouter.java

示例12: installFlows

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
private void installFlows(Map<FibEntry, Group> entriesToInstall) {
    FlowRuleOperations.Builder builder = FlowRuleOperations.builder();

    for (Map.Entry<FibEntry, Group> entry : entriesToInstall.entrySet()) {
        FibEntry fibEntry = entry.getKey();
        Group group = entry.getValue();

        FlowRule flowRule = generateRibFlowRule(fibEntry.prefix(), group);

        builder.add(flowRule);
    }

    flowService.apply(builder.build());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:15,代码来源:BgpRouter.java

示例13: testRouteUpdate

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests updating a route entry.
 */
@Test
public void testRouteUpdate() {
    // Firstly add a route
    testRouteAdd();

    // Route entry with updated next hop for the original prefix
    RouteEntry routeEntryUpdate = new RouteEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.20.1"));

    // The old FIB entry will be withdrawn
    FibEntry withdrawFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"), null, null);

    // A new FIB entry will be added
    FibEntry updateFibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"),
            Ip4Address.valueOf("192.168.20.1"),
            MacAddress.valueOf("00:00:00:00:00:02"));

    reset(fibListener);
    fibListener.update(Collections.singletonList(new FibUpdate(
                                FibUpdate.Type.UPDATE, updateFibEntry)),
                       Collections.singletonList(new FibUpdate(
                                FibUpdate.Type.DELETE, withdrawFibEntry)));
    replay(fibListener);

    reset(routingConfigurationService);
    expect(routingConfigurationService.isIpPrefixLocal(
            anyObject(IpPrefix.class))).andReturn(false);
    replay(routingConfigurationService);

    router.processRouteUpdates(Collections.singletonList(new RouteUpdate(
            RouteUpdate.Type.UPDATE, routeEntryUpdate)));

    verify(fibListener);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:41,代码来源:RouterTest.java

示例14: testFibDelete

import org.onosproject.routing.FibEntry; //导入依赖的package包/类
/**
 * Tests deleting a FIB entry.
 *
 * We verify that the synchronizer records the correct state and that the
 * correct intent is withdrawn from the IntentService.
 *
 * @throws TestUtilsException
 */
@Test
public void testFibDelete() throws TestUtilsException {
    // Firstly add a route
    testFibAdd();

    Intent addedIntent =
            intentSynchronizer.getRouteIntents().iterator().next();

    // Construct the existing route entry
    FibEntry fibEntry = new FibEntry(
            Ip4Prefix.valueOf("1.1.1.0/24"), null, null);

    // Set up expectation
    reset(intentService);
    // Setup the expected intents
    intentService.withdraw(eqExceptId(addedIntent));
    replay(intentService);

    // Call the update() method in IntentSynchronizer class
    intentSynchronizer.leaderChanged(true);
    TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
    FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.DELETE, fibEntry);
    intentSynchronizer.update(Collections.emptyList(),
                              Collections.singletonList(fibUpdate));

    // Verify
    assertEquals(intentSynchronizer.getRouteIntents().size(), 0);
    verify(intentService);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:38,代码来源:IntentSyncTest.java

示例15: processRouteAdd

import org.onosproject.routing.FibEntry; //导入依赖的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.FibEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。