diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-12-05 21:52:08 +0100 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-12-06 20:04:02 +0100 |
commit | 3259cde6374a34a61f11b24e69ac90a77e03a248 (patch) | |
tree | 521cfb0ace10188d2d8f8466dcc020ba69eab5ba /pbrd | |
parent | pbrd: refactor vty map show output into functions (diff) | |
download | frr-3259cde6374a34a61f11b24e69ac90a77e03a248.tar.xz frr-3259cde6374a34a61f11b24e69ac90a77e03a248.zip |
pbrd: make show pbr map detail actually work
The `detail` keyword was doing literally nothing. Changed the
default show to be a bit more user friendly and detail
to give the information you might would need for
debugging.
alfred# show pbr map
pbr-map TEST1 valid: 1
Seq: 222 rule: 521
Installed: yes Reason: Valid
SRC Match: 2.2.2.2/32
Nexthop-Group: blue(10000) Installed: yes
Seq: 333 rule: 632
Installed: yes Reason: Valid
SRC Match: 3.3.3.3/32
Nexthop-Group: blue(10000) Installed: yes
Seq: 444 rule: 743
Installed: yes Reason: Valid
SRC Match: 4.4.4.4/32
Nexthop-Group: blue(10000) Installed: yes
Seq: 555 rule: 854
Installed: yes Reason: Valid
SRC Match: 5.5.5.5/32
Nexthop-Group: red(10001) Installed: yes
Seq: 666 rule: 965
Installed: yes Reason: Valid
SRC Match: 6.6.6.6/32
nexthop 1.1.1.1
Installed: yes Tableid: 10002
alfred# show pbr map detail
pbr-map TEST1 valid: 1
Seq: 222 rule: 521
Installed: 1(1) Reason: Valid
SRC Match: 2.2.2.2/32
Nexthop-Group: blue(10000) Installed: 1(1)
Seq: 333 rule: 632
Installed: 1(2) Reason: Valid
SRC Match: 3.3.3.3/32
Nexthop-Group: blue(10000) Installed: 1(1)
Seq: 444 rule: 743
Installed: 1(3) Reason: Valid
SRC Match: 4.4.4.4/32
Nexthop-Group: blue(10000) Installed: 1(1)
Seq: 555 rule: 854
Installed: 1(4) Reason: Valid
SRC Match: 5.5.5.5/32
Nexthop-Group: red(10001) Installed: 1(1)
Seq: 666 rule: 965
Installed: 1(5) Reason: Valid
SRC Match: 6.6.6.6/32
nexthop 1.1.1.1
Installed: 1(1) Tableid: 10002
alfred#
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'pbrd')
-rw-r--r-- | pbrd/pbr_vty.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 0122e029b..5fd8e5b65 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -532,10 +532,17 @@ static void vty_show_pbrms(struct vty *vty, if (pbrms->reason) pbr_map_reason_string(pbrms->reason, rbuf, sizeof(rbuf)); - vty_out(vty, - " Seq: %u rule: %u Installed: %" PRIu64 "(%u) Reason: %s\n", - pbrms->seqno, pbrms->ruleno, pbrms->installed, pbrms->unique, - pbrms->reason ? rbuf : "Valid"); + + vty_out(vty, " Seq: %u rule: %u\n", pbrms->seqno, pbrms->ruleno); + + if (detail) + vty_out(vty, " Installed: %" PRIu64 "(%u) Reason: %s\n", + pbrms->installed, pbrms->unique, + pbrms->reason ? rbuf : "Valid"); + else + vty_out(vty, " Installed: %s Reason: %s\n", + pbrms->installed ? "yes" : "no", + pbrms->reason ? rbuf : "Valid"); if (pbrms->src) vty_out(vty, "\tSRC Match: %s\n", @@ -547,23 +554,41 @@ static void vty_show_pbrms(struct vty *vty, vty_out(vty, "\tMARK Match: %u\n", pbrms->mark); if (pbrms->nhgrp_name) { - vty_out(vty, "\tNexthop-Group: %s(%u) Installed: %u(%d)\n", - pbrms->nhgrp_name, pbr_nht_get_table(pbrms->nhgrp_name), - pbrms->nhs_installed, - pbr_nht_get_installed(pbrms->nhgrp_name)); + if (detail) + vty_out(vty, + "\tNexthop-Group: %s(%u) Installed: %u(%d)\n", + pbrms->nhgrp_name, + pbr_nht_get_table(pbrms->nhgrp_name), + pbrms->nhs_installed, + pbr_nht_get_installed(pbrms->nhgrp_name)); + else + vty_out(vty, "\tNexthop-Group: %s(%u) Installed: %s\n", + pbrms->nhgrp_name, + pbr_nht_get_table(pbrms->nhgrp_name), + pbr_nht_get_installed(pbrms->nhgrp_name) + ? "yes" + : "no"); } else if (pbrms->nhg) { vty_out(vty, " "); nexthop_group_write_nexthop(vty, pbrms->nhg->nexthop); - vty_out(vty, "\tInstalled: %u(%d) Tableid: %d\n", - pbrms->nhs_installed, - pbr_nht_get_installed(pbrms->internal_nhg_name), - pbr_nht_get_table(pbrms->internal_nhg_name)); + if (detail) + vty_out(vty, "\tInstalled: %u(%d) Tableid: %d\n", + pbrms->nhs_installed, + pbr_nht_get_installed(pbrms->internal_nhg_name), + pbr_nht_get_table(pbrms->internal_nhg_name)); + else + vty_out(vty, "\tInstalled: %s Tableid: %d\n", + pbr_nht_get_installed(pbrms->internal_nhg_name) + ? "yes" + : "no", + pbr_nht_get_table(pbrms->internal_nhg_name)); + } else if (pbrms->vrf_unchanged) { vty_out(vty, "\tVRF Unchanged (use interface vrf)\n"); } else if (pbrms->vrf_lookup) { vty_out(vty, "\tVRF Lookup: %s\n", pbrms->vrf_name); } else { - vty_out(vty, "\tNexthop-Group: Unknown Installed: 0(0)\n"); + vty_out(vty, "\tNexthop-Group: Unknown Installed: no\n"); } } |