@Test public void testGetSourceLocationsWithSourceIps() { Location loc1 = new InterfaceLocation("n1", "i1"); LocationInfo info1 = new LocationInfo(true, UniverseIpSpace.INSTANCE, EmptyIpSpace.INSTANCE); Location loc2 = new InterfaceLocation("n2", "i2"); LocationInfo info2 = new LocationInfo(false, UniverseIpSpace.INSTANCE, UniverseIpSpace.INSTANCE); Location loc3 = new InterfaceLocation("n3", "i3"); LocationInfo info3 = new LocationInfo(true, EmptyIpSpace.INSTANCE, UniverseIpSpace.INSTANCE); Set<Location> sourcesWithSourceIps = getSourceLocationsWithSrcIps(ImmutableMap.of(loc1, info1, loc2, info2, loc3, info3)); assertThat(sourcesWithSourceIps, contains(loc1)); }
public static Set<Location> getSourceLocationsWithSrcIps( Map<Location, LocationInfo> locationInfo) { IpSpaceToBDD toBdd = new BDDPacket().getDstIpSpaceToBDD(); return locationInfo.entrySet().stream() .filter( entry -> { LocationInfo info = entry.getValue(); return info.isSource() && !toBdd.visit(info.getSourceIps()).isZero(); }) .map(Entry::getKey) .collect(ImmutableSet.toImmutableSet()); }
CompletionMetadataUtils { public static Set<Location> getSourceLocationsWithSrcIps( Map<Location, LocationInfo> locationInfo) { IpSpaceToBDD toBdd = new BDDPacket().getDstIpSpaceToBDD(); return locationInfo.entrySet().stream() .filter( entry -> { LocationInfo info = entry.getValue(); return info.isSource() && !toBdd.visit(info.getSourceIps()).isZero(); }) .map(Entry::getKey) .collect(ImmutableSet.toImmutableSet()); } }
CompletionMetadataUtils { public static Set<Location> getSourceLocationsWithSrcIps( Map<Location, LocationInfo> locationInfo) { IpSpaceToBDD toBdd = new BDDPacket().getDstIpSpaceToBDD(); return locationInfo.entrySet().stream() .filter( entry -> { LocationInfo info = entry.getValue(); return info.isSource() && !toBdd.visit(info.getSourceIps()).isZero(); }) .map(Entry::getKey) .collect(ImmutableSet.toImmutableSet()); } private  CompletionMetadataUtils(); }
CompletionMetadataUtils { public static Set<Location> getSourceLocationsWithSrcIps( Map<Location, LocationInfo> locationInfo) { IpSpaceToBDD toBdd = new BDDPacket().getDstIpSpaceToBDD(); return locationInfo.entrySet().stream() .filter( entry -> { LocationInfo info = entry.getValue(); return info.isSource() && !toBdd.visit(info.getSourceIps()).isZero(); }) .map(Entry::getKey) .collect(ImmutableSet.toImmutableSet()); } private  CompletionMetadataUtils(); static Set<String> getFilterNames(Map<String, Configuration> configurations); static Set<NodeInterfacePair> getInterfaces(Map<String, Configuration> configurations); static Map<Ip, IpCompletionMetadata> getIps(Map<String, Configuration> configurations); static Set<String> getMlagIds(Map<String, Configuration> configurations); static Map<String, NodeCompletionMetadata> getNodes(
      Map<String, Configuration> configurations); static Set<String> getPrefixes(Map<String, Configuration> configurations); static Set<String> getRoutingPolicyNames(Map<String, Configuration> configurations); static Set<Location> getSourceLocationsWithSrcIps(
      Map<Location, LocationInfo> locationInfo); static Set<String> getStructureNames(Map<String, Configuration> configurations); static Set<String> getVrfs(Map<String, Configuration> configurations); static Set<String> getZones(Map<String, Configuration> configurations); }
CompletionMetadataUtils { public static Set<Location> getSourceLocationsWithSrcIps( Map<Location, LocationInfo> locationInfo) { IpSpaceToBDD toBdd = new BDDPacket().getDstIpSpaceToBDD(); return locationInfo.entrySet().stream() .filter( entry -> { LocationInfo info = entry.getValue(); return info.isSource() && !toBdd.visit(info.getSourceIps()).isZero(); }) .map(Entry::getKey) .collect(ImmutableSet.toImmutableSet()); } private  CompletionMetadataUtils(); static Set<String> getFilterNames(Map<String, Configuration> configurations); static Set<NodeInterfacePair> getInterfaces(Map<String, Configuration> configurations); static Map<Ip, IpCompletionMetadata> getIps(Map<String, Configuration> configurations); static Set<String> getMlagIds(Map<String, Configuration> configurations); static Map<String, NodeCompletionMetadata> getNodes(
      Map<String, Configuration> configurations); static Set<String> getPrefixes(Map<String, Configuration> configurations); static Set<String> getRoutingPolicyNames(Map<String, Configuration> configurations); static Set<Location> getSourceLocationsWithSrcIps(
      Map<Location, LocationInfo> locationInfo); static Set<String> getStructureNames(Map<String, Configuration> configurations); static Set<String> getVrfs(Map<String, Configuration> configurations); static Set<String> getZones(Map<String, Configuration> configurations); static Map<Ip, String> WELL_KNOWN_IPS; }