blob: 88dc7f93f69ca3c1536f0f7bdd23e013fdc4927e [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.device;
tom41a2c5f2014-09-19 09:20:35 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.Device;
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.Port;
21import org.onosproject.net.PortNumber;
22import org.onosproject.net.provider.ProviderId;
23import org.onosproject.store.Store;
tom41a2c5f2014-09-19 09:20:35 -070024
sangho538108b2015-04-08 14:29:20 -070025import java.util.Collection;
tom41a2c5f2014-09-19 09:20:35 -070026import java.util.List;
27
28/**
tome4729872014-09-23 00:37:37 -070029 * Manages inventory of infrastructure devices; not intended for direct use.
tom41a2c5f2014-09-19 09:20:35 -070030 */
tomf80c9722014-09-24 14:49:18 -070031public interface DeviceStore extends Store<DeviceEvent, DeviceStoreDelegate> {
tom41a2c5f2014-09-19 09:20:35 -070032
33 /**
34 * Returns the number of devices known to the system.
35 *
36 * @return number of devices
37 */
38 int getDeviceCount();
39
40 /**
41 * Returns an iterable collection of all devices known to the system.
42 *
43 * @return device collection
44 */
45 Iterable<Device> getDevices();
46
47 /**
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080048 * Returns an iterable collection of all devices currently available to the system.
49 *
50 * @return device collection
51 */
52 Iterable<Device> getAvailableDevices();
53
54
55
56 /**
tom41a2c5f2014-09-19 09:20:35 -070057 * Returns the device with the specified identifier.
58 *
59 * @param deviceId device identifier
60 * @return device
61 */
62 Device getDevice(DeviceId deviceId);
63
64 /**
65 * Creates a new infrastructure device, or updates an existing one using
66 * the supplied device description.
67 *
68 * @param providerId provider identifier
69 * @param deviceId device identifier
70 * @param deviceDescription device description
71 * @return ready to send event describing what occurred; null if no change
72 */
73 DeviceEvent createOrUpdateDevice(ProviderId providerId, DeviceId deviceId,
74 DeviceDescription deviceDescription);
75
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -070076 // TODO: We may need to enforce that ancillary cannot interfere this state
tom41a2c5f2014-09-19 09:20:35 -070077 /**
78 * Removes the specified infrastructure device.
79 *
80 * @param deviceId device identifier
81 * @return ready to send event describing what occurred; null if no change
82 */
83 DeviceEvent markOffline(DeviceId deviceId);
84
85 /**
86 * Updates the ports of the specified infrastructure device using the given
87 * list of port descriptions. The list is assumed to be comprehensive.
88 *
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -070089 * @param providerId provider identifier
tom41a2c5f2014-09-19 09:20:35 -070090 * @param deviceId device identifier
91 * @param portDescriptions list of port descriptions
92 * @return ready to send events describing what occurred; empty list if no change
93 */
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -070094 List<DeviceEvent> updatePorts(ProviderId providerId, DeviceId deviceId,
tom41a2c5f2014-09-19 09:20:35 -070095 List<PortDescription> portDescriptions);
96
97 /**
98 * Updates the port status of the specified infrastructure device using the
99 * given port description.
100 *
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -0700101 * @param providerId provider identifier
tom41a2c5f2014-09-19 09:20:35 -0700102 * @param deviceId device identifier
103 * @param portDescription port description
104 * @return ready to send event describing what occurred; null if no change
105 */
Yuta HIGUCHI5f6739c2014-10-01 14:04:01 -0700106 DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId,
tom41a2c5f2014-09-19 09:20:35 -0700107 PortDescription portDescription);
108
109 /**
110 * Returns the list of ports that belong to the specified device.
111 *
112 * @param deviceId device identifier
113 * @return list of device ports
114 */
115 List<Port> getPorts(DeviceId deviceId);
116
117 /**
sangho538108b2015-04-08 14:29:20 -0700118 * Updates the port statistics of the specified device using the give port
119 * statistics.
120 *
121 * @param providerId provider identifier
122 * @param deviceId device identifier
123 * @param portStats list of port statistics
124 * @return ready to send event describing what occurred;
125 */
126 DeviceEvent updatePortStatistics(ProviderId providerId, DeviceId deviceId,
127 Collection<PortStatistics> portStats);
128
129 /**
130 * Returns the list of port statistics of the specified device.
131 *
132 * @param deviceId device identifier
133 * @return list of port statistics of all ports of the device
134 */
135 List<PortStatistics> getPortStatistics(DeviceId deviceId);
136
137 /**
tom41a2c5f2014-09-19 09:20:35 -0700138 * Returns the specified device port.
139 *
140 * @param deviceId device identifier
141 * @param portNumber port number
142 * @return device port
143 */
144 Port getPort(DeviceId deviceId, PortNumber portNumber);
145
146 /**
147 * Indicates whether the specified device is available/online.
148 *
149 * @param deviceId device identifier
150 * @return true if device is available
151 */
152 boolean isAvailable(DeviceId deviceId);
153
154 /**
tom41a2c5f2014-09-19 09:20:35 -0700155 * Administratively removes the specified device from the store.
156 *
157 * @param deviceId device to be removed
Yuta HIGUCHI5c947272014-11-03 21:39:21 -0800158 * @return null if no such device, or was forwarded to remove master
tom41a2c5f2014-09-19 09:20:35 -0700159 */
160 DeviceEvent removeDevice(DeviceId deviceId);
sangho538108b2015-04-08 14:29:20 -0700161
162
tom41a2c5f2014-09-19 09:20:35 -0700163}