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

Python test_extensions.setup_extensions_middleware函数代码示例

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

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



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

示例1: setUp

    def setUp(self):
        super(ProvidernetExtensionTestCase, self).setUp()

        plugin = 'neutron.neutron_plugin_base_v2.NeutronPluginBaseV2'

        # 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()

        # Update the plugin and extensions path
        self.setup_coreplugin(plugin)
        cfg.CONF.set_override('allow_pagination', True)
        cfg.CONF.set_override('allow_sorting', True)
        self._plugin_patcher = mock.patch(plugin, autospec=True)
        self.plugin = self._plugin_patcher.start()
        # Ensure Quota checks never fail because of mock
        instance = self.plugin.return_value
        instance.get_networks_count.return_value = 1
        # Instantiate mock plugin and enable the 'provider' extension
        NeutronManager.get_plugin().supported_extension_aliases = (
            ["provider"])
        ext_mgr = ProviderExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.addCleanup(self._plugin_patcher.stop)
        self.addCleanup(self._restore_attribute_map)
        self.api = webtest.TestApp(router.APIRouter())

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


示例2: setUp

    def setUp(self):
        # 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()
        service_plugins = {
            'lb_plugin_name': test_db_loadbalancer.DB_LB_PLUGIN_KLASS}

        #default provider should support agent scheduling
        cfg.CONF.set_override(
            'service_provider',
            [('LOADBALANCER:lbaas:neutron.services.'
              'loadbalancer.drivers.haproxy.plugin_driver.'
              'HaproxyOnHostPluginDriver:default')],
            'service_providers')

        # need to reload provider configuration
        st_db.ServiceTypeManager._instance = None

        super(LBaaSAgentSchedulerTestCase, self).setUp(
            self.plugin_str, service_plugins=service_plugins)
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
        self.adminContext = context.get_admin_context()
        # 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(
            agent.RESOURCE_ATTRIBUTE_MAP)
        self.addCleanup(self.restore_attribute_map)
开发者ID:50infivedays,项目名称:neutron,代码行数:31,代码来源:test_agent_scheduler.py


示例3: setUp

 def setUp(self, plugin=None):
     ext_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
                             NICIRA_EXT_PATH)
     cfg.CONF.set_override('api_extensions_path', ext_path)
     super(TestNiciraQoSQueue, self).setUp()
     ext_mgr = NvpQoSTestExtensionManager()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:bmadabus,项目名称:neutron,代码行数:7,代码来源:test_nicira_plugin.py


示例4: 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


示例5: setUp

 def setUp(self):
     self._l3_attribute_map_bk = copy.deepcopy(l3.RESOURCE_ATTRIBUTE_MAP)
     ext_mgr = NuageRouterTestExtensionManager()
     super(TestNuageRouterExtTestCase, self).setUp(plugin=_plugin_name,
                                                   ext_mgr=ext_mgr)
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
     self.addCleanup(self.restore_l3_attribute_map)
开发者ID:absolutarin,项目名称:neutron,代码行数:7,代码来源:test_nuage_plugin.py


示例6: 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


示例7: setUp

    def setUp(self):
        # This is needed because otherwise a failure will occur due to
        # nonexisting core_plugin
        self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS)

        cfg.CONF.set_override("service_plugins", ["%s.%s" % (dp.__name__, dp.DummyServicePlugin.__name__)])
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None
        ext_mgr = TestServiceTypeExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
        self.resource_name = servicetype.RESOURCE_NAME.replace("-", "_")
        super(ServiceTypeExtensionTestCaseBase, self).setUp()
开发者ID:waltBB,项目名称:neutron_read,代码行数:13,代码来源:test_servicetype.py


示例8: setUp

    def setUp(self):
        """Configure a log exception counter and an API extension manager."""
        self.log_exc_count = 0

        def _count_exception_logs(*args, **kwargs):
            self.log_exc_count += 1

        mock.patch.object(
            logging.LoggerAdapter,
            "exception",
            autospec=True,
            side_effect=_count_exception_logs,
            wraps=logging.LoggerAdapter.exception,
        ).start()
        super(TestCiscoRouterInterfacesV2, self).setUp()
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:raceli,项目名称:neutron,代码行数:17,代码来源:test_network_plugin.py


示例9: setUp

    def setUp(self, core_plugin=None, sc_plugin=None, service_plugins=None,
              ext_mgr=None):
        extensions.append_api_extensions_path(gbp.neutron.extensions.__path__)
        if not sc_plugin:
            sc_plugin = DB_GP_PLUGIN_KLASS
        self.plugin = importutils.import_object(sc_plugin)
        if not service_plugins:
            service_plugins = {'sc_plugin_name': sc_plugin}

        super(ServiceChainDbTestCase, self).setUp(
            plugin=core_plugin, ext_mgr=ext_mgr,
            service_plugins=service_plugins
        )

        if not ext_mgr:
            ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
            self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:yapengwu,项目名称:group-based-policy,代码行数:17,代码来源:test_servicechain_db.py


示例10: setUp

    def setUp(self):
        # This is needed because otherwise a failure will occur due to
        # nonexisting core_plugin
        cfg.CONF.set_override('core_plugin', test_db_plugin.DB_PLUGIN_KLASS)

        cfg.CONF.set_override('service_plugins',
                              ["%s.%s" % (dp.__name__,
                                          dp.DummyServicePlugin.__name__)])
        self.addCleanup(cfg.CONF.reset)
        # Make sure at each test a new instance of the plugin is returned
        manager.NeutronManager._instance = None
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None
        ext_mgr = TestServiceTypeExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
        self.resource_name = servicetype.RESOURCE_NAME.replace('-', '_')
        super(ServiceTypeExtensionTestCaseBase, self).setUp()
