blob: 1a1c42309c4d418b9bd5d4c584ef8806f5673006 [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
Ray Milkeyea125322016-02-16 13:35:09 -080051 * @deprecated 1.4.0 Emu release
CNlucius74fd4942015-07-20 14:28:04 +080052 */
jiangruie2766822015-11-27 10:17:10 +080053 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +080054 void createTunnel(IpAddress srcIp, IpAddress dstIp);
55
56 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070057 * Creates a tunnel port with given options.
58 *
59 * @param bridgeName bridge name
60 * @param portName port name
61 * @param tunnelType tunnel type
62 * @param options tunnel options
63 * @return true if tunnel creation is successful, false otherwise
64 */
65 boolean createTunnel(String bridgeName, String portName, String tunnelType, Map<String, String> options);
66
67 /**
BitOhenry264f35a2015-11-03 20:58:39 +080068 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080069 *
70 * @param srcIp source IP address
71 * @param dstIp destination IP address
72 */
73 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
74
75 /**
BitOhenry264f35a2015-11-03 20:58:39 +080076 * Gets tunnels of node.
CNlucius74fd4942015-07-20 14:28:04 +080077 *
78 * @return set of tunnels; empty if no tunnel is find
79 */
80 Set<OvsdbTunnel> getTunnels();
81
82 /**
83 * Creates a bridge.
84 *
85 * @param bridgeName bridge name
86 */
87 void createBridge(String bridgeName);
88
89 /**
lishuai6c56f5e2015-11-17 16:38:19 +080090 * Creates a bridge.
91 *
92 * @param bridgeName bridge name
93 * @param dpid data path id
94 * @param exPortName external port name
95 */
96 void createBridge(String bridgeName, String dpid, String exPortName);
97
98 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070099 * Creates a bridge with given name and dpid.
100 * Sets the bridge's controller with given controllers.
101 *
102 * @param bridgeName bridge name
103 * @param dpid data path id
104 * @param controllers controllers
105 * @return true if bridge creation is successful, false otherwise
106 */
107 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
108
109 /**
CNlucius74fd4942015-07-20 14:28:04 +0800110 * Drops a bridge.
111 *
112 * @param bridgeName bridge name
113 */
114 void dropBridge(String bridgeName);
115
116 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800117 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800118 *
119 * @return set of bridges; empty if no bridge is find
120 */
121 Set<OvsdbBridge> getBridges();
122
123 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800124 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700125 *
Brian O'Connor52515622015-10-09 17:03:44 -0700126 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700127 * @return set of controllers; empty if no controller is find
128 */
129 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
130
131 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700132 * Sets the Controllers for the specified bridge.
Brian O'Connor52515622015-10-09 17:03:44 -0700133 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700134 * This method will replace the existing controller list with the new controller
135 * list.
andreaed976a42015-10-05 14:38:25 -0700136 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700137 * @param bridgeUuid bridge uuid
138 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700139 */
Jonathan Hart51539b82015-10-29 09:53:04 -0700140 void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers);
andreaed976a42015-10-05 14:38:25 -0700141
142 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700143 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700144 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700145 * This method will replace the existing controller list with the new controller
146 * list.
andreaed976a42015-10-05 14:38:25 -0700147 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700148 * @param deviceId device id (likely Openflow device)
149 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700150 */
151 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
152
153 /**
CNlucius74fd4942015-07-20 14:28:04 +0800154 * Creates a port.
155 *
156 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700157 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800158 */
159 void createPort(String bridgeName, String portName);
160
161 /**
162 * Drops a port.
163 *
164 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700165 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800166 */
167 void dropPort(String bridgeName, String portName);
168
169 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800170 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800171 *
172 * @return set of ports; empty if no ports is find
173 */
174 Set<OvsdbPort> getPorts();
175
176 /**
177 * Checks if the node is still connected.
178 *
179 * @return true if the node is still connected
180 */
181 boolean isConnected();
182
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800183 /**
184 * Gets the Bridge uuid.
185 *
186 * @param bridgeName bridge name
187 * @return bridge uuid, empty if no uuid is find
188 */
189 String getBridgeUuid(String bridgeName);
190
191 /**
192 * Gets the Port uuid.
193 *
andreaed976a42015-10-05 14:38:25 -0700194 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800195 * @param bridgeUuid bridge uuid
196 * @return port uuid, empty if no uuid is find
197 */
198 String getPortUuid(String portName, String bridgeUuid);
199
200 /**
201 * Gets the Interface uuid.
202 *
203 * @param portUuid port uuid
204 * @param portName port name
205 * @return interface uuid, empty if no uuid is find
206 */
207 String getInterfaceUuid(String portUuid, String portName);
208
209 /**
210 * Gets the Controller uuid.
211 *
andreaed976a42015-10-05 14:38:25 -0700212 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800213 * @param controllerTarget controller target
214 * @return controller uuid, empty if no uuid is find
215 */
216 String getControllerUuid(String controllerName, String controllerTarget);
217
218 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800219 * Gets the OVS uuid.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800220 *
221 * @param dbName database name
222 * @return ovs uuid, empty if no uuid is find
223 */
224 String getOvsUuid(String dbName);
225
226 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800227 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800228 *
229 * @param dbName database name
230 * @return database schema
231 */
232 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
233
234 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800235 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800236 *
237 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700238 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800239 * @return table updates
240 */
241 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
242
243 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800244 * Gets the OVSDB config operation result.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800245 *
andreaed976a42015-10-05 14:38:25 -0700246 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800247 * @param operations the list of operations
248 * @return operation results
249 */
250 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
251 List<Operation> operations);
252
253 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800254 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800255 *
andreaed976a42015-10-05 14:38:25 -0700256 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800257 * @return database schema
258 */
259 DatabaseSchema getDatabaseSchema(String dbName);
260
261 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800262 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800263 *
andreaed976a42015-10-05 14:38:25 -0700264 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800265 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700266 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800267 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800268 */
269 Row getRow(String dbName, String tableName, String uuid);
270
271 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800272 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800273 *
andreaed976a42015-10-05 14:38:25 -0700274 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800275 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700276 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800277 */
278 void removeRow(String dbName, String tableName, String uuid);
279
280 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800281 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800282 *
andreaed976a42015-10-05 14:38:25 -0700283 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800284 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700285 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800286 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800287 */
288 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
289
CNluciusa66c3972015-09-06 20:31:29 +0800290 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800291 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800292 *
293 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800294 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800295 */
296 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700297
298 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800299 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700300 */
301 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800302}