Skip to content

Commit

Permalink
tools: strip 'vrf default' from 'router bgp' line in frr-reload.py
Browse files Browse the repository at this point in the history
Since CUE defines the bgp defines the default bgp instance with an
explicit 'vrf default', it causes problems for frr-reload when
trying to match up with the the generated config without the
'vrf default' in the config. This patch strips the 'vrf default'
when the new config file is read so all match up nicely.

Ticket: CM-33044
Signed-off-by: Don Slice <dslice@nvidia.com>
  • Loading branch information
dslicenc authored and donaldsharp committed Dec 18, 2024
1 parent c4b9065 commit f854b55
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/frr-reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ def get_normalized_es_id(line):
return line


def get_normalized_bgp_default(line):
"""
If 'router bgp <ASN> vrf default' is entered, we need to remove the
explicit "vrf default" so that the context information is created
correctly and configurations are matched appropriately.
"""
new_line = line.replace("vrf default", "").strip()

return new_line

def get_normalized_mac_ip_line(line):
if line.startswith("evpn mh es"):
return get_normalized_es_id(line)
Expand Down Expand Up @@ -317,6 +327,10 @@ def load_from_file(self, filename):
if line.startswith("interface ") and "vrf" in line:
line = get_normalized_interface_vrf(line)

# remove 'vrf default' from 'router bgp x vrf default'
if line.startswith('router bgp') and "vrf default" in line:
line = get_normalized_bgp_default(line)

if ":" in line:
line = get_normalized_mac_ip_line(line)

Expand Down

0 comments on commit f854b55

Please sign in to comment.