| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
import abc |
| 14 |
|
| 15 |
from oslo_utils import importutils |
| 16 |
|
| 17 |
|
| 18 |
interface_map = { |
| 19 |
'vsctl': 'vif_plug_ovs.ovsdb.impl_vsctl', |
| 20 |
'native': 'vif_plug_ovs.ovsdb.impl_idl', |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
def get_instance(context, iface_name=None): |
| 25 |
"""Return the configured OVSDB API implementation""" |
| 26 |
iface = importutils.import_module( |
| 27 |
interface_map[iface_name or context.interface]) |
| 28 |
return iface.api_factory(context) |
| 29 |
|
| 30 |
|
| 31 |
class ImplAPI(metaclass=abc.ABCMeta): |
| 32 |
@abc.abstractmethod |
| 33 |
def has_table_column(self, table, column): |
| 34 |
"""Check if a column exists in a database table |
| 35 |
|
| 36 |
:param table: (string) table name |
| 37 |
:param column: (string) column name |
| 38 |
:return: True if the column exists, False if not. |
| 39 |
""" |