@Test public void testGetInterfacesByIp() throws Exception { IpAddress ip = Ip4Address.valueOf("192.168.2.1"); Set<Interface> byIp = Collections.singleton(createInterface(2)); assertEquals(byIp, interfaceManager.getInterfacesByIp(ip)); }
@Override public Set<Interface> getInterfacesByIp(IpAddress ip) { return interfaces.values() .stream() .flatMap(set -> set.stream()) .filter(intf -> intf.ipAddresses() .stream() .anyMatch(ia -> ia.ipAddress().equals(ip))) .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); }
InterfaceManager extends ListenerRegistry<InterfaceEvent, InterfaceListener> implements InterfaceService, InterfaceAdminService { @Override public Set<Interface> getInterfacesByIp(IpAddress ip) { return interfaces.values() .stream() .flatMap(set -> set.stream()) .filter(intf -> intf.ipAddresses() .stream() .anyMatch(ia -> ia.ipAddress().equals(ip))) .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); } }
InterfaceManager extends ListenerRegistry<InterfaceEvent, InterfaceListener> implements InterfaceService, InterfaceAdminService { @Override public Set<Interface> getInterfacesByIp(IpAddress ip) { return interfaces.values() .stream() .flatMap(set -> set.stream()) .filter(intf -> intf.ipAddresses() .stream() .anyMatch(ia -> ia.ipAddress().equals(ip))) .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); }  }
InterfaceManager extends ListenerRegistry<InterfaceEvent, InterfaceListener> implements InterfaceService, InterfaceAdminService { @Override public Set<Interface> getInterfacesByIp(IpAddress ip) { return interfaces.values() .stream() .flatMap(set -> set.stream()) .filter(intf -> intf.ipAddresses() .stream() .anyMatch(ia -> ia.ipAddress().equals(ip))) .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); }  @Activate void activate(); @Deactivate void deactivate(); @Override Set<Interface> getInterfaces(); @Override Interface getInterfaceByName(ConnectPoint connectPoint, String name); @Override Set<Interface> getInterfacesByPort(ConnectPoint port); @Override Set<Interface> getInterfacesByIp(IpAddress ip); @Override Interface getMatchingInterface(IpAddress ip); @Override Set<Interface> getInterfacesByVlan(VlanId vlan); @Override void add(Interface intf); @Override boolean remove(ConnectPoint connectPoint, String name); }
InterfaceManager extends ListenerRegistry<InterfaceEvent, InterfaceListener> implements InterfaceService, InterfaceAdminService { @Override public Set<Interface> getInterfacesByIp(IpAddress ip) { return interfaces.values() .stream() .flatMap(set -> set.stream()) .filter(intf -> intf.ipAddresses() .stream() .anyMatch(ia -> ia.ipAddress().equals(ip))) .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); }  @Activate void activate(); @Deactivate void deactivate(); @Override Set<Interface> getInterfaces(); @Override Interface getInterfaceByName(ConnectPoint connectPoint, String name); @Override Set<Interface> getInterfacesByPort(ConnectPoint port); @Override Set<Interface> getInterfacesByIp(IpAddress ip); @Override Interface getMatchingInterface(IpAddress ip); @Override Set<Interface> getInterfacesByVlan(VlanId vlan); @Override void add(Interface intf); @Override boolean remove(ConnectPoint connectPoint, String name);  }