コード例 #1
0
    def setUp(self):
        sfc_plugin = test_sfc_db.DB_SFC_PLUGIN_CLASS
        flowclassifier_plugin = (
            test_flowclassifier_db.DB_FLOWCLASSIFIER_PLUGIN_CLASS)

        service_plugins = {
            sfc_ext.SFC_EXT: sfc_plugin,
            flowclassifier.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
        }
        sfc_db.SfcDbPlugin.supported_extension_aliases = [sfc_ext.SFC_EXT]
        sfc_db.SfcDbPlugin.path_prefix = sfc_ext.SFC_PREFIX
        fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
            flowclassifier.FLOW_CLASSIFIER_EXT
        ]
        fdb.FlowClassifierDbPlugin.path_prefix = (
            flowclassifier.FLOW_CLASSIFIER_PREFIX)
        super(TestDfSfcDriver, self).setUp(ext_mgr=None,
                                           plugin=None,
                                           service_plugins=service_plugins)
        self.sfc_plugin = importutils.import_object(sfc_plugin)
        self.flowclassifier_plugin = importutils.import_object(
            flowclassifier_plugin)
        ext_mgr = api_ext.PluginAwareExtensionManager(
            test_sfc_db.extensions_path, {
                sfc_ext.SFC_EXT: self.sfc_plugin,
                flowclassifier.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin
            })
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.ctx = context.get_admin_context()
        self.driver = driver.DfSfcDriver()
        self.driver.initialize()
        self.driver._nb_api = mock.Mock()
コード例 #2
0
ファイル: test_quotasv2_detail.py プロジェクト: thh/neutron
    def setUp(self):
        super(DetailQuotaExtensionTestCase, self).setUp()
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        self.useFixture(fixture.APIDefinitionFixture())

        # Create the default configurations
        self.config_parse()

        # Update the plugin and extensions path
        self.setup_coreplugin('ml2')
        quota.QUOTAS = quota.QuotaEngine()
        self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
        self.plugin = self._plugin_patcher.start()
        self.plugin.return_value.supported_extension_aliases = \
            ['quotas', 'quota_details']
        # QUOTAS will register the items in conf when starting
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
        # Initialize the router for the core API in order to ensure core quota
        # resources are registered
        router.APIRouter()
コード例 #3
0
 def setUp(self,
           core_plugin=None,
           flowclassifier_plugin=None,
           ext_mgr=None):
     mock_log_p = mock.patch.object(fdb, 'LOG')
     self.mock_log = mock_log_p.start()
     cfg.CONF.register_opts(fc_ext.flow_classifier_quota_opts, 'QUOTAS')
     if not flowclassifier_plugin:
         flowclassifier_plugin = DB_FLOWCLASSIFIER_PLUGIN_CLASS
     service_plugins = {fc_ext.FLOW_CLASSIFIER_EXT: flowclassifier_plugin}
     fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
         fc_ext.FLOW_CLASSIFIER_EXT
     ]
     fdb.FlowClassifierDbPlugin.path_prefix = (
         fc_ext.FLOW_CLASSIFIER_PREFIX)
     super(FlowClassifierDbPluginTestCase,
           self).setUp(ext_mgr=ext_mgr,
                       plugin=core_plugin,
                       service_plugins=service_plugins)
     if not ext_mgr:
         self.flowclassifier_plugin = importutils.import_object(
             flowclassifier_plugin)
         ext_mgr = api_ext.PluginAwareExtensionManager(
             extensions_path,
             {fc_ext.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin})
         app = config.load_paste_app('extensions_test_app')
         self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #4
0
    def setUp(self):
        super(QuotaExtensionTestCase, self).setUp()
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        self.useFixture(tools.AttributeMapMemento())

        # Create the default configurations
        self.config_parse()

        # Update the plugin and extensions path
        self.setup_coreplugin(TARGET_PLUGIN)
        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 register the items in conf when starting
        # extra1 here is added later, so have to do it manually
        resource_registry.register_resource_by_name('extra1')
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
        # Initialize the router for the core API in order to ensure core quota
        # resources are registered
        router.APIRouter()
