def test_get_virtual_devices(self): pattern = "PCI_SLOT_NAME=0000:05:00.0" with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(1, pattern, "")) ssh.return_value = ssh_mock status = StandaloneContextHelper.get_virtual_devices( ssh_mock, "0000:00:05.0") self.assertIsNotNone(status)
def _get_vf_data(self, value, vfmac, pfif): vf_data = {"mac": vfmac, "pf_if": pfif} vfs = StandaloneContextHelper.get_virtual_devices( self.connection, value) for k, v in vfs.items(): m = PciAddress(k.strip()) m1 = PciAddress(value.strip()) if m.bus == m1.bus: vf_data.update({"vf_pci": str(v)}) break return vf_data