diff options
| author | Kyrylo Yatsenko <hedrok@gmail.com> | 2026-11-12 23:02:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-12 23:02:07 +0200 |
| commit | 95afe65e7dc8a0b3d620dda7bdf758e7f0245a45 (patch) | |
| tree | 161eaf164ccb094444a3893b2be7a351f1d2bd8a /smoketest/scripts/cli | |
| parent | fb1e6941824f43832535a6c08c1a11cddadaf583 (diff) | |
| parent | bffa7c48f7e8724c1fba21cbb32a7b8ab0d40def (diff) | |
| download | vyos-1x-95afe65e7dc8a0b3d620dda7bdf758e7f0245a45.tar.gz vyos-1x-95afe65e7dc8a0b3d620dda7bdf758e7f0245a45.zip | |
Merge pull request #5648 from c-po/T9606-ospf-compatible
ospf: T9606: add "compatible" node for RFC1583 and RFC7474 options
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_ospf.py | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py index 28568ecbb..5ea9c8fae 100755 --- a/smoketest/scripts/cli/test_protocols_ospf.py +++ b/smoketest/scripts/cli/test_protocols_ospf.py @@ -75,6 +75,7 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.assertIn(f'router ospf', frrconfig) self.assertIn(f' auto-cost reference-bandwidth 100', frrconfig) self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults + self.assertIn(f' no compatible rfc7474', frrconfig) def test_ospf_02_simple(self): router_id = '127.0.0.1' @@ -86,7 +87,7 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.cli_set(base_path + ['parameters', 'router-id', router_id]) self.cli_set(base_path + ['parameters', 'abr-type', abr_type]) self.cli_set(base_path + ['capability', 'opaque']) - self.cli_set(base_path + ['parameters', 'rfc1583-compatibility']) + self.cli_set(base_path + ['compatible', 'rfc1583']) self.cli_set(base_path + ['log-adjacency-changes', 'detail']) self.cli_set(base_path + ['default-metric', metric]) self.cli_set(base_path + ['passive-interface', 'default']) @@ -742,17 +743,17 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.assertIn(' ospf router-id 192.0.2.1', frrconfig) def test_ospf_22_rfc1583_canonical_form(self): - # FRR prints "compatible rfc1583". The CLI option "parameters - # rfc1583-compatibility" must be rendered in this form: if the alias - # form "ospf rfc1583compatibility" is rendered, frr-reload finds the - # line missing on every reload, removes the setting and adds it again, + # FRR prints "compatible rfc1583". The CLI option "compatible rfc1583" + # must be rendered in this form: if the alias form + # "ospf rfc1583compatibility" is rendered, frr-reload finds the line + # missing on every reload, removes the setting and adds it again, # which runs an extra SPF on each FRR reload, whatever it changed. # # This reads the generated FRR config file: FRR accepts both forms, so # vtysh cannot tell which one we rendered. frr_conf = '/run/frr/config/vyos.frr.conf' alias_form = r'(?m)^ ospf rfc1583compatibility' - rfc1583 = base_path + ['parameters', 'rfc1583-compatibility'] + rfc1583 = base_path + ['compatible', 'rfc1583'] # the router-id keeps "router ospf" configured when the node is # deleted below, so the delete is tested against a running instance @@ -780,7 +781,7 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.cli_set(vrf_base + ['table', '1000']) vrf_params = vrf_base + ['protocols', 'ospf', 'parameters'] self.cli_set(vrf_params + ['router-id', '1.1.1.1']) - self.cli_set(vrf_params + ['rfc1583-compatibility']) + self.cli_set(vrf_base + ['protocols', 'ospf', 'compatible', 'rfc1583']) self.cli_commit() frrconfig = read_file(frr_conf) @@ -816,5 +817,52 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.cli_delete(vrf_base) + def test_ospf_24_compatible(self): + # FRR enables "compatible rfc7474" by default and prints only the + # "no" form - rendered when the CLI node is not set + vrf = 'blue' + vrf_base = ['vrf', 'name', vrf] + instances = { + 'router ospf': base_path, + f'router ospf vrf {vrf}': vrf_base + base_path, + } + + def verify(rfc1583: bool, rfc7474: bool): + for header in instances: + frrconfig = self.getFRRconfig(header, stop_section='^exit') + self.assertIn(' ospf router-id 192.0.2.1', frrconfig) + if rfc1583: + self.assertIn(' compatible rfc1583', frrconfig) + else: + self.assertNotIn(' compatible rfc1583', frrconfig) + self.assertNotRegex(frrconfig, r'(?m)^ compatible rfc7474$') + if rfc7474: + self.assertNotIn(' no compatible rfc7474', frrconfig) + else: + self.assertIn(' no compatible rfc7474', frrconfig) + + self.cli_set(vrf_base + ['table', '1000']) + for path in instances.values(): + self.cli_set(path + ['parameters', 'router-id', '192.0.2.1']) + self.cli_commit() + verify(rfc1583=False, rfc7474=False) + + for path in instances.values(): + self.cli_set(path + ['compatible', 'rfc7474']) + self.cli_commit() + verify(rfc1583=False, rfc7474=True) + + for path in instances.values(): + self.cli_set(path + ['compatible', 'rfc1583']) + self.cli_commit() + verify(rfc1583=True, rfc7474=True) + + for path in instances.values(): + self.cli_delete(path + ['compatible']) + self.cli_commit() + verify(rfc1583=False, rfc7474=False) + + self.cli_delete(vrf_base) + if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) |
