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