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


Java FibUpdate类代码示例

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


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

示例1: testIpv4RouteAdd

import org.onosproject.routing.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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.FibUpdate; //导入依赖的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: testRouteUpdate

import org.onosproject.routing.FibUpdate; //导入依赖的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

示例13: testFibDelete

import org.onosproject.routing.FibUpdate; //导入依赖的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

示例14: updateMac

import org.onosproject.routing.FibUpdate; //导入依赖的package包/类
/**
 * Signals the Router that the MAC to IP mapping has potentially been
 * updated. This has the effect of updating the MAC address for any
 * installed prefixes if it has changed, as well as installing any pending
 * prefixes that were waiting for MAC resolution.
 *
 * @param ipAddress the IP address that an event was received for
 * @param macAddress the most recently known MAC address for the IP address
 */
private void updateMac(IpAddress ipAddress, MacAddress macAddress) {
    log.debug("Received updated MAC info: {} => {}", ipAddress,
            macAddress);

    //
    // We synchronize on "this" to prevent changes to the Radix tree
    // while we're pushing intents. If the tree changes, the
    // tree and the intents could get out of sync.
    //
    synchronized (this) {
        Collection<FibUpdate> submitFibEntries = new LinkedList<>();

        Set<RouteEntry> routesToPush =
                routesWaitingOnArp.removeAll(ipAddress);

        for (RouteEntry routeEntry : routesToPush) {
            // These will always be adds
            RouteEntry foundRouteEntry = findRibRoute(routeEntry.prefix());
            if (foundRouteEntry != null &&
                    foundRouteEntry.nextHop().equals(routeEntry.nextHop())) {
                // We only push FIB updates if the prefix is still in the
                // radix tree and the next hop is the same as our entry.
                // The prefix could have been removed while we were waiting
                // for the ARP, or the next hop could have changed.
                submitFibEntries.add(new FibUpdate(FibUpdate.Type.UPDATE,
                        new FibEntry(routeEntry.prefix(),
                                ipAddress, macAddress)));
            } else {
                log.debug("{} has been revoked before the MAC was resolved",
                        routeEntry);
            }
        }

        if (!submitFibEntries.isEmpty()) {
            fibComponent.update(submitFibEntries, Collections.emptyList());
        }

        ip2Mac.put(ipAddress, macAddress);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:50,代码来源:DefaultRouter.java

示例15: testRouteAdd

import org.onosproject.routing.FibUpdate; //导入依赖的package包/类
/**
 * Tests adding a route entry with asynchronous HostService replies.
 */
@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);

    // Host service will reply with no hosts when asked
    reset(hostService);
    expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
            Collections.emptySet()).anyTimes();
    hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
    replay(hostService);

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

    // Initially when we add the route, no FIB update will be sent
    replay(fibListener);

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

    verify(fibListener);


    // Now when we send the event, we expect the FIB update to be sent
    reset(fibListener);
    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);

    Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
                                MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
                                new HostLocation(
                                        SW1_ETH1.deviceId(),
                                        SW1_ETH1.port(), 1),
                                Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));

    // Send in the host event
    internalHostListener.event(
            new HostEvent(HostEvent.Type.HOST_ADDED, host));

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


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