コード例 #5
0
    def setUp(self):
        super(RouterServiceInsertionTestCase, self).setUp()
        plugin = ("neutron.tests.unit.test_routerserviceinsertion."
                  "RouterServiceInsertionTestPlugin")

        # point config file to: neutron/tests/etc/neutron.conf.test
        args = ['--config-file', test_api_v2.etcdir('neutron.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
        neutron.manager.NeutronManager._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"

        self._service_type_id = _uuid()

        self._setup_core_resources()
コード例 #6
0
ファイル: service.py プロジェクト: fcxliang/lzf5-study
def _run_wsgi(app_name):
    app = config.load_paste_app(
        app_name)  # 加载paste  包括了/和/v2 ,v返回版本信息  v2下是主要的api
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    return run_wsgi_app(app)  # 启动server
コード例 #7
0
ファイル: test_quota_ext.py プロジェクト: yuhui7red/neutron
    def setUp(self):
        super(QuotaExtensionTestCase, self).setUp()
        # 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('neutron.conf.test')]
        config.parse(args=args)

        # Update the plugin and extensions path
        self.setup_coreplugin(TARGET_PLUGIN)
        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 register 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()
        db.configure_db()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
コード例 #8
0
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = "neutron.tests.unit.test_extension_extended_attribute." "ExtensionExtendedAttributeTestPlugin"

        # point config file to: neutron/tests/etc/neutron.conf.test
        self.config_parse()

        self.setup_coreplugin(plugin)

        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.NeutronManager.get_plugin()
        self.addCleanup(self.restore_attribute_map)

        quota.QUOTAS._driver = None
        cfg.CONF.set_override("quota_driver", "neutron.quota.ConfDriver", group="QUOTAS")
コード例 #9
0
ファイル: test_quota_ext.py プロジェクト: absolutarin/neutron
    def setUp(self):
        super(QuotaExtensionTestCase, self).setUp()
        # 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
        self.config_parse()

        # Update the plugin and extensions path
        self.setup_coreplugin(TARGET_PLUGIN)
        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 register 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()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
コード例 #10
0
    def setUp(self):
        flowclassifier_plugin = (
            test_flowclassifier_db.DB_FLOWCLASSIFIER_PLUGIN_CLASS)

        service_plugins = {
            flowclassifier.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
        }
        fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
            flowclassifier.FLOW_CLASSIFIER_EXT]
        fdb.FlowClassifierDbPlugin.path_prefix = (
            flowclassifier.FLOW_CLASSIFIER_PREFIX
        )
        super(OVSFlowClassifierDriverTestCase, self).setUp(
            ext_mgr=None,
            plugin=None,
            service_plugins=service_plugins
        )
        self.flowclassifier_plugin = importutils.import_object(
            flowclassifier_plugin)
        ext_mgr = api_ext.PluginAwareExtensionManager(
            test_flowclassifier_db.extensions_path,
            {
                flowclassifier.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin
            }
        )
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.ctx = context.get_admin_context()
        self.driver = driver.OVSFlowClassifierDriver()
        self.driver.initialize()
コード例 #11
0
    def setUp(self):
        service_plugins = {
            'router':
            'neutron.tests.unit.extensions.test_l3.TestL3NatServicePlugin'}
        l3_plugin = test_l3.TestL3NatServicePlugin()
        sec_plugin = test_securitygroup.SecurityGroupTestPlugin()
        ext_mgr = extensions.PluginAwareExtensionManager(
            EXTENSIONS_PATH, {'router': l3_plugin, 'sec': sec_plugin}
        )
        super(TestRevisionNumberMaintenance, self).setUp(
            plugin=PLUGIN_CLASS, service_plugins=service_plugins)
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.session = db_api.get_writer_session()
        revision_plugin.RevisionPlugin()
        self.net = self._make_network(self.fmt, 'net1', True)['network']

        # Mock the default value for INCONSISTENCIES_OLDER_THAN so
        # tests won't need to wait for the timeout in order to validate
        # the database inconsistencies
        self.older_than_mock = mock.patch(
            'neutron.db.ovn_revision_numbers_db.INCONSISTENCIES_OLDER_THAN',
            -1)
        self.older_than_mock.start()
        self.addCleanup(self.older_than_mock.stop)
        self.ctx = context.get_admin_context()
コード例 #12
0
    def setUp(self):
        super(RouterServiceInsertionTestCase, self).setUp()
        plugin = (
            "neutron.tests.unit.test_routerserviceinsertion."
            "RouterServiceInsertionTestPlugin"
        )

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

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

        # 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"

        self._service_type_id = _uuid()

        self._setup_core_resources()
コード例 #13
0
ファイル: test_extensions.py プロジェクト: igordcard/neutron
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = (
            "neutron.tests.unit.api.test_extensions."
            "ExtensionExtendedAttributeTestPlugin"
        )

        # point config file to: neutron/tests/etc/neutron.conf
        self.config_parse()

        self.setup_coreplugin(plugin)

        ext_mgr = extensions.PluginAwareExtensionManager(
            extensions_path,
            {lib_const.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.agentscheduler_dbMinxin = directory.get_plugin()

        quota.QUOTAS._driver = None
        cfg.CONF.set_override('quota_driver', 'neutron.quota.ConfDriver',
                              group='QUOTAS')
コード例 #14
0
ファイル: test_quotasv2.py プロジェクト: HoratiusTang/neutron
    def setUp(self):
        super(QuotaExtensionTestCase, self).setUp()
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        self.useFixture(tools.AttributeMapMemento())

        # Create the default configurations
        self.config_parse()

        # Update the plugin and extensions path
        self.setup_coreplugin(TARGET_PLUGIN)
        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 register the items in conf when starting
        # extra1 here is added later, so have to do it manually
        resource_registry.register_resource_by_name('extra1')
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
        # Initialize the router for the core API in order to ensure core quota
        # resources are registered
        router.APIRouter()
コード例 #15
0
    def setUp(self):
        super(RouterServiceInsertionTestCase, self).setUp()
        plugin = (
            "neutron.tests.unit.test_routerserviceinsertion."
            "RouterServiceInsertionTestPlugin"
        )

        # point config file to: neutron/tests/etc/neutron.conf.test
        self.config_parse()

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

        # 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"

        self._service_type_id = _uuid()

        self._setup_core_resources()
コード例 #16
0
    def setUp(self):
        super(DetailQuotaExtensionTestCase, self).setUp()
        # Ensure existing ExtensionManager is not used
        extensions.PluginAwareExtensionManager._instance = None

        self.useFixture(fixture.APIDefinitionFixture())

        # Create the default configurations
        self.config_parse()

        # Update the plugin and extensions path
        self.setup_coreplugin('ml2')
        quota.QUOTAS = quota.QuotaEngine()
        self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
        self.plugin = self._plugin_patcher.start()
        self.plugin.return_value.supported_extension_aliases = \
            ['quotas', 'quota_details']
        # QUOTAS will register the items in conf when starting
        ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
        app = config.load_paste_app('extensions_test_app')
        ext_middleware = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.api = webtest.TestApp(ext_middleware)
        # Initialize the router for the core API in order to ensure core quota
        # resources are registered
        router.APIRouter()
コード例 #17
0
 def setUp(self, core_plugin=None, flowclassifier_plugin=None,
           ext_mgr=None):
     mock_log_p = mock.patch.object(fdb, 'LOG')
     self.mock_log = mock_log_p.start()
     cfg.CONF.register_opts(fc_ext.flow_classifier_quota_opts, 'QUOTAS')
     if not flowclassifier_plugin:
         flowclassifier_plugin = DB_FLOWCLASSIFIER_PLUGIN_CLASS
     service_plugins = {
         fc_ext.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
     }
     fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
         fc_ext.FLOW_CLASSIFIER_EXT]
     fdb.FlowClassifierDbPlugin.path_prefix = (
         fc_ext.FLOW_CLASSIFIER_PREFIX
     )
     super(FlowClassifierDbPluginTestCase, self).setUp(
         ext_mgr=ext_mgr,
         plugin=core_plugin,
         service_plugins=service_plugins
     )
     if not ext_mgr:
         self.flowclassifier_plugin = importutils.import_object(
             flowclassifier_plugin)
         ext_mgr = api_ext.PluginAwareExtensionManager(
             extensions_path,
             {fc_ext.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin}
         )
         app = config.load_paste_app('extensions_test_app')
         self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #18
0
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = ("neutron.tests.unit.api.test_extensions."
                  "ExtensionExtendedAttributeTestPlugin")

        # point config file to: neutron/tests/etc/neutron.conf
        self.config_parse()

        self.setup_coreplugin(plugin)

        ext_mgr = extensions.PluginAwareExtensionManager(
            extensions_path,
            {lib_const.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.agentscheduler_dbMinxin = directory.get_plugin()

        quota.QUOTAS._driver = None
        cfg.CONF.set_override('quota_driver',
                              'neutron.db.quota.api.NullQuotaDriver',
                              group='QUOTAS')
コード例 #19
0
def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager or
                         extensions.PluginAwareExtensionManager(
                             extensions_path,
                             {constants.CORE: FakePluginWithExtension()}))
    base.BaseTestCase.config_parse()
    app = config.load_paste_app('extensions_test_app')
    return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)
コード例 #20
0
 def setUp(self):
     svc_plugins = {'plugin_name': PLUGIN_NAME}
     super(TestNetworkIPUsageAPI, self).setUp(service_plugins=svc_plugins)
     self.plugin = plugin.IpUsagePlugin()
     ext_mgr = api_ext.PluginAwareExtensionManager(
         EXTENSIONS_PATH, {"network-ip-usage": self.plugin})
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #21
0
def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager
                         or extensions.PluginAwareExtensionManager(
                             extensions_path,
                             {constants.CORE: FakePluginWithExtension()}))
    base.BaseTestCase.config_parse()
    app = config.load_paste_app('extensions_test_app')
    return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)
