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)
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']
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)
def setup_extensions_middleware(extension_manager=None): extension_manager = (extension_manager or PluginAwareExtensionManager(extensions_path, QuantumEchoPlugin())) options = {'config_file': test_conf_file} conf, app = config.load_paste_app('extensions_test_app', options, None) return ExtensionMiddleware(app, conf, ext_mgr=extension_manager)
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"
def _setUp1(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) cfg.CONF.set_override("quota_driver", "quantum.extensions._quotav2_driver.DbQuotaDriver", group="QUOTAS") cfg.CONF.set_override("quota_items", ["network", "subnet", "port", "extra1"], group="QUOTAS") self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True) self.plugin = self._plugin_patcher.start() # QUOTAS will regester 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() 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)
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)
def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error(_('No known API applications configured.')) return server = wsgi.Server("Quantum") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host) return server
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)
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)
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)
def _run_wsgi(app_name, paste_conf, paste_config_file): LOG.info(_('Using paste.deploy config at: %s'), paste_config_file) conf, app = config.load_paste_app(app_name, {'config_file': paste_config_file}, None) if not app: LOG.error(_('No known API applications configured in %s.'), paste_config_file) return server = wsgi.Server("Quantum") server.start(app, int(paste_conf['bind_port']), paste_conf['bind_host']) return server
def setUp(self, core_plugin=None, lb_plugin=None): service_plugins = {"lb_plugin_name": DB_LB_PLUGIN_KLASS} super(LoadBalancerPluginDbTestCase, self).setUp(service_plugins=service_plugins) self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14" self.plugin = loadbalancer_plugin.LoadBalancerPlugin() ext_mgr = PluginAwareExtensionManager(extensions_path, {constants.LOADBALANCER: self.plugin}) app = config.load_paste_app("extensions_test_app") self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
def setUp(self, core_plugin=None, lb_plugin=None): service_plugins = {'lb_plugin_name': DB_LB_PLUGIN_KLASS} super(LoadBalancerPluginDbTestCase, self).setUp(service_plugins=service_plugins) self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14" self.plugin = loadbalancer_plugin.LoadBalancerPlugin() ext_mgr = PluginAwareExtensionManager( extensions_path, {constants.LOADBALANCER: self.plugin}) app = config.load_paste_app('extensions_test_app') self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error(_('No known API applications configured.')) return server = wsgi.Server("Quantum") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host) # Dump all option values here after all options are parsed cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) LOG.info(_("Quantum service started, listening on %(host)s:%(port)s"), {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port}) return server
def _run_wsgi(app_name): app = config.load_paste_app(app_name) if not app: LOG.error(_('No known API applications configured.')) return server = wsgi.Server("Quantum") server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host) # Dump all option values here after all options are parsed cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) LOG.info(_("Quantum service started, listening on %(host)s:%(port)s"), { 'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port }) return server
def setUp(self, core_plugin=None, vpn_plugin=None): service_plugins = {'vpn_plugin_name': DB_VPN_PLUGIN_KLASS} super(VPNPluginDbTestCase, self).setUp( service_plugins=service_plugins ) self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14" self.plugin = VPNPlugin.VPNPlugin() ext_mgr = PluginAwareExtensionManager( extensions_path, {constants.VPN: self.plugin} ) app = config.load_paste_app('extensions_test_app') self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
def setUp(self): super(QuotaExtensionTestCase, self).setUp() 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) cfg.CONF.set_override( 'quota_driver', 'quantum.db.quota_db.DbQuotaDriver', group='QUOTAS') 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 regester 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() 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) super(QuotaExtensionTestCase, self).setUp()
def setUp(self, core_plugin=None, lb_plugin=None): super(LoadBalancerPluginDbTestCase, self).setUp() db._ENGINE = None db._MAKER = None QuantumManager._instance = None PluginAwareExtensionManager._instance = None self._attribute_map_bk = {} self._attribute_map_bk = loadbalancer.RESOURCE_ATTRIBUTE_MAP.copy() self._tenant_id = "test-tenant" self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14" json_deserializer = JSONDeserializer() self._deserializers = { 'application/json': json_deserializer, } if not core_plugin: core_plugin = test_config.get('plugin_name_v2', DB_CORE_PLUGIN_KLASS) if not lb_plugin: lb_plugin = test_config.get('lb_plugin_name', DB_LB_PLUGIN_KLASS) # point config file to: quantum/tests/etc/quantum.conf.test args = ['--config-file', etcdir('quantum.conf.test')] config.parse(args=args) # Update the plugin service_plugins = [lb_plugin] cfg.CONF.set_override('core_plugin', core_plugin) cfg.CONF.set_override('service_plugins', service_plugins) cfg.CONF.set_override('base_mac', "12:34:56:78:90:ab") self.api = APIRouter() plugin = loadbalancerPlugin.LoadBalancerPlugin() ext_mgr = PluginAwareExtensionManager( extensions_path, {constants.LOADBALANCER: plugin} ) app = config.load_paste_app('extensions_test_app') self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
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" # 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.QuantumManager.get_plugin() self.addCleanup(cfg.CONF.reset) self.addCleanup(self.restore_attribute_map)
def _setUp1(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) cfg.CONF.set_override( 'quota_driver', 'quantum.extensions._quotav2_driver.DbQuotaDriver', group='QUOTAS') cfg.CONF.set_override('quota_items', ['network', 'subnet', 'port', 'extra1'], group='QUOTAS') self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True) self.plugin = self._plugin_patcher.start() # QUOTAS will regester 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() 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)
def setUp(self): super(RouterServiceInsertionTestCase, self).setUp() 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', []) cfg.CONF.set_override('quota_router', -1, group='quotas') 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 # 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'] self._setup_core_resources()
def setUp(self): super(RouterServiceInsertionTestCase, self).setUp() 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") 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 # 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"] self._setup_core_resources()
def setup_base_app(): config_file = 'quantum.conf.test' args = ['--config-file', etcdir(config_file)] config.parse(args=args) app = config.load_paste_app('extensions_test_app') return app
def setup_base_app(): options = {"config_file": test_conf_file} conf, app = config.load_paste_app("extensions_test_app", options, None) return app
def setup_base_app(): config_file = "quantum.conf.test" args = ["--config-file", etcdir(config_file)] config.parse(args=args) app = config.load_paste_app("extensions_test_app") return app
def setup_extensions_middleware(extension_manager=None): extension_manager = (extension_manager or PluginAwareExtensionManager( EXTENSIONS_PATH, L2Network())) app = config.load_paste_app('extensions_test_app') return ExtensionMiddleware(app, ext_mgr=extension_manager)
def setup_extensions_middleware(extension_manager=None): extension_manager = (extension_manager or PluginAwareExtensionManager( extensions_path, QuantumEchoPlugin())) options = {'config_file': test_conf_file} conf, app = config.load_paste_app('extensions_test_app', options, None) return ExtensionMiddleware(app, conf, ext_mgr=extension_manager)
def setup_base_app(): options = {'config_file': test_conf_file} conf, app = config.load_paste_app('extensions_test_app', options, None) return app
from quantum.openstack.common import log as logging from quantum.common import config logging.setup('quantum') config.parse(['--config-file', '/etc/quantum/quantum.conf', '--config-file', '/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini']) application = config.load_paste_app("quantum")
def setup_extensions_middleware(extension_manager=None): extension_manager = (extension_manager or PluginAwareExtensionManager(EXTENSIONS_PATH, L2Network())) app = config.load_paste_app('extensions_test_app') return ExtensionMiddleware(app, ext_mgr=extension_manager)