summaryrefslogtreecommitdiff
path: root/tools/frr-reload.py
diff options
context:
space:
mode:
authorRajasekar Raja <rajasekarr@nvidia.com>2025-04-08 15:06:57 -0700
committerRajasekar Raja <rajasekarr@nvidia.com>2025-04-10 07:55:57 -0700
commitce06d35fa983c67d25d93f5c2533610490313699 (patch)
tree09d63821914033831b994fe93f886d4b5c5875a6 /tools/frr-reload.py
parent4281d2b2c70408fd3a053a8362ceded943db87ad (diff)
tools: fix reload script for SRv6 locators and formats
Current code implementation does not have a "no" form of handling for the following commands under segment-routing srv6 - no formats - no locators - no prefix <> under locator XYZ Fix the handling of segment-routing srv6 locators and formats commands - Ignore "no formats" and "no locators" command - replace "no prefix" under locator XYZ as "no locator XYZ" as prefix is a mandatory property of locator Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Diffstat (limited to 'tools/frr-reload.py')
-rwxr-xr-xtools/frr-reload.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index f2389f27a5..95a00c2b6a 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -1698,6 +1698,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
@@ -1719,10 +1720,31 @@ def ignore_unconfigurable_lines(lines_to_add, lines_to_del):
):
log.info(f'"{ctx_keys[-1]}" cannot be removed')
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)