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

Python config.parse函数代码示例

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

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



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

示例1: setUp

    def setUp(self):
        plugin = (
            "quantum.tests.unit.test_routerserviceinsertion."
            "RouterServiceInsertionTestPlugin"
        )

        # point config file to: quantum/tests/etc/quantum.conf.test
        args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
        config.parse(args=args)

        #just stubbing core plugin with LoadBalancer plugin
        cfg.CONF.set_override('core_plugin', plugin)
        cfg.CONF.set_override('service_plugins', [plugin])
        cfg.CONF.set_override('quota_router', -1, group='QUOTAS')

        # Ensure 'stale' patched copies of the plugin are never returned
        quantum.manager.QuantumManager._instance = None
        # 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"

        res = self._do_request('GET', _get_path('service-types'))
        self._service_type_id = res['service_types'][0]['id']
开发者ID:StackOps,项目名称:quantum,代码行数:33,代码来源:test_routerserviceinsertion.py


示例2: setup_extensions_middleware

def setup_extensions_middleware(extension_manager=None):
    extension_manager = extension_manager or PluginAwareExtensionManager(extensions_path, FakePluginWithExtension())
    config_file = "quantum.conf.test"
    args = ["--config-file", etcdir(config_file)]
    config.parse(args=args)
    app = config.load_paste_app("extensions_test_app")
    return ExtensionMiddleware(app, ext_mgr=extension_manager)
开发者ID:vbannai,项目名称:quantum,代码行数:7,代码来源:test_extensions.py


示例3: setUp

    def setUp(self):
        plugin = 'quantum.quantum_plugin_base_v2.QuantumPluginBaseV2'

        # Ensure 'stale' patched copies of the plugin are never returned
        QuantumManager._instance = None

        # Ensure existing ExtensionManager is not used
        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', etcdir('quantum.conf.test')]
        config.parse(args=args)

        # Update the plugin and extensions path
        cfg.CONF.set_override('core_plugin', plugin)
        cfg.CONF.set_override('api_extensions_path', EXTDIR)

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()

        # Instantiate mock plugin and enable the V2attributes extension
        QuantumManager.get_plugin().supported_extension_aliases = ["v2attrs"]

        api = router.APIRouter()
        self.api = webtest.TestApp(api)
开发者ID:ewindisch,项目名称:quantum,代码行数:30,代码来源:test_api_v2.py


示例4: setUp

    def setUp(self):
        super(VPNTestCase, self).setUp()
        plugin = ("quantum.tests.unit.test_vpn.VPNTestPlugin")

        # point config file to: quantum/tests/etc/quantum.conf.test
        args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
        config.parse(args=args)

        #just stubbing core plugin with VPN plugin
        cfg.CONF.set_override('core_plugin', plugin)
        cfg.CONF.set_override('service_plugins', [plugin])
        self.addCleanup(cfg.CONF.reset)

        # Ensure 'stale' patched copies of the plugin are never returned
        quantum.manager.QuantumManager._instance = None

        # Ensure the database is reset between tests
        db._ENGINE = None
        db._MAKER = None
        db.configure_db()
        # Ensure existing ExtensionManager is not used

        ext_mgr = extensions.PluginAwareExtensionManager(
            extensions_path,
            {constants.VPN: VPNTestPlugin()}
        )
        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._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14"
开发者ID:liqin75,项目名称:vse-vpnaas-plugin,代码行数:34,代码来源:test_vpn.py


示例5: setUp

    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = (
            "quantum.tests.unit.test_extension_extended_attribute."
            "ExtensionExtendedAttributeTestPlugin"
        )

        # point config file to: quantum/tests/etc/quantum.conf.test
        args = ['--config-file', test_api_v2.etcdir('quantum.conf.test')]
        config.parse(args=args)

        cfg.CONF.set_override('core_plugin', plugin)

        manager.QuantumManager._instance = None

        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"
        self.addCleanup(cfg.CONF.reset)
开发者ID:Frostman,项目名称:quantum,代码行数:27,代码来源:test_extension_extended_attribute.py


