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