|
31 | 31 | from vyos.utils.process import process_named_running |
32 | 32 | from vyos.utils.file import read_file |
33 | 33 | from vyos.utils.process import rc_cmd |
| 34 | +from vyos.utils.system import sysctl_read |
34 | 35 | from vyos.vpp.utils import human_page_memory_to_bytes |
35 | 36 |
|
36 | 37 | sys.path.append(os.getenv('vyos_completion_dir')) |
@@ -1417,6 +1418,33 @@ def test_18_vpp_sflow(self): |
1417 | 1418 | self.cli_delete(base_sflow) |
1418 | 1419 | self.cli_commit() |
1419 | 1420 |
|
| 1421 | + def test_18_host_resources(self): |
| 1422 | + max_map_count = '100000' |
| 1423 | + shmmax = '55555555555555' |
| 1424 | + hr_path = ['system', 'option', 'host-resources'] |
| 1425 | + |
| 1426 | + # Check if max-map-count has default auto calculated value |
| 1427 | + # but not less than '65530' |
| 1428 | + self.assertEqual(sysctl_read('vm.max_map_count'), '65530') |
| 1429 | + # The same is with: kernel.shmmax = '4294967296' |
| 1430 | + self.assertEqual(sysctl_read('kernel.shmmax'), '4294967296') |
| 1431 | + |
| 1432 | + # Change max-map-count, shmmax and check |
| 1433 | + self.cli_set(hr_path + ['max-map-count', max_map_count]) |
| 1434 | + self.cli_set(hr_path + ['shmmax', shmmax]) |
| 1435 | + self.cli_commit() |
| 1436 | + |
| 1437 | + self.assertEqual(sysctl_read('vm.max_map_count'), max_map_count) |
| 1438 | + self.assertEqual(sysctl_read('kernel.shmmax'), shmmax) |
| 1439 | + |
| 1440 | + # We expect max-map-count and shmmax will return auto calculated values |
| 1441 | + self.cli_delete(hr_path + ['max-map-count']) |
| 1442 | + self.cli_delete(hr_path + ['shmmax']) |
| 1443 | + self.cli_commit() |
| 1444 | + |
| 1445 | + self.assertEqual(sysctl_read('vm.max_map_count'), '65530') |
| 1446 | + self.assertEqual(sysctl_read('kernel.shmmax'), '4294967296') |
| 1447 | + |
1420 | 1448 |
|
1421 | 1449 | if __name__ == '__main__': |
1422 | 1450 | unittest.main(verbosity=2) |
0 commit comments