예제 #1
0
 def test_validate_config_fail(self):
     cfg.CONF.set_override('physical_device_mappings',
                           self.DEVICE_MAPPING_LIST, 'SRIOV_NIC')
     cfg.CONF.set_override('exclude_devices',
                           self.EXCLUDE_DEVICES_LIST_INVALID, 'SRIOV_NIC')
     config_parser = agent.SriovNicAgentConfigParser()
     self.assertRaises(ValueError, config_parser.parse)
예제 #2
0
 def test__validate_rp_in_dev_mappings(self):
     with mock.patch.object(
             cfg.CONF.SRIOV_NIC, 'physical_device_mappings',
             new=[]), \
          mock.patch.object(
             cfg.CONF.SRIOV_NIC, 'resource_provider_bandwidths',
             new=['no_such_dev_in_dev_mappings:1:1']):
         parser = sriov_nic_agent.SriovNicAgentConfigParser()
         self.assertRaises(ValueError, parser.parse)
예제 #3
0
 def test_validate_config_ok(self):
     cfg.CONF.set_override('physical_device_mappings',
                           self.DEVICE_MAPPING_LIST, 'SRIOV_NIC')
     cfg.CONF.set_override('exclude_devices', self.EXCLUDE_DEVICES_LIST,
                           'SRIOV_NIC')
     config_parser = agent.SriovNicAgentConfigParser()
     config_parser.parse()
     device_mappings = config_parser.device_mappings
     exclude_devices = config_parser.exclude_devices
     self.assertEqual(self.EXCLUDE_DEVICES, exclude_devices)
     self.assertEqual(self.DEVICE_MAPPING, device_mappings)