diff options
| author | Carmine Scarpitta <cscarpit@cisco.com> | 2025-04-12 10:47:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-12 10:47:46 +0000 |
| commit | f7a6712946e4b0ca9a80ee200393f1b9fa5b452d (patch) | |
| tree | 544fa28b07365d5ed9ac75b05b7f29c62eb13578 | |
| parent | 73b65df25331cacb07b40766c91a47b570d3451d (diff) | |
| parent | d7760fed9ef24e1186c3636a064f8cea5ed91682 (diff) | |
Merge pull request #18646 from FRRouting/mergify/bp/stable/10.3/pr-18628
tools: fix reload script for SRv6 locators and formats (backport #18628)
| -rwxr-xr-x | tools/frr-reload.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 9d3a23ae29..83b4085b0c 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1693,6 +1693,7 @@ def ignore_unconfigurable_lines(lines_to_add, lines_to_del): those commands from lines_to_del. """ lines_to_del_to_del = [] + lines_to_del_to_add = [] for ctx_keys, line in lines_to_del: # The integrated-vtysh-config one is technically "no"able but if we did @@ -1714,10 +1715,31 @@ def ignore_unconfigurable_lines(lines_to_add, lines_to_del): ): log.info('"%s" cannot be removed' % (ctx_keys[-1],)) lines_to_del_to_del.append((ctx_keys, line)) + # Handle segment-routing srv6 locators and formats commands + # - Ignore "no formats" and "no locators" command + # - replace "no prefix" under locator XYZ as "no locator XYZ" + elif ( + len(ctx_keys) > 2 + and ctx_keys[0].startswith("segment-routing") + and ctx_keys[1].startswith("srv6") + and ctx_keys[2] in {"locators", "formats"} + ): + is_top_level = len(ctx_keys) == 3 and not line + if ctx_keys[2] == "formats" and is_top_level: + lines_to_del_to_del.append((ctx_keys, line)) + elif ctx_keys[2] == "locators": + if is_top_level: + lines_to_del_to_del.append((ctx_keys, line)) + elif len(ctx_keys) == 4 and line and line.startswith("prefix "): + lines_to_del_to_del.append((ctx_keys, line)) + lines_to_del_to_add.append((ctx_keys[:-1] + (ctx_keys[-1],), None)) for ctx_keys, line in lines_to_del_to_del: lines_to_del.remove((ctx_keys, line)) + for ctx_keys, line in lines_to_del_to_add: + lines_to_del.append((ctx_keys, line)) + return (lines_to_add, lines_to_del) |
