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)
Example #2
0
    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 _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)
Example #4
0
 def __init__(self):
     self.extra_binding_dict = {
         portbindings.VIF_TYPE: portbindings.VIF_TYPE_BRIDGE,
         portbindings.CAPABILITIES: {
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases
         }
     }
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [
             constants.TYPE_LOCAL, constants.TYPE_VLAN, constants.TYPE_NONE
     ]:
         LOG.error(
             _("Invalid tenant_network_type: %s. "
               "Service terminated!"), self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver)
     LOG.debug(_("Linux Bridge Plugin initialization complete"))
Example #5
0
 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.agent_rpc = cfg.CONF.AGENT.rpc
     self._setup_rpc()
     LOG.debug("Linux Bridge Plugin initialization complete")
Example #6
0
 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.agent_rpc = cfg.CONF.AGENT.rpc
     self._setup_rpc()
     LOG.debug("Linux Bridge Plugin initialization complete")
Example #7
0
 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL, constants.TYPE_VLAN, constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. " "Service terminated!"), self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     LOG.debug(_("Linux Bridge Plugin initialization complete"))
Example #8
0
 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [
             constants.TYPE_LOCAL, constants.TYPE_VLAN, constants.TYPE_NONE
     ]:
         LOG.error("Invalid tenant_network_type: %s. "
                   "Service terminated!" % self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     LOG.debug("Linux Bridge Plugin initialization complete")
Example #9
0
 def __init__(self):
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL,
                                         constants.TYPE_VLAN,
                                         constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                     "Service terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver)
     LOG.debug(_("Linux Bridge Plugin initialization complete"))
    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 _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 __init__(self):
     self.extra_binding_dict = {
         portbindings.VIF_TYPE: portbindings.VIF_TYPE_BRIDGE,
         portbindings.CAPABILITIES: {
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases}}
     db.initialize()
     self._parse_network_vlan_ranges()
     db.sync_network_states(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.VLANS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL,
                                         constants.TYPE_VLAN,
                                         constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                     "Service terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self._setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver)
     LOG.debug(_("Linux Bridge Plugin initialization complete"))
Example #13
0
 def setUp(self):
     super(NetworkStatesTest, self).setUp()
     lb_db.initialize()
     lb_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
     self.addCleanup(db.clear_db)
Example #14
0
 def setUp(self):
     super(NetworkBindingsTest, self).setUp()
     lb_db.initialize()
     self.session = db.get_session()
Example #15
0
 def setUp(self):
     lb_db.initialize()
     self.session = db.get_session()
Example #16
0
 def setUp(self):
     lb_db.initialize()
     lb_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
Example #17
0
 def setUp(self):
     super(NetworkBindingsTest, self).setUp()
     lb_db.initialize()
     self.session = db.get_session()
Example #18
0
 def setUp(self):
     lb_db.initialize()
     lb_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
Example #19
0
 def setUp(self):
     lb_db.initialize()
     self.session = db.get_session()
Example #20
0
 def setUp(self):
     super(NetworkStatesTest, self).setUp()
     lb_db.initialize()
     lb_db.sync_network_states(VLAN_RANGES)
     self.session = db.get_session()
     self.addCleanup(db.clear_db)