tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.host; |
| 2 | |
| 3 | import org.onlab.onos.net.ConnectPoint; |
| 4 | import org.onlab.onos.net.DeviceId; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.Host; |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.HostId; |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame^] | 7 | import org.onlab.packet.IpPrefix; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 8 | import org.onlab.packet.MacAddress; |
| 9 | import org.onlab.packet.VlanId; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 10 | |
| 11 | import java.util.Set; |
| 12 | |
| 13 | /** |
| 14 | * Service for interacting with the inventory of end-station hosts. |
| 15 | */ |
| 16 | public interface HostService { |
| 17 | |
| 18 | /** |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 19 | * Returns the number of end-station hosts known to the system. |
| 20 | * |
| 21 | * @return number of end-station hosts |
| 22 | */ |
| 23 | public int getHostCount(); |
| 24 | |
| 25 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 26 | * Returns a collection of all end-station hosts. |
| 27 | * |
| 28 | * @return collection of hosts |
| 29 | */ |
| 30 | Iterable<Host> getHosts(); |
| 31 | |
| 32 | /** |
| 33 | * Returns the host with the specified identifier. |
| 34 | * |
| 35 | * @param hostId host identifier |
| 36 | * @return host or null if one with the given identifier is not known |
| 37 | */ |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 38 | Host getHost(HostId hostId); |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 39 | |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 40 | /** |
| 41 | * Returns the set of hosts that belong to the specified VLAN. |
| 42 | * |
| 43 | * @param vlanId vlan identifier |
| 44 | * @return set of hosts in the given vlan id |
| 45 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 46 | Set<Host> getHostsByVlan(VlanId vlanId); |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Returns the set of hosts that have the specified MAC address. |
| 50 | * |
| 51 | * @param mac mac address |
| 52 | * @return set of hosts with the given mac |
| 53 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 54 | Set<Host> getHostsByMac(MacAddress mac); |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Returns the set of hosts that have the specified IP address. |
| 58 | * |
| 59 | * @param ip ip address |
| 60 | * @return set of hosts with the given IP |
| 61 | */ |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame^] | 62 | Set<Host> getHostsByIp(IpPrefix ip); |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 63 | |
tom | a56d5fe | 2014-09-17 11:05:47 -0700 | [diff] [blame] | 64 | // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan); |
| 65 | |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 66 | /** |
| 67 | * Returns the set of hosts whose most recent location is the specified |
| 68 | * connection point. |
| 69 | * |
| 70 | * @param connectPoint connection point |
| 71 | * @return set of hosts connected to the connection point |
| 72 | */ |
| 73 | Set<Host> getConnectedHosts(ConnectPoint connectPoint); |
| 74 | |
| 75 | /** |
| 76 | * Returns the set of hosts whose most recent location is the specified |
| 77 | * infrastructure device. |
| 78 | * |
| 79 | * @param deviceId device identifier |
| 80 | * @return set of hosts connected to the device |
| 81 | */ |
| 82 | Set<Host> getConnectedHosts(DeviceId deviceId); |
| 83 | |
| 84 | /** |
| 85 | * Adds the specified host listener. |
| 86 | * |
| 87 | * @param listener host listener |
| 88 | */ |
| 89 | void addListener(HostListener listener); |
| 90 | |
| 91 | /** |
| 92 | * Removes the specified host listener. |
| 93 | * |
| 94 | * @param listener host listener |
| 95 | */ |
| 96 | void removeListener(HostListener listener); |
| 97 | |
| 98 | } |