Debian Codegraph @

vif_plug_ovs/ovsdb/api.py

raw symbols SCIP
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
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 """