• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python config.parse函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.common.config.parse函数的典型用法代码示例。如果您正苦于以下问题:Python parse函数的具体用法?Python parse怎么用?Python parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_load_plugin_with_full_options

 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", PLUGIN_NAME)
     plugin = NeutronManager().get_plugin()
     cluster = plugin.cluster
     self._assert_required_options(cluster)
     self._assert_extra_options(cluster)
开发者ID:vnaum,项目名称:neutron,代码行数:7,代码来源:test_nvpopts.py


示例2: main

def main():
    eventlet.monkey_patch()

    # the configuration will be read into the cfg.CONF global data structure
    config.parse(sys.argv[1:])
    if not cfg.CONF.config_file:
        sys.exit(
            _(
                "ERROR: Unable to find configuration file via the default"
                " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
                " the '--config-file' option!"
            )
        )
    try:
        pool = eventlet.GreenPool()

        neutron_api = service.serve_wsgi(service.NeutronApiService)
        api_thread = pool.spawn(neutron_api.wait)

        try:
            neutron_rpc = service.serve_rpc()
        except NotImplementedError:
            LOG.info(_("RPC was already started in parent process by plugin."))
        else:
            rpc_thread = pool.spawn(neutron_rpc.wait)

            # api and rpc should die together.  When one dies, kill the other.
            rpc_thread.link(lambda gt: api_thread.kill())
            api_thread.link(lambda gt: rpc_thread.kill())

        pool.waitall()
    except KeyboardInterrupt:
        pass
    except RuntimeError as e:
        sys.exit(_("ERROR: %s") % e)
开发者ID:wputra,项目名称:MOS-centos,代码行数:35,代码来源:__init__.py


示例3: test_agent_extensions

 def test_agent_extensions(self):
     q_config.parse(["--config-file", NVP_BASE_CONF_PATH, "--config-file", NVP_INI_FULL_PATH])
     cfg.CONF.set_override("core_plugin", PLUGIN_NAME)
     self.assertEqual(config.AgentModes.AGENT, cfg.CONF.NVP.agent_mode)
     plugin = NeutronManager().get_plugin()
     self.assertIn("agent", plugin.supported_extension_aliases)
     self.assertIn("dhcp_agent_scheduler", plugin.supported_extension_aliases)
开发者ID:vnaum,项目名称:neutron,代码行数:7,代码来源:test_nvpopts.py


示例4: 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
        args = ['--config-file', test_extensions.etcdir('neutron.conf.test')]
        config.parse(args=args)

        # 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()
        db.configure_db()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
开发者ID:Doude,项目名称:neutron,代码行数:33,代码来源:test_quota_ext.py


示例5: 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()
开发者ID:Doude,项目名称:neutron,代码行数:34,代码来源:test_routerserviceinsertion.py


示例6: test_load_api_extensions

 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', PLUGIN_NAME)
     # Load the configuration, and initialize the plugin
     NeutronManager().get_plugin()
     self.assertIn('extensions', cfg.CONF.api_extensions_path)
开发者ID:ader1990,项目名称:neutron,代码行数:7,代码来源:test_nvpopts.py


示例7: 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
        args = ["--config-file", test_api_v2.etcdir("neutron.conf.test")]
        config.parse(args=args)

        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(cfg.CONF.reset)
        self.addCleanup(self.restore_attribute_map)

        quota.QUOTAS._driver = None
        cfg.CONF.set_override("quota_driver", "neutron.quota.ConfDriver", group="QUOTAS")
开发者ID:Juniper,项目名称:neutron,代码行数:35,代码来源:test_extension_extended_attribute.py


示例8: setUp

    def setUp(self):
        super(LoadBalancerExtensionTestCase, self).setUp()
        plugin = 'neutron.extensions.loadbalancer.LoadBalancerPluginBase'
        # Ensure 'stale' patched copies of the plugin are never returned
        manager.NeutronManager._instance = None

        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        # Create the default configurations
        args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
        config.parse(args)

        #just stubbing core plugin with LoadBalancer plugin
        cfg.CONF.set_override('core_plugin', plugin)
        cfg.CONF.set_override('service_plugins', [plugin])

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()
        instance = self.plugin.return_value
        instance.get_plugin_type.return_value = constants.LOADBALANCER

        ext_mgr = LoadBalancerTestExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
        super(LoadBalancerExtensionTestCase, self).setUp()
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:26,代码来源:test_loadbalancer_plugin.py


示例9: setUp

    def setUp(self):
        super(VpnaasExtensionTestCase, self).setUp()
        plugin = 'neutron.extensions.vpnaas.VPNPluginBase'

        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        # Create the default configurations
        args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
        config.parse(args)

        #just stubbing core plugin with LoadBalancer plugin
        self.setup_coreplugin(plugin)
        cfg.CONF.set_override('service_plugins', [plugin])

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()
        instance = self.plugin.return_value
        instance.get_plugin_type.return_value = constants.VPN

        ext_mgr = VpnaasTestExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
        super(VpnaasExtensionTestCase, self).setUp()

        quota.QUOTAS._driver = None
        cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
                              group='QUOTAS')
开发者ID:yuhui7red,项目名称:neutron,代码行数:28,代码来源:test_vpnaas_extension.py


示例10: setUp

 def setUp(self):
     super(NeutronManagerTestCase, self).setUp()
     args = ["--config-file", etcdir("neutron.conf.test")]
     # If test_config specifies some config-file, use it, as well
     config.parse(args=args)
     NeutronManager._instance = None
     self.addCleanup(cfg.CONF.reset)
     self.useFixture(fixtures.MonkeyPatch("neutron.manager.NeutronManager._instance"))
