def test_get_pci_requests_from_flavor(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'}, ] flavor = {'extra_specs': {"pci_passthrough:alias": "QuicAssist:3, IntelNIC: 1"}} requests = request.get_pci_requests_from_flavor(flavor) self.assertEqual(set([1, 3]), set([p.count for p in requests.requests])) self._verify_result(expect_request, requests.requests)
def test_get_pci_requests_from_flavor(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' }, ] flavor = { 'extra_specs': { "pci_passthrough:alias": "QuicAssist:3, IntelNIC: 1" } } requests = request.get_pci_requests_from_flavor(flavor) self.assertEqual(set([1, 3]), set([p.count for p in requests.requests])) self._verify_result(expect_request, requests.requests)
def test_get_pci_requests_from_flavor_no_extra_spec(self): self.flags(pci_alias=[_fake_alias1, _fake_alias3]) flavor = {} requests = request.get_pci_requests_from_flavor(flavor) self.assertEqual([], requests.requests)
def test_get_pci_requests_from_flavor_no_extra_spec(self): self.flags(pci_alias=[_fake_alias1, _fake_alias3]) flavor = {} requests = request.get_pci_requests_from_flavor(flavor) self.assertEqual([], requests.requests)