Fix the Backend class for ovsbapp index changes

The Backend class in ovsdbapp was modified when adding index
support. Different projects wanted different scopes for their
ovsdb_connections, and this was moved to a property in ovsdbapp.
For now, we can just set ovsdb_connection = None on the backend
class to get the behavior we desire.

Also mocks out autocreate_indicies for a unit test.

Change-Id: I7741a441a55e67354bc0887e5db2f8137073b5b4
This commit is contained in:
Terry Wilson 2020-06-09 10:00:58 -05:00
parent 23d743a444
commit 28c311ccd7
2 changed files with 4 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class OvnNbTransaction(idl_trans.Transaction):
# and therefor allows networking-ovn to manage connection scope on its own
class Backend(ovs_idl.Backend):
lookup_table = {}
ovsdb_connection = None
def __init__(self, connection):
self.ovsdb_connection = connection

View File

@ -17,6 +17,7 @@ from unittest import mock
from neutron.tests import base
from ovs.db import idl as ovs_idl
from ovsdbapp.backend import ovs_idl as real_ovs_idl
from ovsdbapp.backend.ovs_idl import idlutils
from ovn_octavia_provider.ovsdb import impl_idl_ovn
@ -47,6 +48,8 @@ class TestOvnNbIdlForLb(base.BaseTestCase):
self.idl._get_ovsdb_helper('foo')
self.mock_gsh.assert_called_once_with('foo', 'OVN_Northbound')
@mock.patch.object(real_ovs_idl.Backend, 'autocreate_indices', mock.Mock(),
create=True)
def test_start(self):
with mock.patch('ovsdbapp.backend.ovs_idl.connection.Connection',
side_effect=lambda x, timeout: mock.Mock()):