开发者ID:jtaleric,项目名称:neutron,代码行数:8,代码来源:test_neutron_manager.py


示例11: setUp

 def setUp(self):
     super(NeutronManagerTestCase, self).setUp()
     args = ['--config-file', etcdir('neutron.conf.test')]
     # If test_config specifies some config-file, use it, as well
     config.parse(args=args)
     self.setup_coreplugin()
     self.useFixture(
         fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance'))
开发者ID:CingHu,项目名称:neutron-1,代码行数:8,代码来源:test_neutron_manager.py


示例12: setUp

    def setUp(self):
        # Point config file to: neutron/tests/etc/neutron.conf.test
        args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
        config.parse(args=args)

        super(TestCiscoPluginModel, self).setUp()

        self.addCleanup(cisco_config.CONF.reset)
开发者ID:50infivedays,项目名称:neutron,代码行数:8,代码来源:test_plugin_model.py


示例13: test_agentless_extensions

 def test_agentless_extensions(self):
     self.skipTest("Enable once agentless support is added")
     q_config.parse(["--config-file", NVP_BASE_CONF_PATH, "--config-file", NVP_INI_AGENTLESS_PATH])
     cfg.CONF.set_override("core_plugin", PLUGIN_NAME)
     self.assertEqual(config.AgentModes.AGENTLESS, cfg.CONF.NVP.agent_mode)
     plugin = NeutronManager().get_plugin()
     self.assertNotIn("agent", plugin.supported_extension_aliases)
     self.assertNotIn("dhcp_agent_scheduler", plugin.supported_extension_aliases)
开发者ID:vnaum,项目名称:neutron,代码行数:8,代码来源:test_nvpopts.py


示例14: config_parse

 def config_parse(conf=None, args=None):
     """Create the default configurations."""
     # neutron.conf.test includes rpc_backend which needs to be cleaned up
     if args is None:
         args = ['--config-file', etcdir('neutron.conf.test')]
     if conf is None:
         config.parse(args=args)
     else:
         conf(args)
开发者ID:hellochosen,项目名称:neutron,代码行数:9,代码来源:base.py


示例15: test_agentless_extensions_version_fail

 def test_agentless_extensions_version_fail(self):
     q_config.parse(['--config-file', BASE_CONF_PATH,
                     '--config-file', NSX_INI_AGENTLESS_PATH])
     cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
     self.assertEqual(config.AgentModes.AGENTLESS,
                      cfg.CONF.NSX.agent_mode)
     with mock.patch.object(client.NsxApiClient,
                            'get_version',
                            return_value=version.Version("3.2")):
         self.assertRaises(exceptions.NsxPluginException, NeutronManager)
开发者ID:CingHu,项目名称:neutron-1,代码行数:10,代码来源:test_nsx_opts.py


示例16: 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)
开发者ID:JoeMido,项目名称:neutron,代码行数:10,代码来源:test_extensions.py


示例17: main

def main():
    cfg.CONF.register_cli_opts(OPTS)
    cfg.CONF.set_override('use_stderr', True)
    config.setup_logging(cfg.CONF)
    config.parse(sys.argv[1:], default_config_files=[])

    if cfg.CONF.config_file:
        enable_tests_from_config()

    return 0 if all_tests_passed() else 1
开发者ID:KumarAcharya,项目名称:neutron,代码行数:10,代码来源:sanity_check.py


示例18: test_load_plugin_with_deprecated_options

 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", PLUGIN_NAME)
     plugin = NeutronManager().get_plugin()
     cluster = plugin.cluster
     self._assert_required_options(cluster)
     # Verify nvp_controller_connection has been fully parsed
     self.assertEqual(4, cluster.req_timeout)
     self.assertEqual(3, cluster.http_timeout)
     self.assertEqual(2, cluster.retries)
     self.assertEqual(1, cluster.redirects)
开发者ID:vnaum,项目名称:neutron,代码行数:11,代码来源:test_nvpopts.py


示例19: test_agent_extensions

 def test_agent_extensions(self):
     q_config.parse(['--config-file', BASE_CONF_PATH,
                     '--config-file', NSX_INI_FULL_PATH])
     cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
     self.assertEqual(config.AgentModes.AGENT,
                      cfg.CONF.NSX.agent_mode)
     plugin = NeutronManager().get_plugin()
     self.assertIn('agent',
                   plugin.supported_extension_aliases)
     self.assertIn('dhcp_agent_scheduler',
                   plugin.supported_extension_aliases)
开发者ID:CingHu,项目名称:neutron-1,代码行数:11,代码来源:test_nsx_opts.py


示例20: test_load_plugin_with_deprecated_options

 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', PLUGIN_NAME)
     plugin = NeutronManager().get_plugin()
     cluster = plugin.cluster
     # Verify old nvp_* params have been fully parsed
     self._assert_required_options(cluster)
     self.assertEqual(4, cluster.req_timeout)
     self.assertEqual(3, cluster.http_timeout)
     self.assertEqual(2, cluster.retries)
     self.assertEqual(2, cluster.redirects)
开发者ID:CingHu,项目名称:neutron-1,代码行数:12,代码来源:test_nsx_opts.py



注:本文中的neutron.common.config.parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.reset_service函数代码示例发布时间:2022-05-27
下一篇:
Python config.load_paste_app函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap