From: armando-migliaccio Date: Wed, 22 May 2013 05:10:13 +0000 (-0700) Subject: Ensure API extensions for NVP are loaded by default X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=95d7c5052a0192c894f75de0f630f541d2b7326f;p=openstack-build%2Fneutron-build.git Ensure API extensions for NVP are loaded by default Fixes bug #1182736 Change-Id: I286f5b69d58a4cd3a0e25a984559fdf37068a75c --- diff --git a/quantum/plugins/nicira/QuantumPlugin.py b/quantum/plugins/nicira/QuantumPlugin.py index e088597e4..f3b0b8cb7 100644 --- a/quantum/plugins/nicira/QuantumPlugin.py +++ b/quantum/plugins/nicira/QuantumPlugin.py @@ -22,6 +22,7 @@ import hashlib import logging +import os from oslo.config import cfg from sqlalchemy.orm import exc as sa_exc @@ -71,6 +72,7 @@ LOG = logging.getLogger("QuantumPlugin") NVP_NOSNAT_RULES_ORDER = 10 NVP_FLOATINGIP_NAT_RULES_ORDER = 224 NVP_EXTGW_NAT_RULES_ORDER = 255 +NVP_EXT_PATH = os.path.join(os.path.dirname(__file__), 'extensions') # Provider network extension - allowed network types for the NVP Plugin @@ -177,6 +179,9 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2, 'default': self._nvp_delete_port} } + # If no api_extensions_path is provided set the following + if not cfg.CONF.api_extensions_path: + cfg.CONF.set_override('api_extensions_path', NVP_EXT_PATH) self.nvp_opts = cfg.CONF.NVP self.cluster = create_nvp_cluster(cfg.CONF, self.nvp_opts.concurrent_connections, diff --git a/quantum/tests/unit/nicira/etc/quantum.conf.test b/quantum/tests/unit/nicira/etc/quantum.conf.test new file mode 100644 index 000000000..aa7163380 --- /dev/null +++ b/quantum/tests/unit/nicira/etc/quantum.conf.test @@ -0,0 +1,31 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = True + +# Show debugging output in logs (sets DEBUG log level output) +debug = False + +# Address to bind the API server +bind_host = 0.0.0.0 + +# Port the bind the API server to +bind_port = 9696 + +# MISSING Path to the extensions +# api_extensions_path = + +# Paste configuration file +api_paste_config = api-paste.ini.test + +# The messaging module to use, defaults to kombu. +rpc_backend = quantum.openstack.common.rpc.impl_fake + +lock_path = $state_path/lock + +[DATABASE] +sql_connection = 'sqlite:///:memory:' + +[default_servicetype] +description = "default service type" +service_definition=dummy:quantum.tests.unit.dummy_plugin.QuantumDummyPlugin + diff --git a/quantum/tests/unit/nicira/test_nvpopts.py b/quantum/tests/unit/nicira/test_nvpopts.py index e0b99f3b2..c32aaa4ef 100644 --- a/quantum/tests/unit/nicira/test_nvpopts.py +++ b/quantum/tests/unit/nicira/test_nvpopts.py @@ -28,6 +28,8 @@ from quantum.plugins.nicira import nvp_cluster BASE_CONF_PATH = os.path.join(os.path.dirname(__file__), '../../etc/quantum.conf.test') +NVP_BASE_CONF_PATH = os.path.join(os.path.dirname(__file__), + 'etc/quantum.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__), @@ -136,6 +138,14 @@ class ConfigurationTest(testtools.TestCase): self.assertIsNone(cfg.CONF.default_l2_gw_service_uuid) self.assertEqual('breth0', cfg.CONF.default_interface_name) + 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) + # Load the configuration, and initialize the plugin + QuantumManager().get_plugin() + self.assertIn('extensions', cfg.CONF.api_extensions_path) + class OldConfigurationTest(testtools.TestCase):