コード例 #22
0
ファイル: test_tag.py プロジェクト: rohitmalaga/neutron
 def setUp(self):
     service_plugins = {'TAG': "neutron.services.tag.tag_plugin.TagPlugin"}
     super(TestTagApiBase, self).setUp(service_plugins=service_plugins)
     plugin = tag_plugin.TagPlugin()
     ext_mgr = extensions.PluginAwareExtensionManager(
         extensions_path, {'TAG': plugin})
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #23
0
ファイル: test_tag.py プロジェクト: 21atlas/neutron
 def setUp(self):
     service_plugins = {'TAG': "neutron.services.tag.tag_plugin.TagPlugin"}
     super(TestTagApiBase, self).setUp(service_plugins=service_plugins)
     plugin = tag_plugin.TagPlugin()
     ext_mgr = extensions.PluginAwareExtensionManager(
         extensions_path, {'TAG': plugin}
     )
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #24
0
    def setUp(self, plugin=None):
        service_plugins = {"metering_plugin_name": DB_METERING_PLUGIN_KLASS}

        super(MeteringPluginDbTestCase, self).setUp(plugin=plugin, service_plugins=service_plugins)

        self.plugin = metering_plugin.MeteringPlugin()
        ext_mgr = extensions.PluginAwareExtensionManager(extensions_path, {constants.METERING: self.plugin})
        app = config.load_paste_app("extensions_test_app")
        self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #25
