@Test public void testFilterExternalRoutesOnExport() { RibDelta<OspfExternalRoute> routes = RibDelta.<OspfExternalRoute>builder() .add( OspfExternalType1Route.builder() .setNetwork(Prefix.parse("1.1.1.1/32")) .setLsaMetric(0L) .setCostToAdvertiser(0L) .setAdvertiser("someNode") .setArea(OspfRoute.NO_AREA) .build()) .build(); assertThat( _routingProcess .filterExternalRoutesOnExport(routes, AREA0_CONFIG) .collect(Collectors.toList()), equalTo(routes.getActions().collect(Collectors.toList()))); assertThat( _routingProcess .filterExternalRoutesOnExport( routes, OspfArea.builder().setNumber(33).setStub(StubSettings.builder().build()).build()) .collect(Collectors.toList()), empty()); assertThat( _routingProcess .filterExternalRoutesOnExport( routes, OspfArea.builder() .setNumber(33) .setNssa(NssaSettings.builder().setSuppressType7(true).build()) .build()) .collect(Collectors.toList()), empty()); assertThat( _routingProcess .filterExternalRoutesOnExport( routes, OspfArea.builder() .setNumber(33) .setNssa(NssaSettings.builder().setSuppressType7(false).build()) .build()) .collect(Collectors.toList()), equalTo(routes.getActions().collect(Collectors.toList()))); }
@Nonnull @VisibleForTesting <T extends OspfExternalRoute> Stream<RouteAdvertisement<T>> filterExternalRoutesOnExport( RibDelta<T> delta, OspfArea areaConfig) { if (areaConfig.getStubType() == StubType.STUB) { return Stream.of(); } if (isABR() && areaConfig.getNssa() != null && areaConfig.getNssa().getSuppressType7() && areaConfig.getStubType() == StubType.NSSA) { return Stream.of(); } return delta.getActions(); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @Nonnull @VisibleForTesting <T extends OspfExternalRoute> Stream<RouteAdvertisement<T>> filterExternalRoutesOnExport( RibDelta<T> delta, OspfArea areaConfig) { if (areaConfig.getStubType() == StubType.STUB) { return Stream.of(); } if (isABR() && areaConfig.getNssa() != null && areaConfig.getNssa().getSuppressType7() && areaConfig.getStubType() == StubType.NSSA) { return Stream.of(); } return delta.getActions(); } }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @Nonnull @VisibleForTesting <T extends OspfExternalRoute> Stream<RouteAdvertisement<T>> filterExternalRoutesOnExport( RibDelta<T> delta, OspfArea areaConfig) { if (areaConfig.getStubType() == StubType.STUB) { return Stream.of(); } if (isABR() && areaConfig.getNssa() != null && areaConfig.getNssa().getSuppressType7() && areaConfig.getStubType() == StubType.NSSA) { return Stream.of(); } return delta.getActions(); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @Nonnull @VisibleForTesting <T extends OspfExternalRoute> Stream<RouteAdvertisement<T>> filterExternalRoutesOnExport( RibDelta<T> delta, OspfArea areaConfig) { if (areaConfig.getStubType() == StubType.STUB) { return Stream.of(); } if (isABR() && areaConfig.getNssa() != null && areaConfig.getNssa().getSuppressType7() && areaConfig.getStubType() == StubType.NSSA) { return Stream.of(); } return delta.getActions(); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty(); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @Nonnull @VisibleForTesting <T extends OspfExternalRoute> Stream<RouteAdvertisement<T>> filterExternalRoutesOnExport( RibDelta<T> delta, OspfArea areaConfig) { if (areaConfig.getStubType() == StubType.STUB) { return Stream.of(); } if (isABR() && areaConfig.getNssa() != null && areaConfig.getNssa().getSuppressType7() && areaConfig.getStubType() == StubType.NSSA) { return Stream.of(); } return delta.getActions(); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty();  }