blob: b81804a3374f1444cdd1618a9285a83fc2a24c42 [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
Ray Milkeyb1250322017-06-05 17:18:17 -070018import java.util.List;
19import java.util.Set;
20
andreaed976a42015-10-05 14:38:25 -070021import org.onosproject.net.DeviceId;
Frank Wange11a98d2016-10-26 17:04:03 +080022import org.onosproject.net.PortNumber;
andreaed976a42015-10-05 14:38:25 -070023import org.onosproject.net.behaviour.ControllerInfo;
Pier Ventref5d72362016-07-17 12:02:14 +020024import org.onosproject.net.behaviour.MirroringName;
Ray Milkeyb1250322017-06-05 17:18:17 -070025import org.onosproject.net.behaviour.MirroringStatistics;
Frank Wange11a98d2016-10-26 17:04:03 +080026import org.onosproject.net.behaviour.QosId;
27import org.onosproject.net.behaviour.QueueId;
Jonathan Hart51539b82015-10-29 09:53:04 -070028import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080029import org.onosproject.ovsdb.rfc.message.TableUpdates;
30import org.onosproject.ovsdb.rfc.notation.Row;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080031import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
32
Ray Milkeyb1250322017-06-05 17:18:17 -070033import com.google.common.util.concurrent.ListenableFuture;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080034
CNlucius74fd4942015-07-20 14:28:04 +080035/**
36 * Represents to provider facing side of a node.
37 */
Jonathan Hart51539b82015-10-29 09:53:04 -070038public interface OvsdbClientService extends OvsdbRpc {
CNlucius74fd4942015-07-20 14:28:04 +080039 /**
40 * Gets the node identifier.
41 *
42 * @return node identifier
43 */
44 OvsdbNodeId nodeId();
45
46 /**
Pier Ventref5d72362016-07-17 12:02:14 +020047 * Creates a mirror port. Mirrors the traffic
48 * that goes to selectDstPort or comes from
49 * selectSrcPort or packets containing selectVlan
50 * to mirrorPort or to all ports that trunk mirrorVlan.
51 *
52 * @param bridgeName the name of the bridge
53 * @param mirror the OVSDB mirror description
54 * @return true if mirror creation is successful, false otherwise
55 */
56 boolean createMirror(String bridgeName, OvsdbMirror mirror);
57
58 /**
59 * Gets the Mirror uuid.
60 *
61 * @param mirrorName mirror name
62 * @return mirror uuid, empty if no uuid is found
63 */
64 String getMirrorUuid(String mirrorName);
65
66 /**
67 * Gets mirroring statistics of the device.
68 *
69 * @param deviceId target device id
70 * @return set of mirroring statistics; empty if no mirror is found
71 */
72 Set<MirroringStatistics> getMirroringStatistics(DeviceId deviceId);
73
74 /**
75 * Drops the configuration for mirror.
76 *
Ray Milkeyef794342016-11-09 16:20:29 -080077 * @param mirroringName name of mirror to drop
Pier Ventref5d72362016-07-17 12:02:14 +020078 */
79 void dropMirror(MirroringName mirroringName);
80
81 /**
Frank Wange11a98d2016-10-26 17:04:03 +080082 * apply qos to port.
83 *
84 * @param portNumber port identifier
85 * @param qosName the qos name
86 */
87 void applyQos(PortNumber portNumber, String qosName);
88
89 /**
90 * Creates a qos port.
91 *
92 * @param portNumber port identifier
93 */
94 void removeQos(PortNumber portNumber);
95
96 /**
97 * Creates a qos. associates with queue to
98 * provide the ability of limit the rate of different flows
99 * depend on itself priority.
100 *
101 * @param ovsdbQos the OVSDB Qos
102 * @return true if qos creation is successful, false otherwise
103 */
104 boolean createQos(OvsdbQos ovsdbQos);
105
106 /**
107 * Drops the configuration for qos.
108 *
109 * @param qosId qos identifier
110 */
111 void dropQos(QosId qosId);
112
113 /**
114 * Gets a qos of node.
115 * @param qosId qos identifier
116 * @return null if no qos is find
117 */
118 OvsdbQos getQos(QosId qosId);
119
120 /**
121 * Gets qoses of node.
122 *
123 * @return set of qoses; empty if no qos is find
124 */
125 Set<OvsdbQos> getQoses();
126
127 /**
128 * Creates queues. limits the rate of each flow
129 * depend on itself priority.
130 *
131 * @param queue the OVSDB queue description
132 * @return true if queue creation is successful, false otherwise
133 */
134 boolean createQueue(OvsdbQueue queue);
135
136 /**
137 * Drops the configuration for queue.
138 *
139 * @param queueId queue identifier
140 */
141 void dropQueue(QueueId queueId);
142
143 /**
144 * Gets a queue of node.
145 * @param queueId the queue identifier
146 * @return null if no queue is find
147 */
148 OvsdbQueue getQueue(QueueId queueId);
149
150 /**
151 * Gets queues of node.
152 *
153 * @return set of queues; empty if no queue is find
154 */
155 Set<OvsdbQueue> getQueues();
156
157 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700158 * Creates an interface with a given OVSDB interface description.
CNlucius74fd4942015-07-20 14:28:04 +0800159 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700160 * @param bridgeName bridge name
161 * @param ovsdbIface ovsdb interface description
162 * @return true if interface creation is successful, false otherwise
CNlucius74fd4942015-07-20 14:28:04 +0800163 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700164 boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface);
165
166 /**
167 * Removes an interface with the supplied interface name.
168 *
169 * @param ifaceName interface name
170 * @return true if interface creation is successful, false otherwise
171 */
172 boolean dropInterface(String ifaceName);
CNlucius74fd4942015-07-20 14:28:04 +0800173
174 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700175 * Creates a bridge with a given bridge description.
176 *
177 * @param ovsdbBridge ovsdb bridge description
178 * @return true if bridge creation is successful, otherwise false
179 */
180 boolean createBridge(OvsdbBridge ovsdbBridge);
181
182 /**
CNlucius74fd4942015-07-20 14:28:04 +0800183 * Drops a bridge.
184 *
185 * @param bridgeName bridge name
186 */
187 void dropBridge(String bridgeName);
188
189 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800190 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800191 *
192 * @return set of bridges; empty if no bridge is find
193 */
194 Set<OvsdbBridge> getBridges();
195
196 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800197 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700198 *
Brian O'Connor52515622015-10-09 17:03:44 -0700199 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700200 * @return set of controllers; empty if no controller is find
201 */
202 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
203
204 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700205 * Returns local controller information.
206 * The connection is a TCP connection to the local ONOS instance's IP
207 * and the default OpenFlow port.
208 *
209 * @return local controller
210 */
211 ControllerInfo localController();
212
213 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700214 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700215 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700216 * This method will replace the existing controller list with the new controller
217 * list.
andreaed976a42015-10-05 14:38:25 -0700218 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700219 * @param deviceId device id (likely Openflow device)
220 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700221 */
222 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
223
224 /**
CNlucius74fd4942015-07-20 14:28:04 +0800225 * Creates a port.
226 *
227 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700228 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800229 */
230 void createPort(String bridgeName, String portName);
231
232 /**
233 * Drops a port.
234 *
235 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700236 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800237 */
238 void dropPort(String bridgeName, String portName);
239
240 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800241 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800242 *
243 * @return set of ports; empty if no ports is find
244 */
245 Set<OvsdbPort> getPorts();
246
247 /**
248 * Checks if the node is still connected.
249 *
250 * @return true if the node is still connected
251 */
252 boolean isConnected();
253
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800254 /**
255 * Gets the Bridge uuid.
256 *
257 * @param bridgeName bridge name
258 * @return bridge uuid, empty if no uuid is find
259 */
260 String getBridgeUuid(String bridgeName);
261
262 /**
263 * Gets the Port uuid.
264 *
andreaed976a42015-10-05 14:38:25 -0700265 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800266 * @param bridgeUuid bridge uuid
267 * @return port uuid, empty if no uuid is find
268 */
269 String getPortUuid(String portName, String bridgeUuid);
270
271 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800272 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800273 *
274 * @param dbName database name
275 * @return database schema
276 */
277 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
278
279 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800280 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800281 *
282 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700283 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800284 * @return table updates
285 */
286 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
287
288 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800289 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800290 *
andreaed976a42015-10-05 14:38:25 -0700291 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800292 * @return database schema
293 */
294 DatabaseSchema getDatabaseSchema(String dbName);
295
296 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800297 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800298 *
andreaed976a42015-10-05 14:38:25 -0700299 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800300 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700301 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800302 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800303 */
304 Row getRow(String dbName, String tableName, String uuid);
305
306 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800307 * Removes the OVSDB row from local OVSDB store.
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 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700311 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800312 */
313 void removeRow(String dbName, String tableName, String uuid);
314
315 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800316 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800317 *
andreaed976a42015-10-05 14:38:25 -0700318 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800319 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700320 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800321 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800322 */
323 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
324
CNluciusa66c3972015-09-06 20:31:29 +0800325 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800326 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800327 *
328 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800329 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800330 */
331 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700332
333 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800334 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700335 */
336 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800337}