tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.host; |
| 2 | |
| 3 | import org.onlab.onos.net.ConnectPoint; |
| 4 | import org.onlab.onos.net.DeviceId; |
| 5 | import org.onlab.onos.net.Host; |
| 6 | import org.onlab.onos.net.HostId; |
| 7 | import org.onlab.onos.net.provider.ProviderId; |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 8 | import org.onlab.onos.store.Store; |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 9 | import org.onlab.packet.IpPrefix; |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 10 | import org.onlab.packet.MacAddress; |
| 11 | import org.onlab.packet.VlanId; |
| 12 | |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 13 | import java.util.Set; |
| 14 | |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 15 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 16 | * Manages inventory of end-station hosts; not intended for direct use. |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 17 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 18 | public interface HostStore extends Store<HostEvent, HostStoreDelegate> { |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Creates a new host or updates the existing one based on the specified |
| 22 | * description. |
| 23 | * |
| 24 | * @param providerId provider identification |
| 25 | * @param hostId host identification |
| 26 | * @param hostDescription host description data |
| 27 | * @return appropriate event or null if no change resulted |
| 28 | */ |
| 29 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
| 30 | HostDescription hostDescription); |
| 31 | |
Yuta HIGUCHI | a263915 | 2014-10-14 15:08:10 -0700 | [diff] [blame^] | 32 | // FIXME: API to remove only IpAddress is missing |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 33 | /** |
| 34 | * Removes the specified host from the inventory. |
| 35 | * |
| 36 | * @param hostId host identification |
| 37 | * @return remove event or null if host was not found |
| 38 | */ |
| 39 | HostEvent removeHost(HostId hostId); |
| 40 | |
| 41 | /** |
| 42 | * Returns the number of hosts in the store. |
| 43 | * |
| 44 | * @return host count |
| 45 | */ |
| 46 | int getHostCount(); |
| 47 | |
| 48 | /** |
| 49 | * Returns a collection of all hosts in the store. |
| 50 | * |
| 51 | * @return iterable collection of all hosts |
| 52 | */ |
| 53 | Iterable<Host> getHosts(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the host with the specified identifer. |
| 57 | * |
| 58 | * @param hostId host identification |
| 59 | * @return host or null if not found |
| 60 | */ |
| 61 | Host getHost(HostId hostId); |
| 62 | |
| 63 | /** |
| 64 | * Returns the set of all hosts within the specified VLAN. |
| 65 | * |
| 66 | * @param vlanId vlan id |
| 67 | * @return set of hosts in the vlan |
| 68 | */ |
| 69 | Set<Host> getHosts(VlanId vlanId); |
| 70 | |
| 71 | /** |
| 72 | * Returns the set of hosts with the specified MAC address. |
| 73 | * |
| 74 | * @param mac mac address |
| 75 | * @return set of hosts with the given mac |
| 76 | */ |
| 77 | Set<Host> getHosts(MacAddress mac); |
| 78 | |
| 79 | /** |
| 80 | * Returns the set of hosts with the specified IP address. |
| 81 | * |
| 82 | * @param ip ip address |
| 83 | * @return set of hosts with the given IP |
| 84 | */ |
Yuta HIGUCHI | a263915 | 2014-10-14 15:08:10 -0700 | [diff] [blame^] | 85 | // FIXME: Switch to IpAddress |
Ayaka Koshibe | 1d56fe4 | 2014-09-19 16:51:58 -0700 | [diff] [blame] | 86 | Set<Host> getHosts(IpPrefix ip); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Returns the set of hosts whose location falls on the given connection point. |
| 90 | * |
| 91 | * @param connectPoint connection point |
| 92 | * @return set of hosts |
| 93 | */ |
| 94 | Set<Host> getConnectedHosts(ConnectPoint connectPoint); |
| 95 | |
| 96 | /** |
| 97 | * Returns the set of hosts whose location falls on the given device. |
| 98 | * |
| 99 | * @param deviceId infrastructure device identifier |
| 100 | * @return set of hosts |
| 101 | */ |
| 102 | Set<Host> getConnectedHosts(DeviceId deviceId); |
| 103 | |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 104 | /** |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 105 | * Updates the address information for a given port. The given address |
| 106 | * information is added to any previously held information for the port. |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 107 | * |
| 108 | * @param addresses the port and address information |
| 109 | */ |
| 110 | void updateAddressBindings(PortAddresses addresses); |
| 111 | |
| 112 | /** |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 113 | * Removes the given addresses from the set of address information held for |
| 114 | * a port. |
| 115 | * |
| 116 | * @param addresses the port and address information |
| 117 | */ |
| 118 | void removeAddressBindings(PortAddresses addresses); |
| 119 | |
| 120 | /** |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 121 | * Removes any previously stored address information for a given connection |
| 122 | * point. |
| 123 | * |
| 124 | * @param connectPoint the connection point |
| 125 | */ |
Jonathan Hart | 09585c6 | 2014-09-23 16:58:04 -0700 | [diff] [blame] | 126 | void clearAddressBindings(ConnectPoint connectPoint); |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 127 | |
| 128 | /** |
| 129 | * Returns the address bindings stored for all connection points. |
| 130 | * |
| 131 | * @return the set of address bindings |
| 132 | */ |
| 133 | Set<PortAddresses> getAddressBindings(); |
| 134 | |
| 135 | /** |
| 136 | * Returns the address bindings for a particular connection point. |
| 137 | * |
| 138 | * @param connectPoint the connection point to return address information |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 139 | * for |
Jonathan Hart | ac60c08 | 2014-09-23 08:55:17 -0700 | [diff] [blame] | 140 | * @return address information for the connection point |
| 141 | */ |
| 142 | PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint); |
tom | 5bcc946 | 2014-09-19 10:11:31 -0700 | [diff] [blame] | 143 | } |