Use Topology Node in place of Inventory Node
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / api / OvsdbConfigurationService.java
1 package org.opendaylight.ovsdb.openstack.netvirt.api;
2
3 import java.util.List;
4 import java.util.concurrent.ConcurrentMap;
5 import java.util.concurrent.ExecutionException;
6 import org.opendaylight.ovsdb.lib.notation.Row;
7 import org.opendaylight.ovsdb.lib.notation.UUID;
8 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
9 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
10 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
11
12 /**
13  * Created by shague on 4/20/15.
14  */
15 public interface OvsdbConfigurationService {
16
17     /**
18      * @deprecated This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
19      * This API assumes an Open_vSwitch database Schema.
20      *
21      * This API is replaced by
22      * {@link #insertRow(Node, String, String, String, Row < GenericTableSchema >) insertRow} and
23      * {@link #insertTree(Node, String, String, String, Row<GenericTableSchema>) insertTree}
24      *
25      * @param node OVSDB Node
26      * @param tableName Table on which the row is inserted
27      * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
28      * @param row Row of table Content to be inserted
29      * @return UUID of the inserted Row
30      */
31     @Deprecated
32     public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
33
34     /**
35      * insert a Row in a Table of a specified Database Schema. This is a convenience method on top of
36      * {@link insertRow(Node, String, String, String, UUID , String, Row<GenericTableSchema>) insertRow}
37      * which assumes that OVSDB schema implementation that corresponds to the databaseName will provide
38      * the necessary service to populate the Parent Table Name and Parent Column Name.
39      *
40      * This method can insert just a single Row specified in the row parameter.
41      * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
42      * can insert a hierarchy of rows with parent-child relationship.
43      *
44      * @param node OVSDB Node
45      * @param databaseName Database Name that represents the Schema supported by the node.
46      * @param tableName Table on which the row is inserted
47      * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
48      * @param row Row of table Content to be inserted
49      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
50      * @return UUID of the inserted Row
51      */
52     public UUID insertRow(Node node, String databaseName, String tableName, UUID parentRowUuid,
53                           Row<GenericTableSchema> row) throws OvsdbPluginException;
54
55     /**
56      * insert a Row in a Table of a specified Database Schema.
57      *
58      * This method can insert just a single Row specified in the row parameter.
59      * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
60      * can insert a hierarchy of rows with parent-child relationship.
61      *
62      * @param node OVSDB Node
63      * @param databaseName Database Name that represents the Schema supported by the node.
64      * @param tableName Table on which the row is inserted
65      * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
66      * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
67      * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
68      * @param row Row of table Content to be inserted
69      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
70      * @return UUID of the inserted Row
71      */
72     public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
73                           String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
74
75     /**
76      * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct.
77      * This is a convenience method on top of {@link #insertTree(Node, String, String, String, UUID, String, Row<GenericTableSchema>) insertTree}
78      *
79      * @param node OVSDB Node
80      * @param databaseName Database Name that represents the Schema supported by the node.
81      * @param tableName Table on which the row is inserted
82      * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
83      * @param row Row Tree with parent-child relationships via column of type refTable.
84      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
85      * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
86      */
87     public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, UUID parentRowUuid,
88                                               Row<GenericTableSchema> row) throws OvsdbPluginException;
89
90     /**
91      * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct
92      *
93      * @param node OVSDB Node
94      * @param databaseName Database Name that represents the Schema supported by the node.
95      * @param tableName Table on which the row is inserted
96      * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
97      * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
98      * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
99      * @param row Row Tree with parent-child relationships via column of type refTable.
100      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
101      * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
102      */
103     public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
104                                               String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
105
106     /**
107      * @deprecated This version of updateRow is a short-term replacement for the older & now deprecated method of the same name.
108      * This API assumes an Open_vSwitch database Schema.
109      *
110      * This API is replaced by
111      * {@link #updateRow(Node, String, String, UUID, Row<GenericTableSchema>, boolean) updateRow}
112      *
113      * @param node OVSDB Node
114      * @param tableName Table on which the row is Updated
115      * @param parentUuid UUID of the parent row on which this operation might result in mutating.
116      * @param rowUuid UUID of the row that is being updated
117      * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
118      */
119     @Deprecated
120     public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
121
122     /**
123      * update or mutate a Row in a Table of a specified Database Schema.
124      *
125      * @param node OVSDB Node
126      * @param databaseName Database Name that represents the Schema supported by the node.
127      * @param tableName Table on which the row is updated
128      * @param rowUuid UUID of the row being updated
129      * @param row Row of table Content to be updated
130      * @param overwrite true will overwrite/replace the existing row (matching the rowUuid) with the passed row object.
131      *                  false will update the existing row (matching the rowUuid) using only the columns in the passed row object.
132      * @throws OvsdbPluginException Any failure during the update operation will result in a specific exception.
133      * @return Returns the entire Row after the update operation.
134      */
135     public Row<GenericTableSchema> updateRow(Node node, String databaseName, String tableName, UUID rowUuid,
136                                              Row<GenericTableSchema> row, boolean overwrite) throws OvsdbPluginException;
137
138     /**
139      * @deprecated This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
140      * This API assumes an Open_vSwitch database Schema.
141      *
142      * This API is replaced by {@link #deleteRow(Node, String, String, UUID) deleteRow}
143      *
144      * @param node OVSDB Node
145      * @param tableName Table on which the row is Updated
146      * @param rowUuid UUID of the row that is being deleted
147      */
148     @Deprecated
149     public Status deleteRow (Node node, String tableName, String rowUuid);
150
151     /**
152      * update or mutate a Row in a Table of a specified Database Schema.
153      *
154      * @param node OVSDB Node
155      * @param databaseName Database Name that represents the Schema supported by the node.
156      * @param tableName Table on which the row is Updated
157      * @param rowUuid UUID of the row that is being deleted
158      * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
159      */
160
161     public void deleteRow (Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException;
162
163     /**
164      * update or mutate a Row in a Table of a specified Database Schema.
165      *
166      * @param node OVSDB Node
167      * @param databaseName Database Name that represents the Schema supported by the node.
168      * @param tableName Table on which the row is Updated
169      * @param parentTable Name of the Parent Table to which this operation will result in mutating.
170      * @param parentColumn Name of the Column in the Parent Table to be mutated.
171      * @param rowUuid UUID of the row that is being deleted
172      * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
173      */
174
175     public void deleteRow (Node node, String databaseName, String tableName, String parentTable,
176                            UUID parentRowUuid, String parentColumn, UUID rowUuid) throws OvsdbPluginException;
177
178     /**
179      * @deprecated This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
180      * This API assumes an Open_vSwitch database Schema.
181      *
182      * This API is replaced by {@link #getRow(Node, String, String, UUID) getRow}
183      *
184      * @param node OVSDB Node
185      * @param tableName Table Name
186      * @param rowUuid UUID of the row being queried
187      * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
188      */
189     @Deprecated
190     public Row getRow(Node node, String tableName, String uuid);
191
192     /**
193      * Returns a Row from a table for the specified uuid.
194      *
195      * @param node OVSDB Node
196      * @param databaseName Database Name that represents the Schema supported by the node.
197      * @param tableName Table Name
198      * @param uuid UUID of the row being queried
199      * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
200      * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
201      */
202     public Row<GenericTableSchema> getRow(Node node, String databaseName, String tableName, UUID uuid) throws OvsdbPluginException;
203
204     /**
205      * @Deprecated This version of getRows is a short-term replacement for the older & now deprecated method of the same name.
206      * This API assumes an Open_vSwitch database Schema.
207      *
208      * This API is replaced by
209      * {@link #getRows(Node, String, String) getRows} and {@link #getRows(Node, String, String, String) getRows}
210      *
211      * @param node OVSDB Node
212      * @param tableName Table Name
213      * @return List of rows that makes the entire Table.
214      */
215     @Deprecated
216     public ConcurrentMap<String, Row> getRows(Node node, String tableName);
217
218     /**
219      * Returns all rows of a table.
220      *
221      * @param node OVSDB Node
222      * @param databaseName Database Name that represents the Schema supported by the node.
223      * @param tableName Table Name
224      * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
225      * @return Map of rows to its UUID that makes the entire Table.
226      */
227     public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName) throws OvsdbPluginException;
228
229     /**
230      * Returns all rows of a table filtered by query string.
231      *
232      * @param node OVSDB Node
233      * @param databaseName Database Name that represents the Schema supported by the node.
234      * @param tableName Table Name
235      * @param fiqlQuery FIQL style String Query {@link http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00} to filter rows
236      * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
237      * @return Map of rows to its UUID that makes the entire Table.
238      */
239     public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName, String fiqlQuery) throws OvsdbPluginException;
240
241     /**
242      * @Deprecated Returns all the Tables in a given Ndoe.
243      * This API assumes an Open_vSwitch database Schema.
244      *
245      * This API is replaced by
246      * {@link #getTables(Node, String) getTables}
247      * @param node OVSDB node
248      * @return List of Table Names that make up Open_vSwitch schema.
249      */
250     @Deprecated
251     public List<String> getTables(Node node);
252
253     /**
254      * Returns all the Tables in a given Node.
255      *
256      * @param node OVSDB node
257      * @param databaseName Database Name that represents the Schema supported by the node.
258      * @throws OvsdbPluginException Any failure during the get operation will result in a specific exception.
259      * @return List of Table Names that make up the schema represented by the databaseName
260      */
261     public List<String> getTables(Node node, String databaseName) throws OvsdbPluginException;
262
263     /**
264      * setOFController is a convenience method used by existing applications to setup Openflow Controller on
265      * a Open_vSwitch Bridge.
266      * This API assumes an Open_vSwitch database Schema.
267      *
268      * @param node Node
269      * @param bridgeUUID uuid of the Bridge for which the ip-address of Openflow Controller should be programmed.
270      * @return Boolean representing success or failure of the operation.
271      *
272      * @throws InterruptedException
273      * @throws ExecutionException
274      */
275     public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
276
277     public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass);
278     public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row);
279     public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass);
280 }