blob: 86f6226b34bc28c1a278d837244229006803d8bb [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;
31import java.util.Set;
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080032
CNlucius74fd4942015-07-20 14:28:04 +080033/**
34 * Represents to provider facing side of a node.
35 */
YuanyouZhangd06bb6b2015-08-05 16:59:07 +080036public interface OvsdbClientService extends OvsdbRPC {
CNlucius74fd4942015-07-20 14:28:04 +080037 /**
38 * Gets the node identifier.
39 *
40 * @return node identifier
41 */
42 OvsdbNodeId nodeId();
43
44 /**
45 * Creates the configuration for the tunnel.
46 *
47 * @param srcIp source IP address
48 * @param dstIp destination IP address
49 */
50 void createTunnel(IpAddress srcIp, IpAddress dstIp);
51
52 /**
53 * Drops the configuration for the tunnel.
54 *
55 * @param srcIp source IP address
56 * @param dstIp destination IP address
57 */
58 void dropTunnel(IpAddress srcIp, IpAddress dstIp);
59
60 /**
61 * Gets tunnels of the node.
62 *
63 * @return set of tunnels; empty if no tunnel is find
64 */
65 Set<OvsdbTunnel> getTunnels();
66
67 /**
68 * Creates a bridge.
69 *
70 * @param bridgeName bridge name
71 */
72 void createBridge(String bridgeName);
73
74 /**
75 * Drops a bridge.
76 *
77 * @param bridgeName bridge name
78 */
79 void dropBridge(String bridgeName);
80
81 /**
82 * Gets bridges of the node.
83 *
84 * @return set of bridges; empty if no bridge is find
85 */
86 Set<OvsdbBridge> getBridges();
87
88 /**
andreaed976a42015-10-05 14:38:25 -070089 * Gets controllers of the node.
90 *
Brian O'Connor52515622015-10-09 17:03:44 -070091 * @param openflowDeviceId target device id
andreaed976a42015-10-05 14:38:25 -070092 * @return set of controllers; empty if no controller is find
93 */
94 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
95
96 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -070097 * Sets the Controllers for the specified bridge.
Brian O'Connor52515622015-10-09 17:03:44 -070098 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -070099 * This method will replace the existing controller list with the new controller
100 * list.
andreaed976a42015-10-05 14:38:25 -0700101 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700102 * @param bridgeUuid bridge uuid
103 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700104 */
105 void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers);
106
107 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700108 * Sets the Controllers for the specified device.
Brian O'Connor52515622015-10-09 17:03:44 -0700109 * <p>
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700110 * This method will replace the existing controller list with the new controller
111 * list.
andreaed976a42015-10-05 14:38:25 -0700112 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700113 * @param deviceId device id (likely Openflow device)
114 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700115 */
116 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
117
118 /**
CNlucius74fd4942015-07-20 14:28:04 +0800119 * Creates a port.
120 *
121 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700122 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800123 */
124 void createPort(String bridgeName, String portName);
125
126 /**
127 * Drops a port.
128 *
129 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700130 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800131 */
132 void dropPort(String bridgeName, String portName);
133
134 /**
135 * Gets ports of the bridge.
136 *
137 * @return set of ports; empty if no ports is find
138 */
139 Set<OvsdbPort> getPorts();
140
141 /**
142 * Checks if the node is still connected.
143 *
144 * @return true if the node is still connected
145 */
146 boolean isConnected();
147
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800148 /**
149 * Gets the Bridge uuid.
150 *
151 * @param bridgeName bridge name
152 * @return bridge uuid, empty if no uuid is find
153 */
154 String getBridgeUuid(String bridgeName);
155
156 /**
157 * Gets the Port uuid.
158 *
andreaed976a42015-10-05 14:38:25 -0700159 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800160 * @param bridgeUuid bridge uuid
161 * @return port uuid, empty if no uuid is find
162 */
163 String getPortUuid(String portName, String bridgeUuid);
164
165 /**
166 * Gets the Interface uuid.
167 *
168 * @param portUuid port uuid
169 * @param portName port name
170 * @return interface uuid, empty if no uuid is find
171 */
172 String getInterfaceUuid(String portUuid, String portName);
173
174 /**
175 * Gets the Controller uuid.
176 *
andreaed976a42015-10-05 14:38:25 -0700177 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800178 * @param controllerTarget controller target
179 * @return controller uuid, empty if no uuid is find
180 */
181 String getControllerUuid(String controllerName, String controllerTarget);
182
183 /**
184 * Gets the Ovs uuid.
185 *
186 * @param dbName database name
187 * @return ovs uuid, empty if no uuid is find
188 */
189 String getOvsUuid(String dbName);
190
191 /**
192 * Gets the ovsdb database schema.
193 *
194 * @param dbName database name
195 * @return database schema
196 */
197 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
198
199 /**
200 * Gets the ovsdb table updates.
201 *
202 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700203 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800204 * @return table updates
205 */
206 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
207
208 /**
209 * Gets the ovsdb config operation result.
210 *
andreaed976a42015-10-05 14:38:25 -0700211 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800212 * @param operations the list of operations
213 * @return operation results
214 */
215 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
216 List<Operation> operations);
217
218 /**
219 * Gets the ovsdb database schema from local.
220 *
andreaed976a42015-10-05 14:38:25 -0700221 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800222 * @return database schema
223 */
224 DatabaseSchema getDatabaseSchema(String dbName);
225
226 /**
227 * Gets the ovsdb row from the local ovsdb store.
228 *
andreaed976a42015-10-05 14:38:25 -0700229 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800230 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700231 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800232 * @return row ovsdb row
233 */
234 Row getRow(String dbName, String tableName, String uuid);
235
236 /**
237 * Removes the ovsdb row from the local ovsdb store.
238 *
andreaed976a42015-10-05 14:38:25 -0700239 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800240 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700241 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800242 */
243 void removeRow(String dbName, String tableName, String uuid);
244
245 /**
CNluciusa66c3972015-09-06 20:31:29 +0800246 * Updates the local ovsdb store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800247 *
andreaed976a42015-10-05 14:38:25 -0700248 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800249 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700250 * @param uuid row uuid
251 * @param row ovsdb row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800252 */
253 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
254
CNluciusa66c3972015-09-06 20:31:29 +0800255 /**
256 * Gets ovsdb local ports.
257 *
258 * @param ifaceids the ifaceid that needed
259 * @return ovsdb ports
260 */
261 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700262
263 /**
264 * Disconnects the ovsdb server.
265 */
266 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800267}