@Test public void testQueueDeltaOrder() { Queue<RouteAdvertisement<AbstractRoute>> q = new ConcurrentLinkedQueue<>(); StaticRoute sr1 = StaticRoute.builder() .setNetwork(Ip.parse("1.1.1.1").toPrefix()) .setNextHopIp(Ip.ZERO) .setNextHopInterface(null) .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(); StaticRoute sr2 = StaticRoute.builder() .setNetwork(Ip.parse("1.1.1.1").toPrefix()) .setNextHopIp(Ip.ZERO) .setNextHopInterface(null) .setAdministrativeCost(100) .setMetric(0L) .setTag(1L) .build(); RibDelta.Builder<AbstractRoute> builder = RibDelta.builder(); builder.add(sr1).remove(sr2, Reason.WITHDRAW); VirtualRouter.queueDelta(q, builder.build()); assertThat(q.remove(), equalTo(new RouteAdvertisement<>(sr1))); assertThat( q.remove(), equalTo(RouteAdvertisement.builder().setRoute(sr2).setReason(Reason.WITHDRAW).build())); assertThat(q, empty()); }
static <R extends AbstractRoute, D extends R> void queueDelta( Queue<RouteAdvertisement<R>> queue, @Nonnull RibDelta<D> delta) { delta .getActions() .forEach( r -> { @SuppressWarnings("unchecked") RouteAdvertisement<R> sanitized = (RouteAdvertisement<R>) r.sanitizeForExport(); queue.add(sanitized); }); }
VirtualRouter { static <R extends AbstractRoute, D extends R> void queueDelta( Queue<RouteAdvertisement<R>> queue, @Nonnull RibDelta<D> delta) { delta .getActions() .forEach( r -> { @SuppressWarnings("unchecked") RouteAdvertisement<R> sanitized = (RouteAdvertisement<R>) r.sanitizeForExport(); queue.add(sanitized); }); } }
VirtualRouter { static <R extends AbstractRoute, D extends R> void queueDelta( Queue<RouteAdvertisement<R>> queue, @Nonnull RibDelta<D> delta) { delta .getActions() .forEach( r -> { @SuppressWarnings("unchecked") RouteAdvertisement<R> sanitized = (RouteAdvertisement<R>) r.sanitizeForExport(); queue.add(sanitized); }); } VirtualRouter(@Nonnull String name, @Nonnull Node node); }
VirtualRouter { static <R extends AbstractRoute, D extends R> void queueDelta( Queue<RouteAdvertisement<R>> queue, @Nonnull RibDelta<D> delta) { delta .getActions() .forEach( r -> { @SuppressWarnings("unchecked") RouteAdvertisement<R> sanitized = (RouteAdvertisement<R>) r.sanitizeForExport(); queue.add(sanitized); }); } VirtualRouter(@Nonnull String name, @Nonnull Node node); void computeFib(); Configuration getConfiguration(); Fib getFib(); void enqueueCrossVrfRoutes(
      @Nonnull CrossVrfEdgeId remoteVrfToOurRib,
      @Nonnull Stream<RouteAdvertisement<AnnotatedRoute<AbstractRoute>>> routeAdverts,
      @Nullable String policyName); Map<String, OspfRoutingProcess> getOspfProcesses(); Set<Layer2Vni> getLayer2Vnis(); Set<Layer3Vni> getLayer3Vnis(); @Nonnull String getName(); }
VirtualRouter { static <R extends AbstractRoute, D extends R> void queueDelta( Queue<RouteAdvertisement<R>> queue, @Nonnull RibDelta<D> delta) { delta .getActions() .forEach( r -> { @SuppressWarnings("unchecked") RouteAdvertisement<R> sanitized = (RouteAdvertisement<R>) r.sanitizeForExport(); queue.add(sanitized); }); } VirtualRouter(@Nonnull String name, @Nonnull Node node); void computeFib(); Configuration getConfiguration(); Fib getFib(); void enqueueCrossVrfRoutes(
      @Nonnull CrossVrfEdgeId remoteVrfToOurRib,
      @Nonnull Stream<RouteAdvertisement<AnnotatedRoute<AbstractRoute>>> routeAdverts,
      @Nullable String policyName); Map<String, OspfRoutingProcess> getOspfProcesses(); Set<Layer2Vni> getLayer2Vnis(); Set<Layer3Vni> getLayer3Vnis(); @Nonnull String getName();  }