当前位置: 首页>>代码示例>>Python>>正文


Python directory.add_plugin方法代码示例

本文整理汇总了Python中neutron_lib.plugins.directory.add_plugin方法的典型用法代码示例。如果您正苦于以下问题:Python directory.add_plugin方法的具体用法?Python directory.add_plugin怎么用?Python directory.add_plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neutron_lib.plugins.directory的用法示例。


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

示例1: setUp

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def setUp(self):
        super(TestIPsecDriver, self).setUp()
        mock.patch('neutron_lib.rpc.Connection').start()

        l3_agent = mock.Mock()
        l3_agent.host = FAKE_HOST
        plugin = mock.Mock()
        plugin.get_l3_agents_hosting_routers.return_value = [l3_agent]
        directory.add_plugin(constants.CORE, plugin)
        directory.add_plugin(constants.L3, plugin)
        self.svc_plugin = mock.Mock()
        self.svc_plugin.get_l3_agents_hosting_routers.return_value = [l3_agent]
        self._fake_vpn_router_id = _uuid()
        self.svc_plugin._get_vpnservice.return_value = {
            'router_id': self._fake_vpn_router_id
        }
        self.driver = ipsec_driver.IPsecVPNDriver(self.svc_plugin)
        self.validator = ipsec_validator.IpsecVpnValidator(self.driver)
        self.context = n_ctx.get_admin_context() 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:21,代码来源:test_ipsec.py

示例2: test_get_provider_for_flavor_id_provider_not_found

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_get_provider_for_flavor_id_provider_not_found(self):
        FLAVOR_ID = _uuid()
        FAKE_FLAVOR = {'id': FLAVOR_ID,
                       'service_type': p_constants.VPN,
                       'enabled': True}
        PROVIDERS = [{'provider': 'SOME_PROVIDER'}]
        directory.add_plugin(p_constants.FLAVORS,
                             flavors_plugin.FlavorsPlugin())
        mock.patch(
            'neutron.services.flavors.flavors_plugin.FlavorsPlugin.get_flavor',
            return_value=FAKE_FLAVOR).start()
        mock.patch(
            'neutron.services.flavors.flavors_plugin.'
            'FlavorsPlugin.get_flavor_next_provider',
            return_value=PROVIDERS).start()
        with self.vpnservices_providers_set():
            driver_plugin = vpn_plugin.VPNDriverPlugin()
            self.assertRaises(
                vpn_flavors.NoProviderFoundForFlavor,
                driver_plugin._get_provider_for_flavor,
                self.adminContext,
                FLAVOR_ID) 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:24,代码来源:test_plugin.py

示例3: test_get_provider_for_flavor_id

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_get_provider_for_flavor_id(self):
        FLAVOR_ID = _uuid()
        FAKE_FLAVOR = {'id': FLAVOR_ID,
                       'service_type': p_constants.VPN,
                       'enabled': True}
        PROVIDERS = [{'provider': 'dummy'}]
        directory.add_plugin(p_constants.FLAVORS,
                             flavors_plugin.FlavorsPlugin())
        mock.patch(
            'neutron.services.flavors.flavors_plugin.FlavorsPlugin.get_flavor',
            return_value=FAKE_FLAVOR).start()
        mock.patch(
            'neutron.services.flavors.flavors_plugin.'
            'FlavorsPlugin.get_flavor_next_provider',
            return_value=PROVIDERS).start()
        with self.vpnservices_providers_set():
            driver_plugin = vpn_plugin.VPNDriverPlugin()
            self.assertEqual(
                'dummy',
                driver_plugin._get_provider_for_flavor(
                    self.adminContext, FLAVOR_ID)) 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:23,代码来源:test_plugin.py

示例4: _mock_l2_resources

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def _mock_l2_resources(self):
        expected_journal = {odl_const.ODL_NETWORK: '1',
                            odl_const.ODL_SUBNET: '2',
                            odl_const.ODL_PORT: '3'}
        network_id = expected_journal[odl_const.ODL_NETWORK]
        plugin = mock.Mock()
        plugin.get_networks.return_value = [{'id': network_id}]
        plugin.get_subnets.return_value = [
            {'id': expected_journal[odl_const.ODL_SUBNET],
             'network_id': network_id}]
        port = {'id': expected_journal[odl_const.ODL_PORT],
                odl_const.ODL_SGS: None,
                'tenant_id': '123',
                'fixed_ips': [],
                'network_id': network_id}
        plugin.get_ports.side_effect = ([port], [])
        directory.add_plugin(constants.CORE, plugin)
        return expected_journal 
