diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2025-07-13 05:24:18 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-13 05:24:18 +0300 |
| commit | 59732c9b412f5d7607dc8a4790d4e9f19294f34b (patch) | |
| tree | 1df35e158c88880dd3fd0902e2e74c5e9ed2afe8 /smoketest/scripts/cli | |
| parent | 7fee1e1d7f6fc40b5444d3e23c26a3aa7fe541d5 (diff) | |
| parent | fcb2975de5f21923002ae1e7d428862ae78dc6d1 (diff) | |
| download | vyos-1x-59732c9b412f5d7607dc8a4790d4e9f19294f34b.tar.gz vyos-1x-59732c9b412f5d7607dc8a4790d4e9f19294f34b.zip | |
Merge pull request #4598 from nobidev/features/add-test-route-static-dhcp
T7623: Add test route static dhcp in VRF
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_static.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_static.py b/smoketest/scripts/cli/test_protocols_static.py index 183ebe24c..7b482b78c 100755 --- a/smoketest/scripts/cli/test_protocols_static.py +++ b/smoketest/scripts/cli/test_protocols_static.py @@ -619,5 +619,37 @@ class TestProtocolsStatic(VyOSUnitTestSHIM.TestCase): while process_named_running('dhclient', cmdline=interface, timeout=10): sleep(0.250) + def test_06_dhcp_default_route_for_vrf(self): + # When running via vyos-build under the QEMU environment a local DHCP + # server is available. This test verifies that the default route is set. + # When not running under the VyOS QEMU environment, this test is skipped. + if not os.path.exists('/tmp/vyos.smoketests.hint'): + self.skipTest('Not running under VyOS CI/CD QEMU environment!') + + interface = 'eth0' + vrf = 'red' + vrf_path = ['vrf', 'name', vrf] + interface_path = ['interfaces', 'ethernet', interface] + self.cli_set(vrf_path + ['table', '1000']) + default_distance = default_value(interface_path + ['dhcp-options', 'default-route-distance']) + self.cli_set(interface_path + ['address', 'dhcp']) + self.cli_set(interface_path + ['vrf', vrf]) + self.cli_commit() + + # Wait for dhclient to receive IP address and default gateway + sleep(5) + + router = get_dhcp_router(interface) + frrconfig = self.getFRRconfig(f'vrf {vrf}', endsection='^exit-vrf') + self.assertIn(rf'ip route 0.0.0.0/0 {router} {interface} tag 210 {default_distance}', frrconfig) + + self.cli_delete(interface_path + ['address']) + self.cli_delete(interface_path + ['vrf']) + self.cli_commit() + + # Wait for dhclient to stop + while process_named_running('dhclient', cmdline=interface, timeout=10): + sleep(0.250) + if __name__ == '__main__': unittest.main(verbosity=2) |
