Пример #1
0
    def test_get_alias_from_config_valid_multispec(self):
        _fake_alias = jsonutils.dumps({
            "name": "QuickAssist",
            "capability_type": "pci",
            "product_id": "4444",
            "vendor_id": "8086",
            "device_type": "type-PCI",
        })

        self.flags(alias=[_fake_alias1, _fake_alias], group='pci')
        result = request._get_alias_from_config()
        expected_result = (
            'legacy',
            [{
                "capability_type": "pci",
                "product_id": "4443",
                "vendor_id": "8086",
                "dev_type": "type-PCI"
            }, {
                "capability_type": "pci",
                "product_id": "4444",
                "vendor_id": "8086",
                "dev_type": "type-PCI"
            }])
        self.assertEqual(expected_result, result['QuickAssist'])
Пример #2
0
 def test_valid_alias(self):
     self.flags(alias=[_fake_alias1], group='pci')
     result = request._get_alias_from_config()
     expected_result = ('legacy', [{
         "capability_type": "pci",
         "product_id": "4443",
         "vendor_id": "8086",
         "dev_type": "type-PCI",
     }])
     self.assertEqual(expected_result, result['QuicAssist'])
Пример #3
0
 def test_good_alias(self):
     self.flags(alias=[_fake_alias1], group='pci')
     als = request._get_alias_from_config()
     self.assertIsInstance(als['QuicAssist'], list)
     expect_dict = {
         "capability_type": "pci",
         "product_id": "4443",
         "vendor_id": "8086",
         "dev_type": "type-PCI"
         }
     self.assertEqual(expect_dict, als['QuicAssist'][0])
Пример #4
0
 def test_good_alias(self):
     self.flags(alias=[_fake_alias1], group='pci')
     als = request._get_alias_from_config()
     self.assertIsInstance(als['QuicAssist'], list)
     expect_dict = {
         "capability_type": "pci",
         "product_id": "4443",
         "vendor_id": "8086",
         "dev_type": "type-PCI"
     }
     self.assertEqual(expect_dict, als['QuicAssist'][0])
Пример #5
0
 def test_valid_alias(self):
     self.flags(alias=[_fake_alias1], group='pci')
     result = request._get_alias_from_config()
     expected_result = (
         'legacy',
         [{
             "capability_type": "pci",
             "product_id": "4443",
             "vendor_id": "8086",
             "dev_type": "type-PCI",
         }])
     self.assertEqual(expected_result, result['QuicAssist'])
Пример #6
0
 def test_get_alias_from_config_valid_numa_policy(self):
     for policy in fields.PCINUMAAffinityPolicy.ALL:
         fake_alias = jsonutils.dumps({
             "name": "xxx",
             "capability_type": "pci",
             "product_id": "1111",
             "vendor_id": "8086",
             "device_type": "type-PCI",
             "numa_policy": policy,
         })
         self.flags(alias=[fake_alias], group='pci')
         aliases = request._get_alias_from_config()
         self.assertIsNotNone(aliases)
         self.assertIn("xxx", aliases)
         self.assertEqual(policy, aliases["xxx"][0])
Пример #7
0
    def test_multispec_alias(self):
        self.flags(pci_alias=[_fake_alias1, _fake_alias11])
        als = request._get_alias_from_config()
        self.assertIsInstance(als['QuicAssist'], list)
        expect_dict1 = {
            "capability_type": "pci",
            "product_id": "4443",
            "vendor_id": "8086",
            "dev_type": "type-PCI"
            }
        expect_dict2 = {
            "capability_type": "pci",
            "product_id": "4444",
            "vendor_id": "8086",
            "dev_type": "type-PCI"
            }

        self.assertEqual(expect_dict1, als['QuicAssist'][0])
        self.assertEqual(expect_dict2, als['QuicAssist'][1])
Пример #8
0
    def test_multispec_alias(self):
        self.flags(pci_alias=[_fake_alias1, _fake_alias11])
        als = request._get_alias_from_config()
        self.assertIsInstance(als['QuicAssist'], list)
        expect_dict1 = {
            "capability_type": "pci",
            "product_id": "4443",
            "vendor_id": "8086",
            "dev_type": "type-PCI"
        }
        expect_dict2 = {
            "capability_type": "pci",
            "product_id": "4444",
            "vendor_id": "8086",
            "dev_type": "type-PCI"
        }

        self.assertEqual(expect_dict1, als['QuicAssist'][0])
        self.assertEqual(expect_dict2, als['QuicAssist'][1])