blob: 41bdfed96d0fdca21d0cd4ff103d5eb4614d5934 [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 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070047 * Creates a tunnel port with given options.
48 *
49 * @param bridgeName bridge name
50 * @param portName port name
51 * @param tunnelType tunnel type
52 * @param options tunnel options
53 * @return true if tunnel creation is successful, false otherwise
54 */
55 boolean createTunnel(String bridgeName, String portName, String tunnelType, Map<String, String> options);
56
57 /**
BitOhenry264f35a2015-11-03 20:58:39 +080058 * Drops the configuration for tunnel.
CNlucius74fd4942015-07-20 14:28:04 +080059 *
60 * @param srcIp source IP address
61 * @param dstIp destination IP address
62 */
63 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
64
65 /**
BitOhenry264f35a2015-11-03 20:58:39 +080066 * Gets tunnels of node.
CNlucius74fd4942015-07-20 14:28:04 +080067 *
68 * @return set of tunnels; empty if no tunnel is find
69 */
70 Set<OvsdbTunnel> getTunnels();
71
72 /**
73 * Creates a bridge.
74 *
75 * @param bridgeName bridge name
76 */
77 void createBridge(String bridgeName);
78
79 /**
lishuai6c56f5e2015-11-17 16:38:19 +080080 * Creates a bridge.
81 *
82 * @param bridgeName bridge name
83 * @param dpid data path id
84 * @param exPortName external port name
85 */
86 void createBridge(String bridgeName, String dpid, String exPortName);
87
88 /**
Hyunsun Moon646d8c42015-10-08 20:32:44 -070089 * Creates a bridge with given name and dpid.
90 * Sets the bridge's controller with given controllers.
91 *
92 * @param bridgeName bridge name
93 * @param dpid data path id
94 * @param controllers controllers
95 * @return true if bridge creation is successful, false otherwise
96 */
97 boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers);
98
99 /**
CNlucius74fd4942015-07-20 14:28:04 +0800100 * Drops a bridge.
101 *
102 * @param bridgeName bridge name
103 */
104 void dropBridge(String bridgeName);
105
106 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800107 * Gets bridges of node.
CNlucius74fd4942015-07-20 14:28:04 +0800108 *
109 * @return set of bridges; empty if no bridge is find
110 */
111 Set<OvsdbBridge> getBridges();
112
113 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800114 * Gets controllers of node.
andreaed976a42015-10-05 14:38:25 -0700115 *
Brian O'Connor52515622015-10-09 17:03:44 -0700116 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -0700117 * @return set of controllers; empty if no controller is find
118 */
119 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
120
121 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700122 * Sets the Controllers for the specified bridge.
Brian O'Connor52515622015-10-09 17:03:44 -0700123 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700124 * This method will replace the existing controller list with the new controller
125 * list.
andreaed976a42015-10-05 14:38:25 -0700126 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700127 * @param bridgeUuid bridge uuid
128 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700129 */
Jonathan Hart51539b82015-10-29 09:53:04 -0700130 void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers);
andreaed976a42015-10-05 14:38:25 -0700131
132 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700133 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700134 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700135 * This method will replace the existing controller list with the new controller
136 * list.
andreaed976a42015-10-05 14:38:25 -0700137 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700138 * @param deviceId device id (likely Openflow device)
139 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700140 */
141 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
142
143 /**
CNlucius74fd4942015-07-20 14:28:04 +0800144 * Creates a port.
145 *
146 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700147 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800148 */
149 void createPort(String bridgeName, String portName);
150
151 /**
152 * Drops a port.
153 *
154 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700155 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800156 */
157 void dropPort(String bridgeName, String portName);
158
159 /**
BitOhenry264f35a2015-11-03 20:58:39 +0800160 * Gets ports of bridge.
CNlucius74fd4942015-07-20 14:28:04 +0800161 *
162 * @return set of ports; empty if no ports is find
163 */
164 Set<OvsdbPort> getPorts();
165
166 /**
167 * Checks if the node is still connected.
168 *
169 * @return true if the node is still connected
170 */
171 boolean isConnected();
172
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800173 /**
174 * Gets the Bridge uuid.
175 *
176 * @param bridgeName bridge name
177 * @return bridge uuid, empty if no uuid is find
178 */
179 String getBridgeUuid(String bridgeName);
180
181 /**
182 * Gets the Port uuid.
183 *
andreaed976a42015-10-05 14:38:25 -0700184 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800185 * @param bridgeUuid bridge uuid
186 * @return port uuid, empty if no uuid is find
187 */
188 String getPortUuid(String portName, String bridgeUuid);
189
190 /**
191 * Gets the Interface uuid.
192 *
193 * @param portUuid port uuid
194 * @param portName port name
195 * @return interface uuid, empty if no uuid is find
196 */
197 String getInterfaceUuid(String portUuid, String portName);
198
199 /**
200 * Gets the Controller uuid.
201 *
andreaed976a42015-10-05 14:38:25 -0700202 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800203 * @param controllerTarget controller target
204 * @return controller uuid, empty if no uuid is find
205 */
206 String getControllerUuid(String controllerName, String controllerTarget);
207
208 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800209 * Gets the OVS uuid.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800210 *
211 * @param dbName database name
212 * @return ovs uuid, empty if no uuid is find
213 */
214 String getOvsUuid(String dbName);
215
216 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800217 * Gets the OVSDB database schema.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800218 *
219 * @param dbName database name
220 * @return database schema
221 */
222 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
223
224 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800225 * Gets the OVSDB table updates.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800226 *
227 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700228 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800229 * @return table updates
230 */
231 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
232
233 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800234 * Gets the OVSDB config operation result.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800235 *
andreaed976a42015-10-05 14:38:25 -0700236 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800237 * @param operations the list of operations
238 * @return operation results
239 */
240 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
241 List<Operation> operations);
242
243 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800244 * Gets the OVSDB database schema from local.
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 * @return database schema
248 */
249 DatabaseSchema getDatabaseSchema(String dbName);
250
251 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800252 * Gets the OVSDB row from local OVSDB store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800253 *
andreaed976a42015-10-05 14:38:25 -0700254 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800255 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700256 * @param uuid row uuid
BitOhenry3f28c682015-11-07 10:40:03 +0800257 * @return row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800258 */
259 Row getRow(String dbName, String tableName, String uuid);
260
261 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800262 * Removes 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
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800267 */
268 void removeRow(String dbName, String tableName, String uuid);
269
270 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800271 * Updates the 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
BitOhenry3f28c682015-11-07 10:40:03 +0800276 * @param row OVSDB row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800277 */
278 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
279
CNluciusa66c3972015-09-06 20:31:29 +0800280 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800281 * Gets OVSDB local ports.
CNluciusa66c3972015-09-06 20:31:29 +0800282 *
283 * @param ifaceids the ifaceid that needed
BitOhenry3f28c682015-11-07 10:40:03 +0800284 * @return OVSDB ports
CNluciusa66c3972015-09-06 20:31:29 +0800285 */
286 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700287
288 /**
BitOhenry3f28c682015-11-07 10:40:03 +0800289 * Disconnects the OVSDB server.
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700290 */
291 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800292}