@Test public void testGenerateGeneratedRoutes() { Prefix prefix = Prefix.parse("1.2.3.0/24"); generateGeneratedRoutes( _c, _v, ImmutableMap.of(prefix, new BgpVrfAddressFamilyAggregateNetworkConfiguration())); String policyName = computeBgpGenerationPolicyName(true, _v.getName(), prefix.toString()); assertThat(_c.getRoutingPolicies(), Matchers.hasKey(policyName)); ImmutableList<GeneratedRoute> grs = _v.getGeneratedRoutes().stream() .filter(gr -> gr.getNetwork().equals(prefix)) .collect(ImmutableList.toImmutableList()); assertThat(grs, hasSize(1)); GeneratedRoute gr = grs.get(0); assertTrue(gr.getDiscard()); assertThat(gr.getGenerationPolicy(), equalTo(policyName)); }
static void generateGeneratedRoutes( Configuration c, org.batfish.datamodel.Vrf vrf, Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { aggregateNetworks.forEach( (prefix, agg) -> { generateGenerationPolicy(c, vrf.getName(), prefix); GeneratedRoute gr = GeneratedRoute.builder() .setNetwork(prefix) .setAdmin(AGGREGATE_ROUTE_ADMIN_COST) .setGenerationPolicy( computeBgpGenerationPolicyName(true, vrf.getName(), prefix.toString())) .setDiscard(true) .build(); vrf.getGeneratedRoutes().add(gr); }); }
CumulusConversions { static void generateGeneratedRoutes( Configuration c, org.batfish.datamodel.Vrf vrf, Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { aggregateNetworks.forEach( (prefix, agg) -> { generateGenerationPolicy(c, vrf.getName(), prefix); GeneratedRoute gr = GeneratedRoute.builder() .setNetwork(prefix) .setAdmin(AGGREGATE_ROUTE_ADMIN_COST) .setGenerationPolicy( computeBgpGenerationPolicyName(true, vrf.getName(), prefix.toString())) .setDiscard(true) .build(); vrf.getGeneratedRoutes().add(gr); }); } }
CumulusConversions { static void generateGeneratedRoutes( Configuration c, org.batfish.datamodel.Vrf vrf, Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { aggregateNetworks.forEach( (prefix, agg) -> { generateGenerationPolicy(c, vrf.getName(), prefix); GeneratedRoute gr = GeneratedRoute.builder() .setNetwork(prefix) .setAdmin(AGGREGATE_ROUTE_ADMIN_COST) .setGenerationPolicy( computeBgpGenerationPolicyName(true, vrf.getName(), prefix.toString())) .setDiscard(true) .build(); vrf.getGeneratedRoutes().add(gr); }); }  }
CumulusConversions { static void generateGeneratedRoutes( Configuration c, org.batfish.datamodel.Vrf vrf, Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { aggregateNetworks.forEach( (prefix, agg) -> { generateGenerationPolicy(c, vrf.getName(), prefix); GeneratedRoute gr = GeneratedRoute.builder() .setNetwork(prefix) .setAdmin(AGGREGATE_ROUTE_ADMIN_COST) .setGenerationPolicy( computeBgpGenerationPolicyName(true, vrf.getName(), prefix.toString())) .setDiscard(true) .build(); vrf.getGeneratedRoutes().add(gr); }); }  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 void generateGeneratedRoutes( Configuration c, org.batfish.datamodel.Vrf vrf, Map<Prefix, BgpVrfAddressFamilyAggregateNetworkConfiguration> aggregateNetworks) { aggregateNetworks.forEach( (prefix, agg) -> { generateGenerationPolicy(c, vrf.getName(), prefix); GeneratedRoute gr = GeneratedRoute.builder() .setNetwork(prefix) .setAdmin(AGGREGATE_ROUTE_ADMIN_COST) .setGenerationPolicy( computeBgpGenerationPolicyName(true, vrf.getName(), prefix.toString())) .setDiscard(true) .build(); vrf.getGeneratedRoutes().add(gr); }); }  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; }