def setUp(self, core_plugin=None, dm_plugin=None, ext_mgr=None): # Save the global RESOURCE_ATTRIBUTE_MAP self.saved_attr_map = {} for resource, attrs in six.iteritems( attributes.RESOURCE_ATTRIBUTE_MAP): self.saved_attr_map[resource] = attrs.copy() if not core_plugin: core_plugin = CORE_PLUGIN_KLASS service_plugins = {} cfg.CONF.set_override('api_extensions_path', dev_mgr_test_support.extensions_path) if ext_mgr is None: ext_mgr = dev_mgr_test_support.TestDeviceManagerExtensionManager() super(HostingDeviceConfigAgentSchedulerTestCaseBase, self).setUp(plugin=core_plugin, service_plugins=service_plugins, ext_mgr=ext_mgr) # Ensure we use policy definitions from our repo cfg.CONF.set_override('policy_file', policy_path, 'oslo_policy') self.core_plugin = bc.get_plugin() self.plugin = self.core_plugin self.setup_notification_driver() if NEUTRON_VERSION.version[0] <= NEUTRON_NEWTON_VERSION.version[0]: cfg.CONF.set_override('allow_sorting', True) self._define_keystone_authtoken() self._mock_l3_admin_tenant() self._create_mgmt_nw_for_tests(self.fmt) # in unit tests we don't use keystone so we mock that session self.core_plugin._svc_vm_mgr_obj = service_vm_lib.ServiceVMManager( True, None, None, None, '', keystone_session=mock.MagicMock()) self._mock_svc_vm_create_delete(self.core_plugin) self._mock_io_file_ops() if self.mock_cfg_agent_notifiers is True: self._mock_cfg_agent_notifier(self.plugin) self._other_tenant_id = dev_mgr_test_support._uuid() self.adminContext = n_context.get_admin_context()
def setUp(self, core_plugin=None, dm_plugin=None, ext_mgr=None): # Save the global RESOURCE_ATTRIBUTE_MAP self.saved_attr_map = {} for resource, attrs in six.iteritems(attributes.RESOURCE_ATTRIBUTE_MAP): self.saved_attr_map[resource] = attrs.copy() if not core_plugin: core_plugin = CORE_PLUGIN_KLASS service_plugins = {} cfg.CONF.set_override("api_extensions_path", dev_mgr_test_support.extensions_path) if ext_mgr is None: ext_mgr = dev_mgr_test_support.TestDeviceManagerExtensionManager() super(HostingDeviceConfigAgentSchedulerTestCaseBase, self).setUp( plugin=core_plugin, service_plugins=service_plugins, ext_mgr=ext_mgr ) # Ensure we use policy definitions from our repo cfg.CONF.set_override("policy_file", policy_path, "oslo_policy") self.core_plugin = manager.NeutronManager.get_plugin() self.plugin = self.core_plugin self.setup_notification_driver() cfg.CONF.set_override("allow_sorting", True) self._define_keystone_authtoken() self._mock_l3_admin_tenant() self._create_mgmt_nw_for_tests(self.fmt) # in unit tests we don't use keystone so we mock that session self.core_plugin._svc_vm_mgr_obj = service_vm_lib.ServiceVMManager( True, None, None, None, "", keystone_session=mock.MagicMock() ) self._mock_svc_vm_create_delete(self.core_plugin) self._mock_io_file_ops() if self.mock_cfg_agent_notifiers is True: self._mock_cfg_agent_notifier(self.plugin) self._other_tenant_id = dev_mgr_test_support._uuid() self.adminContext = n_context.get_admin_context()