From: Daniel Walton Date: Tue, 19 Sep 2017 13:06:49 +0000 (+0000) Subject: tools: frr-reload support for "no no" scenario X-Git-Tag: frr-4.0-dev~267^2~8 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8ad1fe6cae1b1e4b17448b1b7a64651e53ffaa3a;p=mirror%2Ffrr.git tools: frr-reload support for "no no" scenario Signed-off-by: Daniel Walton --- diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 8f34b4cb3f..53188ec31b 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -557,7 +557,15 @@ def line_for_vtysh_file(ctx_keys, line, delete): for ctx_key in ctx_keys: cmd.append(ctx_key) - return '\n' + '\n'.join(cmd) + cmd = '\n' + '\n'.join(cmd) + + # There are some commands that are on by default so their "no" form will be + # displayed in the config. "no bgp default ipv4-unicast" is one of these. + # If we need to remove this line we do so by adding "bgp default ipv4-unicast", + # not by doing a "no no bgp default ipv4-unicast" + cmd = cmd.replace('no no ', '') + + return cmd def get_normalized_ipv6_line(line): @@ -931,6 +939,7 @@ def compare_context_objects(newconf, running): return (lines_to_add, lines_to_del) + if __name__ == '__main__': # Command line options parser = argparse.ArgumentParser(description='Dynamically apply diff in frr configs')