blob: b27b697d9d00826be1b094032279f6fe39ee80b8 [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;
tomf80c9722014-09-24 14:49:18 -07008import org.onlab.onos.store.Store;
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -07009import org.onlab.packet.IpPrefix;
tom5bcc9462014-09-19 10:11:31 -070010import org.onlab.packet.MacAddress;
11import org.onlab.packet.VlanId;
12
tomf80c9722014-09-24 14:49:18 -070013import java.util.Set;
14
tom5bcc9462014-09-19 10:11:31 -070015/**
tome4729872014-09-23 00:37:37 -070016 * Manages inventory of end-station hosts; not intended for direct use.
tom5bcc9462014-09-19 10:11:31 -070017 */
tomf80c9722014-09-24 14:49:18 -070018public interface HostStore extends Store<HostEvent, HostStoreDelegate> {
tom5bcc9462014-09-19 10:11:31 -070019
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
Yuta HIGUCHIa2639152014-10-14 15:08:10 -070032 // FIXME: API to remove only IpAddress is missing
tom5bcc9462014-09-19 10:11:31 -070033 /**
34 * Removes the specified host from the inventory.
35 *
36 * @param hostId host identification
37 * @return remove event or null if host was not found
38 */
39 HostEvent removeHost(HostId hostId);
40
41 /**
42 * Returns the number of hosts in the store.
43 *
44 * @return host count
45 */
46 int getHostCount();
47
48 /**
49 * Returns a collection of all hosts in the store.
50 *
51 * @return iterable collection of all hosts
52 */
53 Iterable<Host> getHosts();
54
55 /**
56 * Returns the host with the specified identifer.
57 *
58 * @param hostId host identification
59 * @return host or null if not found
60 */
61 Host getHost(HostId hostId);
62
63 /**
64 * Returns the set of all hosts within the specified VLAN.
65 *
66 * @param vlanId vlan id
67 * @return set of hosts in the vlan
68 */
69 Set<Host> getHosts(VlanId vlanId);
70
71 /**
72 * Returns the set of hosts with the specified MAC address.
73 *
74 * @param mac mac address
75 * @return set of hosts with the given mac
76 */
77 Set<Host> getHosts(MacAddress mac);
78
79 /**
80 * Returns the set of hosts with the specified IP address.
81 *
82 * @param ip ip address
83 * @return set of hosts with the given IP
84 */
Yuta HIGUCHIa2639152014-10-14 15:08:10 -070085 // FIXME: Switch to IpAddress
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -070086 Set<Host> getHosts(IpPrefix ip);
tom5bcc9462014-09-19 10:11:31 -070087
88 /**
89 * Returns the set of hosts whose location falls on the given connection point.
90 *
91 * @param connectPoint connection point
92 * @return set of hosts
93 */
94 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
95
96 /**
97 * Returns the set of hosts whose location falls on the given device.
98 *
99 * @param deviceId infrastructure device identifier
100 * @return set of hosts
101 */
102 Set<Host> getConnectedHosts(DeviceId deviceId);
103
Jonathan Hartac60c082014-09-23 08:55:17 -0700104 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700105 * Updates the address information for a given port. The given address
106 * information is added to any previously held information for the port.
Jonathan Hartac60c082014-09-23 08:55:17 -0700107 *
108 * @param addresses the port and address information
109 */
110 void updateAddressBindings(PortAddresses addresses);
111
112 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700113 * Removes the given addresses from the set of address information held for
114 * a port.
115 *
116 * @param addresses the port and address information
117 */
118 void removeAddressBindings(PortAddresses addresses);
119
120 /**
Jonathan Hartac60c082014-09-23 08:55:17 -0700121 * Removes any previously stored address information for a given connection
122 * point.
123 *
124 * @param connectPoint the connection point
125 */
Jonathan Hart09585c62014-09-23 16:58:04 -0700126 void clearAddressBindings(ConnectPoint connectPoint);
Jonathan Hartac60c082014-09-23 08:55:17 -0700127
128 /**
129 * Returns the address bindings stored for all connection points.
130 *
131 * @return the set of address bindings
132 */
133 Set<PortAddresses> getAddressBindings();
134
135 /**
136 * Returns the address bindings for a particular connection point.
137 *
138 * @param connectPoint the connection point to return address information
tomf80c9722014-09-24 14:49:18 -0700139 * for
Jonathan Hartac60c082014-09-23 08:55:17 -0700140 * @return address information for the connection point
141 */
142 PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint);
tom5bcc9462014-09-19 10:11:31 -0700143}