示例6: _setUp2

    def _setUp2(self):
        db._ENGINE = None
        db._MAKER = None
        # Ensure 'stale' patched copies of the plugin are never returned
        manager.QuantumManager._instance = None

        # 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('quantum.conf.test')]
        config.parse(args=args)

        # Update the plugin and extensions path
        cfg.CONF.set_override('core_plugin', TARGET_PLUGIN)
        self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
        self.plugin = self._plugin_patcher.start()
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        l2network_db_v2.initialize()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
开发者ID:FreescaleSemiconductor,项目名称:quantum,代码行数:27,代码来源:test_quota_per_tenant_ext.py


示例7: 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", NVP_PLUGIN_PATH)
     plugin = QuantumManager().get_plugin()
     cluster = plugin.cluster
     self._assert_required_options(cluster)
     self._assert_extra_options(cluster)
开发者ID:emagana,项目名称:quantum,代码行数:7,代码来源:test_nvpopts.py


示例8: setUp

    def setUp(self):

        plugin = 'quantum.extensions.l3.RouterPluginBase'

        # Ensure 'stale' patched copies of the plugin are never returned
        manager.QuantumManager._instance = None

        # 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_api_v2.etcdir('quantum.conf.test')]
        config.parse(args=args)

        # Update the plugin and extensions path
        cfg.CONF.set_override('core_plugin', plugin)

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()

        # Instantiate mock plugin and enable the 'router' extension
        manager.QuantumManager.get_plugin().supported_extension_aliases = (
            ["router"])

        ext_mgr = L3TestExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
开发者ID:ewindisch,项目名称:quantum,代码行数:32,代码来源:test_l3_plugin.py


示例9: setUp

    def setUp(self):
        super(NetworkGatewayExtensionTestCase, self).setUp()
        plugin = '%s.%s' % (networkgw.__name__,
                            networkgw.NetworkGatewayPluginBase.__name__)
        self._resource = networkgw.RESOURCE_NAME.replace('-', '_')
        # Ensure 'stale' patched copies of the plugin are never returned
        manager.QuantumManager._instance = None

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

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

        # Update the plugin and extensions path
        cfg.CONF.set_override('core_plugin', plugin)
        self.addCleanup(cfg.CONF.reset)

        _plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = _plugin_patcher.start()
        self.addCleanup(_plugin_patcher.stop)

        # Instantiate mock plugin and enable extensions
        manager.QuantumManager.get_plugin().supported_extension_aliases = (
            [networkgw.EXT_ALIAS])
        ext_mgr = TestExtensionManager()
        PluginAwareExtensionManager._instance = ext_mgr
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
开发者ID:NCU-PDCLAB,项目名称:quantum,代码行数:30,代码来源:test_networkgw.py


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


示例11: setUp

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

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

        # Create the default configurations
        args = ['--config-file', test_api_v2.etcdir('quantum.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:ericwanghp,项目名称:quantum,代码行数:26,代码来源:test_loadbalancer_plugin.py


示例12: setUp

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


示例13: setup_extensions_middleware

def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager or
                         PluginAwareExtensionManager(extensions_path,
                                                     QuantumEchoPlugin()))
    config_file = 'quantum.conf.test'
    args = ['--config-file', etcdir(config_file)]
    config.parse(args=args)
    app = config.load_paste_app('extensions_test_app')
    return ExtensionMiddleware(app, ext_mgr=extension_manager)
开发者ID:Milstein,项目名称:quantum,代码行数:9,代码来源:test_extensions.py


示例14: setup_extensions_middleware

def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager or
                         extensions.PluginAwareExtensionManager(
                             extensions_path,
                             {constants.CORE: FakePluginWithExtension()}))
    config_file = 'quantum.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:Apsu,项目名称:quantum,代码行数:10,代码来源:test_extensions.py


示例15: 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", NVP_PLUGIN_PATH)
     plugin = QuantumManager().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:emagana,项目名称:quantum,代码行数:11,代码来源:test_nvpopts.py


示例16: main

def main():
    # 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 (~/.quantum/, ~/, /etc/quantum/, /etc/) and"
                 " the '--config-file' option!")
    try:
        quantum_service = service.serve_wsgi(service.QuantumApiService)
        quantum_service.wait()
    except RuntimeError, e:
        sys.exit("ERROR: %s" % e)
