本文整理汇总了Python中neutron.common.config.load_paste_app函数的典型用法代码示例。如果您正苦于以下问题:Python load_paste_app函数的具体用法?Python load_paste_app怎么用?Python load_paste_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_paste_app函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(ExtensionExtendedAttributeTestCase, self).setUp()
plugin = (
"neutron.tests.unit.api.test_extensions."
"ExtensionExtendedAttributeTestPlugin"
)
# point config file to: neutron/tests/etc/neutron.conf
self.config_parse()
self.setup_coreplugin(plugin)
ext_mgr = extensions.PluginAwareExtensionManager(
extensions_path,
{lib_const.CORE: ExtensionExtendedAttributeTestPlugin()}
)
ext_mgr.extend_resources("2.0", {})
extensions.PluginAwareExtensionManager._instance = ext_mgr
app = config.load_paste_app('extensions_test_app')
self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1"
self.agentscheduler_dbMinxin = directory.get_plugin()
quota.QUOTAS._driver = None
cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
group='QUOTAS')
示例2: setUp
def setUp(self):
super(ExtensionExtendedAttributeTestCase, self).setUp()
plugin = "neutron.tests.unit.test_extension_extended_attribute." "ExtensionExtendedAttributeTestPlugin"
# point config file to: neutron/tests/etc/neutron.conf.test
self.config_parse()
self.setup_coreplugin(plugin)
ext_mgr = extensions.PluginAwareExtensionManager(
extensions_path, {constants.CORE: ExtensionExtendedAttributeTestPlugin}
)
ext_mgr.extend_resources("2.0", {})
extensions.PluginAwareExtensionManager._instance = ext_mgr
app = config.load_paste_app("extensions_test_app")
self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1"
# Save the global RESOURCE_ATTRIBUTE_MAP
self.saved_attr_map = {}
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
self.saved_attr_map[resource] = attrs.copy()
# Add the resources to the global attribute map
# This is done here as the setup process won't
# initialize the main API router which extends
# the global attribute map
attributes.RESOURCE_ATTRIBUTE_MAP.update(extattr.EXTENDED_ATTRIBUTES_2_0)
self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
self.addCleanup(self.restore_attribute_map)
quota.QUOTAS._driver = None
cfg.CONF.set_override("quota_driver", "neutron.quota.ConfDriver", group="QUOTAS")
示例3: setUp
def setUp(self):
super(QuotaExtensionTestCase, self).setUp()
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
self.useFixture(tools.AttributeMapMemento())
# Create the default configurations
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(TARGET_PLUGIN)
cfg.CONF.set_override(
'quota_items',
['network', 'subnet', 'port', 'extra1'],
group='QUOTAS')
quota.QUOTAS = quota.QuotaEngine()
quota.register_resources_from_config()
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()
self.plugin.return_value.supported_extension_aliases = ['quotas']
# QUOTAS will register the items in conf when starting
# extra1 here is added later, so have to do it manually
resource_registry.register_resource_by_name('extra1')
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
app = config.load_paste_app('extensions_test_app')
ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self.api = webtest.TestApp(ext_middleware)
# Initialize the router for the core API in order to ensure core quota
# resources are registered
router.APIRouter()
示例4: setUp
def setUp(self):
super(RouterServiceInsertionTestCase, self).setUp()
plugin = (
"neutron.tests.unit.test_routerserviceinsertion."
"RouterServiceInsertionTestPlugin"
)
# point config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
#just stubbing core plugin with LoadBalancer plugin
self.setup_coreplugin(plugin)
cfg.CONF.set_override('service_plugins', [])
cfg.CONF.set_override('quota_router', -1, group='QUOTAS')
self.addCleanup(cfg.CONF.reset)
# Ensure existing ExtensionManager is not used
ext_mgr = extensions.PluginAwareExtensionManager(
extensions_path,
{constants.LOADBALANCER: RouterServiceInsertionTestPlugin()}
)
extensions.PluginAwareExtensionManager._instance = ext_mgr
router.APIRouter()
app = config.load_paste_app('extensions_test_app')
self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1"
self._service_type_id = _uuid()
self._setup_core_resources()
示例5: setUp
def setUp(self, core_plugin=None, flowclassifier_plugin=None,
ext_mgr=None):
mock_log_p = mock.patch.object(fdb, 'LOG')
self.mock_log = mock_log_p.start()
cfg.CONF.register_opts(fc_ext.flow_classifier_quota_opts, 'QUOTAS')
if not flowclassifier_plugin:
flowclassifier_plugin = DB_FLOWCLASSIFIER_PLUGIN_CLASS
service_plugins = {
fc_ext.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
}
fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
fc_ext.FLOW_CLASSIFIER_EXT]
fdb.FlowClassifierDbPlugin.path_prefix = (
fc_ext.FLOW_CLASSIFIER_PREFIX
)
super(FlowClassifierDbPluginTestCase, self).setUp(
ext_mgr=ext_mgr,
plugin=core_plugin,
service_plugins=service_plugins
)
if not ext_mgr:
self.flowclassifier_plugin = importutils.import_object(
flowclassifier_plugin)
ext_mgr = api_ext.PluginAwareExtensionManager(
extensions_path,
{fc_ext.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin}
)
app = config.load_paste_app('extensions_test_app')
self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
示例6: setUp
def setUp(self):
super(DetailQuotaExtensionTestCase, self).setUp()
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
self.useFixture(fixture.APIDefinitionFixture())
# Create the default configurations
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin('ml2')
quota.QUOTAS = quota.QuotaEngine()
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()
self.plugin.return_value.supported_extension_aliases = \
['quotas', 'quota_details']
# QUOTAS will register the items in conf when starting
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
app = config.load_paste_app('extensions_test_app')
ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self.api = webtest.TestApp(ext_middleware)
# Initialize the router for the core API in order to ensure core quota
# resources are registered
router.APIRouter()
示例7: setUp
def setUp(self):
super(QuotaExtensionTestCase, self).setUp()
# Ensure existing ExtensionManager is not used
extensions.PluginAwareExtensionManager._instance = None
# Save the global RESOURCE_ATTRIBUTE_MAP
self.saved_attr_map = {}
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(TARGET_PLUGIN)
cfg.CONF.set_override(
'quota_items',
['network', 'subnet', 'port', 'extra1'],
group='QUOTAS')
quota.QUOTAS = quota.QuotaEngine()
quota.register_resources_from_config()
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()
self.plugin.return_value.supported_extension_aliases = ['quotas']
# QUOTAS will register the items in conf when starting
# extra1 here is added later, so have to do it manually
quota.QUOTAS.register_resource_by_name('extra1')
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
app = config.load_paste_app('extensions_test_app')
ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self.api = webtest.TestApp(ext_middleware)
示例8: setUp
def setUp(self):
flowclassifier_plugin = (
test_flowclassifier_db.DB_FLOWCLASSIFIER_PLUGIN_CLASS)
service_plugins = {
flowclassifier.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
}
fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
flowclassifier.FLOW_CLASSIFIER_EXT]
fdb.FlowClassifierDbPlugin.path_prefix = (
flowclassifier.FLOW_CLASSIFIER_PREFIX
)
super(OVSFlowClassifierDriverTestCase, self).setUp(
ext_mgr=None,
plugin=None,
service_plugins=service_plugins
)
self.flowclassifier_plugin = importutils.import_object(
flowclassifier_plugin)
ext_mgr = api_ext.PluginAwareExtensionManager(
test_flowclassifier_db.extensions_path,
{
flowclassifier.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin
}
)
app = config.load_paste_app('extensions_test_app')
self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
self.ctx = context.get_admin_context()
self.driver = driver.OVSFlowClassifierDriver()
self.driver.initialize()
示例9: setup_extensions_middleware
def setup_extensions_middleware(extension_manager=None):
extension_manager = (extension_manager or
extensions.PluginAwareExtensionManager(
extensions_path,
{constants.CORE: FakePluginWithExtension()}))
base.BaseTestCase.config_parse()
app = config.load_paste_app('extensions_test_app')
return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)
示例10: setUp
def setUp(self):
service_plugins = {'TAG': "neutron.services.tag.tag_plugin.TagPlugin"}
super(TestTagApiBase, self).setUp(service_plugins=service_plugins)
plugin = tag_plugin.TagPlugin()
ext_mgr = extensions.PluginAwareExtensionManager(
extensions_path, {'TAG': plugin}
)
app = config.load_paste_app('extensions_test_app')
self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
示例11: setUp
def setUp(self, plugin=None):
service_plugins = {"metering_plugin_name": DB_METERING_PLUGIN_KLASS}
super(MeteringPluginDbTestCase, self).setUp(plugin=plugin, service_plugins=service_plugins)
self.plugin = metering_plugin.MeteringPlugin()
ext_mgr = extensions.PluginAwareExtensionManager(extensions_path, {constants.METERING: self.plugin})
app = config.load_paste_app("extensions_test_app")
self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
示例12: setup_extensions_middleware
def setup_extensions_middleware(extension_manager=None):
extension_manager = (extension_manager or
extensions.PluginAwareExtensionManager(
extensions_path,
{constants.CORE: FakePluginWithExtension()}))
config_file = 'neutron.conf.test'
args = ['--config-file', etcdir(config_file)]
config.parse(args=args)
app = config.load_paste_app('extensions_test_app')
return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)
示例13: setUp
def setUp(self):
svc_plugins = {'plugin_name': PLUGIN_NAME}
super(TestNetworkIPAvailabilityAPI, self).setUp(
service_plugins=svc_plugins)
self.plugin = plugin_module.NetworkIPAvailabilityPlugin()
ext_mgr = api_ext.PluginAwareExtensionManager(
EXTENSIONS_PATH, {"network-ip-availability": self.plugin}
)
app = config.load_paste_app('extensions_test_app')
self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
示例14: _run_wsgi
def _run_wsgi(app_name):
app = config.load_paste_app(app_name)
if not app:
LOG.error(_LE('No known API applications configured.'))
return
server = wsgi.Server("Neutron")
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
workers=_get_api_workers())
LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
{'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
return server
示例15: _run_wsgi
def _run_wsgi(app_name):
app = config.load_paste_app(app_name)
if not app:
LOG.error(_LE('No known API applications configured.'))
return
app.normalize_url("http://192.168.37.127:9696/v2.0/extensions.json")
server = wsgi.Server("Neutron")
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
workers=_get_api_workers())
LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
{'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
return server