diff options
| author | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-08 22:27:36 +0700 |
|---|---|---|
| committer | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-18 16:34:21 +0700 |
| commit | 60aabdc9587700a326c8e9df06f09ba0c60c5435 (patch) | |
| tree | fcb9598c8d52d3472eb3628b677d62baf7611dc7 /smoketest/scripts/cli/test_protocols_ospf.py | |
| parent | db29bdc899e4b4c27569d3c5705839b924393fe6 (diff) | |
| download | vyos-1x-60aabdc9587700a326c8e9df06f09ba0c60c5435.tar.gz vyos-1x-60aabdc9587700a326c8e9df06f09ba0c60c5435.zip | |
ospf: T9441: migrate "parameters opaque-lsa" to "capability opaque"
"protocols ospf parameters opaque-lsa" and "protocols ospf capability
opaque" are two CLI nodes for one FRR setting, FRR's "capability opaque".
Keep "capability opaque" only.
The migration script ospf/2-to-3 sets "capability opaque" where "parameters
opaque-lsa" exists in the default VRF, and deletes the old node (and the
"parameters" node when it is left empty). FRR refuses opaque LSAs outside
the default VRF, so in a VRF instance the option never took effect: for a
VRF the migration drops both "parameters opaque-lsa" and a plain
"capability opaque" instead of moving the value into a node FRR would
refuse at the next commit. The template renders the line from "capability
opaque" only; it rendered the alias form "ospf opaque-lsa" for the old
node, which frr-reload found missing in the running config on every
reload: while only the old node was set, every commit that reloads FRR
reset all adjacencies of that OSPF instance.
Tests: a migration unit test (global instance, VRF instance, a VRF with
"capability opaque" set directly, both nodes set together in a VRF, and
global+VRF independence), the vrf-ospf config test (now carries "parameters
opaque-lsa" in both the default instance and a VRF instance; the VRF
instance is expected to lose it with no replacement), test_ospf_02 uses the
new node, and test_ospf_21 checks the generated FRR config.
Diffstat (limited to 'smoketest/scripts/cli/test_protocols_ospf.py')
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_ospf.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py index 7879a7379..ef20bb2a2 100755 --- a/smoketest/scripts/cli/test_protocols_ospf.py +++ b/smoketest/scripts/cli/test_protocols_ospf.py @@ -85,7 +85,7 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.cli_set(base_path + ['auto-cost', 'reference-bandwidth', bandwidth]) 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 + ['parameters', 'opaque-lsa']) + self.cli_set(base_path + ['capability', 'opaque']) self.cli_set(base_path + ['parameters', 'rfc1583-compatibility']) self.cli_set(base_path + ['log-adjacency-changes', 'detail']) self.cli_set(base_path + ['default-metric', metric]) @@ -712,5 +712,34 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.cli_commit() verify('') + def test_ospf_21_capability_opaque(self): + # "capability opaque" is the only CLI node for FRR's "capability opaque" + # (T9441: "parameters opaque-lsa" was migrated to it). The generated + # FRR config file must hold the line once, and no alias form of it. + # + # This reads the generated FRR config file: FRR accepts the alias + # "ospf opaque-lsa", so vtysh cannot tell which form was rendered. + frr_conf = '/run/frr/config/vyos.frr.conf' + capability = base_path + ['capability', 'opaque'] + + # the router-id keeps "router ospf" configured when the node is + # deleted below, so the delete is tested against a running instance + self.cli_set(base_path + ['parameters', 'router-id', '192.0.2.1']) + self.cli_set(capability) + self.cli_commit() + + frrconfig = read_file(frr_conf) + self.assertEqual(frrconfig.count('\n capability opaque\n'), 1) + self.assertNotRegex(frrconfig, r'(?m)^ ospf opaque-lsa') + frrconfig = self.getFRRconfig('router ospf', stop_section='^exit') + self.assertIn(' capability opaque', frrconfig) + + self.cli_delete(capability) + self.cli_commit() + self.assertNotIn('capability opaque', read_file(frr_conf)) + frrconfig = self.getFRRconfig('router ospf', stop_section='^exit') + self.assertNotIn(' capability opaque', frrconfig) + self.assertIn(' ospf router-id 192.0.2.1', frrconfig) + if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) |
