blob: 5894fe92bbd8b1bf2b8eeb8e81772ebfdeee191b [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 */
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 /**
58 * Returns the number of hosts in the store.
59 *
60 * @return host count
61 */
62 int getHostCount();
63
64 /**
65 * Returns a collection of all hosts in the store.
66 *
67 * @return iterable collection of all hosts
68 */
69 Iterable<Host> getHosts();
70
71 /**
72 * Returns the host with the specified identifer.
73 *
74 * @param hostId host identification
75 * @return host or null if not found
76 */
77 Host getHost(HostId hostId);
78
79 /**
80 * Returns the set of all hosts within the specified VLAN.
81 *
82 * @param vlanId vlan id
83 * @return set of hosts in the vlan
84 */
85 Set<Host> getHosts(VlanId vlanId);
86
87 /**
88 * Returns the set of hosts with the specified MAC address.
89 *
90 * @param mac mac address
91 * @return set of hosts with the given mac
92 */
93 Set<Host> getHosts(MacAddress mac);
94
95 /**
96 * Returns the set of hosts with the specified IP address.
97 *
98 * @param ip ip address
99 * @return set of hosts with the given IP
100 */
Pavlin Radoslavov33f228a2014-10-27 19:33:16 -0700101 Set<Host> getHosts(IpAddress ip);
tom5bcc9462014-09-19 10:11:31 -0700102
103 /**
104 * Returns the set of hosts whose location falls on the given connection point.
105 *
106 * @param connectPoint connection point
107 * @return set of hosts
108 */
109 Set<Host> getConnectedHosts(ConnectPoint connectPoint);
110
111 /**
112 * Returns the set of hosts whose location falls on the given device.
113 *
114 * @param deviceId infrastructure device identifier
115 * @return set of hosts
116 */
117 Set<Host> getConnectedHosts(DeviceId deviceId);
118
tom5bcc9462014-09-19 10:11:31 -0700119}