Merge "Clean-up in the unit tests for NVP plugin"
This commit is contained in:
commit
c0d3c5864c
@ -1,6 +1,6 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2012 OpenStack Foundation.
|
||||
# Copyright 2013 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -14,3 +14,24 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
import neutron.plugins.nicira.api_client.client_eventlet as client
|
||||
import neutron.plugins.nicira.NeutronPlugin as plugin
|
||||
import neutron.plugins.nicira.NvpApiClient as nvpapi
|
||||
|
||||
nvp_plugin = plugin.NvpPluginV2
|
||||
api_helper = nvpapi.NVPApiHelper
|
||||
nvp_client = client.NvpApiClientEventlet
|
||||
|
||||
STUBS_PATH = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
NVPEXT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
"../../plugins/nicira/extensions")
|
||||
NVPAPI_NAME = '%s.%s' % (api_helper.__module__, api_helper.__name__)
|
||||
PLUGIN_NAME = '%s.%s' % (nvp_plugin.__module__, nvp_plugin.__name__)
|
||||
CLIENT_NAME = '%s.%s' % (nvp_client.__module__, nvp_client.__name__)
|
||||
|
||||
|
||||
def get_fake_conf(filename):
|
||||
return os.path.join(STUBS_PATH, filename)
|
||||
|
@ -14,33 +14,26 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
|
||||
from neutron.common.test_lib import test_config
|
||||
import neutron.plugins.nicira as nvp_plugin
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit.openvswitch import test_agent_scheduler as test_base
|
||||
|
||||
|
||||
NVP_MODULE_PATH = nvp_plugin.__name__
|
||||
NVP_INI_CONFIG_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/nvp.ini.full.test')
|
||||
NVP_STUBS_PATH = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
|
||||
PLUGIN_NAME = '%s.NeutronPlugin.NvpPluginV2' % nvp_plugin.__name__
|
||||
|
||||
|
||||
class NVPDhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase):
|
||||
plugin_str = PLUGIN_NAME
|
||||
|
||||
def setUp(self):
|
||||
test_config['plugin_name_v2'] = PLUGIN_NAME
|
||||
test_config['config_files'] = [NVP_INI_CONFIG_PATH]
|
||||
test_config['config_files'] = [get_fake_conf('nvp.ini.full.test')]
|
||||
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(NVP_STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NVP_MODULE_PATH, autospec=True)
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
|
||||
def _fake_request(*args, **kwargs):
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import contextlib
|
||||
import mock
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
@ -25,22 +24,16 @@ from neutron.api.v2 import attributes
|
||||
from neutron.common.test_lib import test_config
|
||||
from neutron import context
|
||||
from neutron.extensions import agent
|
||||
from neutron.openstack.common import log as logging
|
||||
import neutron.plugins.nicira as nvp_plugin
|
||||
from neutron.plugins.nicira.NvpApiClient import NVPVersion
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import NVPEXT_PATH
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
NVP_MODULE_PATH = nvp_plugin.__name__
|
||||
NVP_FAKE_RESPS_PATH = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
NVP_INI_CONFIG_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/nvp.ini.full.test')
|
||||
NVP_EXTENSIONS_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'../../../plugins/nicira/extensions')
|
||||
|
||||
|
||||
class MacLearningExtensionManager(object):
|
||||
|
||||
def get_resources(self):
|
||||
@ -64,11 +57,9 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.adminContext = context.get_admin_context()
|
||||
test_config['config_files'] = [NVP_INI_CONFIG_PATH]
|
||||
test_config['plugin_name_v2'] = (
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2')
|
||||
cfg.CONF.set_override('api_extensions_path',
|
||||
NVP_EXTENSIONS_PATH)
|
||||
test_config['config_files'] = [get_fake_conf('nvp.ini.full.test')]
|
||||
test_config['plugin_name_v2'] = PLUGIN_NAME
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
# Save the original RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
|
||||
@ -76,9 +67,8 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
ext_mgr = MacLearningExtensionManager()
|
||||
test_config['extension_manager'] = ext_mgr
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(NVP_FAKE_RESPS_PATH)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NVP_MODULE_PATH, autospec=True)
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
|
||||
def _fake_request(*args, **kwargs):
|
||||
|
@ -14,7 +14,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
|
||||
import mock
|
||||
import netaddr
|
||||
@ -30,7 +29,6 @@ from neutron.extensions import providernet as pnet
|
||||
from neutron.extensions import securitygroup as secgrp
|
||||
from neutron import manager
|
||||
from neutron.openstack.common import uuidutils
|
||||
import neutron.plugins.nicira as nvp_plugin
|
||||
from neutron.plugins.nicira.dbexts import nicira_qos_db as qos_db
|
||||
from neutron.plugins.nicira.extensions import nvp_networkgw
|
||||
from neutron.plugins.nicira.extensions import nvp_qos as ext_qos
|
||||
@ -40,6 +38,11 @@ from neutron.plugins.nicira.NvpApiClient import NVPVersion
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests.unit import _test_extension_portbindings as test_bindings
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import NVPEXT_PATH
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
import neutron.tests.unit.nicira.test_networkgw as test_l2_gw
|
||||
import neutron.tests.unit.test_db_plugin as test_plugin
|
||||
import neutron.tests.unit.test_extension_ext_gw_mode as test_ext_gw_mode
|
||||
@ -49,14 +52,9 @@ from neutron.tests.unit import test_extensions
|
||||
import neutron.tests.unit.test_l3_plugin as test_l3_plugin
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
NICIRA_PKG_PATH = nvp_plugin.__name__
|
||||
NICIRA_EXT_PATH = "../../plugins/nicira/extensions"
|
||||
|
||||
|
||||
class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
|
||||
_plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
|
||||
|
||||
def _create_network(self, fmt, name, admin_state_up,
|
||||
arg_list=None, providernet_args=None, **kwargs):
|
||||
data = {'network': {'name': name,
|
||||
@ -78,13 +76,10 @@ class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
return network_req.get_response(self.api)
|
||||
|
||||
def setUp(self):
|
||||
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
test_lib.test_config['config_files'] = [os.path.join(etc_path,
|
||||
'nvp.ini.test')]
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')]
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(etc_path)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NICIRA_PKG_PATH, autospec=True)
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
|
||||
def _fake_request(*args, **kwargs):
|
||||
@ -93,7 +88,7 @@ class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
# Emulate tests against NVP 2.x
|
||||
instance.return_value.get_nvp_version.return_value = NVPVersion("2.9")
|
||||
instance.return_value.request.side_effect = _fake_request
|
||||
super(NiciraPluginV2TestCase, self).setUp(self._plugin_name)
|
||||
super(NiciraPluginV2TestCase, self).setUp(PLUGIN_NAME)
|
||||
cfg.CONF.set_override('metadata_mode', None, 'NVP')
|
||||
self.addCleanup(self.fc.reset_all)
|
||||
self.addCleanup(self.mock_nvpapi.stop)
|
||||
@ -254,16 +249,11 @@ class TestNiciraNetworksV2(test_plugin.TestNetworksV2,
|
||||
|
||||
class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase):
|
||||
|
||||
_plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
|
||||
|
||||
def setUp(self):
|
||||
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
test_lib.test_config['config_files'] = [os.path.join(etc_path,
|
||||
'nvp.ini.test')]
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')]
|
||||
# mock nvp api client
|
||||
fc = fake_nvpapiclient.FakeClient(etc_path)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NICIRA_PKG_PATH, autospec=True)
|
||||
fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
|
||||
@ -271,7 +261,7 @@ class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase):
|
||||
return fc.fake_request(*args, **kwargs)
|
||||
|
||||
instance.return_value.request.side_effect = _fake_request
|
||||
super(NiciraPortSecurityTestCase, self).setUp(self._plugin_name)
|
||||
super(NiciraPortSecurityTestCase, self).setUp(PLUGIN_NAME)
|
||||
self.addCleanup(self.mock_nvpapi.stop)
|
||||
|
||||
|
||||
@ -282,16 +272,11 @@ class TestNiciraPortSecurity(psec.TestPortSecurity,
|
||||
|
||||
class NiciraSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
|
||||
|
||||
_plugin_name = ('%s.NeutronPlugin.NvpPluginV2' % NICIRA_PKG_PATH)
|
||||
|
||||
def setUp(self):
|
||||
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
test_lib.test_config['config_files'] = [os.path.join(etc_path,
|
||||
'nvp.ini.test')]
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')]
|
||||
# mock nvp api client
|
||||
fc = fake_nvpapiclient.FakeClient(etc_path)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NICIRA_PKG_PATH, autospec=True)
|
||||
fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
|
||||
@ -299,7 +284,7 @@ class NiciraSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
|
||||
return fc.fake_request(*args, **kwargs)
|
||||
|
||||
instance.return_value.request.side_effect = _fake_request
|
||||
super(NiciraSecurityGroupsTestCase, self).setUp(self._plugin_name)
|
||||
super(NiciraSecurityGroupsTestCase, self).setUp(PLUGIN_NAME)
|
||||
|
||||
def tearDown(self):
|
||||
super(NiciraSecurityGroupsTestCase, self).tearDown()
|
||||
@ -615,9 +600,7 @@ class NvpQoSTestExtensionManager(object):
|
||||
class TestNiciraQoSQueue(NiciraPluginV2TestCase):
|
||||
|
||||
def setUp(self, plugin=None):
|
||||
ext_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
NICIRA_EXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', ext_path)
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
super(TestNiciraQoSQueue, self).setUp()
|
||||
ext_mgr = NvpQoSTestExtensionManager()
|
||||
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
|
||||
@ -1039,9 +1022,7 @@ class TestNiciraNetworkGateway(test_l2_gw.NetworkGatewayDbTestCase,
|
||||
NiciraPluginV2TestCase):
|
||||
|
||||
def setUp(self):
|
||||
ext_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
NICIRA_EXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', ext_path)
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
super(TestNiciraNetworkGateway, self).setUp()
|
||||
|
||||
def test_create_network_gateway_name_exceeds_40_chars(self):
|
||||
|
@ -22,11 +22,10 @@ from eventlet.green import urllib2
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
|
||||
from neutron.plugins.nicira.api_client import (
|
||||
client_eventlet as nace,
|
||||
request_eventlet as nare,
|
||||
)
|
||||
from neutron.plugins.nicira.api_client import client_eventlet as nace
|
||||
from neutron.plugins.nicira.api_client import request_eventlet as nare
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import CLIENT_NAME
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
@ -212,8 +211,7 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.assertTrue(retval is None)
|
||||
|
||||
def test_redirect_params_setup_https_with_cooki(self):
|
||||
with patch('neutron.plugins.nicira.api_client.'
|
||||
'client_eventlet.NvpApiClientEventlet') as mock:
|
||||
with patch(CLIENT_NAME) as mock:
|
||||
api_client = mock.return_value
|
||||
self.req._api_client = api_client
|
||||
myconn = Mock()
|
||||
@ -224,8 +222,7 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.assertTrue(api_client.acquire_redirect_connection.called)
|
||||
|
||||
def test_redirect_params_setup_htttps_and_query(self):
|
||||
with patch('neutron.plugins.nicira.api_client.'
|
||||
'client_eventlet.NvpApiClientEventlet') as mock:
|
||||
with patch(CLIENT_NAME) as mock:
|
||||
api_client = mock.return_value
|
||||
self.req._api_client = api_client
|
||||
myconn = Mock()
|
||||
@ -236,8 +233,7 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.assertTrue(api_client.acquire_redirect_connection.called)
|
||||
|
||||
def test_redirect_params_setup_https_connection_no_cookie(self):
|
||||
with patch('neutron.plugins.nicira.api_client.'
|
||||
'client_eventlet.NvpApiClientEventlet') as mock:
|
||||
with patch(CLIENT_NAME) as mock:
|
||||
api_client = mock.return_value
|
||||
self.req._api_client = api_client
|
||||
myconn = Mock()
|
||||
@ -248,8 +244,7 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.assertTrue(api_client.acquire_redirect_connection.called)
|
||||
|
||||
def test_redirect_params_setup_https_and_query_no_cookie(self):
|
||||
with patch('neutron.plugins.nicira.api_client.'
|
||||
'client_eventlet.NvpApiClientEventlet') as mock:
|
||||
with patch(CLIENT_NAME) as mock:
|
||||
api_client = mock.return_value
|
||||
self.req._api_client = api_client
|
||||
myconn = Mock()
|
||||
@ -259,8 +254,7 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.assertTrue(api_client.acquire_redirect_connection.called)
|
||||
|
||||
def test_redirect_params_path_only_with_query(self):
|
||||
with patch('neutron.plugins.nicira.api_client.'
|
||||
'client_eventlet.NvpApiClientEventlet') as mock:
|
||||
with patch(CLIENT_NAME) as mock:
|
||||
api_client = mock.return_value
|
||||
api_client.wait_for_login.return_value = None
|
||||
api_client.auth_cookie = None
|
||||
|
@ -16,11 +16,9 @@
|
||||
# @author: Salvatore Orlando, VMware
|
||||
|
||||
import mock
|
||||
import os
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
import neutron.plugins.nicira as nvp_plugin
|
||||
from neutron.plugins.nicira.common import config # noqa
|
||||
from neutron.plugins.nicira.common import exceptions as nvp_exc
|
||||
from neutron.plugins.nicira import nvp_cluster
|
||||
@ -28,9 +26,11 @@ from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit import test_api_v2
|
||||
|
||||
NICIRA_PKG_PATH = nvp_plugin.__name__
|
||||
|
||||
_uuid = test_api_v2._uuid
|
||||
|
||||
|
||||
@ -38,10 +38,8 @@ class NvplibTestCase(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
# mock nvp api client
|
||||
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
self.fc = fake_nvpapiclient.FakeClient(etc_path)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NICIRA_PKG_PATH, autospec=True)
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
fake_version = getattr(self, 'fake_version', "2.9")
|
||||
@ -104,10 +102,8 @@ class NvplibNegativeTests(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
# mock nvp api client
|
||||
etc_path = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
self.fc = fake_nvpapiclient.FakeClient(etc_path)
|
||||
self.mock_nvpapi = mock.patch('%s.NvpApiClient.NVPApiHelper'
|
||||
% NICIRA_PKG_PATH, autospec=True)
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
# Choose 2.9, but the version is irrelevant for the aim of
|
||||
|
@ -14,7 +14,6 @@
|
||||
#
|
||||
|
||||
import fixtures
|
||||
import os
|
||||
import testtools
|
||||
|
||||
from oslo.config import cfg
|
||||
@ -25,19 +24,14 @@ from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.nicira.common import config # noqa
|
||||
from neutron.plugins.nicira.common import exceptions
|
||||
from neutron.plugins.nicira import nvp_cluster
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
|
||||
BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'../../etc/neutron.conf.test')
|
||||
NVP_BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/neutron.conf.test')
|
||||
NVP_INI_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/nvp.ini.basic.test')
|
||||
NVP_INI_FULL_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/nvp.ini.full.test')
|
||||
NVP_INI_DEPR_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'etc/nvp.ini.grizzly.test')
|
||||
NVP_PLUGIN_PATH = ('neutron.plugins.nicira.nicira_nvp_plugin.'
|
||||
'NeutronPlugin.NvpPluginV2')
|
||||
BASE_CONF_PATH = get_fake_conf('neutron.conf.test')
|
||||
NVP_BASE_CONF_PATH = get_fake_conf('neutron.conf.test')
|
||||
NVP_INI_PATH = get_fake_conf('nvp.ini.basic.test')
|
||||
NVP_INI_FULL_PATH = get_fake_conf('nvp.ini.full.test')
|
||||
NVP_INI_DEPR_PATH = get_fake_conf('nvp.ini.grizzly.test')
|
||||
|
||||
|
||||
class NVPClusterTest(testtools.TestCase):
|
||||
@ -105,7 +99,7 @@ class ConfigurationTest(testtools.TestCase):
|
||||
def test_load_plugin_with_full_options(self):
|
||||
q_config.parse(['--config-file', BASE_CONF_PATH,
|
||||
'--config-file', NVP_INI_FULL_PATH])
|
||||
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
|
||||
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
|
||||
plugin = NeutronManager().get_plugin()
|
||||
cluster = plugin.cluster
|
||||
self._assert_required_options(cluster)
|
||||
@ -114,7 +108,7 @@ class ConfigurationTest(testtools.TestCase):
|
||||
def test_load_plugin_with_required_options_only(self):
|
||||
q_config.parse(['--config-file', BASE_CONF_PATH,
|
||||
'--config-file', NVP_INI_PATH])
|
||||
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
|
||||
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
|
||||
plugin = NeutronManager().get_plugin()
|
||||
self._assert_required_options(plugin.cluster)
|
||||
|
||||
@ -141,7 +135,7 @@ class ConfigurationTest(testtools.TestCase):
|
||||
def test_load_api_extensions(self):
|
||||
q_config.parse(['--config-file', NVP_BASE_CONF_PATH,
|
||||
'--config-file', NVP_INI_FULL_PATH])
|
||||
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
|
||||
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
|
||||
# Load the configuration, and initialize the plugin
|
||||
NeutronManager().get_plugin()
|
||||
self.assertIn('extensions', cfg.CONF.api_extensions_path)
|
||||
@ -165,7 +159,7 @@ class OldConfigurationTest(testtools.TestCase):
|
||||
def test_load_plugin_with_deprecated_options(self):
|
||||
q_config.parse(['--config-file', BASE_CONF_PATH,
|
||||
'--config-file', NVP_INI_DEPR_PATH])
|
||||
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
|
||||
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
|
||||
plugin = NeutronManager().get_plugin()
|
||||
cluster = plugin.cluster
|
||||
self._assert_required_options(cluster)
|
||||
|
Loading…
Reference in New Issue
Block a user