def test_numvfs_preconfigured(self): """Test the numvfs config while its already configured""" os.makedirs(sriov_config._SYS_CLASS_NET + "/p2p1/device") f = open(sriov_config._SYS_CLASS_NET + "/p2p1/device/sriov_numvfs", "w+") f.write("10") f.close() self.assertEqual(None, sriov_config.main(['ARG0', '-n', 'p2p1:15'])) self.assertEqual(10, sriov_config.get_numvfs('p2p1'))
def test_numvfs_invalid_params(self): """Test the numvfs config with invalid arguments""" os.makedirs(sriov_config._SYS_CLASS_NET + "/p2p1/device") f = open(sriov_config._SYS_CLASS_NET + "/p2p1/device/sriov_numvfs", "w+") f.write("0") f.close() self.assertEqual(1, sriov_config.main(['ARG0', '-n', 'p2p1:15a'])) self.assertEqual(0, sriov_config.get_numvfs('p2p1'))
def test_numvfs_preconfigured(self): """Test the numvfs config while its already configured""" self._write_numvfs('p2p1', 10) self.assertEqual(None, sriov_config.main(['ARG0', '-n', 'p2p1:15'])) self.assertEqual(10, sriov_config.get_numvfs('p2p1'))
def test_numvfs_invalid_params(self): """Test the numvfs config with invalid arguments""" self._write_numvfs('p2p1') self.assertEqual(1, sriov_config.main(['ARG0', '-n', 'p2p1:15a'])) self.assertEqual(0, sriov_config.get_numvfs('p2p1'))
def test_numvfs_config(self): """Test the numvfs config with valid arguments""" self._write_numvfs('p2p1') self.assertEqual(None, sriov_config.main(['ARG0', '-n', 'p2p1:15'])) self.assertEqual(15, sriov_config.get_numvfs('p2p1'))
def configure_sriov_pfs(): logger.info("Configuring PFs now") sriov_config.main() _configure_sriov_config_service()