blob: a5ba5a3c9e03beb54dcf4ebde0dccd05c1d39743 [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;
21import org.onosproject.net.behaviour.ControllerInfo;
Pier Ventref5d72362016-07-17 12:02:14 +020022import org.onosproject.net.behaviour.MirroringStatistics;
23import org.onosproject.net.behaviour.MirroringName;
Jonathan Hart51539b82015-10-29 09:53:04 -070024import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080025import org.onosproject.ovsdb.rfc.message.TableUpdates;
26import org.onosproject.ovsdb.rfc.notation.Row;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080027import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
28
andreaed976a42015-10-05 14:38:25 -070029import java.util.List;
Hyunsun Moon646d8c42015-10-08 20:32:44 -070030import java.util.Map;
andreaed976a42015-10-05 14:38:25 -070031import java.util.Set;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080032
CNlucius74fd4942015-07-20 14:28:04 +080033/**
34 * Represents to provider facing side of a node.
35 */
Jonathan Hart51539b82015-10-29 09:53:04 -070036public interface OvsdbClientService extends OvsdbRpc {
CNlucius74fd4942015-07-20 14:28:04 +080037 /**
38 * Gets the node identifier.
39 *
40 * @return node identifier
41 */
42 OvsdbNodeId nodeId();
43
44 /**
Pier Ventref5d72362016-07-17 12:02:14 +020045 * Creates a mirror port. Mirrors the traffic
46 * that goes to selectDstPort or comes from
47 * selectSrcPort or packets containing selectVlan
48 * to mirrorPort or to all ports that trunk mirrorVlan.
49 *
50 * @param bridgeName the name of the bridge
51 * @param mirror the OVSDB mirror description
52 * @return true if mirror creation is successful, false otherwise
53 */
54 boolean createMirror(String bridgeName, OvsdbMirror mirror);
55
56 /**
57 * Gets the Mirror uuid.
58 *
59 * @param mirrorName mirror name
60 * @return mirror uuid, empty if no uuid is found
61 */
62 String getMirrorUuid(String mirrorName);
63
64 /**
65 * Gets mirroring statistics of the device.
66 *
67 * @param deviceId target device id
68 * @return set of mirroring statistics; empty if no mirror is found
69 */
70 Set<MirroringStatistics> getMirroringStatistics(DeviceId deviceId);
71
72 /**
73 * Drops the configuration for mirror.
74 *
75 * @param mirroringName
76 */
77 void dropMirror(MirroringName mirroringName);
78
79 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070080 * Creates a tunnel port with given options.
81 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070082 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -070083 * @param bridgeName bridge name
84 * @param portName port name
85 * @param tunnelType tunnel type
86 * @param options tunnel options
87 * @return true if tunnel creation is successful, false otherwise
88 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070089 @Deprecated
90 boolean createTunnel(String bridgeName, String portName, String tunnelType,
91 Map<String, String> options);
Hyunsun Moon646d8c42015-10-08 20:32:44 -070092
93 /**
BitOhenry264f35a2015-11-03 20:58:39 +080094 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080095 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070096 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +080097 * @param srcIp source IP address
98 * @param dstIp destination IP address
99 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700100 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +0800101 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
102
103 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700104 * Creates an interface with a given OVSDB interface description.
CNlucius74fd4942015-07-20 14:28:04 +0800105 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700106 * @param bridgeName bridge name
107 * @param ovsdbIface ovsdb interface description
108 * @return true if interface creation is successful, false otherwise
CNlucius74fd4942015-07-20 14:28:04 +0800109 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700110 boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface);
111
112 /**
113 * Removes an interface with the supplied interface name.
114 *
115 * @param ifaceName interface name
116 * @return true if interface creation is successful, false otherwise
117 */
118 boolean dropInterface(String ifaceName);
CNlucius74fd4942015-07-20 14:28:04 +0800119
120 /**
121 * Creates a bridge.
122 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700123 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +0800124 * @param bridgeName bridge name
125 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700126 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +0800127 void createBridge(String bridgeName);
128
129 /**
lishuai6c56f5e2015-11-17 16:38:19 +0800130 * Creates a bridge.
131 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700132 * @deprecated version 1.7.0 - Hummingbird
lishuai6c56f5e2015-11-17 16:38:19 +0800133 * @param bridgeName bridge name
134 * @param dpid data path id
135 * @param exPortName external port name
136 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700137 @Deprecated
lishuai6c56f5e2015-11-17 16:38:19 +0800138 void createBridge(String bridgeName, String dpid, String exPortName);
139
140 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700141 * Creates a bridge with given name and dpid.
142 * Sets the bridge's controller with given controllers.
143 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700144 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700145 * @param bridgeName bridge name
146 * @param dpid data path id
147 * @param controllers controllers
148 * @return true if bridge creation is successful, false otherwise
149 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700150 @Deprecated
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700151 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
152
153 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700154 * Creates a bridge with a given bridge description.
155 *
156 * @param ovsdbBridge ovsdb bridge description
157 * @return true if bridge creation is successful, otherwise false
158 */
159 boolean createBridge(OvsdbBridge ovsdbBridge);
160
161 /**
CNlucius74fd4942015-07-20 14:28:04 +0800162 * Drops a bridge.
163 *
164 * @param bridgeName bridge name
165 */
166 void dropBridge(String bridgeName);
167
168 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800169 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800170 *
171 * @return set of bridges; empty if no bridge is find
172 */
173 Set<OvsdbBridge> getBridges();
174
175 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800176 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700177 *
Brian O'Connor52515622015-10-09 17:03:44 -0700178 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700179 * @return set of controllers; empty if no controller is find
180 */
181 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
182
183 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700184 * Returns local controller information.
185 * The connection is a TCP connection to the local ONOS instance's IP
186 * and the default OpenFlow port.
187 *
188 * @return local controller
189 */
190 ControllerInfo localController();
191
192 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700193 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700194 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700195 * This method will replace the existing controller list with the new controller
196 * list.
andreaed976a42015-10-05 14:38:25 -0700197 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700198 * @param deviceId device id (likely Openflow device)
199 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700200 */
201 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
202
203 /**
CNlucius74fd4942015-07-20 14:28:04 +0800204 * Creates a port.
205 *
206 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700207 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800208 */
209 void createPort(String bridgeName, String portName);
210
211 /**
212 * Drops a port.
213 *
214 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700215 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800216 */
217 void dropPort(String bridgeName, String portName);
218
219 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800220 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800221 *
222 * @return set of ports; empty if no ports is find
223 */
224 Set<OvsdbPort> getPorts();
225
226 /**
227 * Checks if the node is still connected.
228 *
229 * @return true if the node is still connected
230 */
231 boolean isConnected();
232
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800233 /**
234 * Gets the Bridge uuid.
235 *
236 * @param bridgeName bridge name
237 * @return bridge uuid, empty if no uuid is find
238 */
239 String getBridgeUuid(String bridgeName);
240
241 /**
242 * Gets the Port uuid.
243 *
andreaed976a42015-10-05 14:38:25 -0700244 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800245 * @param bridgeUuid bridge uuid
246 * @return port uuid, empty if no uuid is find
247 */
248 String getPortUuid(String portName, String bridgeUuid);
249
250 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800251 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800252 *
253 * @param dbName database name
254 * @return database schema
255 */
256 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
257
258 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800259 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800260 *
261 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700262 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800263 * @return table updates
264 */
265 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
266
267 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800268 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800269 *
andreaed976a42015-10-05 14:38:25 -0700270 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800271 * @return database schema
272 */
273 DatabaseSchema getDatabaseSchema(String dbName);
274
275 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800276 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800277 *
andreaed976a42015-10-05 14:38:25 -0700278 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800279 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700280 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800281 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800282 */
283 Row getRow(String dbName, String tableName, String uuid);
284
285 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800286 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800287 *
andreaed976a42015-10-05 14:38:25 -0700288 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800289 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700290 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800291 */
292 void removeRow(String dbName, String tableName, String uuid);
293
294 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800295 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800296 *
andreaed976a42015-10-05 14:38:25 -0700297 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800298 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700299 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800300 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800301 */
302 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
303
CNluciusa66c3972015-09-06 20:31:29 +0800304 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800305 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800306 *
307 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800308 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800309 */
310 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700311
312 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800313 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700314 */
315 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800316}