Skip to content

Commit

Permalink
Merge pull request #15794 from chiragshah6/fdev2
Browse files Browse the repository at this point in the history
tools: fix pim interface config deletion II
  • Loading branch information
ton31337 authored Apr 24, 2024
2 parents 0d0350a + da2093b commit 3bb7b49
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tools/frr-reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,34 @@ def pim_delete_move_lines(lines_to_add, lines_to_del):
# Remove all such depdendent options from delete
# pending list.
pim_disable = False
lines_to_del_to_del = []

index = -1
for ctx_keys, line in lines_to_del:
index = index + 1
if ctx_keys[0].startswith("interface") and line and line == "ip pim":
pim_disable = True

# no ip msdp peer <> does not accept source so strip it off.
if line and line.startswith("ip msdp peer "):
pim_msdp_peer = re.search("ip msdp peer (\S+) source (\S+)", line)
if pim_msdp_peer:
source_sub_str = "source %s" % pim_msdp_peer.group(2)
new_line = line.replace(source_sub_str, "").strip()
lines_to_del.remove((ctx_keys, line))
lines_to_del.insert(index, (ctx_keys, new_line))

if pim_disable:
for ctx_keys, line in lines_to_del:
if (
ctx_keys[0].startswith("interface")
and line
and line.startswith("ip pim ")
and (line.startswith("ip pim ") or line.startswith("ip multicast "))
):
lines_to_del.remove((ctx_keys, line))
lines_to_del_to_del.append((ctx_keys, line))

for ctx_keys, line in lines_to_del_to_del:
lines_to_del.remove((ctx_keys, line))

return (lines_to_add, lines_to_del)

Expand Down

0 comments on commit 3bb7b49

Please sign in to comment.