def test_create_eswitch_mgr_ok(self): device_mappings = {'physnet1': 'p6p1'} with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.scan_vf_devices", return_value=self.SCANNED_DEVICES),\ mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.is_assigned_vf", return_value=True): esm.ESwitchManager(device_mappings, None)
def setUp(self): super(TestESwitchManagerApi, self).setUp() device_mappings = {'physnet1': 'p6p1'} with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.scan_vf_devices", return_value=self.SCANNED_DEVICES),\ mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.is_assigned_vf", return_value=True): self.eswitch_mgr = esm.ESwitchManager(device_mappings, None)
def test_create_eswitch_mgr_fail(self): device_mappings = {'physnet1': 'p6p1'} with mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.scan_vf_devices", side_effect=exc.InvalidDeviceError( dev_name="p6p1", reason="device" " not found")),\ mock.patch("neutron.plugins.sriovnicagent.eswitch_manager." "PciOsWrapper.is_assigned_vf", return_value=True): with testtools.ExpectedException(exc.InvalidDeviceError): esm.ESwitchManager(device_mappings, None)
def setup_eswitch_mgr(self, device_mappings, exclude_devices={}): self.eswitch_mgr = esm.ESwitchManager(device_mappings, exclude_devices, self.root_helper)