本文整理汇总了Python中neutron.tests.unit.api.test_extensions.setup_extensions_middleware函数的典型用法代码示例。如果您正苦于以下问题:Python setup_extensions_middleware函数的具体用法?Python setup_extensions_middleware怎么用?Python setup_extensions_middleware使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup_extensions_middleware函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
self.useFixture(tools.AttributeMapMemento())
# 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
manager.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.api = webtest.TestApp(router.APIRouter())
quota.QUOTAS._driver = None
cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
group='QUOTAS')
示例2: setUp
def setUp(self, plugin=None, ext_mgr=None):
service_plugins = {'l2gw_plugin_name': MN_PLUGIN_KLASS,
'gateway_device_plugin_name':
test_gw.DB_GATEWAY_DEVICE_PLUGIN_KLASS}
l2gw_provider = (l2gw_consts.L2GW + ':' +
mido_const.MIDONET_L2GW_PROVIDER +
':' + MN_DRIVER_KLASS + ':default')
mock.patch.object(provconf.NeutronModule, 'service_providers',
return_value=[l2gw_provider]).start()
manager = st_db.ServiceTypeManager.get_instance()
manager.add_provider_configuration(
l2gw_consts.L2GW, provconf.ProviderConfiguration())
l2_gw_mgr = MidonetL2GatewayTestExtensionManager()
super(MidonetL2GatewayTestCase, self).setUp(
service_plugins=service_plugins, ext_mgr=l2_gw_mgr)
self.ext_api = test_ex.setup_extensions_middleware(l2_gw_mgr)
network = self._make_network(self.fmt, 'net1', True)
self._network_id = network['network']['id']
self._subnet = self._make_subnet(self.fmt, network, "10.0.0.1",
'10.0.0.0/24')
self._subnet_id = self._subnet['subnet']['id']
router1 = self._make_router('json', str(uuid.uuid4()),
'router1', True)
self._router_id = router1['router']['id']
router2 = self._make_router('json', str(uuid.uuid4()),
'router2', True)
self._router_id2 = router2['router']['id']
示例3: 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_lbaas.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)
示例4: setUp
def setUp(self):
super(TestOvnNbSync, self).setUp()
ext_mgr = test_extraroute.ExtraRouteTestExtensionManager()
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
self.create_lswitches = []
self.create_lswitch_ports = []
self.create_lrouters = []
self.create_lrouter_ports = []
self.create_lrouter_routes = []
self.update_lrouter_ports = []
self.create_acls = []
self.delete_lswitches = []
self.delete_lswitch_ports = []
self.delete_lrouters = []
self.delete_lrouter_ports = []
self.delete_lrouter_routes = []
self.delete_acls = []
self.create_address_sets = []
self.delete_address_sets = []
self.update_address_sets = []
self.expected_dhcp_options_rows = []
self.reset_lport_dhcpv4_options = []
self.reset_lport_dhcpv6_options = []
self.stale_lport_dhcpv4_options = []
self.stale_lport_dhcpv6_options = []
self.orphaned_lport_dhcp_options = []
self.lport_dhcpv4_disabled = {}
self.lport_dhcpv6_disabled = {}
self.missed_dhcp_options = []
self.dirty_dhcp_options = []
示例5: setUp
def setUp(self):
# Save the global RESOURCE_ATTRIBUTE_MAP
self.saved_attr_map = {}
for res, attrs in six.iteritems(attributes.RESOURCE_ATTRIBUTE_MAP):
self.saved_attr_map[res] = attrs.copy()
service_plugins = {
'lb_plugin_name': test_db_loadbalancerv2.DB_LB_PLUGIN_CLASS}
# default provider should support agent scheduling
self.set_override(
[('LOADBALANCERV2:lbaas:neutron_lbaas.drivers.haproxy.'
'plugin_driver.HaproxyOnHostPluginDriver:default')])
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.lbaas_plugin = manager.NeutronManager.get_service_plugins()[
plugin_const.LOADBALANCERV2]
self.core_plugin = manager.NeutronManager.get_plugin()
self.addCleanup(self.restore_attribute_map)
示例6: 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
self.useFixture(fixture.APIDefinitionFixture())
# Update the plugin and extensions path
self.setup_coreplugin(plugin, load_plugins=False)
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
# Register mock plugin and enable the 'provider' extension
instance.supported_extension_aliases = ["provider"]
directory.add_plugin(constants.CORE, instance)
ext_mgr = ProviderExtensionManager()
self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
self.addCleanup(self._plugin_patcher.stop)
self.api = webtest.TestApp(router.APIRouter())
quota.QUOTAS._driver = None
cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
group='QUOTAS')
示例7: setUp
def setUp(self, plugin=None, service_plugins=None, ext_mgr=None):
service_plugins = {
'gateway_device_plugin_name': DB_GATEWAY_DEVICE_PLUGIN_KLASS}
gw_dev_mgr = GatewayDeviceTestExtensionManager()
super(GatewayDeviceTestCase,
self).setUp(service_plugins=service_plugins,
ext_mgr=gw_dev_mgr)
self.ext_api = test_ex.setup_extensions_middleware(gw_dev_mgr)
network = self._make_network(self.fmt, 'net1', True)
self._subnet = self._make_subnet(self.fmt, network, "10.0.0.1",
'10.0.0.0/24')
self._subnet_id = self._subnet['subnet']['id']
router1 = self._make_router(self.fmt, str(uuid.uuid4()),
'router1', True)
self._router_id = router1['router']['id']
router2 = self._make_router(self.fmt, str(uuid.uuid4()),
'router2', True)
self._router_id_in_use = router2['router']['id']
self._router_interface_action('add', self._router_id_in_use,
self._subnet_id, None)
# for network_vlan gateway device setting
res = self._create_network(self.fmt, 'gateway_network_vlan',
True)
self._network_id = self.deserialize(self.fmt, res)['network']['id']
示例8: setUp
def setUp(self):
mock.patch('neutron.api.rpc.handlers.resources_rpc.'
'ResourcesPushRpcApi').start()
svc_plugins = {'port_forwarding': PLUGIN_NAME}
ext_mgr = test_fip_pf.ExtendFipPortForwardingExtensionManager()
super(FloatingIPPorForwardingTestCase, self).setUp(
ext_mgr=ext_mgr, service_plugins=svc_plugins)
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
示例9: setUp
def setUp(self, plugin=None, service_plugins=None, ext_mgr=None):
service_plugins = {'bgp_plugin_name': BGP_PLUGIN_KLASS}
bgp_mgr = BgpTestExtensionManager()
super(BgpTestCase, self).setUp(
service_plugins=service_plugins, ext_mgr=bgp_mgr)
self.ext_api = test_ex.setup_extensions_middleware(bgp_mgr)
self.bgp_plugin = bgp_plugin.MidonetBgpPlugin()
network = self._make_network(self.fmt, 'net1', True)
self._subnet = self._make_subnet(self.fmt, network, "192.168.0.1",
'192.168.0.0/24')
self._subnet_id = self._subnet['subnet']['id']
network = self._make_network(self.fmt, 'net2', True)
self._subnet = self._make_subnet(self.fmt, network, "192.168.1.1",
'192.168.1.0/24')
self._subnet_id2 = self._subnet['subnet']['id']
network = self._make_network(self.fmt, 'net3', True)
self._subnet = self._make_subnet(self.fmt, network, "192.168.2.1",
'192.168.2.0/24')
self._subnet_id3 = self._subnet['subnet']['id']
port = self._make_port(self.fmt, network['network']['id'])
self._port_id = port['port']['id']
self._port_fixed_ip = port['port']['fixed_ips'][0]['ip_address']
router1 = self._make_router(self.fmt, str(uuid.uuid4()),
'router1', True)
self._router_id = router1['router']['id']
router2 = self._make_router(self.fmt, str(uuid.uuid4()),
'router2', True)
self._router_id2 = router2['router']['id']
self._router_interface_action('add', self._router_id, self._subnet_id,
None)
self._router_interface_action('add', self._router_id, self._subnet_id2,
None)
self._router_interface_action('add', self._router_id, self._subnet_id3,
None)
self._router_interface_action('add', self._router_id2, None,
self._port_id)
# for non-router use case
ext_net = self._make_network(self.fmt, 'ext_net2', True)
self._set_net_external(ext_net['network']['id'])
self._ext_net_id = ext_net['network']['id']
self._ext_subnet = self._make_subnet(self.fmt, ext_net, "100.65.0.1",
'100.65.0.0/24')
self._ext_subnet_id = self._ext_subnet['subnet']['id']
edge_router = self._make_router(self.fmt, str(uuid.uuid4()),
'edge_router', True)
self._edge_router_id = edge_router['router']['id']
self._router_interface_action('add', self._edge_router_id,
self._ext_subnet_id, None)
示例10: setUp
def setUp(self):
super(TestOvnNbSync, self).setUp()
ext_mgr = test_extraroute.ExtraRouteTestExtensionManager()
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
self.create_lswitches = []
self.create_lswitch_ports = []
self.create_lrouters = []
self.create_lrouter_ports = []
self.create_lrouter_routes = []
self.delete_lswitches = []
self.delete_lswitch_ports = []
self.delete_lrouters = []
self.delete_lrouter_ports = []
self.delete_lrouter_routes = []
示例11: setUp
def setUp(self, plugin=None, service_plugins=None, ext_mgr=None):
ext_mgr = TaasExtensionManager()
service_plugins = {'taas_plugin_name': DB_TAAS_PLUGIN_KLASS}
taas_provider = (taas_const.TAAS + ':BSN:' + BSN_TAAS_DRIVER_KLASS
+ ':default')
mock.patch.object(provconf.NeutronModule, 'service_providers',
return_value=[taas_provider]).start()
manager = sdb.ServiceTypeManager.get_instance()
manager.add_provider_configuration(
taas_const.TAAS, provconf.ProviderConfiguration())
super(TestBSNTaasCase,
self).setUp(service_plugins=service_plugins,
ext_mgr=ext_mgr)
self.ext_api = test_ex.setup_extensions_middleware(ext_mgr)
示例12: setUp
def setUp(self):
# This is needed because otherwise a failure will occur due to
# nonexisting core_plugin
self.setup_coreplugin(test_db_base_plugin_v2.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()
示例13: setUp
def setUp(self):
service_plugins = {
'lb_plugin_name': test_db_loadbalancerv2.DB_LB_PLUGIN_CLASS}
# default provider should support agent scheduling
self.set_override(
[('LOADBALANCERV2:lbaas:neutron_lbaas.drivers.haproxy.'
'plugin_driver.HaproxyOnHostPluginDriver:default')])
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()
self.lbaas_plugin = directory.get_plugin(plugin_const.LOADBALANCERV2)
self.core_plugin = directory.get_plugin()
示例14: setUp
def setUp(self):
# Enable the test mechanism driver to ensure that
# we can successfully call through to all mechanism
# driver apis.
cfg.CONF.set_override('mechanism_drivers',
['logger_plus', 'test'], group='ml2')
cfg.CONF.set_override('network_vlan_ranges',
['physnet1:1000:1099'], group='ml2_type_vlan')
extensions.append_api_extensions_path(
gbpservice.neutron.extensions.__path__)
super(Ml2PlusPluginV2TestCase, self).setUp(PLUGIN_NAME)
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
self.port_create_status = 'DOWN'
self.plugin = directory.get_plugin()
示例15: setUp
def setUp(self, core_plugin=None, sc_plugin=None, service_plugins=None,
ext_mgr=None, gp_plugin=None):
if not sc_plugin:
sc_plugin = DB_GP_PLUGIN_KLASS
if not service_plugins:
service_plugins = {
'l3_plugin_name': 'router',
'gp_plugin_name': gp_plugin or GP_PLUGIN_KLASS,
'sc_plugin_name': sc_plugin}
super(ServiceChainDbTestCase, self).setUp(
plugin=core_plugin, ext_mgr=ext_mgr,
service_plugins=service_plugins
)
self.plugin = importutils.import_object(sc_plugin)
if not ext_mgr:
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
engine = db_api.get_engine()
model_base.BASEV2.metadata.create_all(engine)