@Test public void testComputeLocationInfo_default() { NetworkFactory nf = new NetworkFactory(); Configuration config = nf.configurationBuilder() .setConfigurationFormat(ConfigurationFormat.CISCO_IOS) .setHostname("a") .build(); Vrf vrf = nf.vrfBuilder().setOwner(config).build(); Interface.Builder ib = nf.interfaceBuilder().setOwner(config).setActive(true).setVrf(vrf); Interface i = ib.setName("i").setAddress(ConcreteInterfaceAddress.parse("1.1.1.1/29")).build(); InterfaceLocation iloc = interfaceLocation(i); InterfaceLinkLocation linkLoc = interfaceLinkLocation(i); Ip ip1 = Ip.parse("1.1.1.1"); Ip ip2 = Ip.parse("1.1.1.2"); Ip ip3 = Ip.parse("1.1.1.3"); Map<String, Map<String, IpSpace>> interfaceOwnedIps = ImmutableMap.of("a", ImmutableMap.of("i", ip1.toIpSpace())); Map<Location, LocationInfo> locationInfo = computeLocationInfo( ip1.toIpSpace(), interfaceOwnedIps, ImmutableMap.of(config.getHostname(), config)); { LocationInfo info = locationInfo.get(iloc); assertFalse(info.isSource()); assertThat(info.getSourceIps(), containsIp(ip1)); assertEquals(EmptyIpSpace.INSTANCE, info.getArpIps()); } { LocationInfo info = locationInfo.get(linkLoc); assertTrue(info.isSource()); assertThat(info.getSourceIps(), allOf(not(containsIp(ip1)), containsIp(ip2))); assertThat(info.getArpIps(), containsIp(ip3)); } }
public static Map<Location, LocationInfo> computeLocationInfo( Map<String, Configuration> configs) { return computeLocationInfo(new IpOwners(configs), configs); }
LocationInfoUtils { public static Map<Location, LocationInfo> computeLocationInfo( Map<String, Configuration> configs) { return computeLocationInfo(new IpOwners(configs), configs); } }
LocationInfoUtils { public static Map<Location, LocationInfo> computeLocationInfo( Map<String, Configuration> configs) { return computeLocationInfo(new IpOwners(configs), configs); } private  LocationInfoUtils(); }
LocationInfoUtils { public static Map<Location, LocationInfo> computeLocationInfo( Map<String, Configuration> configs) { return computeLocationInfo(new IpOwners(configs), configs); } private  LocationInfoUtils(); @Nonnull static IpSpace connectedHostSubnetHostIps(Interface iface); @Nonnull static IpSpace connectedSubnetHostIps(Interface iface); static Map<Location, LocationInfo> computeLocationInfo(
      Map<String, Configuration> configs); static Map<Location, LocationInfo> computeLocationInfo(
      IpOwners ipOwners, Map<String, Configuration> configs); static IpSpace configuredIps(Interface iface); }
LocationInfoUtils { public static Map<Location, LocationInfo> computeLocationInfo( Map<String, Configuration> configs) { return computeLocationInfo(new IpOwners(configs), configs); } private  LocationInfoUtils(); @Nonnull static IpSpace connectedHostSubnetHostIps(Interface iface); @Nonnull static IpSpace connectedSubnetHostIps(Interface iface); static Map<Location, LocationInfo> computeLocationInfo(
      Map<String, Configuration> configs); static Map<Location, LocationInfo> computeLocationInfo(
      IpOwners ipOwners, Map<String, Configuration> configs); static IpSpace configuredIps(Interface iface);  }