Ejemplo n.º 1
0
 def test_init(self):
     address_regex = {
         "domain": ".*",
         "bus": "02",
         "slot": "01",
         "function": "[0-2]"
     }
     phys_addr = devspec.PciAddressRegexSpec(address_regex)
     self.assertEqual(phys_addr.domain, ".*")
     self.assertEqual(phys_addr.bus, "02")
     self.assertEqual(phys_addr.slot, "01")
     self.assertEqual(phys_addr.func, "[0-2]")
Ejemplo n.º 2
0
 def test_false_match(self):
     address_str = "0000:0b:00.5"
     phys_addr = devspec.PhysicalPciAddress(address_str)
     addresses = [{
         "domain": ".*",
         "bus": "0a",
         "slot": "00",
         "function": "[5-6]"
     }, {
         "domain": ".*",
         "bus": "02",
         "slot": ".*",
         "function": "[4-5]"
     }, {
         "domain": ".*",
         "bus": "02",
         "slot": "[0-3]",
         "function": ".*"
     }]
     for address in addresses:
         regex_addr = devspec.PciAddressRegexSpec(address)
         self.assertFalse(regex_addr.match(phys_addr))