blob: f2ff0709851c09058786fd7572660adec10f51a1 [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 *
91 * @return set of controllers; empty if no controller is find
92 */
93 Set<ControllerInfo> getControllers(DeviceId openflowDeviceId);
94
95 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -070096 * Sets the Controllers for the specified bridge.
97 * <p/>
98 * This method will replace the existing controller list with the new controller
99 * list.
andreaed976a42015-10-05 14:38:25 -0700100 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700101 * @param bridgeUuid bridge uuid
102 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700103 */
104 void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers);
105
106 /**
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700107 * Sets the Controllers for the specified device.
108 * <p/>
109 * This method will replace the existing controller list with the new controller
110 * list.
andreaed976a42015-10-05 14:38:25 -0700111 *
Brian O'Connor6ee8aa32015-10-09 16:07:42 -0700112 * @param deviceId device id (likely Openflow device)
113 * @param controllers list of controllers
andreaed976a42015-10-05 14:38:25 -0700114 */
115 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
116
117 /**
CNlucius74fd4942015-07-20 14:28:04 +0800118 * Creates a port.
119 *
120 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700121 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800122 */
123 void createPort(String bridgeName, String portName);
124
125 /**
126 * Drops a port.
127 *
128 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700129 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800130 */
131 void dropPort(String bridgeName, String portName);
132
133 /**
134 * Gets ports of the bridge.
135 *
136 * @return set of ports; empty if no ports is find
137 */
138 Set<OvsdbPort> getPorts();
139
140 /**
141 * Checks if the node is still connected.
142 *
143 * @return true if the node is still connected
144 */
145 boolean isConnected();
146
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800147 /**
148 * Gets the Bridge uuid.
149 *
150 * @param bridgeName bridge name
151 * @return bridge uuid, empty if no uuid is find
152 */
153 String getBridgeUuid(String bridgeName);
154
155 /**
156 * Gets the Port uuid.
157 *
andreaed976a42015-10-05 14:38:25 -0700158 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800159 * @param bridgeUuid bridge uuid
160 * @return port uuid, empty if no uuid is find
161 */
162 String getPortUuid(String portName, String bridgeUuid);
163
164 /**
165 * Gets the Interface uuid.
166 *
167 * @param portUuid port uuid
168 * @param portName port name
169 * @return interface uuid, empty if no uuid is find
170 */
171 String getInterfaceUuid(String portUuid, String portName);
172
173 /**
174 * Gets the Controller uuid.
175 *
andreaed976a42015-10-05 14:38:25 -0700176 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800177 * @param controllerTarget controller target
178 * @return controller uuid, empty if no uuid is find
179 */
180 String getControllerUuid(String controllerName, String controllerTarget);
181
182 /**
183 * Gets the Ovs uuid.
184 *
185 * @param dbName database name
186 * @return ovs uuid, empty if no uuid is find
187 */
188 String getOvsUuid(String dbName);
189
190 /**
191 * Gets the ovsdb database schema.
192 *
193 * @param dbName database name
194 * @return database schema
195 */
196 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
197
198 /**
199 * Gets the ovsdb table updates.
200 *
201 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700202 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800203 * @return table updates
204 */
205 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
206
207 /**
208 * Gets the ovsdb config operation result.
209 *
andreaed976a42015-10-05 14:38:25 -0700210 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800211 * @param operations the list of operations
212 * @return operation results
213 */
214 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
215 List<Operation> operations);
216
217 /**
218 * Gets the ovsdb database schema from local.
219 *
andreaed976a42015-10-05 14:38:25 -0700220 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800221 * @return database schema
222 */
223 DatabaseSchema getDatabaseSchema(String dbName);
224
225 /**
226 * Gets the ovsdb row from the local ovsdb store.
227 *
andreaed976a42015-10-05 14:38:25 -0700228 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800229 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700230 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800231 * @return row ovsdb row
232 */
233 Row getRow(String dbName, String tableName, String uuid);
234
235 /**
236 * Removes the ovsdb row from the local ovsdb store.
237 *
andreaed976a42015-10-05 14:38:25 -0700238 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800239 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700240 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800241 */
242 void removeRow(String dbName, String tableName, String uuid);
243
244 /**
CNluciusa66c3972015-09-06 20:31:29 +0800245 * Updates the local ovsdb store.
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800246 *
andreaed976a42015-10-05 14:38:25 -0700247 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800248 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700249 * @param uuid row uuid
250 * @param row ovsdb row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800251 */
252 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
253
CNluciusa66c3972015-09-06 20:31:29 +0800254 /**
255 * Gets ovsdb local ports.
256 *
257 * @param ifaceids the ifaceid that needed
258 * @return ovsdb ports
259 */
260 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700261
262 /**
263 * Disconnects the ovsdb server.
264 */
265 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800266}