blob: 94c45850f5cb0dd53ba329874604a01bceb84c55 [file] [log] [blame]
tom5bcc9462014-09-19 10:11:31 -07001package org.onlab.onos.net.host;
2
3import org.onlab.onos.net.ConnectPoint;
4import org.onlab.onos.net.DeviceId;
5import org.onlab.onos.net.Host;
6import org.onlab.onos.net.HostId;
7import org.onlab.onos.net.provider.ProviderId;
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -07008import org.onlab.packet.IpPrefix;
tom5bcc9462014-09-19 10:11:31 -07009import org.onlab.packet.MacAddress;
10import org.onlab.packet.VlanId;
11
12import java.util.Set;
13
14/**
15 * Manages inventory of end-station hosts. It may do so using whatever
16 * means are appropriate.
17 */
18public interface HostStore {
19
20 /**
21 * Creates a new host or updates the existing one based on the specified
22 * description.
23 *
24 * @param providerId provider identification
25 * @param hostId host identification
26 * @param hostDescription host description data
27 * @return appropriate event or null if no change resulted
28 */
29 HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
30 HostDescription hostDescription);
31
32 /**
33 * Removes the specified host from the inventory.
34 *
35 * @param hostId host identification
36 * @return remove event or null if host was not found
37 */
38 HostEvent removeHost(HostId hostId);
39
40 /**
41 * Returns the number of hosts in the store.
42 *
43 * @return host count
44 */
45 int getHostCount();
46
47 /**
48 * Returns a collection of all hosts in the store.
49 *
50 * @return iterable collection of all hosts
51 */
52 Iterable<Host> getHosts();
53
54 /**
55 * Returns the host with the specified identifer.
56 *
57 * @param hostId host identification
58 * @return host or null if not found
59 */
60 Host getHost(HostId hostId);
61
62 /**
63 * Returns the set of all hosts within the specified VLAN.
64 *
65 * @param vlanId vlan id
66 * @return set of hosts in the vlan
67 */
68 Set<Host> getHosts(VlanId vlanId);
69
70 /**
71 * Returns the set of hosts with the specified MAC address.
72 *
73 * @param mac mac address
74 * @return set of hosts with the given mac
75 */
76 Set<Host> getHosts(MacAddress mac);
77
78 /**
79 * Returns the set of hosts with the specified IP address.
80 *
81 * @param ip ip address
82 * @return set of hosts with the given IP
83 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -070084 Set<Host> getHosts(IpPrefix ip);
tom5bcc9462014-09-19 10:11:31 -070085
86 /**
87 * Returns the set of hosts whose location falls on the given connection point.
88 *
89 * @param connectPoint connection point
90 * @return set of hosts
91 */
92 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
93
94 /**
95 * Returns the set of hosts whose location falls on the given device.
96 *
97 * @param deviceId infrastructure device identifier
98 * @return set of hosts
99 */
100 Set<Host> getConnectedHosts(DeviceId deviceId);
101
102}