@Test public void testIspNameConflictsIspConflict() { Map<Long, IspModel> ispInfoMap = ImmutableMap.of( 1L, IspModel.builder().setAsn(1).setName("isp1").build(), 2L, IspModel.builder().setAsn(2).setName("isp1").build()); Map<String, Configuration> configurations = ImmutableMap.of(); assertThat(ispNameConflicts(configurations, ispInfoMap), empty()); }
@VisibleForTesting static List<String> ispNameConflicts( Map<String, Configuration> configurations, Map<Long, IspModel> asnToIspInfo) { ImmutableList.Builder<String> conflicts = ImmutableList.builder(); asnToIspInfo.forEach( (asn, ispInfo) -> { String hostname = ispInfo.getHostname(); if (configurations.containsKey(hostname)) { conflicts.add( String.format( "ISP hostname %s for ASN %d conflicts with a node name in the snapshot", hostname, asn)); } }); return conflicts.build(); }
IspModelingUtils { @VisibleForTesting static List<String> ispNameConflicts( Map<String, Configuration> configurations, Map<Long, IspModel> asnToIspInfo) { ImmutableList.Builder<String> conflicts = ImmutableList.builder(); asnToIspInfo.forEach( (asn, ispInfo) -> { String hostname = ispInfo.getHostname(); if (configurations.containsKey(hostname)) { conflicts.add( String.format( "ISP hostname %s for ASN %d conflicts with a node name in the snapshot", hostname, asn)); } }); return conflicts.build(); } }
IspModelingUtils { @VisibleForTesting static List<String> ispNameConflicts( Map<String, Configuration> configurations, Map<Long, IspModel> asnToIspInfo) { ImmutableList.Builder<String> conflicts = ImmutableList.builder(); asnToIspInfo.forEach( (asn, ispInfo) -> { String hostname = ispInfo.getHostname(); if (configurations.containsKey(hostname)) { conflicts.add( String.format( "ISP hostname %s for ASN %d conflicts with a node name in the snapshot", hostname, asn)); } }); return conflicts.build(); } private  IspModelingUtils(); }
IspModelingUtils { @VisibleForTesting static List<String> ispNameConflicts( Map<String, Configuration> configurations, Map<Long, IspModel> asnToIspInfo) { ImmutableList.Builder<String> conflicts = ImmutableList.builder(); asnToIspInfo.forEach( (asn, ispInfo) -> { String hostname = ispInfo.getHostname(); if (configurations.containsKey(hostname)) { conflicts.add( String.format( "ISP hostname %s for ASN %d conflicts with a node name in the snapshot", hostname, asn)); } }); return conflicts.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 List<String> ispNameConflicts( Map<String, Configuration> configurations, Map<Long, IspModel> asnToIspInfo) { ImmutableList.Builder<String> conflicts = ImmutableList.builder(); asnToIspInfo.forEach( (asn, ispInfo) -> { String hostname = ispInfo.getHostname(); if (configurations.containsKey(hostname)) { conflicts.add( String.format( "ISP hostname %s for ASN %d conflicts with a node name in the snapshot", hostname, asn)); } }); return conflicts.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; }