tom | e33cc1a | 2014-08-25 21:59:41 -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; |
| 5 | import org.onlab.onos.net.MastershipRole; |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.Port; |
| 7 | import org.onlab.onos.net.PortNumber; |
| 8 | |
| 9 | import java.util.List; |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 10 | |
| 11 | /** |
| 12 | * Service for interacting with the inventory of infrastructure devices. |
| 13 | */ |
| 14 | public interface DeviceService { |
| 15 | |
| 16 | /** |
| 17 | * Returns the current mastership role for the specified device. |
| 18 | * |
| 19 | * @param deviceId device identifier |
| 20 | * @return designated mastership role |
| 21 | */ |
| 22 | MastershipRole getRole(DeviceId deviceId); |
| 23 | |
| 24 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame^] | 25 | * Returns a collection of the currently known infrastructure |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 26 | * devices. |
| 27 | * |
| 28 | * @return collection of devices |
| 29 | */ |
| 30 | Iterable<Device> getDevices(); |
| 31 | |
| 32 | /** |
| 33 | * Returns the device with the specified identifier. |
| 34 | * |
| 35 | * @param deviceId device identifier |
| 36 | * @return device or null if one with the given identifier is not known |
| 37 | */ |
| 38 | Device getDevice(DeviceId deviceId); |
| 39 | |
| 40 | |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Returns the list of ports associated with the device. |
| 43 | * |
| 44 | * @param deviceId device identifier |
| 45 | * @return list of ports |
| 46 | */ |
| 47 | List<Port> getPorts(DeviceId deviceId); |
| 48 | |
| 49 | /** |
| 50 | * Returns the port with the specified number and hosted by the given device. |
| 51 | * @param deviceId device identifier |
| 52 | * @param portNumber port number |
| 53 | * @return device port |
| 54 | */ |
| 55 | Port getPort(DeviceId deviceId, PortNumber portNumber); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Adds the specified device listener. |
| 59 | * |
| 60 | * @param listener device listener |
| 61 | */ |
| 62 | void addListener(DeviceListener listener); |
| 63 | |
| 64 | /** |
| 65 | * Removes the specified device listener. |
| 66 | * |
| 67 | * @param listener device listener |
| 68 | */ |
| 69 | void removeListener(DeviceListener listener); |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 70 | |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 71 | } |