开发者ID:openstack,项目名称:networking-odl,代码行数:20,代码来源:test_full_sync.py

示例5: setUp

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def setUp(self):
        self._extension_drivers.append('qos')
        super(TestDFTrunkDriver, self).setUp()
        drivers_patch = mock.patch.object(trunk_drivers, 'register')
        self.addCleanup(drivers_patch.stop)
        drivers_patch.start()

        compat_patch = mock.patch.object(
            trunk_plugin.TrunkPlugin, 'check_compatibility')
        self.addCleanup(compat_patch.stop)
        compat_patch.start()

        self.trunk_plugin = trunk_plugin.TrunkPlugin()
        self.trunk_plugin.add_segmentation_type('vlan', lambda x: True)
        cfg.CONF.set_override('mechanism_drivers', 'df', group='ml2')
        directory.add_plugin('trunk', self.trunk_plugin)
        self.df_driver = self.mech_driver.trunk_driver 
开发者ID:openstack,项目名称:dragonflow,代码行数:19,代码来源:test_trunk_driver.py

示例6: test_get_provider_for_flavor_id_invalid_type

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_get_provider_for_flavor_id_invalid_type(self):
        FAKE_FLAVOR = {'service_type': 'NOT_VPN'}
        directory.add_plugin(p_constants.FLAVORS,
                             flavors_plugin.FlavorsPlugin())
        mock.patch(
            'neutron.services.flavors.flavors_plugin.FlavorsPlugin.get_flavor',
            return_value=FAKE_FLAVOR).start()
        with self.vpnservices_providers_set():
            driver_plugin = vpn_plugin.VPNDriverPlugin()
            self.assertRaises(
                lib_exc.InvalidServiceType,
                driver_plugin._get_provider_for_flavor,
                self.adminContext,
                _uuid()) 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:16,代码来源:test_plugin.py

示例7: test_get_provider_for_flavor_id_flavor_disabled

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_get_provider_for_flavor_id_flavor_disabled(self):
        FAKE_FLAVOR = {'service_type': p_constants.VPN,
                       'enabled': False}
        directory.add_plugin(p_constants.FLAVORS,
                             flavors_plugin.FlavorsPlugin())
        mock.patch(
            'neutron.services.flavors.flavors_plugin.FlavorsPlugin.get_flavor',
            return_value=FAKE_FLAVOR).start()
        with self.vpnservices_providers_set():
            driver_plugin = vpn_plugin.VPNDriverPlugin()
            self.assertRaises(
                flav_exc.FlavorDisabled,
                driver_plugin._get_provider_for_flavor,
                self.adminContext,
                _uuid()) 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:17,代码来源:test_plugin.py

示例8: setUp

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def setUp(self):
        super(TestVpnValidation, self).setUp()
        self.l3_plugin = mock.Mock()
        self.core_plugin = mock.Mock()
        directory.add_plugin(nconstants.CORE, self.core_plugin)
        directory.add_plugin(nconstants.L3, self.l3_plugin)
        self.context = n_ctx.Context('some_user', 'some_tenant')
        self.validator = vpn_validator.VpnReferenceValidator()
        self.router = mock.Mock()
        self.router.gw_port = {'fixed_ips': [{'ip_address': '10.0.0.99'}]} 
开发者ID:openstack,项目名称:neutron-vpnaas,代码行数:12,代码来源:test_vpn_validator.py

示例9: setUp

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def setUp(self):
        super(TestBgpSpeakerRpcCallback, self).setUp()
        self.plugin = mock.Mock()
        directory.add_plugin(bgp_ext.BGP_EXT_ALIAS, self.plugin)
        self.callback = bgp_speaker_rpc.BgpSpeakerRpcCallback() 
