blob: ac2f4a4b9480e4a37cca5a27ef8d7f57be2dfac9 [file] [log] [blame]
tome33cc1a2014-08-25 21:59:41 -07001package org.onlab.onos.net.device;
2
3import org.onlab.onos.net.Device;
4import org.onlab.onos.net.DeviceId;
5import org.onlab.onos.net.MastershipRole;
tomb36046e2014-08-27 00:22:24 -07006import org.onlab.onos.net.Port;
7import org.onlab.onos.net.PortNumber;
8
9import java.util.List;
tome33cc1a2014-08-25 21:59:41 -070010
11/**
12 * Service for interacting with the inventory of infrastructure devices.
13 */
14public 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 /**
25 * Returns an iterable collection of the currently known infrastructure
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
tomb36046e2014-08-27 00:22:24 -070041 /**
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);
tome33cc1a2014-08-25 21:59:41 -070056
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);
tomb36046e2014-08-27 00:22:24 -070070
tome33cc1a2014-08-25 21:59:41 -070071}