@Test public void testInstallRoutingPolicyForIspToCustomers() { NetworkFactory nf = new NetworkFactory(); Configuration isp = nf.configurationBuilder() .setConfigurationFormat(ConfigurationFormat.CISCO_IOS) .setHostname("fakeIsp") .build(); RoutingPolicy ispRoutingPolicy = installRoutingPolicyForIspToCustomers(isp); RoutingPolicy expectedRoutingPolicy = nf.routingPolicyBuilder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements( Collections.singletonList( new If( new MatchProtocol(RoutingProtocol.BGP), ImmutableList.of(Statements.ReturnTrue.toStaticStatement())))) .build(); assertThat(ispRoutingPolicy, equalTo(expectedRoutingPolicy)); }
@VisibleForTesting static RoutingPolicy installRoutingPolicyForIspToCustomers(Configuration isp) { return RoutingPolicy.builder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements(Collections.singletonList(getAdvertiseBgpStatement())) .build(); }
IspModelingUtils { @VisibleForTesting static RoutingPolicy installRoutingPolicyForIspToCustomers(Configuration isp) { return RoutingPolicy.builder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements(Collections.singletonList(getAdvertiseBgpStatement())) .build(); } }
IspModelingUtils { @VisibleForTesting static RoutingPolicy installRoutingPolicyForIspToCustomers(Configuration isp) { return RoutingPolicy.builder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements(Collections.singletonList(getAdvertiseBgpStatement())) .build(); } private  IspModelingUtils(); }
IspModelingUtils { @VisibleForTesting static RoutingPolicy installRoutingPolicyForIspToCustomers(Configuration isp) { return RoutingPolicy.builder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements(Collections.singletonList(getAdvertiseBgpStatement())) .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 { @VisibleForTesting static RoutingPolicy installRoutingPolicyForIspToCustomers(Configuration isp) { return RoutingPolicy.builder() .setName(EXPORT_POLICY_ON_ISP_TO_CUSTOMERS) .setOwner(isp) .setStatements(Collections.singletonList(getAdvertiseBgpStatement())) .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; }