tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame^] | 1 | package org.onlab.onos.net.trivial.impl; |
| 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.host.HostDescription; |
| 8 | import org.onlab.onos.net.host.HostEvent; |
| 9 | import org.onlab.onos.net.provider.ProviderId; |
| 10 | import org.onlab.packet.IPv4; |
| 11 | import org.onlab.packet.MACAddress; |
| 12 | |
| 13 | import java.util.Map; |
| 14 | import java.util.Set; |
| 15 | import java.util.concurrent.ConcurrentHashMap; |
| 16 | |
| 17 | /** |
| 18 | * Manages inventory of end-station hosts using trivial in-memory |
| 19 | * implementation. |
| 20 | */ |
| 21 | public class SimpleHostStore { |
| 22 | |
| 23 | private final Map<HostId, Host> hosts = new ConcurrentHashMap<>(); |
| 24 | |
| 25 | /** |
| 26 | * Creates a new host or updates the existing one based on the specified |
| 27 | * description. |
| 28 | * |
| 29 | * @param providerId provider identification |
| 30 | * @param hostId host identification |
| 31 | * @param hostDescription host description data |
| 32 | * @return appropriate event or null if no change resulted |
| 33 | */ |
| 34 | HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId, |
| 35 | HostDescription hostDescription) { |
| 36 | return null; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Removes the specified host from the inventory. |
| 41 | * |
| 42 | * @param hostId host identification |
| 43 | * @return remove even or null if host was not found |
| 44 | */ |
| 45 | HostEvent removeHost(HostId hostId) { |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Returns the number of hosts in the store. |
| 51 | * |
| 52 | * @return host count |
| 53 | */ |
| 54 | int getHostCount() { |
| 55 | return hosts.size(); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Returns a collection of all hosts in the store. |
| 60 | * |
| 61 | * @return iterable collection of all hosts |
| 62 | */ |
| 63 | Iterable<Host> getHosts() { |
| 64 | return null; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Returns the host with the specified identifer. |
| 69 | * |
| 70 | * @param hostId host identification |
| 71 | * @return host or null if not found |
| 72 | */ |
| 73 | Host getHost(HostId hostId) { |
| 74 | return null; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the set of all hosts within the specified VLAN. |
| 79 | * |
| 80 | * @param vlanId vlan id |
| 81 | * @return set of hosts in the vlan |
| 82 | */ |
| 83 | Set<Host> getHosts(long vlanId) { |
| 84 | return null; |
| 85 | } |
| 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 | return null; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Returns the set of hosts with the specified IP address. |
| 99 | * |
| 100 | * @param ip ip address |
| 101 | * @return set of hosts with the given IP |
| 102 | */ |
| 103 | Set<Host> getHosts(IPv4 ip) { |
| 104 | return null; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Returns the set of hosts whose location falls on the given connection point. |
| 109 | * |
| 110 | * @param connectPoint connection point |
| 111 | * @return set of hosts |
| 112 | */ |
| 113 | Set<Host> getConnectedHosts(ConnectPoint connectPoint) { |
| 114 | return null; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Returns the set of hosts whose location falls on the given device. |
| 119 | * |
| 120 | * @param deviceId infrastructure device identifier |
| 121 | * @return set of hosts |
| 122 | */ |
| 123 | public Set<Host> getConnectedHosts(DeviceId deviceId) { |
| 124 | return null; |
| 125 | } |
| 126 | |
| 127 | } |