@Test public void testInitStaticRibs() { VirtualRouter vr = makeIosVirtualRouter(null); addInterfaces(vr.getConfiguration(), exampleInterfaceAddresses); List<StaticRoute> routes = ImmutableList.of( StaticRoute.builder() .setNetwork(Prefix.parse("1.1.1.1/32")) .setNextHopIp(null) .setNextHopInterface("Ethernet1") .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(), StaticRoute.builder() .setNetwork(Prefix.parse("2.2.2.2/32")) .setNextHopIp(Ip.parse("9.9.9.8")) .setNextHopInterface(null) .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(), StaticRoute.builder() .setNetwork(Prefix.parse("3.3.3.3/32")) .setNextHopIp(Ip.parse("9.9.9.9")) .setNextHopInterface("Ethernet1") .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(), StaticRoute.builder() .setNetwork(Prefix.parse("4.4.4.4/32")) .setNextHopIp(null) .setNextHopInterface(Interface.NULL_INTERFACE_NAME) .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(), StaticRoute.builder() .setNetwork(Prefix.parse("5.5.5.5/32")) .setNextHopIp(null) .setNextHopInterface("Eth1") .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build(), StaticRoute.builder() .setNetwork(Prefix.parse("6.6.6.6/32")) .setNextHopIp(null) .setNextHopInterface(null) .setAdministrativeCost(1) .setMetric(0L) .setTag(1L) .build()); vr.getConfiguration() .getVrfs() .get(DEFAULT_VRF_NAME) .setStaticRoutes(ImmutableSortedSet.copyOf(routes)); vr.initStaticRibs(); assertThat( vr._staticUnconditionalRib.getTypedRoutes(), containsInAnyOrder(routes.get(0), routes.get(2), routes.get(3))); assertThat(vr._staticNextHopRib.getTypedRoutes(), containsInAnyOrder(routes.get(1))); }
@VisibleForTesting void initStaticRibs() { for (StaticRoute sr : _vrf.getStaticRoutes()) { if (isInterfaceRoute(sr)) { Interface nextHopInterface = _c.getAllInterfaces().get(sr.getNextHopInterface()); if (Interface.NULL_INTERFACE_NAME.equals(sr.getNextHopInterface()) || (nextHopInterface != null && (nextHopInterface.getActive()))) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } } else if (isNextVrfRoute(sr)) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } else { if (Route.UNSET_ROUTE_NEXT_HOP_IP.equals(sr.getNextHopIp())) { continue; } _staticNextHopRib.mergeRouteGetDelta(sr); } } }
VirtualRouter { @VisibleForTesting void initStaticRibs() { for (StaticRoute sr : _vrf.getStaticRoutes()) { if (isInterfaceRoute(sr)) { Interface nextHopInterface = _c.getAllInterfaces().get(sr.getNextHopInterface()); if (Interface.NULL_INTERFACE_NAME.equals(sr.getNextHopInterface()) || (nextHopInterface != null && (nextHopInterface.getActive()))) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } } else if (isNextVrfRoute(sr)) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } else { if (Route.UNSET_ROUTE_NEXT_HOP_IP.equals(sr.getNextHopIp())) { continue; } _staticNextHopRib.mergeRouteGetDelta(sr); } } } }
VirtualRouter { @VisibleForTesting void initStaticRibs() { for (StaticRoute sr : _vrf.getStaticRoutes()) { if (isInterfaceRoute(sr)) { Interface nextHopInterface = _c.getAllInterfaces().get(sr.getNextHopInterface()); if (Interface.NULL_INTERFACE_NAME.equals(sr.getNextHopInterface()) || (nextHopInterface != null && (nextHopInterface.getActive()))) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } } else if (isNextVrfRoute(sr)) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } else { if (Route.UNSET_ROUTE_NEXT_HOP_IP.equals(sr.getNextHopIp())) { continue; } _staticNextHopRib.mergeRouteGetDelta(sr); } } } VirtualRouter(@Nonnull String name, @Nonnull Node node); }
VirtualRouter { @VisibleForTesting void initStaticRibs() { for (StaticRoute sr : _vrf.getStaticRoutes()) { if (isInterfaceRoute(sr)) { Interface nextHopInterface = _c.getAllInterfaces().get(sr.getNextHopInterface()); if (Interface.NULL_INTERFACE_NAME.equals(sr.getNextHopInterface()) || (nextHopInterface != null && (nextHopInterface.getActive()))) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } } else if (isNextVrfRoute(sr)) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } else { if (Route.UNSET_ROUTE_NEXT_HOP_IP.equals(sr.getNextHopIp())) { continue; } _staticNextHopRib.mergeRouteGetDelta(sr); } } } 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 { @VisibleForTesting void initStaticRibs() { for (StaticRoute sr : _vrf.getStaticRoutes()) { if (isInterfaceRoute(sr)) { Interface nextHopInterface = _c.getAllInterfaces().get(sr.getNextHopInterface()); if (Interface.NULL_INTERFACE_NAME.equals(sr.getNextHopInterface()) || (nextHopInterface != null && (nextHopInterface.getActive()))) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } } else if (isNextVrfRoute(sr)) { _staticUnconditionalRib.mergeRouteGetDelta(sr); } else { if (Route.UNSET_ROUTE_NEXT_HOP_IP.equals(sr.getNextHopIp())) { continue; } _staticNextHopRib.mergeRouteGetDelta(sr); } } } 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();  }