From 3703c5452020823f71a7f551cb8defbdd86eb0ae Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Sat, 1 Feb 2025 13:04:14 +0200 Subject: smoketest: temporary skip bonding tests Skip bonding test to check the building, from time to time tests (bond) got recursion as in https://vyos.dev/T7117 --- smoketest/scripts/cli/test_vpp.py | 1 + 1 file changed, 1 insertion(+) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index b1ea66bea..2ca02646a 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -522,6 +522,7 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.cli_set(base_path + ['interfaces', 'loopback', interface_loopback]) self.cli_commit() + @unittest.skip("Skipping temporary bonding, sometimes get recursion T7117") def test_06_vpp_bonding(self): interface_bond = 'bond23' interface_kernel = 'vpptun23' -- cgit v1.2.3 From e5c5d6778883ab1e73f9e0face6ad9b660b2efec Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Tue, 28 Jan 2025 11:56:18 +0200 Subject: T7066: VPP CPU workers should be calculated and verified --- smoketest/scripts/cli/test_vpp.py | 26 ++++++++++++++++++++++++++ src/conf_mode/vpp.py | 17 +++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index ba0d0d728..5e4832c00 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -940,6 +940,32 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): for required_string in required_str_list: self.assertNotIn(required_string, out) + def test_11_vpp_cpu_settings(self): + main_core = '0' + workers = '2' + + self.cli_set(base_path + ['settings', 'cpu', 'workers', workers]) + + # "cpu workers" reqiures main-core to be set + # expect raise ConfigError + with self.assertRaises(ConfigSessionError): + self.cli_commit() + + self.cli_set(base_path + ['settings', 'cpu', 'main-core', main_core]) + + self.cli_commit() + + config_entries = ( + f'main-core {main_core}', + f'workers {workers}', + 'dev 0000:00:00.0', + ) + + # Check configured options + config = read_file(VPP_CONF) + for config_entry in config_entries: + self.assertIn(config_entry, config) + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 923ac7f31..7da40a21a 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -381,10 +381,22 @@ def verify(config): if 'cpu' in config['settings']: if ( 'corelist_workers' in config['settings']['cpu'] - and 'main_core' not in config['settings']['cpu'] - ): + or 'workers' in config['settings']['cpu'] + ) and 'main_core' not in config['settings']['cpu']: raise ConfigError('"cpu main-core" is required but not set!') + cpus = int(get_core_count()) + if 'workers' in config['settings']['cpu']: + # number of worker threads must be not more than + # available CPUs in the system - 2 (1 for main thread and at least 1 for system processes) + workers = int(config['settings']['cpu']['workers']) + available_workers = cpus - 2 + if workers > available_workers: + raise ConfigError( + f'The system does not have enough CPUs for {workers} VPP workers ' + f'(reduce to {available_workers} or less)' + ) + verify_memory(config['settings']) # Check if deleted interfaces are not xconnect memebrs @@ -428,6 +440,7 @@ def generate(config): def apply(config): + # Open persistent config # It is required for operations with interfaces persist_config = JSONStorage('vpp_conf') -- cgit v1.2.3