开发者ID:alexpilotti,项目名称:quantum,代码行数:12,代码来源:__init__.py


示例17: setUp

    def setUp(self):
        plugin = 'quantum.quantum_plugin_base_v2.QuantumPluginBaseV2'
        # Create the default configurations
        args = ['--config-file', etcdir('quantum.conf.test')]
        config.parse(args=args)
        # Update the plugin
        cfg.CONF.set_override('core_plugin', plugin)

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()

        api = router.APIRouter()
        self.api = webtest.TestApp(api)
开发者ID:danhan,项目名称:quantum,代码行数:13,代码来源:test_api_v2.py


示例18: setUp

    def setUp(self, plugin=None):
        super(SecurityGroupsTestCase, self).setUp()
        db._ENGINE = None
        db._MAKER = None
        # Make sure at each test a new instance of the plugin is returned
        QuantumManager._instance = None
        # Make sure at each test according extensions for the plugin is loaded
        PluginAwareExtensionManager._instance = None
        # Save the attributes map in case the plugin will alter it
        # loading extensions
        # Note(salvatore-orlando): shallow copy is not good enough in
        # this case, but copy.deepcopy does not seem to work, since it
        # causes test failures
        self._attribute_map_bk = {}
        for item in attributes.RESOURCE_ATTRIBUTE_MAP:
            self._attribute_map_bk[item] = (attributes.
                                            RESOURCE_ATTRIBUTE_MAP[item].
                                            copy())
        json_deserializer = JSONDeserializer()
        self._deserializers = {
            'application/json': json_deserializer,
        }

        if not plugin:
            plugin = test_config.get('plugin_name_v2', DB_PLUGIN_KLASS)

        # Create the default configurations
        args = ['--config-file', etcdir('quantum.conf.test')]
        # If test_config specifies some config-file, use it, as well
        for config_file in test_config.get('config_files', []):
            args.extend(['--config-file', config_file])
        config.parse(args=args)
        # Update the plugin
        cfg.CONF.set_override('core_plugin', plugin)
        self.api = APIRouter()

        def _is_native_bulk_supported():
            plugin_obj = QuantumManager.get_plugin()
            native_bulk_attr_name = ("_%s__native_bulk_support"
                                     % plugin_obj.__class__.__name__)
            return getattr(plugin_obj, native_bulk_attr_name, False)

        self._skip_native_bulk = not _is_native_bulk_supported()

        QuantumManager.get_plugin().supported_extension_aliases = (
            ["security-groups"])
        ext_mgr = SecurityGroupTestExtensionManager()
        if ext_mgr:
            self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:willfu,项目名称:quantum,代码行数:49,代码来源:test_extension_security_group.py


示例19: setUp

    def setUp(self):
        plugin = 'quantum.plugins.cisco.network_plugin.PluginV2'
        # Create the default configurations
        args = ['--config-file', curdir('quantumv2.conf.cisco.test')]
        config.parse(args=args)
        # Update the plugin
        cfg.CONF.set_override('core_plugin', plugin)

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()

        api = router.APIRouter()
        self.api = webtest.TestApp(api)
        LOG.debug("%s.%s.%s done" % (__name__, self.__class__.__name__,
                                     inspect.stack()[0][3]))
开发者ID:Milstein,项目名称:quantum,代码行数:15,代码来源:test_api_v2.py


示例20: setUp

    def setUp(self):
        plugin = "quantum.plugins.cisco.network_plugin.PluginV2"
        # Ensure 'stale' patched copies of the plugin are never returned
        QuantumManager._instance = None
        # Ensure existing ExtensionManager is not used
        PluginAwareExtensionManager._instance = None
        # Create the default configurations
        args = ["--config-file", curdir("quantumv2.conf.cisco.test")]
        config.parse(args=args)
        # Update the plugin
        cfg.CONF.set_override("core_plugin", plugin)

        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()

        api = router.APIRouter()
        self.api = webtest.TestApp(api)
        LOG.debug("%s.%s.%s done" % (__name__, self.__class__.__name__, inspect.stack()[0][3]))
开发者ID:kumarcv,项目名称:openstack-nf,代码行数:18,代码来源:test_api_v2.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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