开发者ID:openstack,项目名称:neutron-dynamic-routing,代码行数:7,代码来源:test_bgp_speaker_rpc.py

示例10: test_l2gateway_con_create_with_invalid_net_id

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_l2gateway_con_create_with_invalid_net_id(self):
        """Test l2 gateway connection create with invalid net id."""
        name = "l2gw_con2"
        device_name = "device_name2"
        data_l2gw = self._get_l2_gateway_data(name,
                                              device_name)
        gw = self._create_l2gateway(data_l2gw)
        net_id = 'invalid_net_id'
        l2gw_id = gw['id']
        data_con = {self.con_resource: {'l2_gateway_id': l2gw_id,
                                        'network_id': net_id}}
        directory.add_plugin('CORE', self.plugin)
        self.assertRaises(exc.NetworkNotFound,
                          self._validate_l2_gateway_connection_for_create,
                          data_con) 
开发者ID:openstack,项目名称:networking-l2gw,代码行数:17,代码来源:test_l2gw_db.py

示例11: test_l2gw_callback_update_port

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_l2gw_callback_update_port(self):
        service_plugin = mock.Mock()
        directory.add_plugin(constants.L2GW, service_plugin)
        fake_context = mock.Mock()
        fake_port = mock.Mock()
        fake_kwargs = {'context': fake_context,
                       'port': fake_port}
        l2gateway_db.l2gw_callback(resources.PORT,
                                   events.AFTER_UPDATE,
                                   mock.Mock(),
                                   **fake_kwargs)
        self.assertTrue(service_plugin.add_port_mac.called) 
开发者ID:openstack,项目名称:networking-l2gw,代码行数:14,代码来源:test_l2gw_db.py

示例12: test_l2gw_callback_delete_port

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def test_l2gw_callback_delete_port(self):
        service_plugin = mock.Mock()
        directory.add_plugin(constants.L2GW, service_plugin)
        fake_context = mock.Mock()
        fake_port = mock.Mock()
        fake_kwargs = {'context': fake_context,
                       'port': fake_port}
        l2gateway_db.l2gw_callback(resources.PORT,
                                   events.AFTER_DELETE,
                                   mock.Mock(),
                                   **fake_kwargs)
        self.assertTrue(service_plugin.delete_port_mac.called) 
开发者ID:openstack,项目名称:networking-l2gw,代码行数:14,代码来源:test_l2gw_db.py

示例13: setUp

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def setUp(self):
        self.useFixture(nlib_fixture.PluginDirectoryFixture())
        super(QoSDriverTests, self).setUp()
        self.qos_plug = qos_plugin.QoSPlugin()
        directory.add_plugin('QOS', self.qos_plug)
        ext_mgr = QoSTestExtensionManager()
        self.resource_prefix_map = {'policies': '/qos'}
        self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
        tenant_id = uuidutils.generate_uuid()
        self.policy_data = {
            'policy': {'name': 'test-policy', 'tenant_id': tenant_id}} 
开发者ID:openstack,项目名称:networking-odl,代码行数:13,代码来源:test_qos.py

示例14: _clean_registered_plugins

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def _clean_registered_plugins(self):
        for plugin_type in self._get_all_plugins().keys():
            directory.add_plugin(plugin_type, None) 
开发者ID:openstack,项目名称:networking-odl,代码行数:5,代码来源:test_full_sync.py

示例15: _test_full_sync_resources

# 需要导入模块: from neutron_lib.plugins import directory [as 别名]
# 或者: from neutron_lib.plugins.directory import add_plugin [as 别名]
def _test_full_sync_resources(self, expected_journal):
        self._mock_canary_missing()
        directory.add_plugin(constants.CORE, mock.Mock())
        full_sync.full_sync(self.db_context)

        rows = self._assert_canary_created()
        rows = self._filter_out_canary(rows)
        self.assertItemsEqual(expected_journal.keys(),
                              [row['object_type'] for row in rows])
        for row in rows:
            self.assertEqual(expected_journal[row['object_type']],
                             row['object_uuid']) 
开发者ID:openstack,项目名称:networking-odl,代码行数:14,代码来源:test_full_sync.py


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