blob: e73fbb7424e69aedcbc02774572a933ac72ce221 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
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;
25import org.onosproject.net.provider.ProviderId;
26import org.onosproject.store.Store;
Jonathan Hart15ea3702015-08-31 11:22:10 +020027
28import java.util.Set;
tom5bcc9462014-09-19 10:11:31 -070029
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
Brian O'Connorf107bd72015-09-21 15:31:03 -070042 * @param replaceIps replace IP set if true, merge IP set otherwise
tom5bcc9462014-09-19 10:11:31 -070043 * @return appropriate event or null if no change resulted
44 */
45 HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
Brian O'Connorf107bd72015-09-21 15:31:03 -070046 HostDescription hostDescription,
47 boolean replaceIps);
tom5bcc9462014-09-19 10:11:31 -070048
49 /**
50 * Removes the specified host from the inventory.
51 *
52 * @param hostId host identification
53 * @return remove event or null if host was not found
54 */
55 HostEvent removeHost(HostId hostId);
56
57 /**
samanwita palc40e5ed2015-09-24 11:01:51 -070058 * Removes the specified ip from the host entry.
59 *
60 * @param hostId host identification
61 * @param ipAddress ipAddress to be removed
62 * @return remove event or null if host was not found
63 */
64 HostEvent removeIp(HostId hostId, IpAddress ipAddress);
65
66 /**
tom5bcc9462014-09-19 10:11:31 -070067 * Returns the number of hosts in the store.
68 *
69 * @return host count
70 */
71 int getHostCount();
72
73 /**
74 * Returns a collection of all hosts in the store.
75 *
76 * @return iterable collection of all hosts
77 */
78 Iterable<Host> getHosts();
79
80 /**
81 * Returns the host with the specified identifer.
82 *
83 * @param hostId host identification
84 * @return host or null if not found
85 */
86 Host getHost(HostId hostId);
87
88 /**
89 * Returns the set of all hosts within the specified VLAN.
90 *
91 * @param vlanId vlan id
92 * @return set of hosts in the vlan
93 */
94 Set<Host> getHosts(VlanId vlanId);
95
96 /**
97 * Returns the set of hosts with the specified MAC address.
98 *
99 * @param mac mac address
100 * @return set of hosts with the given mac
101 */
102 Set<Host> getHosts(MacAddress mac);
103
104 /**
105 * Returns the set of hosts with the specified IP address.
106 *
107 * @param ip ip address
108 * @return set of hosts with the given IP
109 */
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700110 Set<Host> getHosts(IpAddress ip);
tom5bcc9462014-09-19 10:11:31 -0700111
112 /**
113 * Returns the set of hosts whose location falls on the given connection point.
114 *
115 * @param connectPoint connection point
116 * @return set of hosts
117 */
118 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
119
120 /**
121 * Returns the set of hosts whose location falls on the given device.
122 *
123 * @param deviceId infrastructure device identifier
124 * @return set of hosts
125 */
126 Set<Host> getConnectedHosts(DeviceId deviceId);
127
tom5bcc9462014-09-19 10:11:31 -0700128}