From 2f1406fc863bace0870681483d0096ba12eef492 Mon Sep 17 00:00:00 2001 From: Emanuele Di Pascale Date: Tue, 22 Dec 2020 17:00:39 +0100 Subject: [PATCH] pathd, tools: fix peer preference config on one hand, the default value for a peer preference was always being displayed, and on the other there was some code in frr-reload.py which was attempting to add a default value to match this behavior, and which was incorrectly overriding a specified preference. Fix this by removing this code and making pathd behave like other daemons in this respect, i.e. not displaying the default value. Signed-off-by: Emanuele Di Pascale --- pathd/path_pcep_cli.c | 3 ++- tools/frr-reload.py | 22 +--------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index f80814f17c..1e37304096 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -1479,7 +1479,8 @@ int pcep_cli_pcc_config_write(struct vty *vty) csnprintfrr(buf, sizeof(buf), " peer %s", pce_opts->pce_name); - if (pce_opts->precedence > 0) { + if (pce_opts->precedence > 0 + && pce_opts->precedence != DEFAULT_PCE_PRECEDENCE) { csnprintfrr(buf, sizeof(buf), " %s %d", PCEP_VTYSH_ARG_PRECEDENCE, pce_opts->precedence); diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 5ffa2430b7..e95f0529c5 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -683,26 +683,6 @@ end new_ctx = False log.debug("LINE %-50s: entering new context, %-50s", line, ctx_keys) - elif ( - line.startswith("peer ") - and len(ctx_keys) == 4 - and ctx_keys[0].startswith("segment-routing") - and ctx_keys[1].startswith("traffic-eng") - and ctx_keys[2].startswith("pcep") - and ctx_keys[3].startswith("pcc") - ): - # If there is no precedence, we add the default one (255) so - # the line is not removed and added back - m = re.search('peer ([^ ]*)', line) - if (m != None): - (name,) = m.groups() - line = "peer %s precedence 255" % (name,) - - current_context_lines.append(line) - log.debug( - "LINE %-50s: append to current_context_lines, %-50s", line, ctx_keys - ) - elif ( line.startswith("address-family ") or line.startswith("vnc defaults") @@ -1508,7 +1488,7 @@ def compare_context_objects(newconf, running): elif ( len(running_ctx_keys) == 3 and running_ctx_keys[0].startswith('segment-routing') - and running_ctx_keys[2].startswith('pcep4') + and running_ctx_keys[2].startswith('pcep') ): continue -- 2.39.5