0
ファイル: test_extensions.py プロジェクト: rhel-osp/neutron
def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager or
                         extensions.PluginAwareExtensionManager(
                             extensions_path,
                             {constants.CORE: FakePluginWithExtension()}))
    config_file = 'neutron.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)
コード例 #26
0
ファイル: test_extensions.py プロジェクト: JoeMido/neutron
def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager or
                         extensions.PluginAwareExtensionManager(
                             extensions_path,
                             {constants.CORE: FakePluginWithExtension()}))
    config_file = 'neutron.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)
コード例 #27
0
 def setUp(self):
     svc_plugins = {'plugin_name': PLUGIN_NAME}
     super(TestNetworkIPAvailabilityAPI, self).setUp(
             service_plugins=svc_plugins)
     self.plugin = plugin_module.NetworkIPAvailabilityPlugin()
     ext_mgr = api_ext.PluginAwareExtensionManager(
         EXTENSIONS_PATH, {"network-ip-availability": self.plugin}
     )
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #28
0
ファイル: test_db_metering.py プロジェクト: pjh03/quantum
    def setUp(self, plugin=None):
        service_plugins = {'metering_plugin_name': DB_METERING_PLUGIN_KLASS}

        super(MeteringPluginDbTestCase,
              self).setUp(plugin=plugin, service_plugins=service_plugins)

        self.plugin = metering_plugin.MeteringPlugin()
        ext_mgr = PluginAwareExtensionManager(
            extensions_path, {constants.METERING: self.plugin})
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #29
0
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    server = wsgi.Server("Neutron")
    server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
                 workers=_get_api_workers())
    LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
             {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
    return server
コード例 #30
0
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    server = wsgi.Server("Neutron")
    server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
                 workers=_get_api_workers())
    LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
             {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
    return server
コード例 #31
0
ファイル: service.py プロジェクト: paninetworks/neutron
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    app.normalize_url("http://192.168.37.127:9696/v2.0/extensions.json")
    server = wsgi.Server("Neutron")
    server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
                 workers=_get_api_workers())
    LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
             {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
    return server
コード例 #32
0
ファイル: service.py プロジェクト: kakawxy/neutron-1
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("Neutron")
    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(_("Neutron service started, listening on %(host)s:%(port)s"),
             {'host': cfg.CONF.bind_host,
              'port': cfg.CONF.bind_port})
    return server
コード例 #33
0
ファイル: service.py プロジェクト: Intellifora/neutron
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    server = wsgi.Server("Neutron")
    server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
                 workers=cfg.CONF.api_workers)
    # Dump all option values here after all options are parsed
    cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
    LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
             {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
    return server
コード例 #34
0
 def setUp(self):
     super(TestBnpSwitches, self).setUp()
     self.setup_coreplugin(TARGET_PLUGIN)
     ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
     ml2_config.cfg.CONF.set_override('extension_drivers',
                                      self._ext_drivers,
                                      group='ml2')
     ml2_config.cfg.CONF.set_override('mechanism_drivers',
                                      self._mechanism_drivers,
                                      group='ml2')
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
     self.bnp_wsgi_controller = bnp_switch.BNPSwitchController()
     self.data = {
         "bnp_switch": {
             "access_parameters": {
                 "priv_key": None,
                 "auth_key": None,
                 "write_community": "public",
                 "security_name": None,
                 "auth_protocol": None,
                 "priv_protocol": None
             },
             "vendor": "hpe",
             "ip_address": "1.2.3.4",
             "access_protocol": "snmpv1"
         }
     }
     self.data1 = {
         "bnp_switch": {
             "access_parameters": {
                 "priv_key": None,
                 "auth_key": None,
                 "write_community": "private",
                 "security_name": None,
                 "auth_protocol": None,
                 "priv_protocol": None
             },
             "vendor": "hpe",
             "ip_address": "1.1.1.1",
             "access_protocol": "snmpv2c"
         }
     }
     self.bnp_switch_dict = {
         "mac_address": "44:31:92:dc:2e:c0",
         "ports": []
     }
     self.bnp_switch_dict1 = {
         "mac_address": "11:31:92:aa:2e:c0",
         "ports": []
     }
コード例 #35
0
def _run_wsgi(app_name):
    # load psate app
    # service.start()即为self.wsgi_app = _run_wsgi(self.app_name),而该函数最重要的工作是从api-paste.ini中加载app并启动。
    # 调试可以看到config_path指向/etc/neutron/api-paste.ini,neutron通过解析api-paste.ini中的配置信息来进行指定WSGI Application的实现。
    # 这里可以看到,在方法load_paste_app中,调用了模块库deploy来实现对api-paste.ini中配置信息的解析和指定WSGI Application的实现。

    # PasteDeployment是一种机制或者说是一种设计模式,它用于在应用WSGI Application和Server提供一个联系的桥梁,
    # 并且为用户提供一个接口,当配置好PasteDeployment之后,用户只需调用loadapp方法就可以使用现有的WSGI Application,
    # 而保持了WSGIApplication对用户的透明性。
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error('No known API applications configured.')
        return
    return run_wsgi_app(app)
コード例 #36
0
    def setUp(self, core_plugin=None, fw_plugin=None):
        if not fw_plugin:
            fw_plugin = DB_FW_PLUGIN_KLASS
        service_plugins = {'fw_plugin_name': fw_plugin}

        fdb.Firewall_db_mixin.supported_extension_aliases = ["fwaas"]
        super(FirewallPluginDbTestCase,
              self).setUp(service_plugins=service_plugins)

        self.plugin = importutils.import_object(fw_plugin)
        ext_mgr = api_ext.PluginAwareExtensionManager(
            extensions_path, {constants.FIREWALL: self.plugin})
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #37
0
ファイル: test_tag.py プロジェクト: AradhanaSingh/neutron
 def setUp(self):
     service_plugins = {
         'TAG': "neutron.services.tag.tag_plugin.TagPlugin",
         'router':
         "neutron.tests.unit.extensions.test_l3.TestL3NatServicePlugin"}
     super(TestTagApiBase, self).setUp(service_plugins=service_plugins)
     plugin = tag_plugin.TagPlugin()
     l3_plugin = test_l3.TestL3NatServicePlugin()
     ext_mgr = extensions.PluginAwareExtensionManager(
         extensions_path, {'router': l3_plugin, 'TAG': plugin}
     )
     ext_mgr.extend_resources("2.0", attributes.RESOURCE_ATTRIBUTE_MAP)
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #38
0
    def setUp(self, core_plugin=None, fw_plugin=None, ext_mgr=None):
        self.agentapi_delf_p = mock.patch(DELETEFW_PATH, create=True, new=FakeAgentApi().delete_firewall)
        self.agentapi_delf_p.start()
        if not fw_plugin:
            fw_plugin = DB_FW_PLUGIN_KLASS
        service_plugins = {"fw_plugin_name": fw_plugin}

        fdb.Firewall_db_mixin.supported_extension_aliases = ["fwaas"]
        super(FirewallPluginDbTestCase, self).setUp(ext_mgr=ext_mgr, service_plugins=service_plugins)

        if not ext_mgr:
            self.plugin = importutils.import_object(fw_plugin)
            ext_mgr = api_ext.PluginAwareExtensionManager(extensions_path, {constants.FIREWALL: self.plugin})
            app = config.load_paste_app("extensions_test_app")
            self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #39
0
ファイル: agent_service.py プロジェクト: netscaler/neutron
def _run_wsgi(app_name):
    LOG.debug(_("Loading paste app %s" % app_name))
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_("No known API applications configured."))
        return
    server = wsgi.Server("LBaaS-agent")
    server.start(app, cfg.CONF.agent_bind_port, cfg.CONF.agent_bind_host)
    # Dump all option values here after all options are parsed
    cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
    LOG.info(_("Loading paste app %s" % app_name))
    LOG.info(
        _("LBaaS-agent service started, listening on %(host)s:%(port)s"),
        {"host": cfg.CONF.agent_bind_host, "port": cfg.CONF.agent_bind_port},
    )
    return server
