@Test public void testGetRoutingPolicyAdvertizeStatic() { NetworkFactory nf = new NetworkFactory(); Configuration internet = nf.configurationBuilder() .setConfigurationFormat(ConfigurationFormat.CISCO_IOS) .setHostname("fakeInternet") .build(); RoutingPolicy internetRoutingPolicy = IspModelingUtils.installRoutingPolicyAdvertiseStatic( IspModelingUtils.EXPORT_POLICY_ON_INTERNET, internet, new PrefixSpace(PrefixRange.fromPrefix(Prefix.ZERO))); PrefixSpace prefixSpace = new PrefixSpace(); prefixSpace.addPrefix(Prefix.ZERO); RoutingPolicy expectedRoutingPolicy = nf.routingPolicyBuilder() .setName(IspModelingUtils.EXPORT_POLICY_ON_INTERNET) .setOwner(internet) .setStatements( Collections.singletonList( new If( new Conjunction( ImmutableList.of( new MatchProtocol(RoutingProtocol.STATIC), new MatchPrefixSet( DestinationNetwork.instance(), new ExplicitPrefixSet(prefixSpace)))), ImmutableList.of( new SetOrigin(new LiteralOrigin(OriginType.INCOMPLETE, null)), Statements.ExitAccept.toStaticStatement())))) .build(); assertThat(internetRoutingPolicy, equalTo(expectedRoutingPolicy)); }
public static RoutingPolicy installRoutingPolicyAdvertiseStatic( String policyName, Configuration node, PrefixSpace prefixSpace) { return RoutingPolicy.builder() .setName(policyName) .setOwner(node) .setStatements(Collections.singletonList(getAdvertiseStaticStatement(prefixSpace))) .build(); }
IspModelingUtils { public static RoutingPolicy installRoutingPolicyAdvertiseStatic( String policyName, Configuration node, PrefixSpace prefixSpace) { return RoutingPolicy.builder() .setName(policyName) .setOwner(node) .setStatements(Collections.singletonList(getAdvertiseStaticStatement(prefixSpace))) .build(); } }
IspModelingUtils { public static RoutingPolicy installRoutingPolicyAdvertiseStatic( String policyName, Configuration node, PrefixSpace prefixSpace) { return RoutingPolicy.builder() .setName(policyName) .setOwner(node) .setStatements(Collections.singletonList(getAdvertiseStaticStatement(prefixSpace))) .build(); } private  IspModelingUtils(); }
IspModelingUtils { public static RoutingPolicy installRoutingPolicyAdvertiseStatic( String policyName, Configuration node, PrefixSpace prefixSpace) { return RoutingPolicy.builder() .setName(policyName) .setOwner(node) .setStatements(Collections.singletonList(getAdvertiseStaticStatement(prefixSpace))) .build(); } private  IspModelingUtils(); static String getDefaultIspNodeName(long asn); static String internetToIspInterfaceName(String ispHostname); static String ispToRemoteInterfaceName(String remoteHostname, String remoteInterfaceName); static ModeledNodes getInternetAndIspNodes(
      @Nonnull Map<String, Configuration> configurations,
      @Nonnull List<IspConfiguration> ispConfigurations,
      @Nonnull BatfishLogger logger,
      @Nonnull Warnings warnings); static RoutingPolicy installRoutingPolicyAdvertiseStatic(
      String policyName, Configuration node, PrefixSpace prefixSpace); static Statement getAdvertiseStaticStatement(PrefixSpace prefixSpace); static Statement getAdvertiseBgpStatement(); }
IspModelingUtils { public static RoutingPolicy installRoutingPolicyAdvertiseStatic( String policyName, Configuration node, PrefixSpace prefixSpace) { return RoutingPolicy.builder() .setName(policyName) .setOwner(node) .setStatements(Collections.singletonList(getAdvertiseStaticStatement(prefixSpace))) .build(); } private  IspModelingUtils(); static String getDefaultIspNodeName(long asn); static String internetToIspInterfaceName(String ispHostname); static String ispToRemoteInterfaceName(String remoteHostname, String remoteInterfaceName); static ModeledNodes getInternetAndIspNodes(
      @Nonnull Map<String, Configuration> configurations,
      @Nonnull List<IspConfiguration> ispConfigurations,
      @Nonnull BatfishLogger logger,
      @Nonnull Warnings warnings); static RoutingPolicy installRoutingPolicyAdvertiseStatic(
      String policyName, Configuration node, PrefixSpace prefixSpace); static Statement getAdvertiseStaticStatement(PrefixSpace prefixSpace); static Statement getAdvertiseBgpStatement(); static final String INTERNET_HOST_NAME; static final String INTERNET_OUT_INTERFACE; static final Set<Prefix> INTERNET_NULL_ROUTED_PREFIXES; }