blob: 6c46627c63fdf256dcaa86626e3995b7529cabcc [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 /**
tomad2d2092014-09-06 23:24:20 -070017 * Returns the number of infrastructure devices known to the system.
tome33cc1a2014-08-25 21:59:41 -070018 *
tomad2d2092014-09-06 23:24:20 -070019 * @return number of infrastructure devices
tome33cc1a2014-08-25 21:59:41 -070020 */
tomad2d2092014-09-06 23:24:20 -070021 int getDeviceCount();
tome33cc1a2014-08-25 21:59:41 -070022
23 /**
tomedf06bb2014-08-27 16:22:15 -070024 * Returns a collection of the currently known infrastructure
tome33cc1a2014-08-25 21:59:41 -070025 * devices.
26 *
27 * @return collection of devices
28 */
29 Iterable<Device> getDevices();
30
31 /**
32 * Returns the device with the specified identifier.
33 *
34 * @param deviceId device identifier
35 * @return device or null if one with the given identifier is not known
36 */
37 Device getDevice(DeviceId deviceId);
38
tomad2d2092014-09-06 23:24:20 -070039 /**
40 * Returns the current mastership role for the specified device.
41 *
42 * @param deviceId device identifier
43 * @return designated mastership role
44 */
45 MastershipRole getRole(DeviceId deviceId);
46
tome33cc1a2014-08-25 21:59:41 -070047
tomb36046e2014-08-27 00:22:24 -070048 /**
49 * Returns the list of ports associated with the device.
50 *
51 * @param deviceId device identifier
52 * @return list of ports
53 */
54 List<Port> getPorts(DeviceId deviceId);
55
56 /**
57 * Returns the port with the specified number and hosted by the given device.
58 * @param deviceId device identifier
59 * @param portNumber port number
60 * @return device port
61 */
62 Port getPort(DeviceId deviceId, PortNumber portNumber);
tome33cc1a2014-08-25 21:59:41 -070063
64 /**
65 * Adds the specified device listener.
66 *
67 * @param listener device listener
68 */
69 void addListener(DeviceListener listener);
70
71 /**
72 * Removes the specified device listener.
73 *
74 * @param listener device listener
75 */
76 void removeListener(DeviceListener listener);
tomb36046e2014-08-27 00:22:24 -070077
tome33cc1a2014-08-25 21:59:41 -070078}