CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.ovsdb.controller; |
| 17 | |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 18 | import java.util.List; |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 19 | import java.util.Set; |
| 20 | |
| 21 | import org.onlab.packet.IpAddress; |
| 22 | |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 23 | import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRPC; |
| 24 | import org.onosproject.ovsdb.rfc.message.OperationResult; |
| 25 | import org.onosproject.ovsdb.rfc.message.TableUpdates; |
| 26 | import org.onosproject.ovsdb.rfc.notation.Row; |
| 27 | import org.onosproject.ovsdb.rfc.operations.Operation; |
| 28 | import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; |
| 29 | |
| 30 | import com.google.common.util.concurrent.ListenableFuture; |
| 31 | |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 32 | /** |
| 33 | * Represents to provider facing side of a node. |
| 34 | */ |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 35 | public interface OvsdbClientService extends OvsdbRPC { |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 36 | /** |
| 37 | * Gets the node identifier. |
| 38 | * |
| 39 | * @return node identifier |
| 40 | */ |
| 41 | OvsdbNodeId nodeId(); |
| 42 | |
| 43 | /** |
| 44 | * Creates the configuration for the tunnel. |
| 45 | * |
| 46 | * @param srcIp source IP address |
| 47 | * @param dstIp destination IP address |
| 48 | */ |
| 49 | void createTunnel(IpAddress srcIp, IpAddress dstIp); |
| 50 | |
| 51 | /** |
| 52 | * Drops the configuration for the tunnel. |
| 53 | * |
| 54 | * @param srcIp source IP address |
| 55 | * @param dstIp destination IP address |
| 56 | */ |
| 57 | void dropTunnel(IpAddress srcIp, IpAddress dstIp); |
| 58 | |
| 59 | /** |
| 60 | * Gets tunnels of the node. |
| 61 | * |
| 62 | * @return set of tunnels; empty if no tunnel is find |
| 63 | */ |
| 64 | Set<OvsdbTunnel> getTunnels(); |
| 65 | |
| 66 | /** |
| 67 | * Creates a bridge. |
| 68 | * |
| 69 | * @param bridgeName bridge name |
| 70 | */ |
| 71 | void createBridge(String bridgeName); |
| 72 | |
| 73 | /** |
| 74 | * Drops a bridge. |
| 75 | * |
| 76 | * @param bridgeName bridge name |
| 77 | */ |
| 78 | void dropBridge(String bridgeName); |
| 79 | |
| 80 | /** |
| 81 | * Gets bridges of the node. |
| 82 | * |
| 83 | * @return set of bridges; empty if no bridge is find |
| 84 | */ |
| 85 | Set<OvsdbBridge> getBridges(); |
| 86 | |
| 87 | /** |
| 88 | * Creates a port. |
| 89 | * |
| 90 | * @param bridgeName bridge name |
| 91 | * @param portName port name |
| 92 | */ |
| 93 | void createPort(String bridgeName, String portName); |
| 94 | |
| 95 | /** |
| 96 | * Drops a port. |
| 97 | * |
| 98 | * @param bridgeName bridge name |
| 99 | * @param portName port name |
| 100 | */ |
| 101 | void dropPort(String bridgeName, String portName); |
| 102 | |
| 103 | /** |
| 104 | * Gets ports of the bridge. |
| 105 | * |
| 106 | * @return set of ports; empty if no ports is find |
| 107 | */ |
| 108 | Set<OvsdbPort> getPorts(); |
| 109 | |
| 110 | /** |
| 111 | * Checks if the node is still connected. |
| 112 | * |
| 113 | * @return true if the node is still connected |
| 114 | */ |
| 115 | boolean isConnected(); |
| 116 | |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 117 | /** |
| 118 | * Gets the Bridge uuid. |
| 119 | * |
| 120 | * @param bridgeName bridge name |
| 121 | * @return bridge uuid, empty if no uuid is find |
| 122 | */ |
| 123 | String getBridgeUuid(String bridgeName); |
| 124 | |
| 125 | /** |
| 126 | * Gets the Port uuid. |
| 127 | * |
| 128 | * @param portName port name |
| 129 | * @param bridgeUuid bridge uuid |
| 130 | * @return port uuid, empty if no uuid is find |
| 131 | */ |
| 132 | String getPortUuid(String portName, String bridgeUuid); |
| 133 | |
| 134 | /** |
| 135 | * Gets the Interface uuid. |
| 136 | * |
| 137 | * @param portUuid port uuid |
| 138 | * @param portName port name |
| 139 | * @return interface uuid, empty if no uuid is find |
| 140 | */ |
| 141 | String getInterfaceUuid(String portUuid, String portName); |
| 142 | |
| 143 | /** |
| 144 | * Gets the Controller uuid. |
| 145 | * |
| 146 | * @param controllerName controller name |
| 147 | * @param controllerTarget controller target |
| 148 | * @return controller uuid, empty if no uuid is find |
| 149 | */ |
| 150 | String getControllerUuid(String controllerName, String controllerTarget); |
| 151 | |
| 152 | /** |
| 153 | * Gets the Ovs uuid. |
| 154 | * |
| 155 | * @param dbName database name |
| 156 | * @return ovs uuid, empty if no uuid is find |
| 157 | */ |
| 158 | String getOvsUuid(String dbName); |
| 159 | |
| 160 | /** |
| 161 | * Gets the ovsdb database schema. |
| 162 | * |
| 163 | * @param dbName database name |
| 164 | * @return database schema |
| 165 | */ |
| 166 | ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName); |
| 167 | |
| 168 | /** |
| 169 | * Gets the ovsdb table updates. |
| 170 | * |
| 171 | * @param dbName database name |
| 172 | * @param id random uuid |
| 173 | * @return table updates |
| 174 | */ |
| 175 | ListenableFuture<TableUpdates> monitorTables(String dbName, String id); |
| 176 | |
| 177 | /** |
| 178 | * Gets the ovsdb config operation result. |
| 179 | * |
| 180 | * @param dbName database name |
| 181 | * @param operations the list of operations |
| 182 | * @return operation results |
| 183 | */ |
| 184 | ListenableFuture<List<OperationResult>> transactConfig(String dbName, |
| 185 | List<Operation> operations); |
| 186 | |
| 187 | /** |
| 188 | * Gets the ovsdb database schema from local. |
| 189 | * |
| 190 | * @param dbName database name |
| 191 | * @return database schema |
| 192 | */ |
| 193 | DatabaseSchema getDatabaseSchema(String dbName); |
| 194 | |
| 195 | /** |
| 196 | * Gets the ovsdb row from the local ovsdb store. |
| 197 | * |
| 198 | * @param dbName database name |
| 199 | * @param tableName table name |
| 200 | * @param uuid row uuid |
| 201 | * @return row ovsdb row |
| 202 | */ |
| 203 | Row getRow(String dbName, String tableName, String uuid); |
| 204 | |
| 205 | /** |
| 206 | * Removes the ovsdb row from the local ovsdb store. |
| 207 | * |
| 208 | * @param dbName database name |
| 209 | * @param tableName table name |
| 210 | * @param uuid row uuid |
| 211 | */ |
| 212 | void removeRow(String dbName, String tableName, String uuid); |
| 213 | |
| 214 | /** |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 215 | * Updates the local ovsdb store. |
YuanyouZhang | d06bb6b | 2015-08-05 16:59:07 +0800 | [diff] [blame] | 216 | * |
| 217 | * @param dbName database name |
| 218 | * @param tableName table name |
| 219 | * @param uuid row uuid |
| 220 | * @param row ovsdb row |
| 221 | */ |
| 222 | void updateOvsdbStore(String dbName, String tableName, String uuid, Row row); |
| 223 | |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 224 | /** |
| 225 | * Gets ovsdb local ports. |
| 226 | * |
| 227 | * @param ifaceids the ifaceid that needed |
| 228 | * @return ovsdb ports |
| 229 | */ |
| 230 | Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids); |
Hyunsun Moon | 5fb20a5 | 2015-09-25 17:02:33 -0700 | [diff] [blame] | 231 | |
| 232 | /** |
| 233 | * Disconnects the ovsdb server. |
| 234 | */ |
| 235 | void disconnect(); |
CNlucius | 74fd494 | 2015-07-20 14:28:04 +0800 | [diff] [blame] | 236 | } |