blob: 39f63c0f83d1e0632c5975afee5f6d2708b5e33e [file] [log] [blame]
tomedf06bb2014-08-27 16:22:15 -07001package org.onlab.onos.net.host;
2
3import org.onlab.onos.net.ConnectPoint;
4import org.onlab.onos.net.DeviceId;
tomedf06bb2014-08-27 16:22:15 -07005import org.onlab.onos.net.Host;
tom7869ad92014-09-09 14:32:08 -07006import org.onlab.onos.net.HostId;
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -07007import org.onlab.packet.IpPrefix;
Ayaka Koshibea9c199f2014-09-16 16:21:40 -07008import org.onlab.packet.MacAddress;
9import org.onlab.packet.VlanId;
tomedf06bb2014-08-27 16:22:15 -070010
11import java.util.Set;
12
13/**
14 * Service for interacting with the inventory of end-station hosts.
15 */
16public interface HostService {
17
18 /**
tom7869ad92014-09-09 14:32:08 -070019 * 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 /**
tomedf06bb2014-08-27 16:22:15 -070026 * 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 */
tom7869ad92014-09-09 14:32:08 -070038 Host getHost(HostId hostId);
tomedf06bb2014-08-27 16:22:15 -070039
tom7869ad92014-09-09 14:32:08 -070040 /**
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 Koshibea9c199f2014-09-16 16:21:40 -070046 Set<Host> getHostsByVlan(VlanId vlanId);
tom7869ad92014-09-09 14:32:08 -070047
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 Koshibea9c199f2014-09-16 16:21:40 -070054 Set<Host> getHostsByMac(MacAddress mac);
tom7869ad92014-09-09 14:32:08 -070055
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 Koshibe1d56fe42014-09-19 16:51:58 -070062 Set<Host> getHostsByIp(IpPrefix ip);
tomedf06bb2014-08-27 16:22:15 -070063
toma56d5fe2014-09-17 11:05:47 -070064 // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan);
65
tomedf06bb2014-08-27 16:22:15 -070066 /**
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}