コード例 #40
0
    def setUp(self, core_plugin=None, fw_plugin=None):
        if not fw_plugin:
            fw_plugin = DB_FW_PLUGIN_KLASS
        service_plugins = {'fw_plugin_name': fw_plugin}

        fdb.Firewall_db_mixin.supported_extension_aliases = ["fwaas"]
        super(FirewallPluginDbTestCase, self).setUp(
            service_plugins=service_plugins
        )

        self.plugin = importutils.import_object(fw_plugin)
        ext_mgr = api_ext.PluginAwareExtensionManager(
            extensions_path,
            {constants.FIREWALL: self.plugin}
        )
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #41
0
ファイル: test_tag.py プロジェクト: bopopescu/OpenStack-Ocata
 def setUp(self):
     service_plugins = {
         'TAG':
         "neutron.services.tag.tag_plugin.TagPlugin",
         'router':
         "neutron.tests.unit.extensions.test_l3.TestL3NatServicePlugin"
     }
     super(TestTagApiBase, self).setUp(service_plugins=service_plugins)
     plugin = tag_plugin.TagPlugin()
     l3_plugin = test_l3.TestL3NatServicePlugin()
     ext_mgr = extensions.PluginAwareExtensionManager(
         extensions_path, {
             'router': l3_plugin,
             'TAG': plugin
         })
     ext_mgr.extend_resources("2.0", attributes.RESOURCE_ATTRIBUTE_MAP)
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #42
0
 def setUp(self, core_plugin=None, vpnaas_plugin=DB_VPN_PLUGIN_KLASS):
     service_plugins = {'vpnaas_plugin': vpnaas_plugin}
     plugin_str = ('neutron.tests.unit.db.vpn.'
                   'test_db_vpnaas.TestVpnCorePlugin')
     super(test_db_vpnaas.VPNPluginDbTestCase,
           self).setUp(plugin_str, service_plugins=service_plugins)
     self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14"
     self.core_plugin = test_db_vpnaas.TestVpnCorePlugin
     self.plugin = test_db_vpnaas.TestVPNPlugin()
     ext_mgr = PluginAwareExtensionManager(
         extensions_path, {
             constants.CORE: self.core_plugin,
             constants.VPN: self.plugin,
             constants.SSLVPN: self.plugin,
             constants.VPNCREDENTIAL: self.plugin
         })
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #43
0
 def setUp(self):
     service_plugins = {
         'router':
         'neutron.tests.unit.extensions.test_l3.TestL3NatServicePlugin'
     }
     l3_plugin = test_l3.TestL3NatServicePlugin()
     sec_plugin = test_securitygroup.SecurityGroupTestPlugin()
     ext_mgr = extensions.PluginAwareExtensionManager(
         EXTENSIONS_PATH, {
             'router': l3_plugin,
             'sec': sec_plugin
         })
     super(TestMaintenance, self).setUp(plugin=PLUGIN_CLASS,
                                        service_plugins=service_plugins)
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
     self.session = db_api.get_writer_session()
     revision_plugin.RevisionPlugin()
     self.net = self._make_network(self.fmt, 'net1', True)['network']
