Merge "Ensure API extensions for NVP are loaded by default"
This commit is contained in:
commit
ff36751e1e
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from sqlalchemy.orm import exc as sa_exc
|
from sqlalchemy.orm import exc as sa_exc
|
||||||
@ -71,6 +72,7 @@ LOG = logging.getLogger("QuantumPlugin")
|
|||||||
NVP_NOSNAT_RULES_ORDER = 10
|
NVP_NOSNAT_RULES_ORDER = 10
|
||||||
NVP_FLOATINGIP_NAT_RULES_ORDER = 224
|
NVP_FLOATINGIP_NAT_RULES_ORDER = 224
|
||||||
NVP_EXTGW_NAT_RULES_ORDER = 255
|
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
|
# 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}
|
'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.nvp_opts = cfg.CONF.NVP
|
||||||
self.cluster = create_nvp_cluster(cfg.CONF,
|
self.cluster = create_nvp_cluster(cfg.CONF,
|
||||||
self.nvp_opts.concurrent_connections,
|
self.nvp_opts.concurrent_connections,
|
||||||
|
31
quantum/tests/unit/nicira/etc/quantum.conf.test
Normal file
31
quantum/tests/unit/nicira/etc/quantum.conf.test
Normal file
@ -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
|
||||||
|
|
@ -28,6 +28,8 @@ from quantum.plugins.nicira import nvp_cluster
|
|||||||
|
|
||||||
BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
|
BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
|
||||||
'../../etc/quantum.conf.test')
|
'../../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__),
|
NVP_INI_PATH = os.path.join(os.path.dirname(__file__),
|
||||||
'etc/nvp.ini.basic.test')
|
'etc/nvp.ini.basic.test')
|
||||||
NVP_INI_FULL_PATH = os.path.join(os.path.dirname(__file__),
|
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.assertIsNone(cfg.CONF.default_l2_gw_service_uuid)
|
||||||
self.assertEqual('breth0', cfg.CONF.default_interface_name)
|
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):
|
class OldConfigurationTest(testtools.TestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user