@Test public void testGenerateGenerationPolicy() { Prefix prefix = Prefix.parse("1.2.3.0/24"); generateGenerationPolicy(_c, _v.getName(), prefix); RoutingPolicy policy = _c.getRoutingPolicies() .get(computeBgpGenerationPolicyName(true, _v.getName(), prefix.toString())); assertTrue(value(policy, "1.2.3.4/32")); assertFalse(value(policy, "1.2.3.0/24")); assertFalse(value(policy, "1.2.0.0/16")); }
static void generateGenerationPolicy(Configuration c, String vrfName, Prefix prefix) { RoutingPolicy.builder() .setOwner(c) .setName(computeBgpGenerationPolicyName(true, vrfName, prefix.toString())) .addStatement( new If( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.moreSpecificThan(prefix)))), ImmutableList.of(Statements.ReturnTrue.toStaticStatement()), ImmutableList.of(Statements.ReturnFalse.toStaticStatement()))) .build(); }
CumulusConversions { static void generateGenerationPolicy(Configuration c, String vrfName, Prefix prefix) { RoutingPolicy.builder() .setOwner(c) .setName(computeBgpGenerationPolicyName(true, vrfName, prefix.toString())) .addStatement( new If( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.moreSpecificThan(prefix)))), ImmutableList.of(Statements.ReturnTrue.toStaticStatement()), ImmutableList.of(Statements.ReturnFalse.toStaticStatement()))) .build(); } }
CumulusConversions { static void generateGenerationPolicy(Configuration c, String vrfName, Prefix prefix) { RoutingPolicy.builder() .setOwner(c) .setName(computeBgpGenerationPolicyName(true, vrfName, prefix.toString())) .addStatement( new If( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.moreSpecificThan(prefix)))), ImmutableList.of(Statements.ReturnTrue.toStaticStatement()), ImmutableList.of(Statements.ReturnFalse.toStaticStatement()))) .build(); }  }
CumulusConversions { static void generateGenerationPolicy(Configuration c, String vrfName, Prefix prefix) { RoutingPolicy.builder() .setOwner(c) .setName(computeBgpGenerationPolicyName(true, vrfName, prefix.toString())) .addStatement( new If( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.moreSpecificThan(prefix)))), ImmutableList.of(Statements.ReturnTrue.toStaticStatement()), ImmutableList.of(Statements.ReturnFalse.toStaticStatement()))) .build(); }  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 generateGenerationPolicy(Configuration c, String vrfName, Prefix prefix) { RoutingPolicy.builder() .setOwner(c) .setName(computeBgpGenerationPolicyName(true, vrfName, prefix.toString())) .addStatement( new If( new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(new PrefixSpace(PrefixRange.moreSpecificThan(prefix)))), ImmutableList.of(Statements.ReturnTrue.toStaticStatement()), ImmutableList.of(Statements.ReturnFalse.toStaticStatement()))) .build(); }  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; }