开发者ID:CampHarmony,项目名称:neutron,代码行数:18,代码来源:test_servicetype.py


示例11: setUp

 def setUp(self):
     manager.NeutronManager._instance = None
     extensions.PluginAwareExtensionManager._instance = None
     test_sg_rpc.set_firewall_driver(test_sg_rpc.FIREWALL_HYBRID_DRIVER)
     self.dhcp_notifier_cls_p = mock.patch(
         'neutron.api.rpc.agentnotifiers.dhcp_rpc_agent_api.'
         'DhcpAgentNotifyAPI')
     self.dhcp_notifier = mock.Mock(name='dhcp_notifier')
     self.dhcp_notifier_cls = self.dhcp_notifier_cls_p.start()
     self.dhcp_notifier_cls.return_value = self.dhcp_notifier
     notifier_p = mock.patch(NOTIFIER)
     notifier_cls = notifier_p.start()
     self.notifier = mock.Mock()
     notifier_cls.return_value = self.notifier
     if self.l3_plugin:
         service_plugins = {'l3_plugin_name': self.l3_plugin}
     else:
         service_plugins = None
     super(UosTestCase, self).setUp(
         self.plugin_str, service_plugins=service_plugins)
     ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
     self.adminContext = context.get_admin_context()
     self.addCleanup(mock.patch.stopall)
开发者ID:CingHu,项目名称:neutron-ustack,代码行数:24,代码来源:test_uos.py


示例12: _setUpExtension

    def _setUpExtension(self, plugin, service_type,
                        resource_attribute_map, extension_class,
                        resource_prefix, plural_mappings=None,
                        translate_resource_name=False,
                        allow_pagination=False, allow_sorting=False,
                        supported_extension_aliases=None,
                        use_quota=False,
                        ):

        self._resource_prefix = resource_prefix
        self._plural_mappings = plural_mappings or {}
        self._translate_resource_name = translate_resource_name

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

        # Save the global RESOURCE_ATTRIBUTE_MAP
        self._saved_attr_map = attributes.RESOURCE_ATTRIBUTE_MAP.copy()
        # Restore the global RESOURCE_ATTRIBUTE_MAP
        self.addCleanup(self._resotre_attr_map)

        # Create the default configurations
        self.config_parse()

        #just stubbing core plugin with plugin
        self.setup_coreplugin(plugin)
        cfg.CONF.set_override('core_plugin', plugin)
        if service_type:
            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
        if service_type:
            instance.get_plugin_type.return_value = service_type
        if supported_extension_aliases is not None:
            instance.supported_extension_aliases = supported_extension_aliases
        if allow_pagination:
            cfg.CONF.set_override('allow_pagination', True)
            # instance.__native_pagination_support = True
            native_pagination_attr_name = ("_%s__native_pagination_support"
                                           % instance.__class__.__name__)
            setattr(instance, native_pagination_attr_name, True)
        if allow_sorting:
            cfg.CONF.set_override('allow_sorting', True)
            # instance.__native_sorting_support = True
            native_sorting_attr_name = ("_%s__native_sorting_support"
                                        % instance.__class__.__name__)
            setattr(instance, native_sorting_attr_name, True)
        if use_quota:
            quota.QUOTAS._driver = None
            cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
                                  group='QUOTAS')

        class ExtensionTestExtensionManager(object):
            def get_resources(self):
                # 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(
                    resource_attribute_map)
                return extension_class.get_resources()

            def get_actions(self):
                return []

            def get_request_extensions(self):
                return []

        ext_mgr = ExtensionTestExtensionManager()
        self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
        self.api = webtest.TestApp(self.ext_mdw)
开发者ID:magic0704,项目名称:neutron,代码行数:73,代码来源:test_api_v2_extension.py


示例13: setUp

 def setUp(self):
     """Configure an API extension manager."""
     super(TestCiscoRouterInterfacesV2, self).setUp()
     ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:rchunduru,项目名称:neutron,代码行数:5,代码来源:test_network_plugin.py


示例14: setUp

 def setUp(self, plugin=None, ext_mgr=None):
     super(TestContrailSecurityGroups, self).setUp(self._plugin_name, ext_mgr)
     ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:jdevesa,项目名称:neutron,代码行数:4,代码来源:test_contrail_plugin.py


示例15: setUp

 def setUp(self, plugin=None):
     cfg.CONF.set_override('api_extensions_path', vmware.NSXEXT_PATH)
     super(TestQoSQueue, self).setUp()
     ext_mgr = QoSTestExtensionManager()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:bradleyjones,项目名称:neutron,代码行数:5,代码来源:test_qosqueues.py


示例16: setUp

 def setUp(self):
     ext_mgr = NetPartitionTestExtensionManager()
     super(NetPartitionTestCase, self).setUp()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
开发者ID:bradleyjones,项目名称:neutron,代码行数:4,代码来源:test_netpartition.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python test_security_groups_rpc.set_firewall_driver函数代码示例发布时间:2022-05-27
下一篇:
Python test_api_v2._uuid函数代码示例发布时间: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