CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.ovsdb.controller; |
| 17 | |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 18 | import com.google.common.util.concurrent.ListenableFuture; |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 19 | import org.onlab.packet.IpAddress; |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.behaviour.ControllerInfo; |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 22 | import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc; |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 23 | import org.onosproject.ovsdb.rfc.message.TableUpdates; |
| 24 | import org.onosproject.ovsdb.rfc.notation.Row; |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 25 | import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; |
| 26 | |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 27 | import java.util.List; |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 28 | import java.util.Map; |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 29 | import java.util.Set; |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 30 | |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 31 | /** |
| 32 | * Represents to provider facing side of a node. |
| 33 | */ |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 34 | public interface OvsdbClientService extends OvsdbRpc { |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 35 | /** |
| 36 | * Gets the node identifier. |
| 37 | * |
| 38 | * @return node identifier |
| 39 | */ |
| 40 | OvsdbNodeId nodeId(); |
| 41 | |
| 42 | /** |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 43 | * Creates a tunnel port with given options. |
| 44 | * |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 45 | * @deprecated version 1.7.0 - Hummingbird |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 46 | * @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 Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 52 | @Deprecated |
| 53 | boolean createTunnel(String bridgeName, String portName, String tunnelType, |
| 54 | Map<String, String> options); |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
BitOhenry | 264f35a | 2015-11-03 20:58:39 +0800 | [diff] [blame] | 57 | * Drops the configuration for tunnel. |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 58 | * |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 59 | * @deprecated version 1.7.0 - Hummingbird |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 60 | * @param srcIp source IP address |
| 61 | * @param dstIp destination IP address |
| 62 | */ |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 63 | @Deprecated |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 64 | void dropTunnel(IpAddress srcIp, IpAddress dstIp); |
| 65 | |
| 66 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 67 | * Creates an interface with a given OVSDB interface description. |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 68 | * |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 69 | * @param bridgeName bridge name |
| 70 | * @param ovsdbIface ovsdb interface description |
| 71 | * @return true if interface creation is successful, false otherwise |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 72 | */ |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 73 | 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); |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Creates a bridge. |
| 85 | * |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 86 | * @deprecated version 1.7.0 - Hummingbird |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 87 | * @param bridgeName bridge name |
| 88 | */ |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 89 | @Deprecated |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 90 | void createBridge(String bridgeName); |
| 91 | |
| 92 | /** |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 93 | * Creates a bridge. |
| 94 | * |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 95 | * @deprecated version 1.7.0 - Hummingbird |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 96 | * @param bridgeName bridge name |
| 97 | * @param dpid data path id |
| 98 | * @param exPortName external port name |
| 99 | */ |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 100 | @Deprecated |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 101 | void createBridge(String bridgeName, String dpid, String exPortName); |
| 102 | |
| 103 | /** |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 104 | * Creates a bridge with given name and dpid. |
| 105 | * Sets the bridge's controller with given controllers. |
| 106 | * |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 107 | * @deprecated version 1.7.0 - Hummingbird |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 108 | * @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 Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 113 | @Deprecated |
Hyunsun Moon | 646d8c4 | 2015-10-08 20:32:44 -0700 | [diff] [blame] | 114 | boolean createBridge(String bridgeName, String dpid, List<ControllerInfo> controllers); |
| 115 | |
| 116 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 117 | * 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 | /** |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 125 | * Drops a bridge. |
| 126 | * |
| 127 | * @param bridgeName bridge name |
| 128 | */ |
| 129 | void dropBridge(String bridgeName); |
| 130 | |
| 131 | /** |
BitOhenry | 264f35a | 2015-11-03 20:58:39 +0800 | [diff] [blame] | 132 | * Gets bridges of node. |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 133 | * |
| 134 | * @return set of bridges; empty if no bridge is find |
| 135 | */ |
| 136 | Set<OvsdbBridge> getBridges(); |
| 137 | |
| 138 | /** |
BitOhenry | 264f35a | 2015-11-03 20:58:39 +0800 | [diff] [blame] | 139 | * Gets controllers of node. |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 140 | * |
Brian O'Connor | 5251562 | 2015-10-09 17:03:44 -0700 | [diff] [blame] | 141 | * @param openflowDeviceId target device id |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 142 | * @return set of controllers; empty if no controller is find |
| 143 | */ |
| 144 | Set<ControllerInfo> getControllers(DeviceId openflowDeviceId); |
| 145 | |
| 146 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 147 | * 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'Connor | 6ee8aa3 | 2015-10-09 16:07:42 -0700 | [diff] [blame] | 156 | * Sets the Controllers for the specified device. |
Brian O'Connor | 5251562 | 2015-10-09 17:03:44 -0700 | [diff] [blame] | 157 | * <p> |
Brian O'Connor | 6ee8aa3 | 2015-10-09 16:07:42 -0700 | [diff] [blame] | 158 | * This method will replace the existing controller list with the new controller |
| 159 | * list. |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 160 | * |
Brian O'Connor | 6ee8aa3 | 2015-10-09 16:07:42 -0700 | [diff] [blame] | 161 | * @param deviceId device id (likely Openflow device) |
| 162 | * @param controllers list of controllers |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 163 | */ |
| 164 | void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers); |
| 165 | |
| 166 | /** |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 167 | * Creates a port. |
| 168 | * |
| 169 | * @param bridgeName bridge name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 170 | * @param portName port name |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 171 | */ |
| 172 | void createPort(String bridgeName, String portName); |
| 173 | |
| 174 | /** |
| 175 | * Drops a port. |
| 176 | * |
| 177 | * @param bridgeName bridge name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 178 | * @param portName port name |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 179 | */ |
| 180 | void dropPort(String bridgeName, String portName); |
| 181 | |
| 182 | /** |
BitOhenry | 264f35a | 2015-11-03 20:58:39 +0800 | [diff] [blame] | 183 | * Gets ports of bridge. |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 184 | * |
| 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 | |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 196 | /** |
| 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 | * |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 207 | * @param portName port name |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 208 | * @param bridgeUuid bridge uuid |
| 209 | * @return port uuid, empty if no uuid is find |
| 210 | */ |
| 211 | String getPortUuid(String portName, String bridgeUuid); |
| 212 | |
| 213 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 214 | * Gets the OVSDB database schema. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 215 | * |
| 216 | * @param dbName database name |
| 217 | * @return database schema |
| 218 | */ |
| 219 | ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName); |
| 220 | |
| 221 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 222 | * Gets the OVSDB table updates. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 223 | * |
| 224 | * @param dbName database name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 225 | * @param id random uuid |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 226 | * @return table updates |
| 227 | */ |
| 228 | ListenableFuture<TableUpdates> monitorTables(String dbName, String id); |
| 229 | |
| 230 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 231 | * Gets the OVSDB database schema from local. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 232 | * |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 233 | * @param dbName database name |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 234 | * @return database schema |
| 235 | */ |
| 236 | DatabaseSchema getDatabaseSchema(String dbName); |
| 237 | |
| 238 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 239 | * Gets the OVSDB row from local OVSDB store. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 240 | * |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 241 | * @param dbName database name |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 242 | * @param tableName table name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 243 | * @param uuid row uuid |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 244 | * @return row OVSDB row |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 245 | */ |
| 246 | Row getRow(String dbName, String tableName, String uuid); |
| 247 | |
| 248 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 249 | * Removes the OVSDB row from local OVSDB store. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 250 | * |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 251 | * @param dbName database name |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 252 | * @param tableName table name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 253 | * @param uuid row uuid |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 254 | */ |
| 255 | void removeRow(String dbName, String tableName, String uuid); |
| 256 | |
| 257 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 258 | * Updates the local OVSDB store. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 259 | * |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 260 | * @param dbName database name |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 261 | * @param tableName table name |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 262 | * @param uuid row uuid |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 263 | * @param row OVSDB row |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 264 | */ |
| 265 | void updateOvsdbStore(String dbName, String tableName, String uuid, Row row); |
| 266 | |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 267 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 268 | * Gets OVSDB local ports. |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 269 | * |
| 270 | * @param ifaceids the ifaceid that needed |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 271 | * @return OVSDB ports |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 272 | */ |
| 273 | Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids); |
Hyunsun Moon | 5fb20a5 | 2015-09-25 17:02:33 -0700 | [diff] [blame] | 274 | |
| 275 | /** |
BitOhenry | 3f28c68 | 2015-11-07 10:40:03 +0800 | [diff] [blame] | 276 | * Disconnects the OVSDB server. |
Hyunsun Moon | 5fb20a5 | 2015-09-25 17:02:33 -0700 | [diff] [blame] | 277 | */ |
| 278 | void disconnect(); |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 279 | } |