blob: 0316dcf918860a308315cbaecd1c61dbd4bc1c3d [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
tom5bcc9462014-09-19 10:11:31 -070016package org.onlab.onos.net.host;
17
Jonathan Harta887ba82014-11-03 15:20:52 -080018import java.util.Set;
19
tom5bcc9462014-09-19 10:11:31 -070020import org.onlab.onos.net.ConnectPoint;
21import org.onlab.onos.net.DeviceId;
22import org.onlab.onos.net.Host;
23import org.onlab.onos.net.HostId;
24import org.onlab.onos.net.provider.ProviderId;
tomf80c9722014-09-24 14:49:18 -070025import org.onlab.onos.store.Store;
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -070026import org.onlab.packet.IpAddress;
tom5bcc9462014-09-19 10:11:31 -070027import org.onlab.packet.MacAddress;
28import org.onlab.packet.VlanId;
29
tom5bcc9462014-09-19 10:11:31 -070030/**
tome4729872014-09-23 00:37:37 -070031 * Manages inventory of end-station hosts; not intended for direct use.
tom5bcc9462014-09-19 10:11:31 -070032 */
tomf80c9722014-09-24 14:49:18 -070033public interface HostStore extends Store<HostEvent, HostStoreDelegate> {
tom5bcc9462014-09-19 10:11:31 -070034
35 /**
36 * Creates a new host or updates the existing one based on the specified
37 * description.
38 *
39 * @param providerId provider identification
40 * @param hostId host identification
41 * @param hostDescription host description data
42 * @return appropriate event or null if no change resulted
43 */
44 HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
45 HostDescription hostDescription);
46
Yuta HIGUCHIa2639152014-10-14 15:08:10 -070047 // FIXME: API to remove only IpAddress is missing
tom5bcc9462014-09-19 10:11:31 -070048 /**
49 * Removes the specified host from the inventory.
50 *
51 * @param hostId host identification
52 * @return remove event or null if host was not found
53 */
54 HostEvent removeHost(HostId hostId);
55
56 /**
57 * Returns the number of hosts in the store.
58 *
59 * @return host count
60 */
61 int getHostCount();
62
63 /**
64 * Returns a collection of all hosts in the store.
65 *
66 * @return iterable collection of all hosts
67 */
68 Iterable<Host> getHosts();
69
70 /**
71 * Returns the host with the specified identifer.
72 *
73 * @param hostId host identification
74 * @return host or null if not found
75 */
76 Host getHost(HostId hostId);
77
78 /**
79 * Returns the set of all hosts within the specified VLAN.
80 *
81 * @param vlanId vlan id
82 * @return set of hosts in the vlan
83 */
84 Set<Host> getHosts(VlanId vlanId);
85
86 /**
87 * Returns the set of hosts with the specified MAC address.
88 *
89 * @param mac mac address
90 * @return set of hosts with the given mac
91 */
92 Set<Host> getHosts(MacAddress mac);
93
94 /**
95 * Returns the set of hosts with the specified IP address.
96 *
97 * @param ip ip address
98 * @return set of hosts with the given IP
99 */
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700100 Set<Host> getHosts(IpAddress ip);
tom5bcc9462014-09-19 10:11:31 -0700101
102 /**
103 * Returns the set of hosts whose location falls on the given connection point.
104 *
105 * @param connectPoint connection point
106 * @return set of hosts
107 */
108 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
109
110 /**
111 * Returns the set of hosts whose location falls on the given device.
112 *
113 * @param deviceId infrastructure device identifier
114 * @return set of hosts
115 */
116 Set<Host> getConnectedHosts(DeviceId deviceId);
117
Jonathan Hartac60c082014-09-23 08:55:17 -0700118 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700119 * Updates the address information for a given port. The given address
120 * information is added to any previously held information for the port.
Jonathan Hartac60c082014-09-23 08:55:17 -0700121 *
122 * @param addresses the port and address information
123 */
124 void updateAddressBindings(PortAddresses addresses);
125
126 /**
Jonathan Hart09585c62014-09-23 16:58:04 -0700127 * Removes the given addresses from the set of address information held for
128 * a port.
129 *
130 * @param addresses the port and address information
131 */
132 void removeAddressBindings(PortAddresses addresses);
133
134 /**
Jonathan Hartac60c082014-09-23 08:55:17 -0700135 * Removes any previously stored address information for a given connection
136 * point.
137 *
138 * @param connectPoint the connection point
139 */
Jonathan Hart09585c62014-09-23 16:58:04 -0700140 void clearAddressBindings(ConnectPoint connectPoint);
Jonathan Hartac60c082014-09-23 08:55:17 -0700141
142 /**
143 * Returns the address bindings stored for all connection points.
144 *
145 * @return the set of address bindings
146 */
147 Set<PortAddresses> getAddressBindings();
148
149 /**
150 * Returns the address bindings for a particular connection point.
151 *
152 * @param connectPoint the connection point to return address information
tomf80c9722014-09-24 14:49:18 -0700153 * for
Jonathan Hartac60c082014-09-23 08:55:17 -0700154 * @return address information for the connection point
155 */
Jonathan Harta887ba82014-11-03 15:20:52 -0800156 Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint);
tom5bcc9462014-09-19 10:11:31 -0700157}