blob: fdb9f6d57f43103e835a23d13e81d13d9944234e [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;
tomf80c9722014-09-24 14:49:18 -07008import org.onlab.onos.store.Store;
tom41a2c5f2014-09-19 09:20:35 -07009
10import java.util.List;
11
12/**
tome4729872014-09-23 00:37:37 -070013 * Manages inventory of infrastructure devices; not intended for direct use.
tom41a2c5f2014-09-19 09:20:35 -070014 */
tomf80c9722014-09-24 14:49:18 -070015public interface DeviceStore extends Store<DeviceEvent, DeviceStoreDelegate> {
tom41a2c5f2014-09-19 09:20:35 -070016
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 HIGUCHI5f6739c2014-10-01 14:04:01 -070051 // TODO: We may need to enforce that ancillary cannot interfere this state
tom41a2c5f2014-09-19 09:20:35 -070052 /**
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 HIGUCHI5f6739c2014-10-01 14:04:01 -070064 * @param providerId provider identifier
tom41a2c5f2014-09-19 09:20:35 -070065 * @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 HIGUCHI5f6739c2014-10-01 14:04:01 -070069 List<DeviceEvent> updatePorts(ProviderId providerId, DeviceId deviceId,
tom41a2c5f2014-09-19 09:20:35 -070070 List<PortDescription> portDescriptions);
71
72 /**
73 * Updates the port status of the specified infrastructure device using the
74 * given port description.
75 *
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -070076 * @param providerId provider identifier
tom41a2c5f2014-09-19 09:20:35 -070077 * @param deviceId device identifier
78 * @param portDescription port description
79 * @return ready to send event describing what occurred; null if no change
80 */
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -070081 DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId,
tom41a2c5f2014-09-19 09:20:35 -070082 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 /**
tom41a2c5f2014-09-19 09:20:35 -0700110 * Administratively removes the specified device from the store.
111 *
112 * @param deviceId device to be removed
113 */
114 DeviceEvent removeDevice(DeviceId deviceId);
115}