blob: 1529c681ec1962b3ec1c11924da8e85c2a277ab3 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.host;
tom5bcc9462014-09-19 10:11:31 -070017
Jonathan Hart15ea3702015-08-31 11:22:10 +020018import org.onlab.packet.IpAddress;
19import org.onlab.packet.MacAddress;
20import org.onlab.packet.VlanId;
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.Host;
24import org.onosproject.net.HostId;
Charles Chan888e20a2017-05-01 15:44:23 -070025import org.onosproject.net.HostLocation;
Brian O'Connorabafb502014-12-02 22:26:20 -080026import org.onosproject.net.provider.ProviderId;
27import org.onosproject.store.Store;
Jonathan Hart15ea3702015-08-31 11:22:10 +020028
29import java.util.Set;
tom5bcc9462014-09-19 10:11:31 -070030
tom5bcc9462014-09-19 10:11:31 -070031/**
tome4729872014-09-23 00:37:37 -070032 * Manages inventory of end-station hosts; not intended for direct use.
tom5bcc9462014-09-19 10:11:31 -070033 */
tomf80c9722014-09-24 14:49:18 -070034public interface HostStore extends Store<HostEvent, HostStoreDelegate> {
tom5bcc9462014-09-19 10:11:31 -070035
36 /**
37 * Creates a new host or updates the existing one based on the specified
38 * description.
39 *
40 * @param providerId provider identification
41 * @param hostId host identification
42 * @param hostDescription host description data
Brian O'Connorf107bd72015-09-21 15:31:03 -070043 * @param replaceIps replace IP set if true, merge IP set otherwise
tom5bcc9462014-09-19 10:11:31 -070044 * @return appropriate event or null if no change resulted
45 */
46 HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
Brian O'Connorf107bd72015-09-21 15:31:03 -070047 HostDescription hostDescription,
48 boolean replaceIps);
tom5bcc9462014-09-19 10:11:31 -070049
50 /**
51 * Removes the specified host from the inventory.
52 *
53 * @param hostId host identification
54 * @return remove event or null if host was not found
55 */
56 HostEvent removeHost(HostId hostId);
57
58 /**
samanwita palc40e5ed2015-09-24 11:01:51 -070059 * Removes the specified ip from the host entry.
60 *
61 * @param hostId host identification
62 * @param ipAddress ipAddress to be removed
63 * @return remove event or null if host was not found
64 */
65 HostEvent removeIp(HostId hostId, IpAddress ipAddress);
66
67 /**
Charles Chan888e20a2017-05-01 15:44:23 -070068 * Removes the specified location from the host entry.
69 *
70 * @param hostId host identification
71 * @param location location to be removed
72 */
73 void removeLocation(HostId hostId, HostLocation location);
74
75 /**
tom5bcc9462014-09-19 10:11:31 -070076 * Returns the number of hosts in the store.
77 *
78 * @return host count
79 */
80 int getHostCount();
81
82 /**
83 * Returns a collection of all hosts in the store.
84 *
85 * @return iterable collection of all hosts
86 */
87 Iterable<Host> getHosts();
88
89 /**
90 * Returns the host with the specified identifer.
91 *
92 * @param hostId host identification
93 * @return host or null if not found
94 */
95 Host getHost(HostId hostId);
96
97 /**
98 * Returns the set of all hosts within the specified VLAN.
99 *
100 * @param vlanId vlan id
101 * @return set of hosts in the vlan
102 */
103 Set<Host> getHosts(VlanId vlanId);
104
105 /**
106 * Returns the set of hosts with the specified MAC address.
107 *
108 * @param mac mac address
109 * @return set of hosts with the given mac
110 */
111 Set<Host> getHosts(MacAddress mac);
112
113 /**
114 * Returns the set of hosts with the specified IP address.
115 *
116 * @param ip ip address
117 * @return set of hosts with the given IP
118 */
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700119 Set<Host> getHosts(IpAddress ip);
tom5bcc9462014-09-19 10:11:31 -0700120
121 /**
122 * Returns the set of hosts whose location falls on the given connection point.
123 *
124 * @param connectPoint connection point
125 * @return set of hosts
126 */
127 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
128
129 /**
130 * Returns the set of hosts whose location falls on the given device.
131 *
132 * @param deviceId infrastructure device identifier
133 * @return set of hosts
134 */
135 Set<Host> getConnectedHosts(DeviceId deviceId);
136
tom5bcc9462014-09-19 10:11:31 -0700137}