2 * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.ovsdb.compatibility.plugin.api;
11 import java.util.List;
12 import java.util.concurrent.ConcurrentMap;
13 import java.util.concurrent.ExecutionException;
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.controller.sal.utils.Status;
17 import org.opendaylight.ovsdb.compatibility.plugin.error.OvsdbPluginException;
18 import org.opendaylight.ovsdb.lib.notation.Row;
19 import org.opendaylight.ovsdb.lib.notation.UUID;
20 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
21 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
23 public interface OvsdbConfigurationService {
26 * @deprecated This version of insertRow is a short-term replacement for the older and now deprecated method of the same name.
27 * This API assumes an Open_vSwitch database Schema.
29 * This API is replaced by
30 * {@link #insertRow(Node, String, String, UUID, Row) insertRow} and
31 * {@link #insertTree(Node, String, String, UUID, Row) insertTree}
33 * @param node OVSDB Node
34 * @param tableName Table on which the row is inserted
35 * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
36 * @param row Row of table Content to be inserted
37 * @return UUID of the inserted Row
40 StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
43 * insert a Row in a Table of a specified Database Schema. This is a convenience method on top of
44 * {@link #insertRow(Node, String, String, String, UUID, String, Row) insertRow}
45 * which assumes that OVSDB schema implementation that corresponds to the databaseName will provide
46 * the necessary service to populate the Parent Table Name and Parent Column Name.
48 * This method can insert just a single Row specified in the row parameter.
49 * But {@link #insertTree(Node, String, String, UUID, Row) insertTree}
50 * can insert a hierarchy of rows with parent-child relationship.
52 * @param node OVSDB Node
53 * @param databaseName Database Name that represents the Schema supported by the node.
54 * @param tableName Table on which the row is inserted
55 * @param parentRowUuid UUID of the parent table to which this operation will result in attaching/mutating.
56 * @param row Row of table Content to be inserted
57 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
58 * @return UUID of the inserted Row
60 UUID insertRow(Node node, String databaseName, String tableName, UUID parentRowUuid,
61 Row<GenericTableSchema> row) throws OvsdbPluginException;
64 * insert a Row in a Table of a specified Database Schema.
66 * This method can insert just a single Row specified in the row parameter.
67 * But {@link #insertTree(Node, String, String, UUID, Row) insertTree}
68 * can insert a hierarchy of rows with parent-child relationship.
70 * @param node OVSDB Node
71 * @param databaseName Database Name that represents the Schema supported by the node.
72 * @param tableName Table on which the row is inserted
73 * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
74 * @param parentRowUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
75 * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
76 * @param row Row of table Content to be inserted
77 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
78 * @return UUID of the inserted Row
80 UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
81 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
84 * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct.
85 * This is a convenience method on top of {@link #insertTree(Node, String, String, String, UUID, String, Row) insertTree}
87 * @param node OVSDB Node
88 * @param databaseName Database Name that represents the Schema supported by the node.
89 * @param tableName Table on which the row is inserted
90 * @param parentRowUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
91 * @param row Row Tree with parent-child relationships via column of type refTable.
92 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
93 * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
95 Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, UUID parentRowUuid,
96 Row<GenericTableSchema> row) throws OvsdbPluginException;
99 * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct
101 * @param node OVSDB Node
102 * @param databaseName Database Name that represents the Schema supported by the node.
103 * @param tableName Table on which the row is inserted
104 * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
105 * @param parentRowUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
106 * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
107 * @param row Row Tree with parent-child relationships via column of type refTable.
108 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
109 * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
111 Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
112 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
115 * @deprecated This version of updateRow is a short-term replacement for the older and now deprecated method of the same name.
116 * This API assumes an Open_vSwitch database Schema.
118 * This API is replaced by
119 * {@link #updateRow(Node, String, String, UUID, Row, boolean) updateRow}
121 * @param node OVSDB Node
122 * @param tableName Table on which the row is Updated
123 * @param parentUuid UUID of the parent row on which this operation might result in mutating.
124 * @param rowUuid UUID of the row that is being updated
125 * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
128 Status updateRow(Node node, String tableName, String parentUuid, String rowUuid, Row row);
131 * update or mutate a Row in a Table of a specified Database Schema.
133 * @param node OVSDB Node
134 * @param databaseName Database Name that represents the Schema supported by the node.
135 * @param tableName Table on which the row is updated
136 * @param rowUuid UUID of the row being updated
137 * @param row Row of table Content to be updated
138 * @param overwrite true will overwrite/replace the existing row (matching the rowUuid) with the passed row object.
139 * false will update the existing row (matching the rowUuid) using only the columns in the passed row object.
140 * @throws OvsdbPluginException Any failure during the update operation will result in a specific exception.
141 * @return Returns the entire Row after the update operation.
143 Row<GenericTableSchema> updateRow(Node node, String databaseName, String tableName, UUID rowUuid,
144 Row<GenericTableSchema> row, boolean overwrite) throws OvsdbPluginException;
147 * @deprecated This version of deleteRow is a short-term replacement for the older and now deprecated method of the same name.
148 * This API assumes an Open_vSwitch database Schema.
150 * This API is replaced by {@link #deleteRow(Node, String, String, UUID) deleteRow}
152 * @param node OVSDB Node
153 * @param tableName Table on which the row is Updated
154 * @param rowUuid UUID of the row that is being deleted
157 Status deleteRow(Node node, String tableName, String rowUuid);
160 * update or mutate a Row in a Table of a specified Database Schema.
162 * @param node OVSDB Node
163 * @param databaseName Database Name that represents the Schema supported by the node.
164 * @param tableName Table on which the row is Updated
165 * @param rowUuid UUID of the row that is being deleted
166 * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
169 void deleteRow(Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException;
172 * update or mutate a Row in a Table of a specified Database Schema.
174 * @param node OVSDB Node
175 * @param databaseName Database Name that represents the Schema supported by the node.
176 * @param tableName Table on which the row is Updated
177 * @param parentTable Name of the Parent Table to which this operation will result in mutating.
178 * @param parentColumn Name of the Column in the Parent Table to be mutated.
179 * @param rowUuid UUID of the row that is being deleted
180 * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
183 void deleteRow(Node node, String databaseName, String tableName, String parentTable,
184 UUID parentRowUuid, String parentColumn, UUID rowUuid) throws OvsdbPluginException;
187 * @deprecated This version of getRow is a short-term replacement for the older and now deprecated method of the same name.
188 * This API assumes an Open_vSwitch database Schema.
190 * This API is replaced by {@link #getRow(Node, String, String, UUID) getRow}
192 * @param node OVSDB Node
193 * @param tableName Table Name
194 * @param uuid UUID of the row being queried
195 * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
198 Row getRow(Node node, String tableName, String uuid);
201 * Returns a Row from a table for the specified uuid.
203 * @param node OVSDB Node
204 * @param databaseName Database Name that represents the Schema supported by the node.
205 * @param tableName Table Name
206 * @param uuid UUID of the row being queried
207 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
208 * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
210 Row<GenericTableSchema> getRow(Node node, String databaseName, String tableName, UUID uuid) throws OvsdbPluginException;
213 * @deprecated This version of getRows is a short-term replacement for the older and now deprecated method of the same name.
214 * This API assumes an Open_vSwitch database Schema.
216 * This API is replaced by
217 * {@link #getRows(Node, String, String) getRows} and {@link #getRows(Node, String, String, String) getRows}
219 * @param node OVSDB Node
220 * @param tableName Table Name
221 * @return List of rows that makes the entire Table.
224 ConcurrentMap<String, Row> getRows(Node node, String tableName);
227 * Returns all rows of a table.
229 * @param node OVSDB Node
230 * @param databaseName Database Name that represents the Schema supported by the node.
231 * @param tableName Table Name
232 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
233 * @return Map of rows to its UUID that makes the entire Table.
235 ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName) throws OvsdbPluginException;
238 * Returns all rows of a table filtered by query string.
240 * @param node OVSDB Node
241 * @param databaseName Database Name that represents the Schema supported by the node.
242 * @param tableName Table Name
243 * @param fiqlQuery FIQL style String Query <a href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00">draft-nottingham-atompub-fiql</a> to filter rows
244 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
245 * @return Map of rows to its UUID that makes the entire Table.
247 ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName, String fiqlQuery) throws OvsdbPluginException;
250 * @deprecated Returns all the Tables in a given Ndoe.
251 * This API assumes an Open_vSwitch database Schema.
253 * This API is replaced by
254 * {@link #getTables(Node, String) getTables}
255 * @param node OVSDB node
256 * @return List of Table Names that make up Open_vSwitch schema.
259 List<String> getTables(Node node);
262 * Returns all the Tables in a given Node.
264 * @param node OVSDB node
265 * @param databaseName Database Name that represents the Schema supported by the node.
266 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
267 * @return List of Table Names that make up the schema represented by the databaseName
269 List<String> getTables(Node node, String databaseName) throws OvsdbPluginException;
272 * setOFController is a convenience method used by existing applications to setup Openflow Controller on
273 * a Open_vSwitch Bridge.
274 * This API assumes an Open_vSwitch database Schema.
277 * @param bridgeUUID uuid of the Bridge for which the ip-address of Openflow Controller should be programmed.
278 * @return Boolean representing success or failure of the operation.
280 * @throws InterruptedException
281 * @throws ExecutionException
283 Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
285 <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass);
286 <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row);
287 <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass);