blob: e04d0eedf7a52febf3e2fd80a1dbce09b190e3a1 [file] [log] [blame]
CNlucius74fd4942015-07-20 14:28:04 +08001/*
2 * Copyright 2015 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 */
16package org.onosproject.ovsdb.controller;
17
andreaed976a42015-10-05 14:38:25 -070018import com.google.common.util.concurrent.ListenableFuture;
lishuai6c56f5e2015-11-17 16:38:19 +080019
CNlucius74fd4942015-07-20 14:28:04 +080020import org.onlab.packet.IpAddress;
andreaed976a42015-10-05 14:38:25 -070021import org.onosproject.net.DeviceId;
22import org.onosproject.net.behaviour.ControllerInfo;
Jonathan Hart51539b82015-10-29 09:53:04 -070023import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080024import org.onosproject.ovsdb.rfc.message.OperationResult;
25import org.onosproject.ovsdb.rfc.message.TableUpdates;
26import org.onosproject.ovsdb.rfc.notation.Row;
Jonathan Hart51539b82015-10-29 09:53:04 -070027import org.onosproject.ovsdb.rfc.notation.Uuid;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080028import org.onosproject.ovsdb.rfc.operations.Operation;
29import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
30
andreaed976a42015-10-05 14:38:25 -070031import java.util.List;
Hyunsun Moon646d8c42015-10-08 20:32:44 -070032import java.util.Map;
andreaed976a42015-10-05 14:38:25 -070033import java.util.Set;
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 /**
BitOhenry264f35a2015-11-03 20:58:39 +080047 * Creates the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080048 *
49 * @param srcIp source IP address
50 * @param dstIp destination IP address
51 */
jiangruie2766822015-11-27 10:17:10 +080052 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +080053 void createTunnel(IpAddress srcIp, IpAddress dstIp);
54
55 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070056 * Creates a tunnel port with given options.
57 *
58 * @param bridgeName bridge name
59 * @param portName port name
60 * @param tunnelType tunnel type
61 * @param options tunnel options
62 * @return true if tunnel creation is successful, false otherwise
63 */
64 boolean createTunnel(String bridgeName, String portName, String tunnelType, Map<String, String> options);
65
66 /**
BitOhenry264f35a2015-11-03 20:58:39 +080067 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080068 *
69 * @param srcIp source IP address
70 * @param dstIp destination IP address
71 */
72 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
73
74 /**
BitOhenry264f35a2015-11-03 20:58:39 +080075 * Gets tunnels of node.
CNlucius74fd4942015-07-20 14:28:04 +080076 *
77 * @return set of tunnels; empty if no tunnel is find
78 */
79 Set<OvsdbTunnel> getTunnels();
80
81 /**
82 * Creates a bridge.
83 *
84 * @param bridgeName bridge name
85 */
86 void createBridge(String bridgeName);
87
88 /**
lishuai6c56f5e2015-11-17 16:38:19 +080089 * Creates a bridge.
90 *
91 * @param bridgeName bridge name
92 * @param dpid data path id
93 * @param exPortName external port name
94 */
95 void createBridge(String bridgeName, String dpid, String exPortName);
96
97 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070098 * Creates a bridge with given name and dpid.
99 * Sets the bridge's controller with given controllers.
100 *
101 * @param bridgeName bridge name
102 * @param dpid data path id
103 * @param controllers controllers
104 * @return true if bridge creation is successful, false otherwise
105 */
106 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
107
108 /**
CNlucius74fd4942015-07-20 14:28:04 +0800109 * Drops a bridge.
110 *
111 * @param bridgeName bridge name
112 */
113 void dropBridge(String bridgeName);
114
115 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800116 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800117 *
118 * @return set of bridges; empty if no bridge is find
119 */
120 Set<OvsdbBridge> getBridges();
121
122 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800123 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700124 *
Brian O'Connor52515622015-10-09 17:03:44 -0700125 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700126 * @return set of controllers; empty if no controller is find
127 */
128 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
129
130 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700131 * Sets the Controllers for the specified bridge.
Brian O'Connor52515622015-10-09 17:03:44 -0700132 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700133 * This method will replace the existing controller list with the new controller
134 * list.
andreaed976a42015-10-05 14:38:25 -0700135 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700136 * @param bridgeUuid bridge uuid
137 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700138 */
Jonathan Hart51539b82015-10-29 09:53:04 -0700139 void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers);
andreaed976a42015-10-05 14:38:25 -0700140
141 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700142 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700143 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700144 * This method will replace the existing controller list with the new controller
145 * list.
andreaed976a42015-10-05 14:38:25 -0700146 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700147 * @param deviceId device id (likely Openflow device)
148 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700149 */
150 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
151
152 /**
CNlucius74fd4942015-07-20 14:28:04 +0800153 * Creates a port.
154 *
155 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700156 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800157 */
158 void createPort(String bridgeName, String portName);
159
160 /**
161 * Drops a port.
162 *
163 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700164 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800165 */
166 void dropPort(String bridgeName, String portName);
167
168 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800169 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800170 *
171 * @return set of ports; empty if no ports is find
172 */
173 Set<OvsdbPort> getPorts();
174
175 /**
176 * Checks if the node is still connected.
177 *
178 * @return true if the node is still connected
179 */
180 boolean isConnected();
181
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800182 /**
183 * Gets the Bridge uuid.
184 *
185 * @param bridgeName bridge name
186 * @return bridge uuid, empty if no uuid is find
187 */
188 String getBridgeUuid(String bridgeName);
189
190 /**
191 * Gets the Port uuid.
192 *
andreaed976a42015-10-05 14:38:25 -0700193 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800194 * @param bridgeUuid bridge uuid
195 * @return port uuid, empty if no uuid is find
196 */
197 String getPortUuid(String portName, String bridgeUuid);
198
199 /**
200 * Gets the Interface uuid.
201 *
202 * @param portUuid port uuid
203 * @param portName port name
204 * @return interface uuid, empty if no uuid is find
205 */
206 String getInterfaceUuid(String portUuid, String portName);
207
208 /**
209 * Gets the Controller uuid.
210 *
andreaed976a42015-10-05 14:38:25 -0700211 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800212 * @param controllerTarget controller target
213 * @return controller uuid, empty if no uuid is find
214 */
215 String getControllerUuid(String controllerName, String controllerTarget);
216
217 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800218 * Gets the OVS uuid.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800219 *
220 * @param dbName database name
221 * @return ovs uuid, empty if no uuid is find
222 */
223 String getOvsUuid(String dbName);
224
225 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800226 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800227 *
228 * @param dbName database name
229 * @return database schema
230 */
231 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
232
233 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800234 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800235 *
236 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700237 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800238 * @return table updates
239 */
240 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
241
242 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800243 * Gets the OVSDB config operation result.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800244 *
andreaed976a42015-10-05 14:38:25 -0700245 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800246 * @param operations the list of operations
247 * @return operation results
248 */
249 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
250 List<Operation> operations);
251
252 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800253 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800254 *
andreaed976a42015-10-05 14:38:25 -0700255 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800256 * @return database schema
257 */
258 DatabaseSchema getDatabaseSchema(String dbName);
259
260 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800261 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800262 *
andreaed976a42015-10-05 14:38:25 -0700263 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800264 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700265 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800266 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800267 */
268 Row getRow(String dbName, String tableName, String uuid);
269
270 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800271 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800272 *
andreaed976a42015-10-05 14:38:25 -0700273 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800274 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700275 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800276 */
277 void removeRow(String dbName, String tableName, String uuid);
278
279 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800280 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800281 *
andreaed976a42015-10-05 14:38:25 -0700282 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800283 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700284 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800285 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800286 */
287 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
288
CNluciusa66c3972015-09-06 20:31:29 +0800289 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800290 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800291 *
292 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800293 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800294 */
295 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700296
297 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800298 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700299 */
300 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800301}