From c29cc9c73b2bd49202cdca7919139ee9a194a842 Mon Sep 17 00:00:00 2001 From: Nader Lahouti Date: Sun, 23 Apr 2017 23:52:01 -0700 Subject: [PATCH] Add call to the directory add_plugin method This patch fixes unit tests failure due to adopting oslo-versioned objects (ovo) for neutorn db by adding the core plugin instance to the plugin directroy in the test. Change-Id: Ib0de20addf428c88c169e46ac3b63e4eb0efdb2d --- .../tests/unit/ml2/test_arista_mechanism_driver.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py b/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py index 4988e82..07d5b46 100644 --- a/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py +++ b/networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py @@ -21,7 +21,9 @@ import mock from mock import patch from neutron_lib.api.definitions import portbindings from neutron_lib import constants as n_const +from neutron_lib.plugins import directory from oslo_config import cfg +from oslo_utils import importutils import six import neutron.db.api as db @@ -258,6 +260,9 @@ class _UnorderedDictList(list): class TestAristaJSONRPCWrapper(testlib_api.SqlTestCase): def setUp(self): super(TestAristaJSONRPCWrapper, self).setUp() + plugin_klass = importutils.import_class( + "neutron.db.db_base_plugin_v2.NeutronDbPluginV2") + directory.add_plugin(n_const.CORE, plugin_klass()) setup_valid_config() ndb = db_lib.NeutronNets() self.drv = arista_ml2.AristaRPCWrapperJSON(ndb) @@ -1863,6 +1868,9 @@ class SyncServiceTest(testlib_api.SqlTestCase): def setUp(self): super(SyncServiceTest, self).setUp() + plugin_klass = importutils.import_class( + "neutron.db.db_base_plugin_v2.NeutronDbPluginV2") + directory.add_plugin(n_const.CORE, plugin_klass()) self.rpc = mock.MagicMock() ndb = db_lib.NeutronNets() self.sync_service = arista_ml2.SyncService(self.rpc, ndb)