blob: dfa151838c1b4eb334e72836b99d380e2e3395c9 [file] [log] [blame]
CNlucius74fd4942015-07-20 14:28:04 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
CNlucius74fd4942015-07-20 14:28:04 +08003 *
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 */
16package org.onosproject.ovsdb.controller;
17
Ray Milkeyb1250322017-06-05 17:18:17 -070018import java.util.List;
tanbangchengc944c282017-11-12 20:42:59 +080019import java.util.Map;
Ray Milkeyb1250322017-06-05 17:18:17 -070020import java.util.Set;
21
andreaed976a42015-10-05 14:38:25 -070022import org.onosproject.net.DeviceId;
Frank Wange11a98d2016-10-26 17:04:03 +080023import org.onosproject.net.PortNumber;
andreaed976a42015-10-05 14:38:25 -070024import org.onosproject.net.behaviour.ControllerInfo;
Pier Ventref5d72362016-07-17 12:02:14 +020025import org.onosproject.net.behaviour.MirroringName;
Ray Milkeyb1250322017-06-05 17:18:17 -070026import org.onosproject.net.behaviour.MirroringStatistics;
Frank Wange11a98d2016-10-26 17:04:03 +080027import org.onosproject.net.behaviour.QosId;
tanbangchengc944c282017-11-12 20:42:59 +080028import org.onosproject.net.behaviour.QueueDescription;
Frank Wange11a98d2016-10-26 17:04:03 +080029import org.onosproject.net.behaviour.QueueId;
Jonathan Hart51539b82015-10-29 09:53:04 -070030import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080031import org.onosproject.ovsdb.rfc.message.TableUpdates;
32import org.onosproject.ovsdb.rfc.notation.Row;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080033import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
34
Ray Milkeyb1250322017-06-05 17:18:17 -070035import com.google.common.util.concurrent.ListenableFuture;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080036
CNlucius74fd4942015-07-20 14:28:04 +080037/**
38 * Represents to provider facing side of a node.
39 */
Jonathan Hart51539b82015-10-29 09:53:04 -070040public interface OvsdbClientService extends OvsdbRpc {
CNlucius74fd4942015-07-20 14:28:04 +080041 /**
42 * Gets the node identifier.
43 *
44 * @return node identifier
45 */
46 OvsdbNodeId nodeId();
47
48 /**
Pier Ventref5d72362016-07-17 12:02:14 +020049 * Creates a mirror port. Mirrors the traffic
50 * that goes to selectDstPort or comes from
51 * selectSrcPort or packets containing selectVlan
52 * to mirrorPort or to all ports that trunk mirrorVlan.
53 *
54 * @param bridgeName the name of the bridge
55 * @param mirror the OVSDB mirror description
56 * @return true if mirror creation is successful, false otherwise
57 */
58 boolean createMirror(String bridgeName, OvsdbMirror mirror);
59
60 /**
61 * Gets the Mirror uuid.
62 *
63 * @param mirrorName mirror name
64 * @return mirror uuid, empty if no uuid is found
65 */
66 String getMirrorUuid(String mirrorName);
67
68 /**
69 * Gets mirroring statistics of the device.
70 *
71 * @param deviceId target device id
72 * @return set of mirroring statistics; empty if no mirror is found
73 */
74 Set<MirroringStatistics> getMirroringStatistics(DeviceId deviceId);
75
76 /**
77 * Drops the configuration for mirror.
78 *
Ray Milkeyef794342016-11-09 16:20:29 -080079 * @param mirroringName name of mirror to drop
Pier Ventref5d72362016-07-17 12:02:14 +020080 */
81 void dropMirror(MirroringName mirroringName);
82
83 /**
Frank Wange11a98d2016-10-26 17:04:03 +080084 * apply qos to port.
85 *
86 * @param portNumber port identifier
87 * @param qosName the qos name
88 */
89 void applyQos(PortNumber portNumber, String qosName);
90
91 /**
92 * Creates a qos port.
93 *
94 * @param portNumber port identifier
95 */
96 void removeQos(PortNumber portNumber);
97
98 /**
99 * Creates a qos. associates with queue to
100 * provide the ability of limit the rate of different flows
101 * depend on itself priority.
102 *
103 * @param ovsdbQos the OVSDB Qos
104 * @return true if qos creation is successful, false otherwise
105 */
106 boolean createQos(OvsdbQos ovsdbQos);
107
108 /**
109 * Drops the configuration for qos.
110 *
111 * @param qosId qos identifier
112 */
113 void dropQos(QosId qosId);
114
115 /**
116 * Gets a qos of node.
117 * @param qosId qos identifier
118 * @return null if no qos is find
119 */
120 OvsdbQos getQos(QosId qosId);
121
122 /**
123 * Gets qoses of node.
124 *
125 * @return set of qoses; empty if no qos is find
126 */
127 Set<OvsdbQos> getQoses();
128
129 /**
tanbangchengc944c282017-11-12 20:42:59 +0800130 * Bind Queue to QoS.
131 *
132 * @param qosId qos identifier
133 * @param queues the Queue key and Queue description
134 */
135 void bindQueues(QosId qosId, Map<Long, QueueDescription> queues);
136
137 /**
138 * Unbind Queue from QoS.
139 *
140 * @param qosId qos identifier
141 * @param queueKeys queue key
142 */
143 void unbindQueues(QosId qosId, List<Long> queueKeys);
144
145 /**
Frank Wange11a98d2016-10-26 17:04:03 +0800146 * Creates queues. limits the rate of each flow
147 * depend on itself priority.
148 *
149 * @param queue the OVSDB queue description
150 * @return true if queue creation is successful, false otherwise
151 */
152 boolean createQueue(OvsdbQueue queue);
153
154 /**
155 * Drops the configuration for queue.
156 *
157 * @param queueId queue identifier
158 */
159 void dropQueue(QueueId queueId);
160
161 /**
162 * Gets a queue of node.
163 * @param queueId the queue identifier
164 * @return null if no queue is find
165 */
166 OvsdbQueue getQueue(QueueId queueId);
167
168 /**
169 * Gets queues of node.
170 *
171 * @return set of queues; empty if no queue is find
172 */
173 Set<OvsdbQueue> getQueues();
174
175 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700176 * Creates an interface with a given OVSDB interface description.
CNlucius74fd4942015-07-20 14:28:04 +0800177 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700178 * @param bridgeName bridge name
179 * @param ovsdbIface ovsdb interface description
180 * @return true if interface creation is successful, false otherwise
CNlucius74fd4942015-07-20 14:28:04 +0800181 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700182 boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface);
183
184 /**
185 * Removes an interface with the supplied interface name.
186 *
187 * @param ifaceName interface name
188 * @return true if interface creation is successful, false otherwise
189 */
190 boolean dropInterface(String ifaceName);
CNlucius74fd4942015-07-20 14:28:04 +0800191
192 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700193 * Creates a bridge with a given bridge description.
194 *
195 * @param ovsdbBridge ovsdb bridge description
196 * @return true if bridge creation is successful, otherwise false
197 */
198 boolean createBridge(OvsdbBridge ovsdbBridge);
199
200 /**
CNlucius74fd4942015-07-20 14:28:04 +0800201 * Drops a bridge.
202 *
203 * @param bridgeName bridge name
204 */
205 void dropBridge(String bridgeName);
206
207 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800208 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800209 *
210 * @return set of bridges; empty if no bridge is find
211 */
212 Set<OvsdbBridge> getBridges();
213
214 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800215 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700216 *
Brian O'Connor52515622015-10-09 17:03:44 -0700217 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700218 * @return set of controllers; empty if no controller is find
219 */
220 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
221
222 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700223 * Returns local controller information.
224 * The connection is a TCP connection to the local ONOS instance's IP
225 * and the default OpenFlow port.
226 *
227 * @return local controller
228 */
229 ControllerInfo localController();
230
231 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700232 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700233 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700234 * This method will replace the existing controller list with the new controller
235 * list.
andreaed976a42015-10-05 14:38:25 -0700236 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700237 * @param deviceId device id (likely Openflow device)
238 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700239 */
240 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
241
242 /**
CNlucius74fd4942015-07-20 14:28:04 +0800243 * Creates a port.
244 *
245 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700246 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800247 */
248 void createPort(String bridgeName, String portName);
249
250 /**
251 * Drops a port.
252 *
253 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700254 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800255 */
256 void dropPort(String bridgeName, String portName);
257
258 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800259 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800260 *
261 * @return set of ports; empty if no ports is find
262 */
263 Set<OvsdbPort> getPorts();
264
265 /**
266 * Checks if the node is still connected.
267 *
268 * @return true if the node is still connected
269 */
270 boolean isConnected();
271
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800272 /**
273 * Gets the Bridge uuid.
274 *
275 * @param bridgeName bridge name
276 * @return bridge uuid, empty if no uuid is find
277 */
278 String getBridgeUuid(String bridgeName);
279
280 /**
281 * Gets the Port uuid.
282 *
andreaed976a42015-10-05 14:38:25 -0700283 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800284 * @param bridgeUuid bridge uuid
285 * @return port uuid, empty if no uuid is find
286 */
287 String getPortUuid(String portName, String bridgeUuid);
288
289 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800290 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800291 *
292 * @param dbName database name
293 * @return database schema
294 */
295 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
296
297 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800298 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800299 *
300 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700301 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800302 * @return table updates
303 */
304 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
305
306 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800307 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800308 *
andreaed976a42015-10-05 14:38:25 -0700309 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800310 * @return database schema
311 */
312 DatabaseSchema getDatabaseSchema(String dbName);
313
314 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800315 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800316 *
andreaed976a42015-10-05 14:38:25 -0700317 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800318 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700319 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800320 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800321 */
322 Row getRow(String dbName, String tableName, String uuid);
323
324 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800325 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800326 *
andreaed976a42015-10-05 14:38:25 -0700327 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800328 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700329 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800330 */
331 void removeRow(String dbName, String tableName, String uuid);
332
333 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800334 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800335 *
andreaed976a42015-10-05 14:38:25 -0700336 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800337 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700338 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800339 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800340 */
341 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
342
CNluciusa66c3972015-09-06 20:31:29 +0800343 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800344 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800345 *
346 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800347 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800348 */
349 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700350
351 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800352 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700353 */
354 void disconnect();
Saritha1583a6f2017-06-16 14:42:58 +0530355
356 /**
357 * Gets created ports for the particular bridgeId.
358 *
359 * @param portNames the portNames which needs to checked for create
360 * @param bridgeId bridgeIdentifier
361 * @return OvsdbPortNames the created ports from port table for the bridgeId by considering input port list.
362 * Considered port as created if port's interface table also gets created,irrespective
363 * of ofport value(has errors or not)
364 */
365 public List<OvsdbPortName> getPorts(List<String> portNames, DeviceId bridgeId);
366
367 /**
368 * Gets error status for the given portNames.
369 *
370 * @param portNames the portNames which need to be checked for errors
371 * @param bridgeId bridgeIdentifier
372 * @return errorstatus true if input port list contains error, false otherwise
373 */
374 boolean getPortError(List<OvsdbPortName> portNames, DeviceId bridgeId);
CNlucius74fd4942015-07-20 14:28:04 +0800375}