Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 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'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 | a887ba8 | 2014-11-03 15:20:52 -0800 | [diff] [blame] | 18 | import java.util.Set; |
| 19 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.Host; |
| 23 | import org.onosproject.net.HostId; |
| 24 | import org.onosproject.net.provider.ProviderId; |
| 25 | import org.onosproject.store.Store; |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 26 | import org.onlab.packet.IpAddress; |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 27 | import org.onlab.packet.MacAddress; |
| 28 | import org.onlab.packet.VlanId; |
| 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 |
| 42 | * @return appropriate event or null if no change resulted |
| 43 | */ |
| 44 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
| 45 | HostDescription hostDescription); |
| 46 | |
Yuta HIGUCHI | a263915 | 2014-10-14 15:08:10 -0700 | [diff] [blame] | 47 | // FIXME: API to remove only IpAddress is missing |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 48 | /** |
| 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 Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 100 | Set<Host> getHosts(IpAddress ip); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 101 | |
| 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 Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 118 | /** |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 119 | * Updates the address information for a given port. The given address |
| 120 | * information is added to any previously held information for the port. |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 121 | * |
| 122 | * @param addresses the port and address information |
| 123 | */ |
| 124 | void updateAddressBindings(PortAddresses addresses); |
| 125 | |
| 126 | /** |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 127 | * 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 Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 135 | * Removes any previously stored address information for a given connection |
| 136 | * point. |
| 137 | * |
| 138 | * @param connectPoint the connection point |
| 139 | */ |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 140 | void clearAddressBindings(ConnectPoint connectPoint); |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 141 | |
| 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 |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 153 | * for |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 154 | * @return address information for the connection point |
| 155 | */ |
Jonathan Hart | a887ba8 | 2014-11-03 15:20:52 -0800 | [diff] [blame] | 156 | Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 157 | } |