tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.device; |
| 2 | |
| 3 | import org.onlab.onos.net.Device; |
| 4 | import org.onlab.onos.net.DeviceId; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.Port; |
| 6 | import org.onlab.onos.net.PortNumber; |
| 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; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 9 | |
| 10 | import java.util.List; |
| 11 | |
| 12 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 13 | * Manages inventory of infrastructure devices; not intended for direct use. |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 14 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 15 | public interface DeviceStore extends Store<DeviceEvent, DeviceStoreDelegate> { |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 16 | |
| 17 | /** |
| 18 | * Returns the number of devices known to the system. |
| 19 | * |
| 20 | * @return number of devices |
| 21 | */ |
| 22 | int getDeviceCount(); |
| 23 | |
| 24 | /** |
| 25 | * Returns an iterable collection of all devices known to the system. |
| 26 | * |
| 27 | * @return device collection |
| 28 | */ |
| 29 | Iterable<Device> getDevices(); |
| 30 | |
| 31 | /** |
| 32 | * Returns the device with the specified identifier. |
| 33 | * |
| 34 | * @param deviceId device identifier |
| 35 | * @return device |
| 36 | */ |
| 37 | Device getDevice(DeviceId deviceId); |
| 38 | |
| 39 | /** |
| 40 | * Creates a new infrastructure device, or updates an existing one using |
| 41 | * the supplied device description. |
| 42 | * |
| 43 | * @param providerId provider identifier |
| 44 | * @param deviceId device identifier |
| 45 | * @param deviceDescription device description |
| 46 | * @return ready to send event describing what occurred; null if no change |
| 47 | */ |
| 48 | DeviceEvent createOrUpdateDevice(ProviderId providerId, DeviceId deviceId, |
| 49 | DeviceDescription deviceDescription); |
| 50 | |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame^] | 51 | // TODO: We may need to enforce that ancillary cannot interfere this state |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 52 | /** |
| 53 | * Removes the specified infrastructure device. |
| 54 | * |
| 55 | * @param deviceId device identifier |
| 56 | * @return ready to send event describing what occurred; null if no change |
| 57 | */ |
| 58 | DeviceEvent markOffline(DeviceId deviceId); |
| 59 | |
| 60 | /** |
| 61 | * Updates the ports of the specified infrastructure device using the given |
| 62 | * list of port descriptions. The list is assumed to be comprehensive. |
| 63 | * |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame^] | 64 | * @param providerId provider identifier |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 65 | * @param deviceId device identifier |
| 66 | * @param portDescriptions list of port descriptions |
| 67 | * @return ready to send events describing what occurred; empty list if no change |
| 68 | */ |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame^] | 69 | List<DeviceEvent> updatePorts(ProviderId providerId, DeviceId deviceId, |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 70 | List<PortDescription> portDescriptions); |
| 71 | |
| 72 | /** |
| 73 | * Updates the port status of the specified infrastructure device using the |
| 74 | * given port description. |
| 75 | * |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame^] | 76 | * @param providerId provider identifier |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 77 | * @param deviceId device identifier |
| 78 | * @param portDescription port description |
| 79 | * @return ready to send event describing what occurred; null if no change |
| 80 | */ |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame^] | 81 | DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId, |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 82 | PortDescription portDescription); |
| 83 | |
| 84 | /** |
| 85 | * Returns the list of ports that belong to the specified device. |
| 86 | * |
| 87 | * @param deviceId device identifier |
| 88 | * @return list of device ports |
| 89 | */ |
| 90 | List<Port> getPorts(DeviceId deviceId); |
| 91 | |
| 92 | /** |
| 93 | * Returns the specified device port. |
| 94 | * |
| 95 | * @param deviceId device identifier |
| 96 | * @param portNumber port number |
| 97 | * @return device port |
| 98 | */ |
| 99 | Port getPort(DeviceId deviceId, PortNumber portNumber); |
| 100 | |
| 101 | /** |
| 102 | * Indicates whether the specified device is available/online. |
| 103 | * |
| 104 | * @param deviceId device identifier |
| 105 | * @return true if device is available |
| 106 | */ |
| 107 | boolean isAvailable(DeviceId deviceId); |
| 108 | |
| 109 | /** |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 110 | * Administratively removes the specified device from the store. |
| 111 | * |
| 112 | * @param deviceId device to be removed |
| 113 | */ |
| 114 | DeviceEvent removeDevice(DeviceId deviceId); |
| 115 | } |