]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: add peer description for each afi/safi line in show summary 7589/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 23 Nov 2020 14:29:40 +0000 (14:29 +0000)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 1 Dec 2020 08:06:37 +0000 (08:06 +0000)
For each afi/safi of 'show bgp summary', display the peer description
each time needed. This information is useful, for instance in the case
of a device connected with multiple peers.
The topotest all_protocol_startup is changed accordingly.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_vty.c
tests/topotests/all-protocol-startup/r1/bgpd.conf
tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_summary.ref
tests/topotests/all-protocol-startup/r1/show_ip_bgp_summary.ref
tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py

index 1a7a3543f9712e196a5d9705cf8c60f3ffec70c6..03494f7a1f49063eb8fa3ff525f2a611670c5252 100644 (file)
@@ -10742,7 +10742,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                        vty_out(vty, "EstdCnt DropCnt ResetTime Reason\n");
                                else
                                        vty_out(vty,
-                                               "V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt\n");
+                                               "V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc\n");
                        }
                }
 
@@ -10881,6 +10881,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                                    peer->established);
                                json_object_int_add(json_peer, "connectionsDropped",
                                                    peer->dropped);
+                               if (peer->desc)
+                                       json_object_string_add(
+                                               json_peer, "desc", peer->desc);
                        }
                        /* Avoid creating empty peer dicts in JSON */
                        if (json_peer == NULL)
@@ -10995,6 +10998,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
 
                                        vty_out(vty, " %8u", 0);
                                }
+                               if (peer->desc)
+                                       vty_out(vty, " %s", peer->desc);
+                               else
+                                       vty_out(vty, " N/A");
                                vty_out(vty, "\n");
                        }
 
index d287b86175c6806f87c188717a2d6897e27c9e68..32dcb727e541ae37fe490d4df3647861d569f159 100644 (file)
@@ -13,6 +13,10 @@ router bgp 100
  neighbor fc00:0:0:8::1000 remote-as 100
  neighbor fc00:0:0:8::1000 timers 3 10
  neighbor fc00:0:0:8::2000 remote-as 200
+ neighbor 192.168.7.10 description Transit_cogent
+ neighbor 192.168.7.20 description Client_Bibi_Full
+ neighbor fc00:0:0:8::1000 description Transit_cogent_v6
+ neighbor fc00:0:0:8::2000 description Client_Toto_default
  neighbor fc00:0:0:8::2000 timers 3 10
  !
  address-family ipv4 unicast
index 1e41263e78ae49001ced3575c34fe7278f0b460f..02466872000a485cd2567864361afc1230900952 100644 (file)
@@ -3,6 +3,6 @@ BGP table version 1
 RIB entries 1, using XXXX bytes of memory
 Peers 2, using XXXX KiB of memory
 
-Neighbor         V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
-fc00:0:0:8::1000 4        100         0         0        0    0    0    never       Active        0
-fc00:0:0:8::2000 4        200         0         0        0    0    0    never       Active        0
+Neighbor         V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
+fc00:0:0:8::1000 4        100         0         0        0    0    0    never       Active        0 Transit_cogent_v6
+fc00:0:0:8::2000 4        200         0         0        0    0    0    never       Active        0 Client_Toto_default
index 3ffbf3ff422844b786f7e1328eea196c5ddc9b3a..deeae87fa3b7f270ae462f562c9a85ef56c59062 100644 (file)
@@ -3,8 +3,8 @@ BGP table version 1
 RIB entries 1, using XXXX bytes of memory
 Peers 4, using XXXX KiB of memory
 
-Neighbor         V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
-192.168.7.10     4        100         0         0        0    0    0    never       Active        0
-192.168.7.20     4        200         0         0        0    0    0    never       Active        0
-fc00:0:0:8::1000 4        100         0         0        0    0    0    never       Active        0
-fc00:0:0:8::2000 4        200         0         0        0    0    0    never       Active        0
+Neighbor         V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
+192.168.7.10     4        100         0         0        0    0    0    never       Active        0 Transit_cogent
+192.168.7.20     4        200         0         0        0    0    0    never       Active        0 Client_Bibi_Full
+fc00:0:0:8::1000 4        100         0         0        0    0    0    never       Active        0 Transit_cogent_v6
+fc00:0:0:8::2000 4        200         0         0        0    0    0    never       Active        0 Client_Toto_default
index 7635f741251fdf4ea8c71a5cb54bd52716173d50..d8815a0d39b7e6bd64b1e96fc89f814a0158c994 100644 (file)
@@ -226,7 +226,7 @@ def test_bgp_converge():
         for i in range(1, 2):
             for view in range(1, 4):
                 notConverged = net["r%s" % i].cmd(
-                    'vtysh -c "show ip bgp view %s summary" 2> /dev/null | grep ^[0-9] | grep -vP " 11\s+(\d+)$"'
+                    'vtysh -c "show ip bgp view %s summary" 2> /dev/null | grep ^[0-9] | grep -vP " 11\s+(\d+)"'
                     % view
                 )
                 if notConverged: