diff options
Diffstat (limited to '')
-rwxr-xr-x | tools/frr-reload.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index b06f1df..461f0e8 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1013,16 +1013,17 @@ def bgp_delete_move_lines(lines_to_add, lines_to_del): del_dict[ctx_keys[0]][re_pg.group(1)] = list() found_pg_del_cmd = True + # move neighbor remote-as lines at the end + for ctx_keys, line in lines_to_del_to_app: + lines_to_del.remove((ctx_keys, line)) + lines_to_del.append((ctx_keys, line)) + if found_pg_del_cmd == False: bgp_delete_inst_move_line(lines_to_del) if del_nbr_dict: bgp_remove_neighbor_cfg(lines_to_del, del_nbr_dict) return (lines_to_add, lines_to_del) - for ctx_keys, line in lines_to_del_to_app: - lines_to_del.remove((ctx_keys, line)) - lines_to_del.append((ctx_keys, line)) - # {'router bgp 65001': {'PG': ['10.1.1.2'], 'PG1': ['10.1.1.21']}, # 'router bgp 65001 vrf vrf1': {'PG': ['10.1.1.2'], 'PG1': ['10.1.1.21']}} for ctx_keys, line in lines_to_del: @@ -1082,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) |