コード例 #44
0
    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 = _subnet_id

        self.plugin = loadbalancer_plugin.LoadBalancerPlugin()

        get_lbaas_agent_patcher = mock.patch(
            "neutron.services.loadbalancer.agent_scheduler" ".LbaasAgentSchedulerDbMixin.get_lbaas_agent_hosting_pool"
        )
        mock_lbaas_agent = mock.MagicMock()
        get_lbaas_agent_patcher.start().return_value = mock_lbaas_agent
        mock_lbaas_agent.__getitem__.return_value = {"host": "host"}
        self.addCleanup(mock.patch.stopall)

        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)
コード例 #45
0
 def setUp(self, core_plugin=None, vpnaas_plugin=DB_VPN_PLUGIN_KLASS):
     service_plugins = {'vpnaas_plugin': vpnaas_plugin}
     plugin_str = ('neutron.tests.unit.db.vpn.'
                   'test_db_vpnaas.TestVpnCorePlugin')
     super(test_db_vpnaas.VPNPluginDbTestCase, self).setUp(
         plugin_str,
         service_plugins=service_plugins
     )
     self._subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14"
     self.core_plugin = test_db_vpnaas.TestVpnCorePlugin
     self.plugin = test_db_vpnaas.TestVPNPlugin()
     ext_mgr = PluginAwareExtensionManager(
         extensions_path,
         {constants.CORE: self.core_plugin,
          constants.VPN: self.plugin,
          constants.SSLVPN: self.plugin,
          constants.VPNCREDENTIAL: self.plugin}
     )
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = ExtensionMiddleware(app, ext_mgr=ext_mgr)
コード例 #46
0
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = ("neutron.tests.unit.test_extension_extended_attribute."
                  "ExtensionExtendedAttributeTestPlugin")

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

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

        manager.NeutronManager._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.NeutronManager.get_plugin()
        self.addCleanup(cfg.CONF.reset)
        self.addCleanup(self.restore_attribute_map)

        quota.QUOTAS._driver = None
        cfg.CONF.set_override('quota_driver',
                              'neutron.quota.ConfDriver',
                              group='QUOTAS')
