diff options
author | Russ White <russ@riw.us> | 2020-12-07 22:19:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 22:19:04 +0100 |
commit | bd32345be353d5192ec1ac852f34558942be2992 (patch) | |
tree | 000560ab267190d01bb7ba8f79892b1543567e3a /tools | |
parent | Merge pull request #7501 from pguibert6WIND/nhrp_map_fix (diff) | |
parent | frr-reload: ignore-case in the es-id and es-sys-mac config comparisons (diff) | |
download | frr-bd32345be353d5192ec1ac852f34558942be2992.tar.xz frr-bd32345be353d5192ec1ac852f34558942be2992.zip |
Merge pull request #7582 from AnuradhaKaruppiah/frr-reload-cleanup
frr reload fixes for mac and ip normalization
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/frr-reload.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 0de6c1c2e..3121551ee 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -221,6 +221,26 @@ ip forwarding for ligne in lines: self.dlines[ligne] = True +def get_normalized_es_id(line): + """ + The es-id or es-sys-mac need to be converted to lower case + """ + sub_strs = ["evpn mh es-id", "evpn mh es-sys-mac"] + for sub_str in sub_strs: + obj = re.match(sub_str + " (?P<esi>\S*)", line) + if obj: + line = "%s %s" % (sub_str, obj.group("esi").lower()) + break + return line + +def get_normalized_mac_ip_line(line): + if line.startswith("evpn mh es"): + return get_normalized_es_id(line) + + if not "ipv6 add" in line: + return get_normalized_ipv6_line(line) + + return line class Config(object): @@ -251,11 +271,10 @@ class Config(object): # Compress duplicate whitespaces line = " ".join(line.split()) - if ":" in line and not "ipv6 add": - qv6_line = get_normalized_ipv6_line(line) - self.lines.append(qv6_line) - else: - self.lines.append(line) + if ":" in line: + line = get_normalized_mac_ip_line(line) + + self.lines.append(line) self.load_contexts() |