blob: e3667e3213cd2cd71e5e1fc3558573ffb830d81f [file] [log] [blame]
tom5bcc9462014-09-19 10:11:31 -07001package org.onlab.onos.net.host;
2
Jonathan Hartac60c082014-09-23 08:55:17 -07003import java.util.Set;
4
tom5bcc9462014-09-19 10:11:31 -07005import org.onlab.onos.net.ConnectPoint;
6import org.onlab.onos.net.DeviceId;
7import org.onlab.onos.net.Host;
8import org.onlab.onos.net.HostId;
9import org.onlab.onos.net.provider.ProviderId;
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -070010import org.onlab.packet.IpPrefix;
tom5bcc9462014-09-19 10:11:31 -070011import org.onlab.packet.MacAddress;
12import org.onlab.packet.VlanId;
13
tom5bcc9462014-09-19 10:11:31 -070014/**
tome4729872014-09-23 00:37:37 -070015 * Manages inventory of end-station hosts; not intended for direct use.
tom5bcc9462014-09-19 10:11:31 -070016 */
17public interface HostStore {
18
19 /**
20 * Creates a new host or updates the existing one based on the specified
21 * description.
22 *
23 * @param providerId provider identification
24 * @param hostId host identification
25 * @param hostDescription host description data
26 * @return appropriate event or null if no change resulted
27 */
28 HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
29 HostDescription hostDescription);
30
31 /**
32 * Removes the specified host from the inventory.
33 *
34 * @param hostId host identification
35 * @return remove event or null if host was not found
36 */
37 HostEvent removeHost(HostId hostId);
38
39 /**
40 * Returns the number of hosts in the store.
41 *
42 * @return host count
43 */
44 int getHostCount();
45
46 /**
47 * Returns a collection of all hosts in the store.
48 *
49 * @return iterable collection of all hosts
50 */
51 Iterable<Host> getHosts();
52
53 /**
54 * Returns the host with the specified identifer.
55 *
56 * @param hostId host identification
57 * @return host or null if not found
58 */
59 Host getHost(HostId hostId);
60
61 /**
62 * Returns the set of all hosts within the specified VLAN.
63 *
64 * @param vlanId vlan id
65 * @return set of hosts in the vlan
66 */
67 Set<Host> getHosts(VlanId vlanId);
68
69 /**
70 * Returns the set of hosts with the specified MAC address.
71 *
72 * @param mac mac address
73 * @return set of hosts with the given mac
74 */
75 Set<Host> getHosts(MacAddress mac);
76
77 /**
78 * Returns the set of hosts with the specified IP address.
79 *
80 * @param ip ip address
81 * @return set of hosts with the given IP
82 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -070083 Set<Host> getHosts(IpPrefix ip);
tom5bcc9462014-09-19 10:11:31 -070084
85 /**
86 * Returns the set of hosts whose location falls on the given connection point.
87 *
88 * @param connectPoint connection point
89 * @return set of hosts
90 */
91 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
92
93 /**
94 * Returns the set of hosts whose location falls on the given device.
95 *
96 * @param deviceId infrastructure device identifier
97 * @return set of hosts
98 */
99 Set<Host> getConnectedHosts(DeviceId deviceId);
100
Jonathan Hartac60c082014-09-23 08:55:17 -0700101 /**
102 * Updates the address information for a given port.
103 *
104 * @param addresses the port and address information
105 */
106 void updateAddressBindings(PortAddresses addresses);
107
108 /**
109 * Removes any previously stored address information for a given connection
110 * point.
111 *
112 * @param connectPoint the connection point
113 */
114 void removeAddressBindings(ConnectPoint connectPoint);
115
116 /**
117 * Returns the address bindings stored for all connection points.
118 *
119 * @return the set of address bindings
120 */
121 Set<PortAddresses> getAddressBindings();
122
123 /**
124 * Returns the address bindings for a particular connection point.
125 *
126 * @param connectPoint the connection point to return address information
127 * for
128 * @return address information for the connection point
129 */
130 PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint);
tom5bcc9462014-09-19 10:11:31 -0700131}