2 * Copyright (C) 2013 Red Hat, Inc.
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
8 * Authors : Madhu Venugopal, Brent Salisbury
10 package org.opendaylight.ovsdb.plugin.api;
12 import java.util.List;
13 import java.util.concurrent.ConcurrentMap;
14 import java.util.concurrent.ExecutionException;
16 import org.opendaylight.controller.sal.core.Node;
17 import org.opendaylight.ovsdb.plugin.api.Status;
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;
22 import org.opendaylight.ovsdb.plugin.error.OvsdbPluginException;
24 public interface OvsdbConfigurationService {
27 * @deprecated This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
28 * This API assumes an Open_vSwitch database Schema.
30 * This API is replaced by
31 * {@link #insertRow(Node, String, String, String, Row<GenericTableSchema>) insertRow} and
32 * {@link #insertTree(Node, String, String, String, Row<GenericTableSchema>) insertTree}
34 * @param node OVSDB Node
35 * @param tableName Table on which the row is inserted
36 * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
37 * @param row Row of table Content to be inserted
38 * @return UUID of the inserted Row
41 public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
44 * insert a Row in a Table of a specified Database Schema. This is a convenience method on top of
45 * {@link insertRow(Node, String, String, String, UUID, String, Row<GenericTableSchema>) insertRow}
46 * which assumes that OVSDB schema implementation that corresponds to the databaseName will provide
47 * the necessary service to populate the Parent Table Name and Parent Column Name.
49 * This method can insert just a single Row specified in the row parameter.
50 * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
51 * can insert a hierarchy of rows with parent-child relationship.
53 * @param node OVSDB Node
54 * @param databaseName Database Name that represents the Schema supported by the node.
55 * @param tableName Table on which the row is inserted
56 * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
57 * @param row Row of table Content to be inserted
58 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
59 * @return UUID of the inserted Row
61 public UUID insertRow(Node node, String databaseName, String tableName, UUID parentRowUuid,
62 Row<GenericTableSchema> row) throws OvsdbPluginException;
65 * insert a Row in a Table of a specified Database Schema.
67 * This method can insert just a single Row specified in the row parameter.
68 * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
69 * can insert a hierarchy of rows with parent-child relationship.
71 * @param node OVSDB Node
72 * @param databaseName Database Name that represents the Schema supported by the node.
73 * @param tableName Table on which the row is inserted
74 * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
75 * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
76 * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
77 * @param row Row of table Content to be inserted
78 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
79 * @return UUID of the inserted Row
81 public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
82 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
85 * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct.
86 * This is a convenience method on top of {@link #insertTree(Node, String, String, String, UUID, String, Row<GenericTableSchema>) insertTree}
88 * @param node OVSDB Node
89 * @param databaseName Database Name that represents the Schema supported by the node.
90 * @param tableName Table on which the row is inserted
91 * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
92 * @param row Row Tree with parent-child relationships via column of type refTable.
93 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
94 * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
96 public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, UUID parentRowUuid,
97 Row<GenericTableSchema> row) throws OvsdbPluginException;
100 * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct
102 * @param node OVSDB Node
103 * @param databaseName Database Name that represents the Schema supported by the node.
104 * @param tableName Table on which the row is inserted
105 * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
106 * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
107 * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
108 * @param row Row Tree with parent-child relationships via column of type refTable.
109 * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
110 * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
112 public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
113 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
116 * @deprecated This version of updateRow is a short-term replacement for the older & now deprecated method of the same name.
117 * This API assumes an Open_vSwitch database Schema.
119 * This API is replaced by
120 * {@link #updateRow(Node, String, String, UUID, Row<GenericTableSchema>, boolean) updateRow}
122 * @param node OVSDB Node
123 * @param tableName Table on which the row is Updated
124 * @param parentUuid UUID of the parent row on which this operation might result in mutating.
125 * @param rowUuid UUID of the row that is being updated
126 * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
129 public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
132 * update or mutate a Row in a Table of a specified Database Schema.
134 * @param node OVSDB Node
135 * @param databaseName Database Name that represents the Schema supported by the node.
136 * @param tableName Table on which the row is updated
137 * @param rowUuid UUID of the row being updated
138 * @param row Row of table Content to be updated
139 * @param overwrite true will overwrite/replace the existing row (matching the rowUuid) with the passed row object.
140 * false will update the existing row (matching the rowUuid) using only the columns in the passed row object.
141 * @throws OvsdbPluginException Any failure during the update operation will result in a specific exception.
142 * @return Returns the entire Row after the update operation.
144 public Row<GenericTableSchema> updateRow(Node node, String databaseName, String tableName, UUID rowUuid,
145 Row<GenericTableSchema> row, boolean overwrite) throws OvsdbPluginException;
148 * @deprecated This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
149 * This API assumes an Open_vSwitch database Schema.
151 * This API is replaced by {@link #deleteRow(Node, String, String, UUID) deleteRow}
153 * @param node OVSDB Node
154 * @param tableName Table on which the row is Updated
155 * @param rowUuid UUID of the row that is being deleted
158 public Status deleteRow (Node node, String tableName, String rowUuid);
161 * update or mutate a Row in a Table of a specified Database Schema.
163 * @param node OVSDB Node
164 * @param databaseName Database Name that represents the Schema supported by the node.
165 * @param tableName Table on which the row is Updated
166 * @param rowUuid UUID of the row that is being deleted
167 * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
170 public void deleteRow (Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException;
173 * update or mutate a Row in a Table of a specified Database Schema.
175 * @param node OVSDB Node
176 * @param databaseName Database Name that represents the Schema supported by the node.
177 * @param tableName Table on which the row is Updated
178 * @param parentTable Name of the Parent Table to which this operation will result in mutating.
179 * @param parentColumn Name of the Column in the Parent Table to be mutated.
180 * @param rowUuid UUID of the row that is being deleted
181 * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
184 public void deleteRow (Node node, String databaseName, String tableName, String parentTable,
185 UUID parentRowUuid, String parentColumn, UUID rowUuid) throws OvsdbPluginException;
188 * @deprecated This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
189 * This API assumes an Open_vSwitch database Schema.
191 * This API is replaced by {@link #getRow(Node, String, String, UUID) getRow}
193 * @param node OVSDB Node
194 * @param tableName Table Name
195 * @param rowUuid UUID of the row being queried
196 * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
199 public Row getRow(Node node, String tableName, String uuid);
202 * Returns a Row from a table for the specified uuid.
204 * @param node OVSDB Node
205 * @param databaseName Database Name that represents the Schema supported by the node.
206 * @param tableName Table Name
207 * @param uuid UUID of the row being queried
208 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
209 * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
211 public Row<GenericTableSchema> getRow(Node node, String databaseName, String tableName, UUID uuid) throws OvsdbPluginException;
214 * @Deprecated This version of getRows is a short-term replacement for the older & now deprecated method of the same name.
215 * This API assumes an Open_vSwitch database Schema.
217 * This API is replaced by
218 * {@link #getRows(Node, String, String) getRows} and {@link #getRows(Node, String, String, String) getRows}
220 * @param node OVSDB Node
221 * @param tableName Table Name
222 * @return List of rows that makes the entire Table.
225 public ConcurrentMap<String, Row> getRows(Node node, String tableName);
228 * Returns all rows of a table.
230 * @param node OVSDB Node
231 * @param databaseName Database Name that represents the Schema supported by the node.
232 * @param tableName Table Name
233 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
234 * @return Map of rows to its UUID that makes the entire Table.
236 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName) throws OvsdbPluginException;
239 * Returns all rows of a table filtered by query string.
241 * @param node OVSDB Node
242 * @param databaseName Database Name that represents the Schema supported by the node.
243 * @param tableName Table Name
244 * @param fiqlQuery FIQL style String Query {@link http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00} to filter rows
245 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
246 * @return Map of rows to its UUID that makes the entire Table.
248 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName, String fiqlQuery) throws OvsdbPluginException;
251 * @Deprecated Returns all the Tables in a given Ndoe.
252 * This API assumes an Open_vSwitch database Schema.
254 * This API is replaced by
255 * {@link #getTables(Node, String) getTables}
256 * @param node OVSDB node
257 * @return List of Table Names that make up Open_vSwitch schema.
260 public List<String> getTables(Node node);
263 * Returns all the Tables in a given Node.
265 * @param node OVSDB node
266 * @param databaseName Database Name that represents the Schema supported by the node.
267 * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
268 * @return List of Table Names that make up the schema represented by the databaseName
270 public List<String> getTables(Node node, String databaseName) throws OvsdbPluginException;
273 * setOFController is a convenience method used by existing applications to setup Openflow Controller on
274 * a Open_vSwitch Bridge.
275 * This API assumes an Open_vSwitch database Schema.
278 * @param bridgeUUID uuid of the Bridge for which the ip-address of Openflow Controller should be programmed.
279 * @return Boolean representing success or failure of the operation.
281 * @throws InterruptedException
282 * @throws ExecutionException
284 public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
286 public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass);
287 public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row);
288 public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass);