mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 07:56:29 +00:00
tools: Handle sequence numbers for BGP community (large/ext) in frr-reload.py
If we add/modify community/large/ext lists without sequence numbers, and doing frr-reload.py, then rules with sequence numbers (show running-config always adds sequence numbers) will be deleted and new ones will be re-added. This could lead to blackholing for some time. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
eb53128367
commit
8bcbee1999
@ -1376,6 +1376,37 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del):
|
|||||||
lines_to_add.append((add_cmd, None))
|
lines_to_add.append((add_cmd, None))
|
||||||
lines_to_del_to_del.append((ctx_keys, None))
|
lines_to_del_to_del.append((ctx_keys, None))
|
||||||
|
|
||||||
|
# bgp community-list, large-community-list, extcommunity-list can be
|
||||||
|
# specified without a seq number. However, the running config always
|
||||||
|
# adds `seq X` (sequence number). So, ignore such lines as well.
|
||||||
|
# Examples:
|
||||||
|
# bgp community-list standard clist seq 5 permit 222:213
|
||||||
|
# bgp large-community-list standard llist seq 5 permit 65001:65001:1
|
||||||
|
# bgp extcommunity-list standard elist seq 5 permit soo 123:123
|
||||||
|
re_bgp_lists = re.search(
|
||||||
|
"^(bgp )(community-list|large-community-list|extcommunity-list)(\s+\S+\s+)(\S+\s+)(seq \d+\s+)(permit|deny)(.*)$",
|
||||||
|
ctx_keys[0],
|
||||||
|
)
|
||||||
|
if re_bgp_lists:
|
||||||
|
found = False
|
||||||
|
tmpline = (
|
||||||
|
re_bgp_lists.group(1)
|
||||||
|
+ re_bgp_lists.group(2)
|
||||||
|
+ re_bgp_lists.group(3)
|
||||||
|
+ re_bgp_lists.group(4)
|
||||||
|
+ re_bgp_lists.group(6)
|
||||||
|
+ re_bgp_lists.group(7)
|
||||||
|
)
|
||||||
|
for ctx in lines_to_add:
|
||||||
|
if ctx[0][0] == tmpline:
|
||||||
|
lines_to_del_to_del.append((ctx_keys, None))
|
||||||
|
lines_to_add_to_del.append(((tmpline,), None))
|
||||||
|
found = True
|
||||||
|
if found is False:
|
||||||
|
add_cmd = ("no " + ctx_keys[0],)
|
||||||
|
lines_to_add.append((add_cmd, None))
|
||||||
|
lines_to_del_to_del.append((ctx_keys, None))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
len(ctx_keys) == 3
|
len(ctx_keys) == 3
|
||||||
and ctx_keys[0].startswith("router bgp")
|
and ctx_keys[0].startswith("router bgp")
|
||||||
|
Loading…
Reference in New Issue
Block a user