Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.host; |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 17 | |
Jonathan Hart | 15ea370 | 2015-08-31 11:22:10 +0200 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onlab.packet.VlanId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 21 | import org.onosproject.net.ConnectPoint; |
| 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.Host; |
| 24 | import org.onosproject.net.HostId; |
| 25 | import org.onosproject.net.provider.ProviderId; |
| 26 | import org.onosproject.store.Store; |
Jonathan Hart | 15ea370 | 2015-08-31 11:22:10 +0200 | [diff] [blame] | 27 | |
| 28 | import java.util.Set; |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 29 | |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 30 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 31 | * Manages inventory of end-station hosts; not intended for direct use. |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 32 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 33 | public interface HostStore extends Store<HostEvent, HostStoreDelegate> { |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 34 | |
| 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'Connor | f107bd7 | 2015-09-21 15:31:03 -0700 | [diff] [blame] | 42 | * @param replaceIps replace IP set if true, merge IP set otherwise |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 43 | * @return appropriate event or null if no change resulted |
| 44 | */ |
| 45 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
Brian O'Connor | f107bd7 | 2015-09-21 15:31:03 -0700 | [diff] [blame] | 46 | HostDescription hostDescription, |
| 47 | boolean replaceIps); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 48 | |
| 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 pal | c40e5ed | 2015-09-24 11:01:51 -0700 | [diff] [blame] | 58 | * 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 | /** |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 67 | * 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 Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 110 | Set<Host> getHosts(IpAddress ip); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 111 | |
| 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 | |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 128 | } |