コード例 #47
0
ファイル: test_sfc_driver.py プロジェクト: snapiri/dragonflow
    def setUp(self):
        sfc_plugin = test_sfc_db.DB_SFC_PLUGIN_CLASS
        flowclassifier_plugin = (
            test_flowclassifier_db.DB_FLOWCLASSIFIER_PLUGIN_CLASS)

        service_plugins = {
            sfc_ext.SFC_EXT: sfc_plugin,
            flowclassifier.FLOW_CLASSIFIER_EXT: flowclassifier_plugin
        }
        sfc_db.SfcDbPlugin.supported_extension_aliases = [sfc_ext.SFC_EXT]
        sfc_db.SfcDbPlugin.path_prefix = sfc_ext.SFC_PREFIX
        fdb.FlowClassifierDbPlugin.supported_extension_aliases = [
            flowclassifier.FLOW_CLASSIFIER_EXT
        ]
        fdb.FlowClassifierDbPlugin.path_prefix = (
            flowclassifier.FLOW_CLASSIFIER_PREFIX)
        super(TestDfSfcDriver, self).setUp(ext_mgr=None,
                                           plugin=None,
                                           service_plugins=service_plugins)
        self.sfc_plugin = importutils.import_object(sfc_plugin)
        self.flowclassifier_plugin = importutils.import_object(
            flowclassifier_plugin)
        ext_mgr = api_ext.PluginAwareExtensionManager(
            test_sfc_db.extensions_path, {
                sfc_ext.SFC_EXT: self.sfc_plugin,
                flowclassifier.FLOW_CLASSIFIER_EXT: self.flowclassifier_plugin
            })
        app = config.load_paste_app('extensions_test_app')
        self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)
        self.ctx = context.get_admin_context()

        self.fake_lockedobjects = mock.patch(
            'dragonflow.db.neutron.lockedobjects_db.wrap_db_lock',
            side_effect=utils.empty_wrapper)
        self.fake_lockedobjects.start()
        self.addCleanup(self.fake_lockedobjects.stop)
        # Import must be done after mock.patch for wrap_db_lock
        self.driver = importutils.import_object(
            'dragonflow.neutron.services.sfc.driver.DfSfcDriver')
        self.driver.initialize()
        self.driver._nb_api = mock.Mock()
