def test_aliase_2_request(self): self.flags(pci_alias=[_fake_alias1, _fake_alias3]) expect_request = [ { 'count': 3, 'spec': [{ 'vendor_id': '8086', 'product_id': '4443', 'device_type': 'ACCEL', 'capability_type': 'pci' }], 'alias_name': 'QuicAssist' }, { 'count': 1, 'spec': [{ 'vendor_id': '8086', 'product_id': '1111', 'device_type': "NIC", 'capability_type': 'pci' }], 'alias_name': 'IntelNIC' }, ] requests = pci_request._translate_alias_to_requests( "QuicAssist : 3, IntelNIC: 1") self.assertEqual(set([p['count'] for p in requests]), set([1, 3])) self._verify_result(expect_request, requests)
def test_aliase_2_request(self): self.flags(pci_alias=[_fake_alias1, _fake_alias3]) expect_request = [ {'count': 3, 'spec': [{'vendor_id': '8086', 'product_id': '4443', 'device_type': 'ACCEL', 'capability_type': 'pci'}], 'alias_name': 'QuicAssist'}, {'count': 1, 'spec': [{'vendor_id': '8086', 'product_id': '1111', 'device_type': "NIC", 'capability_type': 'pci'}], 'alias_name': 'IntelNIC'}, ] requests = pci_request._translate_alias_to_requests( "QuicAssist : 3, IntelNIC: 1") self.assertEqual(set([p['count'] for p in requests]), set([1, 3])) self._verify_result(expect_request, requests)