mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
python/ovs/db/idl: add counterpart of ovsdb_idl_add_table()
Add register_table method to SchemaHelper as Python counterpart of ovsdb_idl_add_table() in the C version of the IDL. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
committed by
Ben Pfaff
parent
6d3c5b64b3
commit
7698e31d6a
@@ -1224,6 +1224,15 @@ class SchemaHelper(object):
|
||||
columns = set(columns) | self._tables.get(table, set())
|
||||
self._tables[table] = columns
|
||||
|
||||
def register_table(self, table):
|
||||
"""Registers interest in the given all columns of 'table'. Future calls
|
||||
to get_idl_schema() will include all columns of 'table'.
|
||||
|
||||
'table' must be a string
|
||||
"""
|
||||
assert type(table) is str
|
||||
self._tables[table] = set() # empty set means all columns in the table
|
||||
|
||||
def register_all(self):
|
||||
"""Registers interest in every column of every table."""
|
||||
self._all = True
|
||||
@@ -1249,6 +1258,10 @@ class SchemaHelper(object):
|
||||
assert table_name in schema.tables
|
||||
table = schema.tables[table_name]
|
||||
|
||||
if not columns:
|
||||
# empty set means all columns in the table
|
||||
return table
|
||||
|
||||
new_columns = {}
|
||||
for column_name in columns:
|
||||
assert type(column_name) is str
|
||||
|
Reference in New Issue
Block a user