blob: 5a0676b257dc57fbcf5e2e08f54bbe4d6a05e142 [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;
Jonathan Hart51539b82015-10-29 09:53:04 -070022import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080023import org.onosproject.ovsdb.rfc.message.TableUpdates;
24import org.onosproject.ovsdb.rfc.notation.Row;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080025import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
26
andreaed976a42015-10-05 14:38:25 -070027import java.util.List;
Hyunsun Moon646d8c42015-10-08 20:32:44 -070028import java.util.Map;
andreaed976a42015-10-05 14:38:25 -070029import java.util.Set;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080030
CNlucius74fd4942015-07-20 14:28:04 +080031/**
32 * Represents to provider facing side of a node.
33 */
Jonathan Hart51539b82015-10-29 09:53:04 -070034public interface OvsdbClientService extends OvsdbRpc {
CNlucius74fd4942015-07-20 14:28:04 +080035 /**
36 * Gets the node identifier.
37 *
38 * @return node identifier
39 */
40 OvsdbNodeId nodeId();
41
42 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070043 * Creates a tunnel port with given options.
44 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070045 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -070046 * @param bridgeName bridge name
47 * @param portName port name
48 * @param tunnelType tunnel type
49 * @param options tunnel options
50 * @return true if tunnel creation is successful, false otherwise
51 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070052 @Deprecated
53 boolean createTunnel(String bridgeName, String portName, String tunnelType,
54 Map<String, String> options);
Hyunsun Moon646d8c42015-10-08 20:32:44 -070055
56 /**
BitOhenry264f35a2015-11-03 20:58:39 +080057 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080058 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070059 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +080060 * @param srcIp source IP address
61 * @param dstIp destination IP address
62 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070063 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +080064 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
65
66 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070067 * Creates an interface with a given OVSDB interface description.
CNlucius74fd4942015-07-20 14:28:04 +080068 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070069 * @param bridgeName bridge name
70 * @param ovsdbIface ovsdb interface description
71 * @return true if interface creation is successful, false otherwise
CNlucius74fd4942015-07-20 14:28:04 +080072 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070073 boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface);
74
75 /**
76 * Removes an interface with the supplied interface name.
77 *
78 * @param ifaceName interface name
79 * @return true if interface creation is successful, false otherwise
80 */
81 boolean dropInterface(String ifaceName);
CNlucius74fd4942015-07-20 14:28:04 +080082
83 /**
84 * Creates a bridge.
85 *
Hyunsun Moon1251e192016-06-07 16:57:05 -070086 * @deprecated version 1.7.0 - Hummingbird
CNlucius74fd4942015-07-20 14:28:04 +080087 * @param bridgeName bridge name
88 */
Hyunsun Moon1251e192016-06-07 16:57:05 -070089 @Deprecated
CNlucius74fd4942015-07-20 14:28:04 +080090 void createBridge(String bridgeName);
91
92 /**
lishuai6c56f5e2015-11-17 16:38:19 +080093 * Creates a bridge.
94 *
Hyunsun Moon1251e192016-06-07 16:57:05 -070095 * @deprecated version 1.7.0 - Hummingbird
lishuai6c56f5e2015-11-17 16:38:19 +080096 * @param bridgeName bridge name
97 * @param dpid data path id
98 * @param exPortName external port name
99 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700100 @Deprecated
lishuai6c56f5e2015-11-17 16:38:19 +0800101 void createBridge(String bridgeName, String dpid, String exPortName);
102
103 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700104 * Creates a bridge with given name and dpid.
105 * Sets the bridge's controller with given controllers.
106 *
Hyunsun Moon1251e192016-06-07 16:57:05 -0700107 * @deprecated version 1.7.0 - Hummingbird
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700108 * @param bridgeName bridge name
109 * @param dpid data path id
110 * @param controllers controllers
111 * @return true if bridge creation is successful, false otherwise
112 */
Hyunsun Moon1251e192016-06-07 16:57:05 -0700113 @Deprecated
Hyunsun Moon646d8c42015-10-08 20:32:44 -0700114 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
115
116 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700117 * Creates a bridge with a given bridge description.
118 *
119 * @param ovsdbBridge ovsdb bridge description
120 * @return true if bridge creation is successful, otherwise false
121 */
122 boolean createBridge(OvsdbBridge ovsdbBridge);
123
124 /**
CNlucius74fd4942015-07-20 14:28:04 +0800125 * Drops a bridge.
126 *
127 * @param bridgeName bridge name
128 */
129 void dropBridge(String bridgeName);
130
131 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800132 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800133 *
134 * @return set of bridges; empty if no bridge is find
135 */
136 Set<OvsdbBridge> getBridges();
137
138 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800139 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700140 *
Brian O'Connor52515622015-10-09 17:03:44 -0700141 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700142 * @return set of controllers; empty if no controller is find
143 */
144 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
145
146 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -0700147 * Returns local controller information.
148 * The connection is a TCP connection to the local ONOS instance's IP
149 * and the default OpenFlow port.
150 *
151 * @return local controller
152 */
153 ControllerInfo localController();
154
155 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700156 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700157 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700158 * This method will replace the existing controller list with the new controller
159 * list.
andreaed976a42015-10-05 14:38:25 -0700160 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700161 * @param deviceId device id (likely Openflow device)
162 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700163 */
164 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
165
166 /**
CNlucius74fd4942015-07-20 14:28:04 +0800167 * Creates a port.
168 *
169 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700170 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800171 */
172 void createPort(String bridgeName, String portName);
173
174 /**
175 * Drops a port.
176 *
177 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700178 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800179 */
180 void dropPort(String bridgeName, String portName);
181
182 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800183 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800184 *
185 * @return set of ports; empty if no ports is find
186 */
187 Set<OvsdbPort> getPorts();
188
189 /**
190 * Checks if the node is still connected.
191 *
192 * @return true if the node is still connected
193 */
194 boolean isConnected();
195
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800196 /**
197 * Gets the Bridge uuid.
198 *
199 * @param bridgeName bridge name
200 * @return bridge uuid, empty if no uuid is find
201 */
202 String getBridgeUuid(String bridgeName);
203
204 /**
205 * Gets the Port uuid.
206 *
andreaed976a42015-10-05 14:38:25 -0700207 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800208 * @param bridgeUuid bridge uuid
209 * @return port uuid, empty if no uuid is find
210 */
211 String getPortUuid(String portName, String bridgeUuid);
212
213 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800214 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800215 *
216 * @param dbName database name
217 * @return database schema
218 */
219 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
220
221 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800222 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800223 *
224 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700225 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800226 * @return table updates
227 */
228 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
229
230 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800231 * Gets the OVSDB database schema from local.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800232 *
andreaed976a42015-10-05 14:38:25 -0700233 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800234 * @return database schema
235 */
236 DatabaseSchema getDatabaseSchema(String dbName);
237
238 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800239 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800240 *
andreaed976a42015-10-05 14:38:25 -0700241 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800242 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700243 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800244 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800245 */
246 Row getRow(String dbName, String tableName, String uuid);
247
248 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800249 * Removes the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800250 *
andreaed976a42015-10-05 14:38:25 -0700251 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800252 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700253 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800254 */
255 void removeRow(String dbName, String tableName, String uuid);
256
257 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800258 * Updates the local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800259 *
andreaed976a42015-10-05 14:38:25 -0700260 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800261 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700262 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800263 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800264 */
265 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
266
CNluciusa66c3972015-09-06 20:31:29 +0800267 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800268 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800269 *
270 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800271 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800272 */
273 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700274
275 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800276 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700277 */
278 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800279}