コード例 #48
0
 def setUp(self):
     super(TestBnpSwitches, self).setUp()
     self.setup_coreplugin(TARGET_PLUGIN)
     ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
     ml2_config.cfg.CONF.set_override('extension_drivers',
                                      self._ext_drivers,
                                      group='ml2')
     ml2_config.cfg.CONF.set_override('mechanism_drivers',
                                      self._mechanism_drivers,
                                      group='ml2')
     app = config.load_paste_app('extensions_test_app')
     self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
     self.bnp_wsgi_controller = bnp_switch.BNPSwitchController()
     self.data = {"bnp_switch":
                  {"access_parameters":
                   {"priv_key": None,
                    "auth_key": None,
                    "write_community": "public",
                    "security_name": None,
                    "auth_protocol": None,
                    "priv_protocol": None},
                   "vendor": "hp",
                   "ip_address": "1.2.3.4",
                   "access_protocol": "snmpv1"}}
     self.data1 = {"bnp_switch":
                   {"access_parameters":
                    {"priv_key": None,
                     "auth_key": None,
                     "write_community": "private",
                     "security_name": None,
                     "auth_protocol": None,
                     "priv_protocol": None},
                    "vendor": "hp",
                    "ip_address": "1.1.1.1",
                    "access_protocol": "snmpv2c"}}
     self.bnp_switch_dict = {"mac_address": "44:31:92:dc:2e:c0",
                             "ports": []}
     self.bnp_switch_dict1 = {"mac_address": "11:31:92:aa:2e:c0",
                              "ports": []}
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = (
            "neutron.tests.unit.test_extension_extended_attribute."
            "ExtensionExtendedAttributeTestPlugin"
        )

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

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

        manager.NeutronManager._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.NeutronManager.get_plugin()
        self.addCleanup(cfg.CONF.reset)
        self.addCleanup(self.restore_attribute_map)
コード例 #50
0
    def setUp(self, core_plugin=None, fw_plugin=None, ext_mgr=None):
        self.agentapi_del_fw_p = mock.patch(
            test_db_firewall.DELETEFW_PATH,
            create=True,
            new=test_db_firewall.FakeAgentApi().delete_firewall)
        self.agentapi_del_fw_p.start()

        self.client_mock = mock.MagicMock(name="mocked client")
        mock.patch('neutron.common.rpc.get_client').start(
        ).return_value = self.client_mock

        # the L3 routing with L3 agent scheduling service plugin
        l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                     'TestL3NatAgentSchedulingServicePlugin')

        cfg.CONF.set_override('api_extensions_path', extensions_path)
        if not fw_plugin:
            fw_plugin = FW_PLUGIN_KLASS
        service_plugins = {
            'l3_plugin_name': l3_plugin,
            'fw_plugin_name': fw_plugin
        }

        fdb.Firewall_db_mixin.\
            supported_extension_aliases = ["fwaas",
                                           "fwaasrouterinsertion"]
        fdb.Firewall_db_mixin.path_prefix = fwaas_def.API_PREFIX

        super(test_db_firewall.FirewallPluginDbTestCase,
              self).setUp(ext_mgr=ext_mgr, service_plugins=service_plugins)

        if not ext_mgr:
            ext_mgr = FirewallTestExtensionManager()
            app = config.load_paste_app('extensions_test_app')
            self.ext_api = api_ext.ExtensionMiddleware(app, ext_mgr=ext_mgr)

        self.l3_plugin = directory.get_plugin(plugin_constants.L3)
        self.plugin = directory.get_plugin('FIREWALL')
コード例 #51
0
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    return run_wsgi_app(app)
コード例 #52
0
ファイル: service.py プロジェクト: korroot/neutron
def _run_wsgi(app_name):
    app = config.load_paste_app(app_name)
    if not app:
        LOG.error(_LE('No known API applications configured.'))
        return
    return run_wsgi_app(app)
コード例 #53
0
from neutron.openstack.common import log as logging
from neutron.common import config

logging.setup('neutron')
config.parse(['--config-file', '/etc/neutron/neutron.conf', '--config-file', '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini'])
application = config.load_paste_app("neutron")
コード例 #54
0
def setup_base_app(test):
    base.BaseTestCase.config_parse()
    app = config.load_paste_app('extensions_test_app')
    return app
コード例 #55
0
def setup_base_app(test):
    base.BaseTestCase.config_parse()
    app = config.load_paste_app('extensions_test_app')
    return app
コード例 #56
0
ファイル: __init__.py プロジェクト: AradhanaSingh/neutron
def get_application():
    _init_configuration()
    profiler.setup('neutron-server', cfg.CONF.host)
    return config.load_paste_app('neutron')
コード例 #57
0
ファイル: gunicorn_server.py プロジェクト: Anonymike/quark
 def load(self):
     return config.load_paste_app(app_name=self.prog)
コード例 #58
0
ファイル: test_extensions.py プロジェクト: JoeMido/neutron
def setup_base_app():
    config_file = 'neutron.conf.test'
    args = ['--config-file', etcdir(config_file)]
    config.parse(args=args)
    app = config.load_paste_app('extensions_test_app')
    return app
コード例 #59
0
ファイル: gunicorn_server.py プロジェクト: thomasem/quark
 def load(self):
     return config.load_paste_app(app_name=self.prog)