@Test public void testSuppressSummarizedPrefixes() { Prefix suppressedPrefix = Prefix.parse("1.2.3.0/24"); If stmt = suppressSummarizedPrefixes(_c, _v.getName(), Stream.of(suppressedPrefix)); assertNotNull(stmt); assertTrue(firstNonNull(finalEnvironment(stmt, "1.2.3.4/32").getSuppressed(), false)); assertFalse(firstNonNull(finalEnvironment(stmt, "1.2.3.0/24").getSuppressed(), false)); assertFalse(firstNonNull(finalEnvironment(stmt, "1.2.0.0/16").getSuppressed(), false)); }
@Nullable static If suppressSummarizedPrefixes( Configuration c, String vrfName, Stream<Prefix> summaryOnlyPrefixes) { Iterator<Prefix> prefixesToSuppress = summaryOnlyPrefixes.iterator(); if (!prefixesToSuppress.hasNext()) { return null; } RouteFilterList matchLonger = new RouteFilterList(computeMatchSuppressedSummaryOnlyPolicyName(vrfName)); prefixesToSuppress.forEachRemaining( p -> matchLonger.addLine( new RouteFilterLine(LineAction.PERMIT, PrefixRange.moreSpecificThan(p)))); c.getRouteFilterLists().put(matchLonger.getName(), matchLonger); return new If( "Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of()); }
CumulusConversions { @Nullable static If suppressSummarizedPrefixes( Configuration c, String vrfName, Stream<Prefix> summaryOnlyPrefixes) { Iterator<Prefix> prefixesToSuppress = summaryOnlyPrefixes.iterator(); if (!prefixesToSuppress.hasNext()) { return null; } RouteFilterList matchLonger = new RouteFilterList(computeMatchSuppressedSummaryOnlyPolicyName(vrfName)); prefixesToSuppress.forEachRemaining( p -> matchLonger.addLine( new RouteFilterLine(LineAction.PERMIT, PrefixRange.moreSpecificThan(p)))); c.getRouteFilterLists().put(matchLonger.getName(), matchLonger); return new If( "Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of()); } }
CumulusConversions { @Nullable static If suppressSummarizedPrefixes( Configuration c, String vrfName, Stream<Prefix> summaryOnlyPrefixes) { Iterator<Prefix> prefixesToSuppress = summaryOnlyPrefixes.iterator(); if (!prefixesToSuppress.hasNext()) { return null; } RouteFilterList matchLonger = new RouteFilterList(computeMatchSuppressedSummaryOnlyPolicyName(vrfName)); prefixesToSuppress.forEachRemaining( p -> matchLonger.addLine( new RouteFilterLine(LineAction.PERMIT, PrefixRange.moreSpecificThan(p)))); c.getRouteFilterLists().put(matchLonger.getName(), matchLonger); return new If( "Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of()); }  }
CumulusConversions { @Nullable static If suppressSummarizedPrefixes( Configuration c, String vrfName, Stream<Prefix> summaryOnlyPrefixes) { Iterator<Prefix> prefixesToSuppress = summaryOnlyPrefixes.iterator(); if (!prefixesToSuppress.hasNext()) { return null; } RouteFilterList matchLonger = new RouteFilterList(computeMatchSuppressedSummaryOnlyPolicyName(vrfName)); prefixesToSuppress.forEachRemaining( p -> matchLonger.addLine( new RouteFilterLine(LineAction.PERMIT, PrefixRange.moreSpecificThan(p)))); c.getRouteFilterLists().put(matchLonger.getName(), matchLonger); return new If( "Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of()); }  static @Nonnull String computeBgpCommonExportPolicyName(String vrfName); @VisibleForTesting static @Nonnull String computeBgpPeerExportPolicyName(
      String vrfName, String peerInterface); static @Nonnull String computeBgpPeerImportPolicyName(String vrf, String peer); static String computeBgpGenerationPolicyName(boolean ipv4, String vrfName, String prefix); static String computeMatchSuppressedSummaryOnlyPolicyName(String vrfName); static String computeOspfExportPolicyName(String vrfName); }
CumulusConversions { @Nullable static If suppressSummarizedPrefixes( Configuration c, String vrfName, Stream<Prefix> summaryOnlyPrefixes) { Iterator<Prefix> prefixesToSuppress = summaryOnlyPrefixes.iterator(); if (!prefixesToSuppress.hasNext()) { return null; } RouteFilterList matchLonger = new RouteFilterList(computeMatchSuppressedSummaryOnlyPolicyName(vrfName)); prefixesToSuppress.forEachRemaining( p -> matchLonger.addLine( new RouteFilterLine(LineAction.PERMIT, PrefixRange.moreSpecificThan(p)))); c.getRouteFilterLists().put(matchLonger.getName(), matchLonger); return new If( "Suppress more specific networks for summary-only aggregate-address networks", new MatchPrefixSet( DestinationNetwork.instance(), new NamedPrefixSet(matchLonger.getName())), ImmutableList.of(Statements.Suppress.toStaticStatement()), ImmutableList.of()); }  static @Nonnull String computeBgpCommonExportPolicyName(String vrfName); @VisibleForTesting static @Nonnull String computeBgpPeerExportPolicyName(
      String vrfName, String peerInterface); static @Nonnull String computeBgpPeerImportPolicyName(String vrf, String peer); static String computeBgpGenerationPolicyName(boolean ipv4, String vrfName, String prefix); static String computeMatchSuppressedSummaryOnlyPolicyName(String vrfName); static String computeOspfExportPolicyName(String vrfName); static final int DEFAULT_STATIC_ROUTE_ADMINISTRATIVE_DISTANCE; static final int DEFAULT_STATIC_ROUTE_METRIC; static final Ip CLAG_LINK_LOCAL_IP; static final long DEFAULT_MAX_MED; static final double SPEED_CONVERSION_FACTOR; static final double DEFAULT_LOOPBACK_BANDWIDTH; static final double DEFAULT_PORT_BANDWIDTH; }