]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pbrd: make vty nexthop/nexthop-group output consistent
authorStephen Worley <sworley@cumulusnetworks.com>
Thu, 5 Dec 2019 21:17:42 +0000 (16:17 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 6 Dec 2019 19:04:02 +0000 (14:04 -0500)
The vty output for pbr maps with a nexthop-group was not
consistent with those configured with an individual nexthop.
Fix that so its easier for users to read.

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
                Installed: yes Tableid: 10000
    Seq: 333 rule: 632
        Installed: yes Reason: Valid
        SRC Match: 3.3.3.3/32
        Nexthop-Group: blue
                Installed: yes Tableid: 10000
    Seq: 444 rule: 743
        Installed: yes Reason: Valid
        SRC Match: 4.4.4.4/32
        Nexthop-Group: blue
                Installed: yes Tableid: 10000
    Seq: 555 rule: 854
        Installed: yes Reason: Valid
        SRC Match: 5.5.5.5/32
        Nexthop-Group: red
                Installed: yes Tableid: 10001
    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#

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
pbrd/pbr_vty.c

index 5fd8e5b6520aa5f94572b4b6b9833e9e81dec2ae..26f4938acc1560ff82698bcd5475a4e10bef755f 100644 (file)
@@ -536,11 +536,11 @@ static void vty_show_pbrms(struct vty *vty,
        vty_out(vty, "    Seq: %u rule: %u\n", pbrms->seqno, pbrms->ruleno);
 
        if (detail)
-               vty_out(vty, "    Installed: %" PRIu64 "(%u) Reason: %s\n",
+               vty_out(vty, "\tInstalled: %" PRIu64 "(%u) Reason: %s\n",
                        pbrms->installed, pbrms->unique,
                        pbrms->reason ? rbuf : "Valid");
        else
-               vty_out(vty, "    Installed: %s Reason: %s\n",
+               vty_out(vty, "\tInstalled: %s Reason: %s\n",
                        pbrms->installed ? "yes" : "no",
                        pbrms->reason ? rbuf : "Valid");
 
@@ -554,30 +554,29 @@ 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\n", 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),
+                       vty_out(vty, "\t\tInstalled: %u(%d) Tableid: %d\n",
                                pbrms->nhs_installed,
-                               pbr_nht_get_installed(pbrms->nhgrp_name));
+                               pbr_nht_get_installed(pbrms->nhgrp_name),
+                               pbr_nht_get_table(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");
+                       vty_out(vty, "\t\tInstalled: %s Tableid: %d\n",
+                               pbr_nht_get_installed(pbrms->nhgrp_name) ? "yes"
+                                                                        : "no",
+                               pbr_nht_get_table(pbrms->nhgrp_name));
+
        } else if (pbrms->nhg) {
-               vty_out(vty, "     ");
+               vty_out(vty, "\t");
                nexthop_group_write_nexthop(vty, pbrms->nhg->nexthop);
                if (detail)
-                       vty_out(vty, "\tInstalled: %u(%d) Tableid: %d\n",
+                       vty_out(vty, "\t\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",
+                       vty_out(vty, "\t\tInstalled: %s Tableid: %d\n",
                                pbr_nht_get_installed(pbrms->internal_nhg_name)
                                        ? "yes"
                                        : "no",