@Test public void testGenerateExportAggregateConditions() { BooleanExpr booleanExpr = generateExportAggregateConditions( ImmutableMap.of( Prefix.parse("1.2.3.0/24"), new BgpVrfAddressFamilyAggregateNetworkConfiguration())); { Environment env = Environment.builder(_c) .setOriginalRoute( GeneratedRoute.builder().setNetwork(Prefix.parse("1.2.3.4/32")).build()) .build(); assertFalse(value(booleanExpr, env)); } { Environment env = Environment.builder(_c) .setOriginalRoute( GeneratedRoute.builder().setNetwork(Prefix.parse("1.2.0.0/16")).build()) .build(); assertFalse(value(booleanExpr, env)); } { Environment env = Environment.builder(_c) .setOriginalRoute( GeneratedRoute.builder().setNetwork(Prefix.parse("1.2.3.0/24")).build()) .build(); assertTrue(value(booleanExpr, env)); } }
static BooleanExpr generateExportAggregateConditions( Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { return new Disjunction( aggregateNetworks.entrySet().stream() .map( entry -> { Prefix prefix = entry.getKey(); List<BooleanExpr> exportAggregateConjuncts = new ArrayList<>(); exportAggregateConjuncts.add( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(prefix))))); exportAggregateConjuncts.add(new MatchProtocol(RoutingProtocol.AGGREGATE)); BooleanExpr weInterior = BooleanExprs.TRUE; exportAggregateConjuncts.add( bgpRedistributeWithEnvironmentExpr(weInterior, OriginType.IGP)); return new Conjunction(exportAggregateConjuncts); }) .collect(ImmutableList.toImmutableList())); }
CumulusConversions { static BooleanExpr generateExportAggregateConditions( Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { return new Disjunction( aggregateNetworks.entrySet().stream() .map( entry -> { Prefix prefix = entry.getKey(); List<BooleanExpr> exportAggregateConjuncts = new ArrayList<>(); exportAggregateConjuncts.add( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(prefix))))); exportAggregateConjuncts.add(new MatchProtocol(RoutingProtocol.AGGREGATE)); BooleanExpr weInterior = BooleanExprs.TRUE; exportAggregateConjuncts.add( bgpRedistributeWithEnvironmentExpr(weInterior, OriginType.IGP)); return new Conjunction(exportAggregateConjuncts); }) .collect(ImmutableList.toImmutableList())); } }
CumulusConversions { static BooleanExpr generateExportAggregateConditions( Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { return new Disjunction( aggregateNetworks.entrySet().stream() .map( entry -> { Prefix prefix = entry.getKey(); List<BooleanExpr> exportAggregateConjuncts = new ArrayList<>(); exportAggregateConjuncts.add( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(prefix))))); exportAggregateConjuncts.add(new MatchProtocol(RoutingProtocol.AGGREGATE)); BooleanExpr weInterior = BooleanExprs.TRUE; exportAggregateConjuncts.add( bgpRedistributeWithEnvironmentExpr(weInterior, OriginType.IGP)); return new Conjunction(exportAggregateConjuncts); }) .collect(ImmutableList.toImmutableList())); }  }
CumulusConversions { static BooleanExpr generateExportAggregateConditions( Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { return new Disjunction( aggregateNetworks.entrySet().stream() .map( entry -> { Prefix prefix = entry.getKey(); List<BooleanExpr> exportAggregateConjuncts = new ArrayList<>(); exportAggregateConjuncts.add( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(prefix))))); exportAggregateConjuncts.add(new MatchProtocol(RoutingProtocol.AGGREGATE)); BooleanExpr weInterior = BooleanExprs.TRUE; exportAggregateConjuncts.add( bgpRedistributeWithEnvironmentExpr(weInterior, OriginType.IGP)); return new Conjunction(exportAggregateConjuncts); }) .collect(ImmutableList.toImmutableList())); }  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 { static BooleanExpr generateExportAggregateConditions( Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { return new Disjunction( aggregateNetworks.entrySet().stream() .map( entry -> { Prefix prefix = entry.getKey(); List<BooleanExpr> exportAggregateConjuncts = new ArrayList<>(); exportAggregateConjuncts.add( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.fromPrefix(prefix))))); exportAggregateConjuncts.add(new MatchProtocol(RoutingProtocol.AGGREGATE)); BooleanExpr weInterior = BooleanExprs.TRUE; exportAggregateConjuncts.add( bgpRedistributeWithEnvironmentExpr(weInterior, OriginType.IGP)); return new Conjunction(exportAggregateConjuncts); }) .collect(ImmutableList.toImmutableList())); }  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; }