blob: 833f5fe3e6dc96d51c7bdd3c62da512bd5b36265 [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 /**
96 * sets the controllers of the node to the ones passed in the list.
97 *
98 * @param bridgeUuid UUid for the bridge we are settings the controls on
99 * @param controllers of controllers; empty if no controller is find
100 */
101 void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers);
102
103 /**
104 * sets the controllers of the node to the ones passed in the list.
105 *
106 * @param deviceId deviceId for the bridge we are settings the controls on
107 * @param controllers of controllers; empty if no controller is find
108 */
109 void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers);
110
111 /**
CNlucius74fd4942015-07-20 14:28:04 +0800112 * Creates a port.
113 *
114 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700115 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800116 */
117 void createPort(String bridgeName, String portName);
118
119 /**
120 * Drops a port.
121 *
122 * @param bridgeName bridge name
andreaed976a42015-10-05 14:38:25 -0700123 * @param portName port name
CNlucius74fd4942015-07-20 14:28:04 +0800124 */
125 void dropPort(String bridgeName, String portName);
126
127 /**
128 * Gets ports of the bridge.
129 *
130 * @return set of ports; empty if no ports is find
131 */
132 Set<OvsdbPort> getPorts();
133
134 /**
135 * Checks if the node is still connected.
136 *
137 * @return true if the node is still connected
138 */
139 boolean isConnected();
140
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800141 /**
142 * Gets the Bridge uuid.
143 *
144 * @param bridgeName bridge name
145 * @return bridge uuid, empty if no uuid is find
146 */
147 String getBridgeUuid(String bridgeName);
148
149 /**
150 * Gets the Port uuid.
151 *
andreaed976a42015-10-05 14:38:25 -0700152 * @param portName port name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800153 * @param bridgeUuid bridge uuid
154 * @return port uuid, empty if no uuid is find
155 */
156 String getPortUuid(String portName, String bridgeUuid);
157
158 /**
159 * Gets the Interface uuid.
160 *
161 * @param portUuid port uuid
162 * @param portName port name
163 * @return interface uuid, empty if no uuid is find
164 */
165 String getInterfaceUuid(String portUuid, String portName);
166
167 /**
168 * Gets the Controller uuid.
169 *
andreaed976a42015-10-05 14:38:25 -0700170 * @param controllerName controller name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800171 * @param controllerTarget controller target
172 * @return controller uuid, empty if no uuid is find
173 */
174 String getControllerUuid(String controllerName, String controllerTarget);
175
176 /**
177 * Gets the Ovs uuid.
178 *
179 * @param dbName database name
180 * @return ovs uuid, empty if no uuid is find
181 */
182 String getOvsUuid(String dbName);
183
184 /**
185 * Gets the ovsdb database schema.
186 *
187 * @param dbName database name
188 * @return database schema
189 */
190 ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
191
192 /**
193 * Gets the ovsdb table updates.
194 *
195 * @param dbName database name
andreaed976a42015-10-05 14:38:25 -0700196 * @param id random uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800197 * @return table updates
198 */
199 ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
200
201 /**
202 * Gets the ovsdb config operation result.
203 *
andreaed976a42015-10-05 14:38:25 -0700204 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800205 * @param operations the list of operations
206 * @return operation results
207 */
208 ListenableFuture<List<OperationResult>> transactConfig(String dbName,
209 List<Operation> operations);
210
211 /**
212 * Gets the ovsdb database schema from local.
213 *
andreaed976a42015-10-05 14:38:25 -0700214 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800215 * @return database schema
216 */
217 DatabaseSchema getDatabaseSchema(String dbName);
218
219 /**
220 * Gets the ovsdb row from the local ovsdb store.
221 *
andreaed976a42015-10-05 14:38:25 -0700222 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800223 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700224 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800225 * @return row ovsdb row
226 */
227 Row getRow(String dbName, String tableName, String uuid);
228
229 /**
230 * Removes the ovsdb row from the local ovsdb store.
231 *
andreaed976a42015-10-05 14:38:25 -0700232 * @param dbName database name
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800233 * @param tableName table name
andreaed976a42015-10-05 14:38:25 -0700234 * @param uuid row uuid
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800235 */
236 void removeRow(String dbName, String tableName, String uuid);
237
238 /**
CNluciusa66c3972015-09-06 20:31:29 +0800239 * Updates the 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
244 * @param row ovsdb row
YuanyouZhangd06bb6b2015-08-05 16:59:07 +0800245 */
246 void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
247
CNluciusa66c3972015-09-06 20:31:29 +0800248 /**
249 * Gets ovsdb local ports.
250 *
251 * @param ifaceids the ifaceid that needed
252 * @return ovsdb ports
253 */
254 Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
Hyunsun Moon5fb20a52015-09-25 17:02:33 -0700255
256 /**
257 * Disconnects the ovsdb server.
258 */
259 void disconnect();
CNlucius74fd4942015-07-20 14:28:04 +0800260}