Debian Codegraph @

networking_l2gw/services/l2gateway/agent/ovsdb/api.py

raw
1 # Copyright (c) 2014 OpenStack Foundation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 import abc
16
17
18 class API(metaclass=abc.ABCMeta):
19 def __init__(self, context):
20 self.context = context
21
22 @abc.abstractmethod
23 def transaction(self, check_error=False, log_errors=True, **kwargs):
24 """Create a transaction
25
26 :param check_error: Allow the transaction to raise an exception?
27 :type check_error: bool
28 :param log_errors: Log an error if the transaction fails?
29 :type log_errors: bool
30 :returns: A new transaction
31 :rtype: :class:`Transaction`
32 """
33
34 @abc.abstractmethod
35 def db_find(self, table, *conditions, **kwargs):
36 """Create a command to return find OVSDB records matching conditions
37
38 :param table: The OVS table to query
39 :type table: string
40 :param conditions:The conditions to satisfy the query
41 :type conditions: 3-tuples containing (column, operation, match)
42 Type of 'match' parameter MUST be identical to column
43 type
44 Examples:
45 atomic: ('tag', '=', 7)
46 map: ('external_ids' '=', {'iface-id': 'xxx'})
47 field exists?
48 ('external_ids', '!=', {'iface-id', ''})
49 set contains?:
50 ('protocols', '{>=}', 'OpenFlow13')
51 See the ovs-vsctl man page for more operations
52 :param columns: Limit results to only columns, None means all columns
53 :type columns: list of column names or None
54 :returns: :class:`Command` with [{'column', value}, ...] result
55 """
56
57 @abc.abstractmethod
58 def get_physical_sw_list(self):
59 """Create a command to list Physical Switches."""