blob: edd25ac669e9473c2a76f392402766abef6c1249 [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;
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;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080022import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRPC;
23import org.onosproject.ovsdb.rfc.message.OperationResult;
24import org.onosproject.ovsdb.rfc.message.TableUpdates;
25import org.onosproject.ovsdb.rfc.notation.Row;
andreaed976a42015-10-05 14:38:25 -070026import org.onosproject.ovsdb.rfc.notation.UUID;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080027import org.onosproject.ovsdb.rfc.operations.Operation;
28import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
29
andreaed976a42015-10-05 14:38:25 -070030import java.util.List;
Hyunsun Moon646d8c42015-10-08 20:32:44 -070031import java.util.Map;
andreaed976a42015-10-05 14:38:25 -070032import java.util.Set;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080033
CNlucius74fd4942015-07-20 14:28:04 +080034/**
35 * Represents to provider facing side of a node.
36 */
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080037public interface OvsdbClientService extends OvsdbRPC {
CNlucius74fd4942015-07-20 14:28:04 +080038 /**
39 * Gets the node identifier.
40 *
41 * @return node identifier
42 */
43 OvsdbNodeId nodeId();
44
45 /**
BitOhenry264f35a2015-11-03 20:58:39 +080046 * Creates the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080047 *
48 * @param srcIp source IP address
49 * @param dstIp destination IP address
50 */
51 void createTunnel(IpAddress srcIp, IpAddress dstIp);
52
53 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070054 * Creates a tunnel port with given options.
55 *
56 * @param bridgeName bridge name
57 * @param portName port name
58 * @param tunnelType tunnel type
59 * @param options tunnel options
60 * @return true if tunnel creation is successful, false otherwise
61 */
62 boolean createTunnel(String bridgeName, String portName, String tunnelType, Map<String, String> options);
63
64 /**
BitOhenry264f35a2015-11-03 20:58:39 +080065 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080066 *
67 * @param srcIp source IP address
68 * @param dstIp destination IP address
69 */
70 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
71
72 /**
BitOhenry264f35a2015-11-03 20:58:39 +080073 * Gets tunnels of node.
CNlucius74fd4942015-07-20 14:28:04 +080074 *
75 * @return set of tunnels; empty if no tunnel is find
76 */
77 Set<OvsdbTunnel> getTunnels();
78
79 /**
80 * Creates a bridge.
81 *
82 * @param bridgeName bridge name
83 */
84 void createBridge(String bridgeName);
85
86 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070087 * Creates a bridge with given name and dpid.
88 * Sets the bridge's controller with given controllers.
89 *
90 * @param bridgeName bridge name
91 * @param dpid data path id
92 * @param controllers controllers
93 * @return true if bridge creation is successful, false otherwise
94 */
95 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
96
97 /**
CNlucius74fd4942015-07-20 14:28:04 +080098 * Drops a bridge.
99 *
100 * @param bridgeName bridge name
101 */
102 void dropBridge(String bridgeName);
103
104 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800105 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800106 *
107 * @return set of bridges; empty if no bridge is find
108 */
109 Set<OvsdbBridge> getBridges();
110
111 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800112 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700113 *
Brian O'Connor52515622015-10-09 17:03:44 -0700114 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700115 * @return set of controllers; empty if no controller is find
116 */
117 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
118
119 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700120 * Sets the Controllers for the specified bridge.
Brian O'Connor52515622015-10-09 17:03:44 -0700121 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700122 * This method will replace the existing controller list with the new controller
123 * list.
andreaed976a42015-10-05 14:38:25 -0700124 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700125 * @param bridgeUuid bridge uuid
126 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700127 */
128 void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers);
129
130 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700131 * Sets the Controllers for the specified device.
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 deviceId device id (likely Openflow device)
137 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700138 */
139 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
140
141 /**
CNlucius74fd4942015-07-20 14:28:04 +0800142 * Creates a port.
143 *
144 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700145 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800146 */
147 void createPort(String bridgeName, String portName);
148
149 /**
150 * Drops a port.
151 *
152 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700153 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800154 */
155 void dropPort(String bridgeName, String portName);
156
157 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800158 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800159 *
160 * @return set of ports; empty if no ports is find
161 */
162 Set<OvsdbPort> getPorts();
163
164 /**
165 * Checks if the node is still connected.
166 *
167 * @return true if the node is still connected
168 */
169 boolean isConnected();
170
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800171 /**
172 * Gets the Bridge uuid.
173 *
174 * @param bridgeName bridge name
175 * @return bridge uuid, empty if no uuid is find
176 */
177 String getBridgeUuid(String bridgeName);
178
179 /**
180 * Gets the Port uuid.
181 *
andreaed976a42015-10-05 14:38:25 -0700182 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800183 * @param bridgeUuid bridge uuid
184 * @return port uuid, empty if no uuid is find
185 */
186 String getPortUuid(String portName, String bridgeUuid);
187
188 /**
189 * Gets the Interface uuid.
190 *
191 * @param portUuid port uuid
192 * @param portName port name
193 * @return interface uuid, empty if no uuid is find
194 */
195 String getInterfaceUuid(String portUuid, String portName);
196
197 /**
198 * Gets the Controller uuid.
199 *
andreaed976a42015-10-05 14:38:25 -0700200 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800201 * @param controllerTarget controller target
202 * @return controller uuid, empty if no uuid is find
203 */
204 String getControllerUuid(String controllerName, String controllerTarget);
205
206 /**
207 * Gets the Ovs uuid.
208 *
209 * @param dbName database name
210 * @return ovs uuid, empty if no uuid is find
211 */
212 String getOvsUuid(String dbName);
213
214 /**
215 * Gets the ovsdb database schema.
216 *
217 * @param dbName database name
218 * @return database schema
219 */
220 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
221
222 /**
223 * Gets the ovsdb table updates.
224 *
225 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700226 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800227 * @return table updates
228 */
229 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
230
231 /**
232 * Gets the ovsdb config operation result.
233 *
andreaed976a42015-10-05 14:38:25 -0700234 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800235 * @param operations the list of operations
236 * @return operation results
237 */
238 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
239 List<Operation> operations);
240
241 /**
242 * Gets the ovsdb database schema from local.
243 *
andreaed976a42015-10-05 14:38:25 -0700244 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800245 * @return database schema
246 */
247 DatabaseSchema getDatabaseSchema(String dbName);
248
249 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800250 * Gets the ovsdb row from local ovsdb store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800251 *
andreaed976a42015-10-05 14:38:25 -0700252 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800253 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700254 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800255 * @return row ovsdb row
256 */
257 Row getRow(String dbName, String tableName, String uuid);
258
259 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800260 * Removes the ovsdb row from local ovsdb store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800261 *
andreaed976a42015-10-05 14:38:25 -0700262 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800263 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700264 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800265 */
266 void removeRow(String dbName, String tableName, String uuid);
267
268 /**
CNluciusa66c3972015-09-06 20:31:29 +0800269 * Updates the local ovsdb store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800270 *
andreaed976a42015-10-05 14:38:25 -0700271 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800272 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700273 * @param uuid row uuid
274 * @param row ovsdb row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800275 */
276 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
277
CNluciusa66c3972015-09-06 20:31:29 +0800278 /**
279 * Gets ovsdb local ports.
280 *
281 * @param ifaceids the ifaceid that needed
282 * @return ovsdb ports
283 */
284 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700285
286 /**
287 * Disconnects the ovsdb server.
288 */
289 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800290}