def setUp(self, core_plugin=None, l3_plugin=None, fw_plugin=None, ext_mgr=None): self.agentapi_delf_p = mock.patch(test_db_firewall.DELETEFW_PATH, create=True, new=test_db_firewall.FakeAgentApi().delete_firewall) self.agentapi_delf_p.start() cfg.CONF.set_override('api_extensions_path', extensions_path) # for these tests we need to enable overlapping ips cfg.CONF.set_default('allow_overlapping_ips', True) cfg.CONF.set_default('max_routes', 3) self.saved_attr_map = {} for resource, attrs in six.iteritems(attr.RESOURCE_ATTRIBUTE_MAP): self.saved_attr_map[resource] = attrs.copy() if not core_plugin: core_plugin = CORE_PLUGIN_KLASS if l3_plugin is None: l3_plugin = L3_PLUGIN_KLASS if not fw_plugin: fw_plugin = CSR_FW_PLUGIN_KLASS service_plugins = {'l3_plugin_name': l3_plugin, 'fw_plugin_name': fw_plugin} if not ext_mgr: ext_mgr = CSR1kvFirewallTestExtensionManager() super(test_db_firewall.FirewallPluginDbTestCase, self).setUp( plugin=core_plugin, service_plugins=service_plugins, ext_mgr=ext_mgr) self.core_plugin = manager.NeutronManager.get_plugin() self.l3_plugin = manager.NeutronManager.get_service_plugins().get( const.L3_ROUTER_NAT) self.plugin = manager.NeutronManager.get_service_plugins().get( const.FIREWALL) self.callbacks = self.plugin.endpoints[0] self.setup_notification_driver()
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() # the plugin without L3 support plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin' # the L3 service plugin l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatServicePlugin') cfg.CONF.set_override('api_extensions_path', extensions_path) self.saved_attr_map = {} for resource, attrs in six.iteritems(attr.RESOURCE_ATTRIBUTE_MAP): self.saved_attr_map[resource] = attrs.copy() if not fw_plugin: fw_plugin = FW_PLUGIN_KLASS service_plugins = {'l3_plugin_name': l3_plugin, 'fw_plugin_name': fw_plugin} if not ext_mgr: ext_mgr = FirewallTestExtensionManager() super(test_db_firewall.FirewallPluginDbTestCase, self).setUp( plugin=plugin, service_plugins=service_plugins, ext_mgr=ext_mgr) self.setup_notification_driver() self.l3_plugin = manager.NeutronManager.get_service_plugins().get( const.L3_ROUTER_NAT) self.plugin = manager.NeutronManager.get_service_plugins().get( const.FIREWALL) self.callbacks = self.plugin.endpoints[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')
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() # the plugin without L3 support plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin' # the L3 service plugin l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatAgentSchedulingServicePlugin') cfg.CONF.set_override('api_extensions_path', extensions_path) self.saved_attr_map = {} for resource, attrs in six.iteritems(attr.RESOURCES): self.saved_attr_map[resource] = attrs.copy() if not fw_plugin: fw_plugin = FW_PLUGIN_KLASS service_plugins = { 'l3_plugin_name': l3_plugin, 'fw_plugin_name': fw_plugin } if not ext_mgr: ext_mgr = FirewallTestExtensionManager() super(test_db_firewall.FirewallPluginDbTestCase, self).setUp(plugin=plugin, service_plugins=service_plugins, ext_mgr=ext_mgr) self.addCleanup(self.restore_attribute_map) self.setup_notification_driver() self.l3_plugin = directory.get_plugin(plugin_constants.L3) self.plugin = directory.get_plugin('FIREWALL') self.callbacks = fwaas_plugin.FirewallCallbacks(self.plugin)