blob: 535479c8a5fb5fa27770045a89da5355b7b9332e [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;
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -07009import org.onlab.packet.IpAddress;
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 */
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -070085 Set<Host> getHosts(IpAddress ip);
tom5bcc9462014-09-19 10:11:31 -070086
87 /**
88 * Returns the set of hosts whose location falls on the given connection point.
89 *
90 * @param connectPoint connection point
91 * @return set of hosts
92 */
93 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
94
95 /**
96 * Returns the set of hosts whose location falls on the given device.
97 *
98 * @param deviceId infrastructure device identifier
99 * @return set of hosts
100 */
101 Set<Host> getConnectedHosts(DeviceId deviceId);
102
Jonathan Hartac60c082014-09-23 08:55:17 -0700103 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700104 * Updates the address information for a given port. The given address
105 * information is added to any previously held information for the port.
Jonathan Hartac60c082014-09-23 08:55:17 -0700106 *
107 * @param addresses the port and address information
108 */
109 void updateAddressBindings(PortAddresses addresses);
110
111 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700112 * Removes the given addresses from the set of address information held for
113 * a port.
114 *
115 * @param addresses the port and address information
116 */
117 void removeAddressBindings(PortAddresses addresses);
118
119 /**
Jonathan Hartac60c082014-09-23 08:55:17 -0700120 * Removes any previously stored address information for a given connection
121 * point.
122 *
123 * @param connectPoint the connection point
124 */
Jonathan Hart09585c62014-09-23 16:58:04 -0700125 void clearAddressBindings(ConnectPoint connectPoint);
Jonathan Hartac60c082014-09-23 08:55:17 -0700126
127 /**
128 * Returns the address bindings stored for all connection points.
129 *
130 * @return the set of address bindings
131 */
132 Set<PortAddresses> getAddressBindings();
133
134 /**
135 * Returns the address bindings for a particular connection point.
136 *
137 * @param connectPoint the connection point to return address information
tomf80c9722014-09-24 14:49:18 -0700138 * for
Jonathan Hartac60c082014-09-23 08:55:17 -0700139 * @return address information for the connection point
140 */
141 PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint);
tom5bcc9462014-09-19 10:11:31 -0700142}