blob: 8c11c3df05f749c84fc939e38594f761560dbed0 [file] [log] [blame]
CNlucius74fd4942015-07-20 14:28:04 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
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
andreaed976a42015-10-05 14:38:25 -070018import com.google.common.util.concurrent.ListenableFuture;
CNlucius74fd4942015-07-20 14:28:04 +080019import org.onlab.packet.IpAddress;
andreaed976a42015-10-05 14:38:25 -070020import org.onosproject.net.DeviceId;
Frank Wange11a98d2016-10-26 17:04:03 +080021import org.onosproject.net.PortNumber;
andreaed976a42015-10-05 14:38:25 -070022import org.onosproject.net.behaviour.ControllerInfo;
Pier Ventref5d72362016-07-17 12:02:14 +020023import org.onosproject.net.behaviour.MirroringStatistics;
24import org.onosproject.net.behaviour.MirroringName;
Frank Wange11a98d2016-10-26 17:04:03 +080025import org.onosproject.net.behaviour.QosId;
26import org.onosproject.net.behaviour.QueueId;
Jonathan Hart51539b82015-10-29 09:53:04 -070027import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080028import org.onosproject.ovsdb.rfc.message.TableUpdates;
29import org.onosproject.ovsdb.rfc.notation.Row;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080030import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
31
andreaed976a42015-10-05 14:38:25 -070032import java.util.List;
Hyunsun Moon646d8c42015-10-08 20:32:44 -070033import java.util.Map;
andreaed976a42015-10-05 14:38:25 -070034import java.util.Set;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080035
CNlucius74fd4942015-07-20 14:28:04 +080036/**
37 * Represents to provider facing side of a node.
38 */
Jonathan Hart51539b82015-10-29 09:53:04 -070039public interface OvsdbClientService extends OvsdbRpc {
CNlucius74fd4942015-07-20 14:28:04 +080040 /**
41 * Gets the node identifier.
42 *
43 * @return node identifier
44 */
45 OvsdbNodeId nodeId();
46
47 /**
Pier Ventref5d72362016-07-17 12:02:14 +020048 * Creates a mirror port. Mirrors the traffic
49 * that goes to selectDstPort or comes from
50 * selectSrcPort or packets containing selectVlan
51 * to mirrorPort or to all ports that trunk mirrorVlan.
52 *
53 * @param bridgeName the name of the bridge
54 * @param mirror the OVSDB mirror description
55 * @return true if mirror creation is successful, false otherwise
56 */
57 boolean createMirror(String bridgeName, OvsdbMirror mirror);
58
59 /**
60 * Gets the Mirror uuid.
61 *
62 * @param mirrorName mirror name
63 * @return mirror uuid, empty if no uuid is found
64 */
65 String getMirrorUuid(String mirrorName);
66
67 /**
68 * Gets mirroring statistics of the device.
69 *
70 * @param deviceId target device id
71 * @return set of mirroring statistics; empty if no mirror is found
72 */
73 Set<MirroringStatistics> getMirroringStatistics(DeviceId deviceId);
74
75 /**
76 * Drops the configuration for mirror.
77 *
Ray Milkeyef794342016-11-09 16:20:29 -080078 * @param mirroringName name of mirror to drop
Pier Ventref5d72362016-07-17 12:02:14 +020079 */
80 void dropMirror(MirroringName mirroringName);
81
82 /**
Frank Wange11a98d2016-10-26 17:04:03 +080083 * apply qos to port.
84 *
85 * @param portNumber port identifier
86 * @param qosName the qos name
87 */
88 void applyQos(PortNumber portNumber, String qosName);
89
90 /**
91 * Creates a qos port.
92 *
93 * @param portNumber port identifier
94 */
95 void removeQos(PortNumber portNumber);
96
97 /**
98 * Creates a qos. associates with queue to
99 * provide the ability of limit the rate of different flows
100 * depend on itself priority.
101 *
102 * @param ovsdbQos the OVSDB Qos
103 * @return true if qos creation is successful, false otherwise
104 */
105 boolean createQos(OvsdbQos ovsdbQos);
106
107 /**
108 * Drops the configuration for qos.
109 *
110 * @param qosId qos identifier
111 */
112 void dropQos(QosId qosId);
113
114 /**
115 * Gets a qos of node.
116 * @param qosId qos identifier
117 * @return null if no qos is find
118 */
119 OvsdbQos getQos(QosId qosId);
120
121 /**
122 * Gets qoses of node.
123 *
124 * @return set of qoses; empty if no qos is find
125 */
126 Set<OvsdbQos> getQoses();
127
128 /**
129 * Creates queues. limits the rate of each flow
130 * depend on itself priority.
131 *
132 * @param queue the OVSDB queue description
133 * @return true if queue creation is successful, false otherwise
134 */
135 boolean createQueue(OvsdbQueue queue);
136
137 /**
138 * Drops the configuration for queue.
139 *
140 * @param queueId queue identifier
141 */
142 void dropQueue(QueueId queueId);
143
144 /**
145 * Gets a queue of node.
146 * @param queueId the queue identifier
147 * @return null if no queue is find
148 */
149 OvsdbQueue getQueue(QueueId queueId);
150
151 /**
152 * Gets queues of node.
153 *
154 * @return set of queues; empty if no queue is find
155 */
156 Set<OvsdbQueue> getQueues();
157
158 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700159 * Creates a tunnel port with given options.
160 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700161 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700162 * @param bridgeName bridge name
163 * @param portName port name
164 * @param tunnelType tunnel type
165 * @param options tunnel options
166 * @return true if tunnel creation is successful, false otherwise
167 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700168 @Deprecated
169 boolean createTunnel(String bridgeName, String portName, String tunnelType,
170 Map<String, String> options);
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700171
172 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800173 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +0800174 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700175 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +0800176 * @param srcIp source IP address
177 * @param dstIp destination IP address
178 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700179 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +0800180 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
181
182 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700183 * Creates an interface with a given OVSDB interface description.
CNlucius74fd4942015-07-20 14:28:04 +0800184 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700185 * @param bridgeName bridge name
186 * @param ovsdbIface ovsdb interface description
187 * @return true if interface creation is successful, false otherwise
CNlucius74fd4942015-07-20 14:28:04 +0800188 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700189 boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface);
190
191 /**
192 * Removes an interface with the supplied interface name.
193 *
194 * @param ifaceName interface name
195 * @return true if interface creation is successful, false otherwise
196 */
197 boolean dropInterface(String ifaceName);
CNlucius74fd4942015-07-20 14:28:04 +0800198
199 /**
200 * Creates a bridge.
201 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700202 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +0800203 * @param bridgeName bridge name
204 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700205 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +0800206 void createBridge(String bridgeName);
207
208 /**
lishuai6c56f5e2015-11-17 16:38:19 +0800209 * Creates a bridge.
210 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700211 * @deprecated version 1.7.0 - Hummingbird
lishuai6c56f5e2015-11-17 16:38:19 +0800212 * @param bridgeName bridge name
213 * @param dpid data path id
214 * @param exPortName external port name
215 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700216 @Deprecated
lishuai6c56f5e2015-11-17 16:38:19 +0800217 void createBridge(String bridgeName, String dpid, String exPortName);
218
219 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700220 * Creates a bridge with given name and dpid.
221 * Sets the bridge's controller with given controllers.
222 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700223 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700224 * @param bridgeName bridge name
225 * @param dpid data path id
226 * @param controllers controllers
227 * @return true if bridge creation is successful, false otherwise
228 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700229 @Deprecated
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700230 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
231
232 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700233 * Creates a bridge with a given bridge description.
234 *
235 * @param ovsdbBridge ovsdb bridge description
236 * @return true if bridge creation is successful, otherwise false
237 */
238 boolean createBridge(OvsdbBridge ovsdbBridge);
239
240 /**
CNlucius74fd4942015-07-20 14:28:04 +0800241 * Drops a bridge.
242 *
243 * @param bridgeName bridge name
244 */
245 void dropBridge(String bridgeName);
246
247 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800248 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800249 *
250 * @return set of bridges; empty if no bridge is find
251 */
252 Set<OvsdbBridge> getBridges();
253
254 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800255 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700256 *
Brian O'Connor52515622015-10-09 17:03:44 -0700257 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700258 * @return set of controllers; empty if no controller is find
259 */
260 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
261
262 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700263 * Returns local controller information.
264 * The connection is a TCP connection to the local ONOS instance's IP
265 * and the default OpenFlow port.
266 *
267 * @return local controller
268 */
269 ControllerInfo localController();
270
271 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700272 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700273 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700274 * This method will replace the existing controller list with the new controller
275 * list.
andreaed976a42015-10-05 14:38:25 -0700276 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700277 * @param deviceId device id (likely Openflow device)
278 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700279 */
280 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
281
282 /**
CNlucius74fd4942015-07-20 14:28:04 +0800283 * Creates a port.
284 *
285 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700286 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800287 */
288 void createPort(String bridgeName, String portName);
289
290 /**
291 * Drops a port.
292 *
293 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700294 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800295 */
296 void dropPort(String bridgeName, String portName);
297
298 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800299 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800300 *
301 * @return set of ports; empty if no ports is find
302 */
303 Set<OvsdbPort> getPorts();
304
305 /**
306 * Checks if the node is still connected.
307 *
308 * @return true if the node is still connected
309 */
310 boolean isConnected();
311
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800312 /**
313 * Gets the Bridge uuid.
314 *
315 * @param bridgeName bridge name
316 * @return bridge uuid, empty if no uuid is find
317 */
318 String getBridgeUuid(String bridgeName);
319
320 /**
321 * Gets the Port uuid.
322 *
andreaed976a42015-10-05 14:38:25 -0700323 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800324 * @param bridgeUuid bridge uuid
325 * @return port uuid, empty if no uuid is find
326 */
327 String getPortUuid(String portName, String bridgeUuid);
328
329 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800330 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800331 *
332 * @param dbName database name
333 * @return database schema
334 */
335 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
336
337 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800338 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800339 *
340 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700341 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800342 * @return table updates
343 */
344 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
345
346 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800347 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800348 *
andreaed976a42015-10-05 14:38:25 -0700349 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800350 * @return database schema
351 */
352 DatabaseSchema getDatabaseSchema(String dbName);
353
354 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800355 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800356 *
andreaed976a42015-10-05 14:38:25 -0700357 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800358 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700359 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800360 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800361 */
362 Row getRow(String dbName, String tableName, String uuid);
363
364 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800365 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800366 *
andreaed976a42015-10-05 14:38:25 -0700367 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800368 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700369 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800370 */
371 void removeRow(String dbName, String tableName, String uuid);
372
373 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800374 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800375 *
andreaed976a42015-10-05 14:38:25 -0700376 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800377 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700378 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800379 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800380 */
381 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
382
CNluciusa66c3972015-09-06 20:31:29 +0800383 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800384 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800385 *
386 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800387 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800388 */
389 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700390
391 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800392 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700393 */
394 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800395}