2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Zebra VTY functions
|
|
|
|
* Copyright (C) 2002 Kunihiro Ishiguro
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
2007-05-02 18:05:35 +02:00
|
|
|
#include "memory.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "if.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "rib.h"
|
2015-05-20 02:40:34 +02:00
|
|
|
#include "nexthop.h"
|
2015-05-22 11:39:56 +02:00
|
|
|
#include "vrf.h"
|
2018-03-01 11:10:47 +01:00
|
|
|
#include "linklist.h"
|
2016-04-15 19:51:56 +02:00
|
|
|
#include "mpls.h"
|
2015-05-29 05:48:31 +02:00
|
|
|
#include "routemap.h"
|
2016-12-05 20:05:30 +01:00
|
|
|
#include "srcdest_table.h"
|
2017-05-15 07:45:55 +02:00
|
|
|
#include "vxlan.h"
|
2022-02-04 14:42:07 +01:00
|
|
|
#include "termtable.h"
|
2022-11-03 14:30:23 +01:00
|
|
|
#include "affinitymap.h"
|
2023-11-04 09:47:46 +01:00
|
|
|
#include "frrdistance.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-08-27 16:43:37 +02:00
|
|
|
#include "zebra/zebra_router.h"
|
2005-06-28 19:17:12 +02:00
|
|
|
#include "zebra/zserv.h"
|
2016-04-14 15:20:47 +02:00
|
|
|
#include "zebra/zebra_vrf.h"
|
2016-04-15 19:51:56 +02:00
|
|
|
#include "zebra/zebra_mpls.h"
|
2015-05-20 02:40:34 +02:00
|
|
|
#include "zebra/zebra_rnh.h"
|
2015-05-20 03:03:42 +02:00
|
|
|
#include "zebra/redistribute.h"
|
2022-11-09 15:17:19 +01:00
|
|
|
#include "zebra/zebra_affinitymap.h"
|
2015-08-26 14:21:40 +02:00
|
|
|
#include "zebra/zebra_routemap.h"
|
2016-10-07 15:05:28 +02:00
|
|
|
#include "lib/json.h"
|
2021-04-18 20:53:19 +02:00
|
|
|
#include "lib/route_opaque.h"
|
2017-05-15 07:45:55 +02:00
|
|
|
#include "zebra/zebra_vxlan.h"
|
2020-03-28 01:34:06 +01:00
|
|
|
#include "zebra/zebra_evpn_mh.h"
|
2017-07-28 02:27:56 +02:00
|
|
|
#include "zebra/zebra_vty_clippy.c"
|
2017-10-25 16:47:55 +02:00
|
|
|
#include "zebra/zserv.h"
|
2017-12-07 16:47:30 +01:00
|
|
|
#include "zebra/router-id.h"
|
|
|
|
#include "zebra/ipforward.h"
|
2017-10-08 03:49:27 +02:00
|
|
|
#include "zebra/zebra_vxlan_private.h"
|
2018-04-23 15:17:19 +02:00
|
|
|
#include "zebra/zebra_pbr.h"
|
2019-01-24 03:16:41 +01:00
|
|
|
#include "zebra/zebra_nhg.h"
|
2020-05-08 15:00:40 +02:00
|
|
|
#include "zebra/zebra_evpn_mh.h"
|
2019-05-16 06:24:43 +02:00
|
|
|
#include "zebra/interface.h"
|
2020-02-06 22:32:34 +01:00
|
|
|
#include "northbound_cli.h"
|
2020-07-14 23:23:48 +02:00
|
|
|
#include "zebra/zebra_nb.h"
|
2020-08-03 20:23:56 +02:00
|
|
|
#include "zebra/kernel_netlink.h"
|
2022-01-19 20:36:10 +01:00
|
|
|
#include "zebra/if_netlink.h"
|
2021-07-23 16:56:28 +02:00
|
|
|
#include "zebra/table_manager.h"
|
2021-10-13 17:08:31 +02:00
|
|
|
#include "zebra/zebra_script.h"
|
2022-02-04 14:04:23 +01:00
|
|
|
#include "zebra/rtadv.h"
|
2021-12-18 20:28:49 +01:00
|
|
|
#include "zebra/zebra_neigh.h"
|
2024-01-24 15:50:26 +01:00
|
|
|
#include "zebra/zebra_ptm.h"
|
2015-08-26 14:21:40 +02:00
|
|
|
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
/* context to manage dumps in multiple tables or vrfs */
|
|
|
|
struct route_show_ctx {
|
|
|
|
bool multi; /* dump multiple tables or vrf */
|
|
|
|
bool header_done; /* common header already displayed */
|
|
|
|
};
|
|
|
|
|
2016-08-29 21:59:53 +02:00
|
|
|
static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
|
2024-05-24 16:46:17 +02:00
|
|
|
safi_t safi, bool use_fib, bool use_json,
|
|
|
|
route_tag_t tag,
|
2017-09-13 20:16:12 +02:00
|
|
|
const struct prefix *longer_prefix_p,
|
2017-05-22 21:56:11 +02:00
|
|
|
bool supernets_only, int type,
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
unsigned short ospf_instance_id, uint32_t tableid,
|
2021-11-29 20:59:06 +01:00
|
|
|
bool show_ng, struct route_show_ctx *ctx);
|
2015-01-22 19:12:35 +01:00
|
|
|
static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
2019-08-27 00:20:45 +02:00
|
|
|
int mcast, bool use_fib, bool show_ng);
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
static void vty_show_ip_route_summary(struct vty *vty, struct route_table *table,
|
|
|
|
json_object *vrf_json, bool use_json);
|
2017-09-13 22:40:19 +02:00
|
|
|
static void vty_show_ip_route_summary_prefix(struct vty *vty,
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
struct route_table *table,
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
json_object *vrf_json,
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
bool use_json);
|
2020-07-08 22:34:58 +02:00
|
|
|
/* Helper api to format a nexthop in the 'detailed' output path. */
|
|
|
|
static void show_nexthop_detail_helper(struct vty *vty,
|
2024-05-14 16:28:17 +02:00
|
|
|
const struct route_node *rn,
|
2020-07-08 22:34:58 +02:00
|
|
|
const struct route_entry *re,
|
|
|
|
const struct nexthop *nexthop,
|
|
|
|
bool is_backup);
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
static void show_ip_route_dump_vty(struct vty *vty, struct route_table *table, afi_t afi,
|
|
|
|
safi_t safi);
|
2024-05-14 16:28:17 +02:00
|
|
|
static void show_ip_route_nht_dump(struct vty *vty,
|
|
|
|
const struct nexthop *nexthop,
|
|
|
|
const struct route_node *rn,
|
|
|
|
const struct route_entry *re,
|
|
|
|
unsigned int num);
|
2014-07-14 16:19:00 +02:00
|
|
|
|
2020-03-10 17:44:20 +01:00
|
|
|
static char re_status_output_char(const struct route_entry *re,
|
2020-07-17 19:10:29 +02:00
|
|
|
const struct nexthop *nhop,
|
|
|
|
bool is_fib)
|
2019-01-14 22:32:26 +01:00
|
|
|
{
|
2019-01-14 22:37:53 +01:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED)) {
|
2020-07-17 19:10:29 +02:00
|
|
|
bool star_p = false;
|
|
|
|
|
|
|
|
if (nhop &&
|
|
|
|
!CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_DUPLICATE) &&
|
|
|
|
!CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_RECURSIVE)) {
|
|
|
|
/* More-specific test for 'fib' output */
|
|
|
|
if (is_fib) {
|
|
|
|
star_p = !!CHECK_FLAG(nhop->flags,
|
|
|
|
NEXTHOP_FLAG_FIB);
|
zebra: Properly note that a nhg's nexthop has gone down
Current code when a link is set down is to just mark the
nexthop group as not properly setup. Leaving situations
where when an interface goes down and show output is
entered we see incorrect state. This is true for anything
that would be checking those flags at that point in time.
Modify the interface down nexthop group code to notice the
nexthops appropriately ( and I mean set the appropriate flags )
and to allow a `show ip route` command to actually display
what is going on with the nexthops.
eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
Known via "sharp", distance 150, metric 0, best
Last update 00:00:06 ago
* 192.168.44.33, via dummy1, weight 1
* 192.168.45.33, via dummy2, weight 1
sharpd@eva:~/frr1$ sudo ip link set dummy2 down
eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
Known via "sharp", distance 150, metric 0, best
Last update 00:00:12 ago
* 192.168.44.33, via dummy1, weight 1
192.168.45.33, via dummy2 inactive, weight 1
Notice now that the 1.0.0.0/32 route now correctly
displays the route for the nexthop group entry.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-07 20:56:15 +01:00
|
|
|
} else if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE))
|
2020-07-17 19:10:29 +02:00
|
|
|
star_p = true;
|
|
|
|
}
|
|
|
|
|
2020-09-28 21:22:52 +02:00
|
|
|
if (zrouter.asic_offloaded &&
|
|
|
|
CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))
|
|
|
|
return 'q';
|
|
|
|
|
2020-09-18 21:47:27 +02:00
|
|
|
if (zrouter.asic_offloaded
|
|
|
|
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED))
|
|
|
|
return 't';
|
|
|
|
|
|
|
|
if (zrouter.asic_offloaded
|
2020-10-26 13:46:57 +01:00
|
|
|
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))
|
2020-09-18 21:47:27 +02:00
|
|
|
return 'o';
|
|
|
|
|
2022-11-01 13:00:14 +01:00
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OUTOFSYNC))
|
|
|
|
return 'd';
|
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
if (star_p)
|
2019-01-14 22:32:26 +01:00
|
|
|
return '*';
|
2019-01-14 22:37:53 +01:00
|
|
|
else
|
|
|
|
return ' ';
|
2019-01-14 22:32:26 +01:00
|
|
|
}
|
|
|
|
|
2019-01-14 22:37:53 +01:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_FAILED)) {
|
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))
|
|
|
|
return 'q';
|
|
|
|
|
2019-01-30 02:29:20 +01:00
|
|
|
return 'r';
|
2019-01-14 22:37:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))
|
|
|
|
return 'q';
|
|
|
|
|
2019-01-14 22:32:26 +01:00
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
|
2020-03-10 17:44:20 +01:00
|
|
|
/*
|
2020-07-08 22:34:58 +02:00
|
|
|
* Show backup nexthop info, in the 'detailed' output path
|
2020-03-10 17:44:20 +01:00
|
|
|
*/
|
2024-05-14 16:28:17 +02:00
|
|
|
static void show_nh_backup_helper(struct vty *vty, const struct route_node *rn,
|
2020-07-08 22:34:58 +02:00
|
|
|
const struct route_entry *re,
|
2020-03-10 17:44:20 +01:00
|
|
|
const struct nexthop *nexthop)
|
|
|
|
{
|
2020-07-08 22:34:58 +02:00
|
|
|
const struct nexthop *start, *backup, *temp;
|
|
|
|
int i, idx;
|
|
|
|
|
2020-03-10 17:44:20 +01:00
|
|
|
/* Double-check that there _is_ a backup */
|
2020-07-08 22:34:58 +02:00
|
|
|
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_HAS_BACKUP) ||
|
2020-07-17 19:10:29 +02:00
|
|
|
re->nhe->backup_info == NULL || re->nhe->backup_info->nhe == NULL ||
|
|
|
|
re->nhe->backup_info->nhe->nhg.nexthop == NULL)
|
2020-03-10 17:44:20 +01:00
|
|
|
return;
|
|
|
|
|
2020-07-08 22:34:58 +02:00
|
|
|
/* Locate the backup nexthop(s) */
|
|
|
|
start = re->nhe->backup_info->nhe->nhg.nexthop;
|
|
|
|
for (i = 0; i < nexthop->backup_num; i++) {
|
|
|
|
/* Format the backup(s) (indented) */
|
|
|
|
backup = start;
|
|
|
|
for (idx = 0; idx < nexthop->backup_idx[i]; idx++) {
|
|
|
|
backup = backup->next;
|
|
|
|
if (backup == NULL)
|
|
|
|
break;
|
|
|
|
}
|
2020-03-10 17:44:20 +01:00
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
/* It's possible for backups to be recursive too,
|
|
|
|
* so walk the recursive resolution list if present.
|
|
|
|
*/
|
2020-07-08 22:34:58 +02:00
|
|
|
temp = backup;
|
|
|
|
while (backup) {
|
|
|
|
vty_out(vty, " ");
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nexthop_detail_helper(vty, rn, re, backup,
|
2020-07-08 22:34:58 +02:00
|
|
|
true /*backup*/);
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
|
|
|
|
if (backup->resolved && temp == backup)
|
|
|
|
backup = backup->resolved;
|
|
|
|
else
|
|
|
|
backup = nexthop_next(backup);
|
2020-03-10 17:44:20 +01:00
|
|
|
|
2020-07-08 22:34:58 +02:00
|
|
|
if (backup == temp->next)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-03-10 17:44:20 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper api to format output for a nexthop, used in the 'detailed'
|
|
|
|
* output path.
|
|
|
|
*/
|
|
|
|
static void show_nexthop_detail_helper(struct vty *vty,
|
2024-05-14 16:28:17 +02:00
|
|
|
const struct route_node *rn,
|
2020-03-10 17:44:20 +01:00
|
|
|
const struct route_entry *re,
|
2020-07-08 22:34:58 +02:00
|
|
|
const struct nexthop *nexthop,
|
|
|
|
bool is_backup)
|
2020-03-10 17:44:20 +01:00
|
|
|
{
|
|
|
|
char buf[MPLS_LABEL_STRLEN];
|
2020-07-08 22:34:58 +02:00
|
|
|
int i;
|
2020-03-10 17:44:20 +01:00
|
|
|
|
2020-07-08 22:34:58 +02:00
|
|
|
if (is_backup)
|
|
|
|
vty_out(vty, " b%s",
|
|
|
|
nexthop->rparent ? " " : "");
|
|
|
|
else
|
|
|
|
vty_out(vty, " %c%s",
|
2020-07-17 19:10:29 +02:00
|
|
|
re_status_output_char(re, nexthop, false),
|
2020-07-08 22:34:58 +02:00
|
|
|
nexthop->rparent ? " " : "");
|
2020-03-10 17:44:20 +01:00
|
|
|
|
|
|
|
switch (nexthop->type) {
|
|
|
|
case NEXTHOP_TYPE_IPV4:
|
|
|
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
2020-10-21 19:57:06 +02:00
|
|
|
vty_out(vty, " %pI4",
|
|
|
|
&nexthop->gate.ipv4);
|
2020-03-10 17:44:20 +01:00
|
|
|
if (nexthop->ifindex)
|
|
|
|
vty_out(vty, ", via %s",
|
|
|
|
ifindex2ifname(
|
|
|
|
nexthop->ifindex,
|
|
|
|
nexthop->vrf_id));
|
|
|
|
break;
|
|
|
|
case NEXTHOP_TYPE_IPV6:
|
|
|
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
|
|
|
vty_out(vty, " %s",
|
|
|
|
inet_ntop(AF_INET6, &nexthop->gate.ipv6,
|
|
|
|
buf, sizeof(buf)));
|
|
|
|
if (nexthop->ifindex)
|
|
|
|
vty_out(vty, ", via %s",
|
|
|
|
ifindex2ifname(
|
|
|
|
nexthop->ifindex,
|
|
|
|
nexthop->vrf_id));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NEXTHOP_TYPE_IFINDEX:
|
|
|
|
vty_out(vty, " directly connected, %s",
|
|
|
|
ifindex2ifname(nexthop->ifindex,
|
|
|
|
nexthop->vrf_id));
|
|
|
|
break;
|
|
|
|
case NEXTHOP_TYPE_BLACKHOLE:
|
|
|
|
vty_out(vty, " unreachable");
|
|
|
|
switch (nexthop->bh_type) {
|
|
|
|
case BLACKHOLE_REJECT:
|
|
|
|
vty_out(vty, " (ICMP unreachable)");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_ADMINPROHIB:
|
|
|
|
vty_out(vty,
|
|
|
|
" (ICMP admin-prohibited)");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_NULL:
|
|
|
|
vty_out(vty, " (blackhole)");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_UNSPEC:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2024-10-18 14:16:50 +02:00
|
|
|
if (re->vrf_id != nexthop->vrf_id && nexthop->type != NEXTHOP_TYPE_BLACKHOLE) {
|
2021-08-24 16:53:29 +02:00
|
|
|
struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
|
|
|
|
|
|
|
|
vty_out(vty, "(vrf %s)", VRF_LOGNAME(vrf));
|
|
|
|
}
|
2020-03-10 17:44:20 +01:00
|
|
|
|
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
|
|
|
|
vty_out(vty, " (duplicate nexthop removed)");
|
|
|
|
|
|
|
|
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
|
|
|
|
vty_out(vty, " inactive");
|
|
|
|
|
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK))
|
|
|
|
vty_out(vty, " onlink");
|
|
|
|
|
2022-06-23 16:27:56 +02:00
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_LINKDOWN))
|
|
|
|
vty_out(vty, " linkdown");
|
|
|
|
|
2020-03-10 17:44:20 +01:00
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
|
|
|
vty_out(vty, " (recursive)");
|
|
|
|
|
|
|
|
/* Source specified? */
|
|
|
|
switch (nexthop->type) {
|
|
|
|
case NEXTHOP_TYPE_IPV4:
|
|
|
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
2024-05-14 16:28:17 +02:00
|
|
|
if (nexthop->rmap_src.ipv4.s_addr)
|
|
|
|
vty_out(vty, ", rmapsrc %pI4", &nexthop->rmap_src.ipv4);
|
|
|
|
else if (nexthop->src.ipv4.s_addr)
|
|
|
|
vty_out(vty, ", src %pI4", &nexthop->src.ipv4);
|
2020-03-10 17:44:20 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NEXTHOP_TYPE_IPV6:
|
|
|
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
2024-05-14 16:28:17 +02:00
|
|
|
/* Allow for 5549 ipv4 prefix with ipv6 nexthop */
|
|
|
|
if (rn->p.family == AF_INET && nexthop->rmap_src.ipv4.s_addr)
|
|
|
|
vty_out(vty, ", rmapsrc %pI4", &nexthop->rmap_src.ipv4);
|
|
|
|
else if (!IPV6_ADDR_SAME(&nexthop->rmap_src.ipv6, &in6addr_any))
|
|
|
|
vty_out(vty, ", rmapsrc %pI6", &nexthop->rmap_src.ipv6);
|
|
|
|
else if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
|
|
|
|
vty_out(vty, ", src %pI6", &nexthop->src.ipv6);
|
2020-03-10 17:44:20 +01:00
|
|
|
break;
|
|
|
|
|
2023-01-30 16:05:58 +01:00
|
|
|
case NEXTHOP_TYPE_IFINDEX:
|
|
|
|
case NEXTHOP_TYPE_BLACKHOLE:
|
2020-03-10 17:44:20 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (re->nexthop_mtu)
|
|
|
|
vty_out(vty, ", mtu %u", re->nexthop_mtu);
|
|
|
|
|
|
|
|
/* Label information */
|
|
|
|
if (nexthop->nh_label && nexthop->nh_label->num_labels) {
|
|
|
|
vty_out(vty, ", label %s",
|
|
|
|
mpls_label2str(nexthop->nh_label->num_labels,
|
|
|
|
nexthop->nh_label->label, buf,
|
2021-04-01 17:31:44 +02:00
|
|
|
sizeof(buf), nexthop->nh_label_type,
|
|
|
|
1 /*pretty*/));
|
2020-03-10 17:44:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (nexthop->weight)
|
|
|
|
vty_out(vty, ", weight %u", nexthop->weight);
|
2020-07-08 22:34:58 +02:00
|
|
|
|
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_HAS_BACKUP)) {
|
|
|
|
vty_out(vty, ", backup %d", nexthop->backup_idx[0]);
|
|
|
|
|
|
|
|
for (i = 1; i < nexthop->backup_num; i++)
|
|
|
|
vty_out(vty, ",%d", nexthop->backup_idx[i]);
|
|
|
|
}
|
2020-03-10 17:44:20 +01:00
|
|
|
}
|
|
|
|
|
2020-12-05 13:06:38 +01:00
|
|
|
static void zebra_show_ip_route_opaque(struct vty *vty, struct route_entry *re,
|
|
|
|
struct json_object *json)
|
|
|
|
{
|
2021-04-18 20:53:19 +02:00
|
|
|
struct bgp_zebra_opaque bzo = {};
|
lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).
Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
Known via "ospf", distance 110, metric 20, best
Last update 01:57:08 ago
* 10.0.1.2, via eth-rt2, weight 1
OSPF path type : External-2
OSPF tag : 0
debian#
debian# show ip route 192.168.1.0/24 json
{
"192.168.1.0\/24":[
{
"prefix":"192.168.1.0\/24",
"prefixLen":24,
"protocol":"ospf",
"vrfId":0,
"vrfName":"default",
"selected":true,
[snip]
"ospfPathType":"External-2",
"ospfTag":"0"
}
]
}
```
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 03:15:55 +02:00
|
|
|
struct ospf_zebra_opaque ozo = {};
|
2021-04-18 20:53:19 +02:00
|
|
|
|
2020-12-05 13:06:38 +01:00
|
|
|
if (!re->opaque)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (re->type) {
|
2020-12-05 20:51:21 +01:00
|
|
|
case ZEBRA_ROUTE_SHARP:
|
|
|
|
if (json)
|
|
|
|
json_object_string_add(json, "opaque",
|
|
|
|
(char *)re->opaque->data);
|
|
|
|
else
|
|
|
|
vty_out(vty, " Opaque Data: %s",
|
|
|
|
(char *)re->opaque->data);
|
|
|
|
break;
|
2021-11-09 15:35:54 +01:00
|
|
|
|
lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).
Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
Known via "ospf", distance 110, metric 20, best
Last update 01:57:08 ago
* 10.0.1.2, via eth-rt2, weight 1
OSPF path type : External-2
OSPF tag : 0
debian#
debian# show ip route 192.168.1.0/24 json
{
"192.168.1.0\/24":[
{
"prefix":"192.168.1.0\/24",
"prefixLen":24,
"protocol":"ospf",
"vrfId":0,
"vrfName":"default",
"selected":true,
[snip]
"ospfPathType":"External-2",
"ospfTag":"0"
}
]
}
```
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 03:15:55 +02:00
|
|
|
case ZEBRA_ROUTE_BGP:
|
2021-04-18 20:53:19 +02:00
|
|
|
memcpy(&bzo, re->opaque->data, re->opaque->length);
|
|
|
|
|
|
|
|
if (json) {
|
|
|
|
json_object_string_add(json, "asPath", bzo.aspath);
|
|
|
|
json_object_string_add(json, "communities",
|
|
|
|
bzo.community);
|
|
|
|
json_object_string_add(json, "largeCommunities",
|
|
|
|
bzo.lcommunity);
|
2021-08-06 18:54:57 +02:00
|
|
|
json_object_string_add(json, "selectionReason",
|
|
|
|
bzo.selection_reason);
|
2021-04-18 20:53:19 +02:00
|
|
|
} else {
|
|
|
|
vty_out(vty, " AS-Path : %s\n", bzo.aspath);
|
|
|
|
|
|
|
|
if (bzo.community[0] != '\0')
|
|
|
|
vty_out(vty, " Communities : %s\n",
|
|
|
|
bzo.community);
|
|
|
|
|
|
|
|
if (bzo.lcommunity[0] != '\0')
|
|
|
|
vty_out(vty, " Large-Communities: %s\n",
|
|
|
|
bzo.lcommunity);
|
2021-08-06 18:54:57 +02:00
|
|
|
|
|
|
|
vty_out(vty, " Selection reason : %s\n",
|
|
|
|
bzo.selection_reason);
|
2021-04-18 20:53:19 +02:00
|
|
|
}
|
lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).
Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
Known via "ospf", distance 110, metric 20, best
Last update 01:57:08 ago
* 10.0.1.2, via eth-rt2, weight 1
OSPF path type : External-2
OSPF tag : 0
debian#
debian# show ip route 192.168.1.0/24 json
{
"192.168.1.0\/24":[
{
"prefix":"192.168.1.0\/24",
"prefixLen":24,
"protocol":"ospf",
"vrfId":0,
"vrfName":"default",
"selected":true,
[snip]
"ospfPathType":"External-2",
"ospfTag":"0"
}
]
}
```
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 03:15:55 +02:00
|
|
|
break;
|
|
|
|
case ZEBRA_ROUTE_OSPF:
|
|
|
|
case ZEBRA_ROUTE_OSPF6:
|
|
|
|
memcpy(&ozo, re->opaque->data, re->opaque->length);
|
|
|
|
|
|
|
|
if (json) {
|
|
|
|
json_object_string_add(json, "ospfPathType",
|
|
|
|
ozo.path_type);
|
|
|
|
if (ozo.area_id[0] != '\0')
|
|
|
|
json_object_string_add(json, "ospfAreaId",
|
|
|
|
ozo.area_id);
|
|
|
|
if (ozo.tag[0] != '\0')
|
|
|
|
json_object_string_add(json, "ospfTag",
|
|
|
|
ozo.tag);
|
|
|
|
} else {
|
|
|
|
vty_out(vty, " OSPF path type : %s\n",
|
|
|
|
ozo.path_type);
|
|
|
|
if (ozo.area_id[0] != '\0')
|
|
|
|
vty_out(vty, " OSPF area ID : %s\n",
|
|
|
|
ozo.area_id);
|
|
|
|
if (ozo.tag[0] != '\0')
|
|
|
|
vty_out(vty, " OSPF tag : %s\n",
|
|
|
|
ozo.tag);
|
|
|
|
}
|
|
|
|
break;
|
2020-12-05 13:06:38 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-22 23:19:03 +02:00
|
|
|
static void uptime2str(time_t uptime, char *buf, size_t bufsize)
|
|
|
|
{
|
|
|
|
time_t cur;
|
|
|
|
|
|
|
|
cur = monotime(NULL);
|
|
|
|
cur -= uptime;
|
|
|
|
|
|
|
|
frrtime_to_interval(cur, buf, bufsize);
|
|
|
|
}
|
|
|
|
|
2015-05-22 11:40:06 +02:00
|
|
|
/* New RIB. Detailed information for IPv4 route. */
|
2017-06-01 13:26:25 +02:00
|
|
|
static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
2019-08-27 00:20:45 +02:00
|
|
|
int mcast, bool use_fib, bool show_ng)
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2016-08-29 21:59:53 +02:00
|
|
|
struct nexthop *nexthop;
|
2017-06-01 13:26:25 +02:00
|
|
|
char buf[SRCDEST2STR_BUFFER];
|
2017-05-10 15:42:00 +02:00
|
|
|
struct zebra_vrf *zvrf;
|
2019-05-08 23:26:49 +02:00
|
|
|
rib_dest_t *dest;
|
|
|
|
|
|
|
|
dest = rib_dest_from_rnode(rn);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2019-05-08 23:26:49 +02:00
|
|
|
/*
|
|
|
|
* If re not selected for forwarding, skip re
|
|
|
|
* for "show ip/ipv6 fib <prefix>"
|
|
|
|
*/
|
|
|
|
if (use_fib && re != dest->selected_fib)
|
|
|
|
continue;
|
|
|
|
|
2015-03-07 08:40:48 +01:00
|
|
|
const char *mcast_info = "";
|
2015-01-22 19:12:35 +01:00
|
|
|
if (mcast) {
|
2020-05-07 14:59:27 +02:00
|
|
|
struct rib_table_info *info =
|
|
|
|
srcdest_rnode_table_info(rn);
|
2015-01-22 19:12:35 +01:00
|
|
|
mcast_info = (info->safi == SAFI_MULTICAST)
|
|
|
|
? " using Multicast RIB"
|
|
|
|
: " using Unicast RIB";
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2017-07-13 19:42:42 +02:00
|
|
|
vty_out(vty, "Routing entry for %s%s\n",
|
|
|
|
srcdest_rnode2str(rn, buf, sizeof(buf)), mcast_info);
|
2017-06-01 13:26:25 +02:00
|
|
|
vty_out(vty, " Known via \"%s", zebra_route_string(re->type));
|
|
|
|
if (re->instance)
|
|
|
|
vty_out(vty, "[%d]", re->instance);
|
2015-05-22 11:40:06 +02:00
|
|
|
vty_out(vty, "\"");
|
2017-06-01 13:26:25 +02:00
|
|
|
vty_out(vty, ", distance %u, metric %u", re->distance,
|
|
|
|
re->metric);
|
2017-12-08 21:02:46 +01:00
|
|
|
if (re->tag) {
|
2017-10-06 03:38:19 +02:00
|
|
|
vty_out(vty, ", tag %u", re->tag);
|
2017-12-08 21:02:46 +01:00
|
|
|
#if defined(SUPPORT_REALMS)
|
|
|
|
if (re->tag > 0 && re->tag <= 255)
|
|
|
|
vty_out(vty, "(realm)");
|
|
|
|
#endif
|
|
|
|
}
|
2017-06-01 13:26:25 +02:00
|
|
|
if (re->mtu)
|
|
|
|
vty_out(vty, ", mtu %u", re->mtu);
|
|
|
|
if (re->vrf_id != VRF_DEFAULT) {
|
2023-03-28 21:49:50 +02:00
|
|
|
zvrf = zebra_vrf_lookup_by_id(re->vrf_id);
|
2016-12-05 19:43:38 +01:00
|
|
|
vty_out(vty, ", vrf %s", zvrf_name(zvrf));
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2017-06-01 13:26:25 +02:00
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
|
2015-05-22 11:40:06 +02:00
|
|
|
vty_out(vty, ", best");
|
2017-07-13 19:12:39 +02:00
|
|
|
vty_out(vty, "\n");
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-04-22 23:19:03 +02:00
|
|
|
uptime2str(re->uptime, buf, sizeof(buf));
|
2017-09-12 20:58:10 +02:00
|
|
|
|
2020-03-05 20:06:46 +01:00
|
|
|
vty_out(vty, " Last update %s ago\n", buf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-10-05 21:32:23 +02:00
|
|
|
if (show_ng) {
|
2019-08-27 00:20:45 +02:00
|
|
|
vty_out(vty, " Nexthop Group ID: %u\n", re->nhe_id);
|
2021-10-05 21:32:23 +02:00
|
|
|
if (re->nhe_installed_id != 0
|
|
|
|
&& re->nhe_id != re->nhe_installed_id)
|
|
|
|
vty_out(vty,
|
|
|
|
" Installed Nexthop Group ID: %u\n",
|
|
|
|
re->nhe_installed_id);
|
|
|
|
}
|
2019-08-27 00:20:45 +02:00
|
|
|
|
2020-02-25 14:29:46 +01:00
|
|
|
for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
|
2020-03-10 17:44:20 +01:00
|
|
|
/* Use helper to format each nexthop */
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nexthop_detail_helper(vty, rn, re, nexthop,
|
2020-07-08 22:34:58 +02:00
|
|
|
false /*not backup*/);
|
2020-03-10 17:44:20 +01:00
|
|
|
vty_out(vty, "\n");
|
2018-01-08 16:43:07 +01:00
|
|
|
|
2020-07-08 22:34:58 +02:00
|
|
|
/* Include backup(s), if present */
|
2020-03-10 17:44:20 +01:00
|
|
|
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_HAS_BACKUP))
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nh_backup_helper(vty, rn, re, nexthop);
|
2020-03-10 17:44:20 +01:00
|
|
|
}
|
2020-12-05 13:06:38 +01:00
|
|
|
zebra_show_ip_route_opaque(vty, re, NULL);
|
|
|
|
|
2020-03-10 17:44:20 +01:00
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
|
|
|
}
|
2018-01-08 16:43:07 +01:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
|
2019-04-05 16:38:35 +02:00
|
|
|
struct route_entry *re, json_object *json,
|
2021-11-29 20:59:06 +01:00
|
|
|
bool is_fib, bool show_ng)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
2020-07-17 19:10:29 +02:00
|
|
|
const struct nexthop *nexthop;
|
2016-05-04 15:44:43 +02:00
|
|
|
int len = 0;
|
2016-08-29 21:59:53 +02:00
|
|
|
char buf[SRCDEST2STR_BUFFER];
|
|
|
|
json_object *json_nexthops = NULL;
|
2016-12-05 19:43:38 +01:00
|
|
|
json_object *json_nexthop = NULL;
|
|
|
|
json_object *json_route = NULL;
|
2020-07-17 19:10:29 +02:00
|
|
|
const rib_dest_t *dest = rib_dest_from_rnode(rn);
|
|
|
|
const struct nexthop_group *nhg;
|
2020-03-05 20:06:46 +01:00
|
|
|
char up_str[MONOTIME_STRLEN];
|
2021-03-12 08:02:25 +01:00
|
|
|
bool first_p = true;
|
2020-07-17 19:10:29 +02:00
|
|
|
bool nhg_from_backup = false;
|
2017-09-12 20:58:10 +02:00
|
|
|
|
2021-04-22 23:19:03 +02:00
|
|
|
uptime2str(re->uptime, up_str, sizeof(up_str));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-04-05 16:38:35 +02:00
|
|
|
/* If showing fib information, use the fib view of the
|
|
|
|
* nexthops.
|
|
|
|
*/
|
|
|
|
if (is_fib)
|
2020-05-22 22:42:23 +02:00
|
|
|
nhg = rib_get_fib_nhg(re);
|
2019-04-05 16:38:35 +02:00
|
|
|
else
|
2020-02-25 14:29:46 +01:00
|
|
|
nhg = &(re->nhe->nhg);
|
2019-04-05 16:38:35 +02:00
|
|
|
|
2016-08-29 21:59:53 +02:00
|
|
|
if (json) {
|
|
|
|
json_route = json_object_new_object();
|
|
|
|
json_nexthops = json_object_new_array();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-12-05 20:05:30 +01:00
|
|
|
json_object_string_add(json_route, "prefix",
|
2020-03-08 20:43:26 +01:00
|
|
|
srcdest_rnode2str(rn, buf, sizeof(buf)));
|
2021-07-03 13:17:28 +02:00
|
|
|
json_object_int_add(json_route, "prefixLen", rn->p.prefixlen);
|
2017-06-01 13:26:25 +02:00
|
|
|
json_object_string_add(json_route, "protocol",
|
2017-07-13 17:49:13 +02:00
|
|
|
zebra_route_string(re->type));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-07-13 17:49:13 +02:00
|
|
|
if (re->instance)
|
|
|
|
json_object_int_add(json_route, "instance",
|
|
|
|
re->instance);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-08-20 11:15:33 +02:00
|
|
|
json_object_int_add(json_route, "vrfId", re->vrf_id);
|
|
|
|
json_object_string_add(json_route, "vrfName",
|
|
|
|
vrf_id_to_name(re->vrf_id));
|
2020-08-20 11:15:33 +02:00
|
|
|
|
2017-07-13 17:49:13 +02:00
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
|
2016-08-29 21:59:53 +02:00
|
|
|
json_object_boolean_true_add(json_route, "selected");
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-03-10 02:28:49 +01:00
|
|
|
if (dest->selected_fib == re)
|
|
|
|
json_object_boolean_true_add(json_route,
|
|
|
|
"destSelected");
|
|
|
|
|
zebra: display metric for connected routes
In a VRR/VRRP setup we can have connected routes with different costs.
So this change eliminates suppressing metric display for connected routes.
Sample output -
root@TORC11:~# vtysh -c "show ipv6 route vrf vrf1"
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
> - selected route, * - FIB route
VRF vrf1:
K * ::/0 [255/8192] unreachable (ICMP unreachable), 00:00:36
C * 2001:aa:1::/64 [0/100] is directly connected, vlan1002-v0, 00:00:36
C>* 2001:aa:1::/64 [0/90] is directly connected, vlan1002, 00:00:36
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-15 00:56:30 +01:00
|
|
|
json_object_int_add(json_route, "distance",
|
|
|
|
re->distance);
|
|
|
|
json_object_int_add(json_route, "metric", re->metric);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-14 22:37:53 +01:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED))
|
|
|
|
json_object_boolean_true_add(json_route, "installed");
|
|
|
|
|
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_FAILED))
|
|
|
|
json_object_boolean_true_add(json_route, "failed");
|
|
|
|
|
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))
|
|
|
|
json_object_boolean_true_add(json_route, "queued");
|
|
|
|
|
2020-09-18 21:47:27 +02:00
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED))
|
|
|
|
json_object_boolean_true_add(json_route, "trapped");
|
|
|
|
|
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
|
|
|
|
json_object_boolean_true_add(json_route, "offloaded");
|
|
|
|
|
2020-10-26 13:46:57 +01:00
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))
|
|
|
|
json_object_boolean_false_add(json_route, "offloaded");
|
|
|
|
|
2018-08-08 00:15:34 +02:00
|
|
|
if (re->tag)
|
|
|
|
json_object_int_add(json_route, "tag", re->tag);
|
|
|
|
|
2019-07-09 11:49:26 +02:00
|
|
|
if (re->table)
|
|
|
|
json_object_int_add(json_route, "table", re->table);
|
|
|
|
|
2018-05-02 22:50:37 +02:00
|
|
|
json_object_int_add(json_route, "internalStatus",
|
|
|
|
re->status);
|
|
|
|
json_object_int_add(json_route, "internalFlags",
|
|
|
|
re->flags);
|
2019-08-23 07:36:36 +02:00
|
|
|
json_object_int_add(json_route, "internalNextHopNum",
|
2020-02-25 14:29:46 +01:00
|
|
|
nexthop_group_nexthop_num(&(re->nhe->nhg)));
|
2019-08-23 07:36:36 +02:00
|
|
|
json_object_int_add(json_route, "internalNextHopActiveNum",
|
2019-11-22 21:30:53 +01:00
|
|
|
nexthop_group_active_nexthop_num(
|
2020-02-25 14:29:46 +01:00
|
|
|
&(re->nhe->nhg)));
|
zebra: add nhg id to show ip route json
Add json field nexthop group id to
'show ip route json'.
Testing Done:
{
"27.0.0.14\/32":[
{
"prefix":"27.0.0.14\/32",
"protocol":"bgp",
"selected":true,
"destSelected":true,
"distance":20,
"metric":0,
"installed":true,
"table":254,
"internalStatus":16,
"internalFlags":8,
"internalNextHopNum":2,
"internalNextHopActiveNum":2,
"nexthopGroupId":103, <---- New field
"uptime":"00:04:37",
"nexthops":[
{
"ip":"fe80::202:ff:fe00:11",
"interfaceName":"uplink-1",
},
{
"ip":"fe80::202:ff:fe00:1d",
"interfaceName":"uplink-2",
}
]
}
]
}
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-10-04 00:55:03 +02:00
|
|
|
json_object_int_add(json_route, "nexthopGroupId", re->nhe_id);
|
2017-09-12 20:58:10 +02:00
|
|
|
|
2021-10-05 21:32:23 +02:00
|
|
|
if (re->nhe_installed_id != 0)
|
|
|
|
json_object_int_add(json_route,
|
|
|
|
"installedNexthopGroupId",
|
|
|
|
re->nhe_installed_id);
|
|
|
|
|
2020-03-05 20:06:46 +01:00
|
|
|
json_object_string_add(json_route, "uptime", up_str);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-04-05 16:38:35 +02:00
|
|
|
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
2016-08-29 21:59:53 +02:00
|
|
|
json_nexthop = json_object_new_object();
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nexthop_json_helper(json_nexthop, nexthop, rn, re);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
json_object_array_add(json_nexthops,
|
|
|
|
json_nexthop);
|
2020-05-22 22:42:23 +02:00
|
|
|
}
|
2018-05-02 22:50:37 +02:00
|
|
|
|
2020-05-22 22:42:23 +02:00
|
|
|
json_object_object_add(json_route, "nexthops", json_nexthops);
|
2017-09-12 20:52:20 +02:00
|
|
|
|
2020-05-22 22:42:23 +02:00
|
|
|
/* If there are backup nexthops, include them */
|
|
|
|
if (is_fib)
|
|
|
|
nhg = rib_get_fib_backup_nhg(re);
|
|
|
|
else
|
|
|
|
nhg = zebra_nhg_get_backup_nhg(re->nhe);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
if (nhg && nhg->nexthop) {
|
2020-05-22 22:42:23 +02:00
|
|
|
json_nexthops = json_object_new_array();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-05-22 22:42:23 +02:00
|
|
|
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
|
|
|
json_nexthop = json_object_new_object();
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nexthop_json_helper(json_nexthop, nexthop,
|
|
|
|
rn, re);
|
2020-05-22 22:42:23 +02:00
|
|
|
json_object_array_add(json_nexthops,
|
|
|
|
json_nexthop);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2020-05-22 22:42:23 +02:00
|
|
|
json_object_object_add(json_route, "backupNexthops",
|
|
|
|
json_nexthops);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2020-12-05 13:06:38 +01:00
|
|
|
zebra_show_ip_route_opaque(NULL, re, json_route);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-08-29 21:59:53 +02:00
|
|
|
json_object_array_add(json, json_route);
|
2017-06-01 13:26:25 +02:00
|
|
|
return;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
/* Prefix information, and first nexthop. If we're showing 'fib',
|
|
|
|
* and there are no installed primary nexthops, see if there are any
|
|
|
|
* backup nexthops and start with those.
|
|
|
|
*/
|
|
|
|
if (is_fib && nhg->nexthop == NULL) {
|
|
|
|
nhg = rib_get_fib_backup_nhg(re);
|
|
|
|
nhg_from_backup = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = vty_out(vty, "%c", zebra_route_char(re->type));
|
|
|
|
if (re->instance)
|
|
|
|
len += vty_out(vty, "[%d]", re->instance);
|
|
|
|
if (nhg_from_backup && nhg->nexthop) {
|
|
|
|
len += vty_out(
|
|
|
|
vty, "%cb%c %s",
|
|
|
|
CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED) ? '>' : ' ',
|
|
|
|
re_status_output_char(re, nhg->nexthop, is_fib),
|
|
|
|
srcdest_rnode2str(rn, buf, sizeof(buf)));
|
|
|
|
} else {
|
|
|
|
len += vty_out(
|
|
|
|
vty, "%c%c %s",
|
|
|
|
CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED) ? '>' : ' ',
|
|
|
|
re_status_output_char(re, nhg->nexthop, is_fib),
|
|
|
|
srcdest_rnode2str(rn, buf, sizeof(buf)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Distance and metric display. */
|
*: Introduce Local Host Routes to FRR
Create Local routes in FRR:
S 0.0.0.0/0 [1/0] via 192.168.119.1, enp39s0, weight 1, 00:03:46
K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp39s0, 00:03:51
O 192.168.119.0/24 [110/100] is directly connected, enp39s0, weight 1, 00:03:46
C>* 192.168.119.0/24 is directly connected, enp39s0, 00:03:51
L>* 192.168.119.224/32 is directly connected, enp39s0, 00:03:51
O 192.168.119.229/32 [110/100] via 0.0.0.0, enp39s0 inactive, weight 1, 00:03:46
C>* 192.168.119.229/32 is directly connected, enp39s0, 00:03:46
Create ability to redistribute local routes.
Modify tests to support this change.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-05 00:32:43 +01:00
|
|
|
if (((re->type == ZEBRA_ROUTE_CONNECT ||
|
|
|
|
re->type == ZEBRA_ROUTE_LOCAL) &&
|
2020-07-17 19:10:29 +02:00
|
|
|
(re->distance || re->metric)) ||
|
*: Introduce Local Host Routes to FRR
Create Local routes in FRR:
S 0.0.0.0/0 [1/0] via 192.168.119.1, enp39s0, weight 1, 00:03:46
K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp39s0, 00:03:51
O 192.168.119.0/24 [110/100] is directly connected, enp39s0, weight 1, 00:03:46
C>* 192.168.119.0/24 is directly connected, enp39s0, 00:03:51
L>* 192.168.119.224/32 is directly connected, enp39s0, 00:03:51
O 192.168.119.229/32 [110/100] via 0.0.0.0, enp39s0 inactive, weight 1, 00:03:46
C>* 192.168.119.229/32 is directly connected, enp39s0, 00:03:46
Create ability to redistribute local routes.
Modify tests to support this change.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-05 00:32:43 +01:00
|
|
|
(re->type != ZEBRA_ROUTE_CONNECT && re->type != ZEBRA_ROUTE_LOCAL))
|
2020-07-17 19:10:29 +02:00
|
|
|
len += vty_out(vty, " [%u/%u]", re->distance,
|
|
|
|
re->metric);
|
|
|
|
|
2021-11-29 20:59:06 +01:00
|
|
|
if (show_ng)
|
|
|
|
len += vty_out(vty, " (%u)", re->nhe_id);
|
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
/* Nexthop information. */
|
2019-04-05 16:38:35 +02:00
|
|
|
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
2021-03-12 08:02:25 +01:00
|
|
|
if (first_p) {
|
|
|
|
first_p = false;
|
|
|
|
} else if (nhg_from_backup) {
|
2020-07-17 19:10:29 +02:00
|
|
|
vty_out(vty, " b%c%*c",
|
|
|
|
re_status_output_char(re, nexthop, is_fib),
|
|
|
|
len - 3 + (2 * nexthop_level(nexthop)), ' ');
|
2017-09-12 20:52:20 +02:00
|
|
|
} else {
|
2015-05-22 11:40:06 +02:00
|
|
|
vty_out(vty, " %c%*c",
|
2020-07-17 19:10:29 +02:00
|
|
|
re_status_output_char(re, nexthop, is_fib),
|
2017-05-22 21:56:11 +02:00
|
|
|
len - 3 + (2 * nexthop_level(nexthop)), ' ');
|
2017-09-12 20:52:20 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2024-05-14 16:28:17 +02:00
|
|
|
show_route_nexthop_helper(vty, rn, re, nexthop);
|
2020-03-10 17:44:20 +01:00
|
|
|
vty_out(vty, ", %s\n", up_str);
|
2020-05-22 22:42:23 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-07-17 19:10:29 +02:00
|
|
|
/* If we only had backup nexthops, we're done */
|
|
|
|
if (nhg_from_backup)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Check for backup nexthop info if present */
|
2020-05-22 22:42:23 +02:00
|
|
|
if (is_fib)
|
|
|
|
nhg = rib_get_fib_backup_nhg(re);
|
|
|
|
else
|
|
|
|
nhg = zebra_nhg_get_backup_nhg(re->nhe);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-05-22 22:42:23 +02:00
|
|
|
if (nhg == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Print backup info */
|
|
|
|
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
|
|
|
bool star_p = false;
|
|
|
|
|
|
|
|
if (is_fib)
|
|
|
|
star_p = CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
|
|
|
|
|
|
|
|
/* TODO -- it'd be nice to be able to include
|
|
|
|
* the entire list of backups, *and* include the
|
|
|
|
* real installation state.
|
|
|
|
*/
|
|
|
|
vty_out(vty, " b%c %*c",
|
|
|
|
(star_p ? '*' : ' '),
|
|
|
|
len - 3 + (2 * nexthop_level(nexthop)), ' ');
|
2024-05-14 16:28:17 +02:00
|
|
|
show_route_nexthop_helper(vty, rn, re, nexthop);
|
2020-05-22 22:42:23 +02:00
|
|
|
vty_out(vty, "\n");
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2020-05-22 22:42:23 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2018-08-08 00:15:34 +02:00
|
|
|
static void vty_show_ip_route_detail_json(struct vty *vty,
|
2020-03-10 17:44:20 +01:00
|
|
|
struct route_node *rn, bool use_fib)
|
2018-08-08 00:15:34 +02:00
|
|
|
{
|
|
|
|
json_object *json = NULL;
|
|
|
|
json_object *json_prefix = NULL;
|
|
|
|
struct route_entry *re;
|
|
|
|
char buf[BUFSIZ];
|
2019-05-08 23:26:49 +02:00
|
|
|
rib_dest_t *dest;
|
|
|
|
|
|
|
|
dest = rib_dest_from_rnode(rn);
|
2018-08-08 00:15:34 +02:00
|
|
|
|
|
|
|
json = json_object_new_object();
|
zebra: `show ip route A.B.C.D json` would only show last route entry
The `show ip route A.B.C.D json` command was only displaying
the last route entry looked at and we would drop the data
associated with other route entries. This fixes the issue:
robot# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route
K>* 0.0.0.0/0 [0/100] via 192.168.201.1, enp3s0, 00:13:31
C>* 4.50.50.50/32 is directly connected, lo, 00:13:31
D 10.0.0.1/32 [150/0] via 192.168.201.1, enp3s0, 00:09:46
S>* 10.0.0.1/32 [1/0] via 192.168.201.1, enp3s0, 00:10:04
C>* 192.168.201.0/24 is directly connected, enp3s0, 00:13:31
robot# show ip route 10.0.0.1 json
{
"10.0.0.1\/32":[
{
"prefix":"10.0.0.1\/32",
"protocol":"sharp",
"distance":150,
"metric":0,
"internalStatus":0,
"internalFlags":1,
"uptime":"00:09:50",
"nexthops":[
{
"flags":1,
"ip":"192.168.201.1",
"afi":"ipv4",
"interfaceIndex":2,
"interfaceName":"enp3s0",
"active":true
}
]
},
{
"prefix":"10.0.0.1\/32",
"protocol":"static",
"selected":true,
"distance":1,
"metric":0,
"internalStatus":0,
"internalFlags":2064,
"uptime":"00:10:08",
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"192.168.201.1",
"afi":"ipv4",
"interfaceIndex":2,
"interfaceName":"enp3s0",
"active":true
}
]
}
]
}
robot#
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-05 21:12:50 +01:00
|
|
|
json_prefix = json_object_new_array();
|
2018-08-08 00:15:34 +02:00
|
|
|
|
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2019-05-08 23:26:49 +02:00
|
|
|
/*
|
|
|
|
* If re not selected for forwarding, skip re
|
|
|
|
* for "show ip/ipv6 fib <prefix> json"
|
|
|
|
*/
|
|
|
|
if (use_fib && re != dest->selected_fib)
|
|
|
|
continue;
|
2021-11-29 20:59:06 +01:00
|
|
|
vty_show_ip_route(vty, rn, re, json_prefix, use_fib, false);
|
2018-08-08 00:15:34 +02:00
|
|
|
}
|
|
|
|
|
zebra: `show ip route A.B.C.D json` would only show last route entry
The `show ip route A.B.C.D json` command was only displaying
the last route entry looked at and we would drop the data
associated with other route entries. This fixes the issue:
robot# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route
K>* 0.0.0.0/0 [0/100] via 192.168.201.1, enp3s0, 00:13:31
C>* 4.50.50.50/32 is directly connected, lo, 00:13:31
D 10.0.0.1/32 [150/0] via 192.168.201.1, enp3s0, 00:09:46
S>* 10.0.0.1/32 [1/0] via 192.168.201.1, enp3s0, 00:10:04
C>* 192.168.201.0/24 is directly connected, enp3s0, 00:13:31
robot# show ip route 10.0.0.1 json
{
"10.0.0.1\/32":[
{
"prefix":"10.0.0.1\/32",
"protocol":"sharp",
"distance":150,
"metric":0,
"internalStatus":0,
"internalFlags":1,
"uptime":"00:09:50",
"nexthops":[
{
"flags":1,
"ip":"192.168.201.1",
"afi":"ipv4",
"interfaceIndex":2,
"interfaceName":"enp3s0",
"active":true
}
]
},
{
"prefix":"10.0.0.1\/32",
"protocol":"static",
"selected":true,
"distance":1,
"metric":0,
"internalStatus":0,
"internalFlags":2064,
"uptime":"00:10:08",
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"192.168.201.1",
"afi":"ipv4",
"interfaceIndex":2,
"interfaceName":"enp3s0",
"active":true
}
]
}
]
}
robot#
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-05 21:12:50 +01:00
|
|
|
prefix2str(&rn->p, buf, sizeof(buf));
|
|
|
|
json_object_object_add(json, buf, json_prefix);
|
2021-11-25 16:49:46 +01:00
|
|
|
vty_json(vty, json);
|
2018-08-08 00:15:34 +02:00
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
static void zebra_vty_display_vrf_header(struct vty *vty, struct zebra_vrf *zvrf, uint32_t tableid,
|
|
|
|
afi_t afi, safi_t safi)
|
2024-11-04 19:02:36 +01:00
|
|
|
{
|
|
|
|
if (!tableid)
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_out(vty, "%s %s VRF %s:\n", afi2str(afi), safi2str(safi), zvrf_name(zvrf));
|
2024-11-04 19:02:36 +01:00
|
|
|
else {
|
|
|
|
if (vrf_is_backend_netns())
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_out(vty, "%s %s VRF %s table %u:\n", afi2str(afi), safi2str(safi),
|
|
|
|
zvrf_name(zvrf), tableid);
|
2024-11-04 19:02:36 +01:00
|
|
|
else {
|
|
|
|
vrf_id_t vrf = zebra_vrf_lookup_by_table(tableid, zvrf->zns->ns_id);
|
|
|
|
|
|
|
|
if (vrf == VRF_DEFAULT && tableid != RT_TABLE_ID_MAIN)
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_out(vty, "%s %s table %u:\n", afi2str(afi), safi2str(safi),
|
|
|
|
tableid);
|
2024-11-04 19:02:36 +01:00
|
|
|
else {
|
|
|
|
struct zebra_vrf *zvrf2 = zebra_vrf_lookup_by_id(vrf);
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_out(vty, "%s %s VRF %s table %u:\n", afi2str(afi),
|
|
|
|
safi2str(safi), zvrf_name(zvrf2), tableid);
|
2024-11-04 19:02:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, struct route_table *table,
|
|
|
|
afi_t afi, safi_t safi, bool use_fib, route_tag_t tag,
|
|
|
|
const struct prefix *longer_prefix_p, bool supernets_only,
|
|
|
|
int type, unsigned short ospf_instance_id, bool use_json,
|
|
|
|
uint32_t tableid, bool show_ng, struct route_show_ctx *ctx)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
2017-05-22 21:56:11 +02:00
|
|
|
struct route_node *rn;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2024-05-24 16:34:23 +02:00
|
|
|
bool first_json = true;
|
2015-05-22 11:40:06 +02:00
|
|
|
int first = 1;
|
2018-02-14 04:38:47 +01:00
|
|
|
rib_dest_t *dest;
|
2017-05-22 21:56:11 +02:00
|
|
|
json_object *json_prefix = NULL;
|
2018-02-14 04:38:47 +01:00
|
|
|
uint32_t addr;
|
|
|
|
char buf[BUFSIZ];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
/*
|
|
|
|
* ctx->multi indicates if we are dumping multiple tables or vrfs.
|
|
|
|
* if set:
|
|
|
|
* => display the common header at most once
|
|
|
|
* => add newline at each call except first
|
|
|
|
* => always display the VRF and table
|
|
|
|
* else:
|
|
|
|
* => display the common header if at least one entry is found
|
|
|
|
* => display the VRF and table if specific
|
|
|
|
*/
|
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
/* Show all routes. */
|
2018-07-19 21:16:06 +02:00
|
|
|
for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) {
|
2017-11-30 20:03:07 +01:00
|
|
|
dest = rib_dest_from_rnode(rn);
|
|
|
|
|
2024-08-28 19:18:00 +02:00
|
|
|
if (longer_prefix_p && !prefix_match(longer_prefix_p, &rn->p))
|
|
|
|
continue;
|
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2017-11-30 20:03:07 +01:00
|
|
|
if (use_fib && re != dest->selected_fib)
|
2017-05-22 21:56:11 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
if (tag && re->tag != tag)
|
2017-05-22 21:56:11 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
/* This can only be true when the afi is IPv4 */
|
2017-05-22 21:56:11 +02:00
|
|
|
if (supernets_only) {
|
|
|
|
addr = ntohl(rn->p.u.prefix4.s_addr);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
if (IN_CLASSC(addr) && rn->p.prefixlen >= 24)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
if (IN_CLASSB(addr) && rn->p.prefixlen >= 16)
|
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
if (IN_CLASSA(addr) && rn->p.prefixlen >= 8)
|
|
|
|
continue;
|
2016-08-29 21:59:53 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
if (type && re->type != type)
|
2017-05-22 21:56:11 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-06-01 13:26:25 +02:00
|
|
|
if (ospf_instance_id
|
|
|
|
&& (re->type != ZEBRA_ROUTE_OSPF
|
|
|
|
|| re->instance != ospf_instance_id))
|
2017-05-22 21:56:11 +02:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
|
|
|
if (use_json) {
|
2017-05-22 21:56:11 +02:00
|
|
|
if (!json_prefix)
|
|
|
|
json_prefix = json_object_new_array();
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
} else if (first) {
|
|
|
|
if (!ctx->header_done) {
|
2017-05-22 21:56:11 +02:00
|
|
|
if (afi == AFI_IP)
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty,
|
2011-11-27 15:39:40 +01:00
|
|
|
SHOW_ROUTE_V4_HEADER);
|
2017-07-17 14:03:14 +02:00
|
|
|
else
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty,
|
2011-11-27 15:39:40 +01:00
|
|
|
SHOW_ROUTE_V6_HEADER);
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
}
|
|
|
|
if (ctx->multi && ctx->header_done)
|
|
|
|
vty_out(vty, "\n");
|
2024-10-29 20:30:00 +01:00
|
|
|
zebra_vty_display_vrf_header(vty, zvrf, tableid, afi, safi);
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
ctx->header_done = true;
|
|
|
|
first = 0;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2021-11-29 20:59:06 +01:00
|
|
|
vty_show_ip_route(vty, rn, re, json_prefix, use_fib,
|
|
|
|
show_ng);
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
if (json_prefix) {
|
2018-08-08 00:15:34 +02:00
|
|
|
prefix2str(&rn->p, buf, sizeof(buf));
|
2024-05-24 16:34:23 +02:00
|
|
|
vty_json_key(vty, buf, &first_json);
|
|
|
|
vty_json_no_pretty(vty, json_prefix);
|
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
json_prefix = NULL;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
2024-05-24 16:46:17 +02:00
|
|
|
if (use_json)
|
2024-05-24 16:34:23 +02:00
|
|
|
vty_json_close(vty, first_json);
|
2018-02-14 04:38:47 +01:00
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf, afi_t afi, safi_t safi,
|
|
|
|
bool use_fib, bool use_json, route_tag_t tag,
|
|
|
|
const struct prefix *longer_prefix_p, bool supernets_only,
|
|
|
|
int type, unsigned short ospf_instance_id, bool show_ng,
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
struct route_show_ctx *ctx)
|
2020-02-06 09:52:00 +01:00
|
|
|
{
|
|
|
|
struct zebra_router_table *zrt;
|
2020-05-07 14:59:27 +02:00
|
|
|
struct rib_table_info *info;
|
2020-02-06 09:52:00 +01:00
|
|
|
|
|
|
|
RB_FOREACH (zrt, zebra_router_table_head,
|
|
|
|
&zrouter.tables) {
|
|
|
|
info = route_table_get_info(zrt->table);
|
|
|
|
|
|
|
|
if (zvrf != info->zvrf)
|
|
|
|
continue;
|
2024-10-29 20:30:00 +01:00
|
|
|
if (zrt->afi != afi || zrt->safi != safi)
|
2020-02-06 09:52:00 +01:00
|
|
|
continue;
|
2020-03-05 14:35:55 +01:00
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_ip_route(vty, zvrf_name(zvrf), afi, safi, use_fib, use_json, tag,
|
|
|
|
longer_prefix_p, supernets_only, type, ospf_instance_id,
|
2024-05-24 16:46:17 +02:00
|
|
|
zrt->tableid, show_ng, ctx);
|
2020-02-06 09:52:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-14 04:38:47 +01:00
|
|
|
static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
|
2024-05-24 16:46:17 +02:00
|
|
|
safi_t safi, bool use_fib, bool use_json,
|
|
|
|
route_tag_t tag,
|
2018-02-14 04:38:47 +01:00
|
|
|
const struct prefix *longer_prefix_p,
|
|
|
|
bool supernets_only, int type,
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
unsigned short ospf_instance_id, uint32_t tableid,
|
2021-11-29 20:59:06 +01:00
|
|
|
bool show_ng, struct route_show_ctx *ctx)
|
2018-02-14 04:38:47 +01:00
|
|
|
{
|
|
|
|
struct route_table *table;
|
|
|
|
struct zebra_vrf *zvrf = NULL;
|
|
|
|
|
|
|
|
if (!(zvrf = zebra_vrf_lookup_by_name(vrf_name))) {
|
|
|
|
if (use_json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
else
|
|
|
|
vty_out(vty, "vrf %s not defined\n", vrf_name);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (zvrf_id(zvrf) == VRF_UNKNOWN) {
|
|
|
|
if (use_json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
else
|
|
|
|
vty_out(vty, "vrf %s inactive\n", vrf_name);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-02-06 09:52:00 +01:00
|
|
|
if (tableid)
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_router_find_table(zvrf, tableid, afi, safi);
|
2020-02-06 09:52:00 +01:00
|
|
|
else
|
|
|
|
table = zebra_vrf_table(afi, safi, zvrf_id(zvrf));
|
2018-02-14 04:38:47 +01:00
|
|
|
if (!table) {
|
|
|
|
if (use_json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_route_helper(vty, zvrf, table, afi, safi, use_fib, tag, longer_prefix_p,
|
|
|
|
supernets_only, type, ospf_instance_id, use_json, tableid, show_ng,
|
|
|
|
ctx);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
return CMD_SUCCESS;
|
2016-06-27 17:31:57 +02:00
|
|
|
}
|
2016-02-28 23:03:27 +01:00
|
|
|
|
2019-01-21 15:47:10 +01:00
|
|
|
DEFPY (show_ip_nht,
|
2015-05-22 11:40:06 +02:00
|
|
|
show_ip_nht_cmd,
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
"show <ip$ipv4|ipv6$ipv6> <nht|import-check>$type [<A.B.C.D|X:X::X:X>$addr|vrf NAME$vrf_name [<A.B.C.D|X:X::X:X>$addr]|vrf all$vrf_all] [mrib$mrib] [json]",
|
2015-05-22 11:40:06 +02:00
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
2019-01-21 15:47:10 +01:00
|
|
|
IP6_STR
|
2016-09-23 23:17:10 +02:00
|
|
|
"IP nexthop tracking table\n"
|
2019-04-04 20:28:31 +02:00
|
|
|
"IP import check tracking table\n"
|
|
|
|
"IPv4 Address\n"
|
|
|
|
"IPv6 Address\n"
|
2019-01-21 15:47:10 +01:00
|
|
|
VRF_CMD_HELP_STR
|
2019-04-04 20:28:31 +02:00
|
|
|
"IPv4 Address\n"
|
|
|
|
"IPv6 Address\n"
|
2021-10-21 15:17:41 +02:00
|
|
|
VRF_ALL_CMD_HELP_STR
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
"Show Multicast (MRIB) NHT state\n"
|
|
|
|
JSON_STR)
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
2019-01-21 15:47:10 +01:00
|
|
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
2016-02-01 19:55:42 +01:00
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
2019-04-04 20:28:31 +02:00
|
|
|
struct prefix prefix, *p = NULL;
|
2021-10-21 15:17:41 +02:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
json_object *json = NULL;
|
|
|
|
json_object *json_vrf = NULL;
|
|
|
|
json_object *json_nexthop = NULL;
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool resolve_via_default = false;
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
|
|
|
|
if (uj)
|
|
|
|
json = json_object_new_object();
|
2016-02-01 19:55:42 +01:00
|
|
|
|
2019-01-21 15:47:10 +01:00
|
|
|
if (vrf_all) {
|
|
|
|
struct vrf *vrf;
|
|
|
|
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
2019-01-21 15:47:10 +01:00
|
|
|
if ((zvrf = vrf->info) != NULL) {
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
resolve_via_default =
|
|
|
|
(afi == AFI_IP)
|
|
|
|
? zvrf->zebra_rnh_ip_default_route
|
|
|
|
: zvrf->zebra_rnh_ipv6_default_route;
|
|
|
|
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
if (uj) {
|
|
|
|
json_vrf = json_object_new_object();
|
|
|
|
json_nexthop = json_object_new_object();
|
|
|
|
json_object_object_add(json,
|
|
|
|
zvrf_name(zvrf),
|
|
|
|
json_vrf);
|
|
|
|
json_object_object_add(json_vrf,
|
zebra: fix JSON fields for "show ip/ipv6 nht"
1. Renamed "gates" to "nexthops"
2. Displaying afi of the nexthops being dispalyed in place of
"nexthops" JSON object in the old JSON output
3. Calling show_route_nexthop_helper() and show_nexthop_json_helper()
instead of print_nh() inorder to keeps the fields in "nexthops"
JSON object in sync with "nexthops" JSON object of
"show nexthop-group rib json".
Updated vtysh:
r1# show ip nht
192.168.0.2
resolved via connected
is directly connected, r1-eth0 (vrf default)
Client list: static(fd 28)
192.168.0.4
resolved via connected
is directly connected, r1-eth0 (vrf default)
Client list: static(fd 28)
Updated JSON:
r1# show ip nht json
{
"default":{
"ipv4":{
"192.168.0.2":{
"nhtConnected":false,
"clientList":[
{
"protocol":"static",
"socket":28,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":2,
"interfaceName":"r1-eth0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-01-25 03:15:36 +01:00
|
|
|
(afi == AFI_IP)
|
|
|
|
? "ipv4"
|
|
|
|
: "ipv6",
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
json_nexthop);
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
json_object_boolean_add(json_nexthop,
|
|
|
|
"resolveViaDefault",
|
|
|
|
resolve_via_default);
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
} else {
|
|
|
|
vty_out(vty, "\nVRF %s:\n",
|
|
|
|
zvrf_name(zvrf));
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
vty_out(vty,
|
|
|
|
" Resolve via default: %s\n",
|
|
|
|
resolve_via_default ? "on"
|
|
|
|
: "off");
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
}
|
2021-10-21 15:17:41 +02:00
|
|
|
zebra_print_rnh_table(zvrf_id(zvrf), afi, safi,
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
vty, NULL, json_nexthop);
|
2019-01-21 15:47:10 +01:00
|
|
|
}
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
|
2019-01-21 15:47:10 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
if (vrf_name)
|
|
|
|
VRF_GET_ID(vrf_id, vrf_name, false);
|
2016-02-01 19:55:42 +01:00
|
|
|
|
2019-04-04 20:28:31 +02:00
|
|
|
memset(&prefix, 0, sizeof(prefix));
|
2020-12-08 21:50:46 +01:00
|
|
|
if (addr) {
|
2019-04-04 20:28:31 +02:00
|
|
|
p = sockunion2hostprefix(addr, &prefix);
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
if (!p) {
|
|
|
|
if (uj)
|
|
|
|
json_object_free(json);
|
2020-12-08 21:50:46 +01:00
|
|
|
return CMD_WARNING;
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
}
|
2020-12-08 21:50:46 +01:00
|
|
|
}
|
2020-11-18 17:04:27 +01:00
|
|
|
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
zvrf = zebra_vrf_lookup_by_id(vrf_id);
|
|
|
|
resolve_via_default = (afi == AFI_IP)
|
|
|
|
? zvrf->zebra_rnh_ip_default_route
|
|
|
|
: zvrf->zebra_rnh_ipv6_default_route;
|
|
|
|
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
if (uj) {
|
|
|
|
json_vrf = json_object_new_object();
|
|
|
|
json_nexthop = json_object_new_object();
|
|
|
|
if (vrf_name)
|
|
|
|
json_object_object_add(json, vrf_name, json_vrf);
|
|
|
|
else
|
|
|
|
json_object_object_add(json, "default", json_vrf);
|
|
|
|
|
zebra: fix JSON fields for "show ip/ipv6 nht"
1. Renamed "gates" to "nexthops"
2. Displaying afi of the nexthops being dispalyed in place of
"nexthops" JSON object in the old JSON output
3. Calling show_route_nexthop_helper() and show_nexthop_json_helper()
instead of print_nh() inorder to keeps the fields in "nexthops"
JSON object in sync with "nexthops" JSON object of
"show nexthop-group rib json".
Updated vtysh:
r1# show ip nht
192.168.0.2
resolved via connected
is directly connected, r1-eth0 (vrf default)
Client list: static(fd 28)
192.168.0.4
resolved via connected
is directly connected, r1-eth0 (vrf default)
Client list: static(fd 28)
Updated JSON:
r1# show ip nht json
{
"default":{
"ipv4":{
"192.168.0.2":{
"nhtConnected":false,
"clientList":[
{
"protocol":"static",
"socket":28,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":2,
"interfaceName":"r1-eth0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-01-25 03:15:36 +01:00
|
|
|
json_object_object_add(json_vrf,
|
|
|
|
(afi == AFI_IP) ? "ipv4" : "ipv6",
|
|
|
|
json_nexthop);
|
zebra: Show NHT resolve via default status on/off
```
donatas-laptop# show ip nht
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop# show ip nht vrf all
VRF default:
Resolve via default: on
192.168.10.123
resolved via connected
is directly connected, wlp82s0 (vrf default)
Client list: bgp(fd 21)
donatas-laptop# show ip nht vrf all json
{
"default":{
"ipv4":{
"resolveViaDefault":true,
"192.168.10.123":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":21,
"protocolFiltered":"none"
}
],
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":3,
"interfaceName":"wlp82s0",
"vrf":"default",
"active":true
}
],
"resolvedProtocol":"connected"
}
}
}
}
donatas-laptop#
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08 15:15:45 +02:00
|
|
|
|
|
|
|
json_object_boolean_add(json_nexthop, "resolveViaDefault",
|
|
|
|
resolve_via_default);
|
|
|
|
} else {
|
|
|
|
vty_out(vty, "VRF %s:\n", zvrf_name(zvrf));
|
|
|
|
vty_out(vty, " Resolve via default: %s\n",
|
|
|
|
resolve_via_default ? "on" : "off");
|
zebra: json support for show ip nht
show ip/ipv6 nht vrf <all | name> json support added.
Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json
Sample JSON output:
-------------------
tor-1# show ip nht vrf default json
{
"default":{
"nexthops":{
"27.0.0.5":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
},
"27.0.0.6":{
"nhtConnected":false,
"clientList":[
{
"protocol":"bgp",
"socket":70,
"protocolFiltered":"none"
}
],
"gates":[
{
"ip":"fe80::202:ff:fe00:2b",
"interface":"uplink_1"
},
{
"ip":"fe80::202:ff:fe00:35",
"interface":"uplink_2"
}
],
"resolvedProtocol":"bgp"
}
}
}
}
tor-1# show ipv6 nht vrf default json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
}
}
tor-1# show ipv6 nht vrf all json
{
"default": {
"nexthops": {
"fe80::202:ff:fe00:25": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
},
"fe80::202:ff:fe00:2b": {
"nhtConnected": true,
"clientList": [
{
"protocol": "bgp",
"socket": 45,
"protocolFiltered": "none"
}
],
"gates": [
{
"interface": "swp1",
"directlyConnected": true
}
],
"resolvedProtocol": "connected"
}
}
},
"mgmt": {
"nexthops": {}
},
"sym_1": {
"nexthops": {}
}
}
Ticket:#3229013
Issue:3229013
Testing Done: Unit test completed.
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-11-15 04:33:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
zebra_print_rnh_table(vrf_id, afi, safi, vty, p, json_nexthop);
|
|
|
|
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
|
2018-12-17 12:18:57 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-02-01 19:55:42 +01:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
|
|
|
|
json_object *json_nhe_hdr)
|
2019-05-16 06:24:43 +02:00
|
|
|
{
|
2019-08-08 21:53:58 +02:00
|
|
|
struct nexthop *nexthop = NULL;
|
2019-05-16 06:24:43 +02:00
|
|
|
struct nhg_connected *rb_node_dep = NULL;
|
2020-03-04 22:05:58 +01:00
|
|
|
struct nexthop_group *backup_nhg;
|
2021-04-22 23:19:03 +02:00
|
|
|
char up_str[MONOTIME_STRLEN];
|
2021-10-29 14:16:13 +02:00
|
|
|
char time_left[MONOTIME_STRLEN];
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
json_object *json_dependants = NULL;
|
|
|
|
json_object *json_depends = NULL;
|
|
|
|
json_object *json_nexthop_array = NULL;
|
|
|
|
json_object *json_nexthops = NULL;
|
|
|
|
json_object *json = NULL;
|
|
|
|
json_object *json_backup_nexthop_array = NULL;
|
|
|
|
json_object *json_backup_nexthops = NULL;
|
|
|
|
|
2021-04-22 23:19:03 +02:00
|
|
|
|
|
|
|
uptime2str(nhe->uptime, up_str, sizeof(up_str));
|
2019-05-16 06:24:43 +02:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json_nhe_hdr)
|
|
|
|
json = json_object_new_object();
|
2021-10-29 14:16:13 +02:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json) {
|
|
|
|
json_object_string_add(json, "type",
|
|
|
|
zebra_route_string(nhe->type));
|
|
|
|
json_object_int_add(json, "refCount", nhe->refcnt);
|
2022-12-11 16:51:58 +01:00
|
|
|
if (event_is_scheduled(nhe->timer))
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
json_object_string_add(
|
|
|
|
json, "timeToDeletion",
|
2022-12-11 16:51:58 +01:00
|
|
|
event_timer_to_hhmmss(time_left,
|
|
|
|
sizeof(time_left),
|
|
|
|
nhe->timer));
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
json_object_string_add(json, "uptime", up_str);
|
|
|
|
json_object_string_add(json, "vrf",
|
|
|
|
vrf_id_to_name(nhe->vrf_id));
|
2025-04-23 18:00:55 +02:00
|
|
|
json_object_string_add(json, "afi", zebra_nhg_afi2str(nhe));
|
2019-08-08 21:53:58 +02:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
} else {
|
|
|
|
vty_out(vty, "ID: %u (%s)\n", nhe->id,
|
|
|
|
zebra_route_string(nhe->type));
|
|
|
|
vty_out(vty, " RefCnt: %u", nhe->refcnt);
|
2022-12-11 16:51:58 +01:00
|
|
|
if (event_is_scheduled(nhe->timer))
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
vty_out(vty, " Time to Deletion: %s",
|
2022-12-11 16:51:58 +01:00
|
|
|
event_timer_to_hhmmss(time_left,
|
|
|
|
sizeof(time_left),
|
|
|
|
nhe->timer));
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
vty_out(vty, "\n");
|
|
|
|
|
|
|
|
vty_out(vty, " Uptime: %s\n", up_str);
|
2024-08-29 20:49:36 +02:00
|
|
|
vty_out(vty, " VRF: %s(%s)\n", vrf_id_to_name(nhe->vrf_id),
|
2025-04-23 18:00:55 +02:00
|
|
|
zebra_nhg_afi2str(nhe));
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
}
|
2021-10-29 14:16:13 +02:00
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_object_boolean_true_add(json, "valid");
|
|
|
|
else
|
|
|
|
vty_out(vty, " Valid");
|
2024-02-08 18:32:26 +01:00
|
|
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL)) {
|
|
|
|
if (json)
|
|
|
|
json_object_boolean_true_add(json, "reInstall");
|
|
|
|
else
|
|
|
|
vty_out(vty, ", Reinstall");
|
|
|
|
}
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)) {
|
|
|
|
if (json)
|
|
|
|
json_object_boolean_true_add(json, "installed");
|
|
|
|
else
|
|
|
|
vty_out(vty, ", Installed");
|
|
|
|
}
|
2024-08-29 17:29:55 +02:00
|
|
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INITIAL_DELAY_INSTALL)) {
|
|
|
|
if (json)
|
|
|
|
json_object_boolean_true_add(json,
|
|
|
|
"initialDelay");
|
|
|
|
else
|
|
|
|
vty_out(vty, ", Initial Delay");
|
|
|
|
}
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (!json)
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
|
|
|
if (nhe->ifp) {
|
|
|
|
if (json)
|
|
|
|
json_object_int_add(json, "interfaceIndex",
|
|
|
|
nhe->ifp->ifindex);
|
|
|
|
else
|
|
|
|
vty_out(vty, " Interface Index: %d\n",
|
|
|
|
nhe->ifp->ifindex);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!zebra_nhg_depends_is_empty(nhe)) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_depends = json_object_new_array();
|
|
|
|
else
|
|
|
|
vty_out(vty, " Depends:");
|
2019-09-03 22:12:06 +02:00
|
|
|
frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json_depends)
|
|
|
|
json_object_array_add(
|
|
|
|
json_depends,
|
|
|
|
json_object_new_int(
|
|
|
|
rb_node_dep->nhe->id));
|
|
|
|
else
|
|
|
|
vty_out(vty, " (%u)", rb_node_dep->nhe->id);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (!json_depends)
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
else
|
|
|
|
json_object_object_add(json, "depends", json_depends);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
2019-08-08 21:53:58 +02:00
|
|
|
|
2020-03-04 22:05:58 +01:00
|
|
|
/* Output nexthops */
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_nexthop_array = json_object_new_array();
|
|
|
|
|
2019-08-08 21:53:58 +02:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
for (ALL_NEXTHOPS(nhe->nhg, nexthop)) {
|
|
|
|
if (json_nexthop_array) {
|
|
|
|
json_nexthops = json_object_new_object();
|
2024-05-14 16:28:17 +02:00
|
|
|
show_nexthop_json_helper(json_nexthops, nexthop, NULL,
|
|
|
|
NULL);
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
} else {
|
|
|
|
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
|
|
|
vty_out(vty, " ");
|
|
|
|
else
|
|
|
|
/* Make recursive nexthops a bit more clear */
|
|
|
|
vty_out(vty, " ");
|
2024-05-14 16:28:17 +02:00
|
|
|
show_route_nexthop_helper(vty, NULL, NULL, nexthop);
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
}
|
2020-03-10 17:44:20 +01:00
|
|
|
|
|
|
|
if (nhe->backup_info == NULL || nhe->backup_info->nhe == NULL) {
|
|
|
|
if (CHECK_FLAG(nexthop->flags,
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
NEXTHOP_FLAG_HAS_BACKUP)) {
|
|
|
|
if (json)
|
|
|
|
json_object_int_add(
|
|
|
|
json_nexthops, "backup",
|
|
|
|
nexthop->backup_idx[0]);
|
|
|
|
else
|
|
|
|
vty_out(vty, " [backup %d]",
|
|
|
|
nexthop->backup_idx[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!json)
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
else
|
|
|
|
json_object_array_add(json_nexthop_array,
|
|
|
|
json_nexthops);
|
2020-03-10 17:44:20 +01:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (!json) {
|
|
|
|
/* TODO -- print more useful backup info */
|
|
|
|
if (CHECK_FLAG(nexthop->flags,
|
|
|
|
NEXTHOP_FLAG_HAS_BACKUP)) {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
vty_out(vty, "[backup");
|
|
|
|
for (i = 0; i < nexthop->backup_num; i++)
|
|
|
|
vty_out(vty, " %d",
|
|
|
|
nexthop->backup_idx[i]);
|
|
|
|
vty_out(vty, "]");
|
|
|
|
}
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
} else {
|
|
|
|
json_object_array_add(json_nexthop_array,
|
|
|
|
json_nexthops);
|
2020-03-10 17:44:20 +01:00
|
|
|
}
|
2020-03-04 22:05:58 +01:00
|
|
|
}
|
2019-08-08 21:53:58 +02:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_object_object_add(json, "nexthops", json_nexthop_array);
|
|
|
|
|
2020-03-04 22:05:58 +01:00
|
|
|
/* Output backup nexthops (if any) */
|
|
|
|
backup_nhg = zebra_nhg_get_backup_nhg(nhe);
|
|
|
|
if (backup_nhg) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_backup_nexthop_array = json_object_new_array();
|
|
|
|
else
|
|
|
|
vty_out(vty, " Backups:\n");
|
2019-08-08 21:53:58 +02:00
|
|
|
|
2020-03-04 22:05:58 +01:00
|
|
|
for (ALL_NEXTHOPS_PTR(backup_nhg, nexthop)) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json_backup_nexthop_array) {
|
|
|
|
json_backup_nexthops = json_object_new_object();
|
|
|
|
show_nexthop_json_helper(json_backup_nexthops,
|
2024-05-14 16:28:17 +02:00
|
|
|
nexthop, NULL, NULL);
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
json_object_array_add(json_backup_nexthop_array,
|
|
|
|
json_backup_nexthops);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!CHECK_FLAG(nexthop->flags,
|
|
|
|
NEXTHOP_FLAG_RECURSIVE))
|
|
|
|
vty_out(vty, " ");
|
|
|
|
else
|
|
|
|
/* Make recursive nexthops a bit more
|
|
|
|
* clear
|
|
|
|
*/
|
|
|
|
vty_out(vty, " ");
|
2024-05-14 16:28:17 +02:00
|
|
|
show_route_nexthop_helper(vty, NULL, NULL,
|
|
|
|
nexthop);
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
2019-08-08 21:53:58 +02:00
|
|
|
}
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
|
|
|
|
if (json)
|
|
|
|
json_object_object_add(json, "backupNexthops",
|
|
|
|
json_backup_nexthop_array);
|
2019-08-08 21:53:58 +02:00
|
|
|
}
|
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
if (!zebra_nhg_dependents_is_empty(nhe)) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_dependants = json_object_new_array();
|
|
|
|
else
|
|
|
|
vty_out(vty, " Dependents:");
|
2019-09-03 22:12:06 +02:00
|
|
|
frr_each(nhg_connected_tree, &nhe->nhg_dependents,
|
2019-07-24 18:27:40 +02:00
|
|
|
rb_node_dep) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
json_object_array_add(
|
|
|
|
json_dependants,
|
|
|
|
json_object_new_int(
|
|
|
|
rb_node_dep->nhe->id));
|
|
|
|
else
|
|
|
|
vty_out(vty, " (%u)", rb_node_dep->nhe->id);
|
|
|
|
}
|
|
|
|
if (json)
|
|
|
|
json_object_object_add(json, "dependents",
|
|
|
|
json_dependants);
|
|
|
|
else
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nhe->nhg.nhgr.buckets) {
|
|
|
|
if (json) {
|
|
|
|
json_object_int_add(json, "buckets",
|
|
|
|
nhe->nhg.nhgr.buckets);
|
|
|
|
json_object_int_add(json, "idleTimer",
|
|
|
|
nhe->nhg.nhgr.idle_timer);
|
|
|
|
json_object_int_add(json, "unbalancedTimer",
|
|
|
|
nhe->nhg.nhgr.unbalanced_timer);
|
|
|
|
json_object_int_add(json, "unbalancedTime",
|
|
|
|
nhe->nhg.nhgr.unbalanced_time);
|
|
|
|
} else {
|
|
|
|
vty_out(vty,
|
|
|
|
" Buckets: %u Idle Timer: %u Unbalanced Timer: %u Unbalanced time: %" PRIu64
|
|
|
|
"\n",
|
|
|
|
nhe->nhg.nhgr.buckets, nhe->nhg.nhgr.idle_timer,
|
|
|
|
nhe->nhg.nhgr.unbalanced_timer,
|
|
|
|
nhe->nhg.nhgr.unbalanced_time);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json_nhe_hdr)
|
|
|
|
json_object_object_addf(json_nhe_hdr, json, "%u", nhe->id);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
static int show_nexthop_group_id_cmd_helper(struct vty *vty, uint32_t id,
|
|
|
|
json_object *json)
|
2019-05-16 06:24:43 +02:00
|
|
|
{
|
|
|
|
struct nhg_hash_entry *nhe = NULL;
|
|
|
|
|
|
|
|
nhe = zebra_nhg_lookup_id(id);
|
|
|
|
|
|
|
|
if (nhe)
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
show_nexthop_group_out(vty, nhe, json);
|
2019-05-16 06:24:43 +02:00
|
|
|
else {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (json)
|
|
|
|
vty_json(vty, json);
|
|
|
|
else
|
|
|
|
vty_out(vty, "Nexthop Group ID: %u does not exist\n",
|
|
|
|
id);
|
2019-05-16 06:24:43 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
|
|
|
|
if (json)
|
|
|
|
vty_json(vty, json);
|
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-01-28 20:45:53 +01:00
|
|
|
/* Helper function for iteration through the hash of nexthop-groups/nhe-s */
|
|
|
|
|
|
|
|
struct nhe_show_context {
|
|
|
|
struct vty *vty;
|
|
|
|
vrf_id_t vrf_id;
|
|
|
|
afi_t afi;
|
2020-10-23 20:28:50 +02:00
|
|
|
int type;
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
json_object *json;
|
2020-01-28 20:45:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static int nhe_show_walker(struct hash_bucket *bucket, void *arg)
|
2019-01-24 03:16:41 +01:00
|
|
|
{
|
2020-01-28 20:45:53 +01:00
|
|
|
struct nhe_show_context *ctx = arg;
|
|
|
|
struct nhg_hash_entry *nhe;
|
2019-01-24 03:16:41 +01:00
|
|
|
|
2020-01-28 20:45:53 +01:00
|
|
|
nhe = bucket->data; /* We won't be offered NULL buckets */
|
2019-01-24 03:16:41 +01:00
|
|
|
|
2020-01-28 20:45:53 +01:00
|
|
|
if (ctx->afi && nhe->afi != ctx->afi)
|
|
|
|
goto done;
|
2019-03-19 22:06:01 +01:00
|
|
|
|
2020-01-28 20:45:53 +01:00
|
|
|
if (ctx->vrf_id && nhe->vrf_id != ctx->vrf_id)
|
|
|
|
goto done;
|
2019-01-24 03:16:41 +01:00
|
|
|
|
2020-10-23 20:28:50 +02:00
|
|
|
if (ctx->type && nhe->type != ctx->type)
|
|
|
|
goto done;
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
show_nexthop_group_out(ctx->vty, nhe, ctx->json);
|
2020-01-28 20:45:53 +01:00
|
|
|
|
|
|
|
done:
|
|
|
|
return HASHWALK_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void show_nexthop_group_cmd_helper(struct vty *vty,
|
2020-10-23 20:28:50 +02:00
|
|
|
struct zebra_vrf *zvrf, afi_t afi,
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
int type, json_object *json)
|
2020-01-28 20:45:53 +01:00
|
|
|
{
|
|
|
|
struct nhe_show_context ctx;
|
|
|
|
|
|
|
|
ctx.vty = vty;
|
|
|
|
ctx.afi = afi;
|
|
|
|
ctx.vrf_id = zvrf->vrf->vrf_id;
|
2020-10-23 20:28:50 +02:00
|
|
|
ctx.type = type;
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
ctx.json = json;
|
2019-05-14 03:13:02 +02:00
|
|
|
|
2020-01-28 20:45:53 +01:00
|
|
|
hash_walk(zrouter.nhgs_id, nhe_show_walker, &ctx);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void if_nexthop_group_dump_vty(struct vty *vty, struct interface *ifp)
|
|
|
|
{
|
|
|
|
struct zebra_if *zebra_if = NULL;
|
|
|
|
struct nhg_connected *rb_node_dep = NULL;
|
2024-02-08 17:49:08 +01:00
|
|
|
bool first = true;
|
2019-05-16 06:24:43 +02:00
|
|
|
|
|
|
|
zebra_if = ifp->info;
|
|
|
|
|
2024-02-08 17:49:08 +01:00
|
|
|
frr_each (nhg_connected_tree, &zebra_if->nhg_dependents, rb_node_dep) {
|
|
|
|
if (first) {
|
|
|
|
vty_out(vty, "Interface %s:\n", ifp->name);
|
|
|
|
first = false;
|
2019-03-21 15:52:11 +01:00
|
|
|
}
|
2024-02-08 17:49:08 +01:00
|
|
|
|
|
|
|
vty_out(vty, " ");
|
|
|
|
show_nexthop_group_out(vty, rb_node_dep->nhe, NULL);
|
2019-05-16 06:24:43 +02:00
|
|
|
}
|
|
|
|
}
|
2019-03-21 15:52:11 +01:00
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
DEFPY (show_interface_nexthop_group,
|
|
|
|
show_interface_nexthop_group_cmd,
|
|
|
|
"show interface [IFNAME$if_name] nexthop-group",
|
|
|
|
SHOW_STR
|
|
|
|
"Interface status and configuration\n"
|
|
|
|
"Interface name\n"
|
|
|
|
"Show Nexthop Groups\n")
|
|
|
|
{
|
|
|
|
struct vrf *vrf = NULL;
|
|
|
|
struct interface *ifp = NULL;
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
if (if_name) {
|
|
|
|
ifp = if_lookup_by_name(if_name, vrf->vrf_id);
|
|
|
|
if (ifp) {
|
|
|
|
if_nexthop_group_dump_vty(vty, ifp);
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FOR_ALL_INTERFACES (vrf, ifp)
|
|
|
|
if_nexthop_group_dump_vty(vty, ifp);
|
|
|
|
found = true;
|
2019-01-24 03:16:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
if (!found) {
|
|
|
|
vty_out(vty, "%% Can't find interface %s\n", if_name);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
2019-01-24 03:16:41 +01:00
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
DEFPY(show_nexthop_group,
|
|
|
|
show_nexthop_group_cmd,
|
|
|
|
"show nexthop-group rib <(0-4294967295)$id|[singleton <ip$v4|ipv6$v6>] [<kernel|zebra|bgp|sharp>$type_str] [vrf <NAME$vrf_name|all$vrf_all>]> [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"Show Nexthop Groups\n"
|
|
|
|
"RIB information\n"
|
|
|
|
"Nexthop Group ID\n"
|
|
|
|
"Show Singleton Nexthop-Groups\n"
|
|
|
|
IP_STR
|
|
|
|
IP6_STR
|
|
|
|
"Kernel (not installed via the zebra RIB)\n"
|
|
|
|
"Zebra (implicitly created by zebra)\n"
|
|
|
|
"Border Gateway Protocol (BGP)\n"
|
|
|
|
"Super Happy Advanced Routing Protocol (SHARP)\n"
|
|
|
|
VRF_FULL_CMD_HELP_STR
|
|
|
|
JSON_STR)
|
2019-01-24 03:16:41 +01:00
|
|
|
{
|
2019-03-21 15:52:11 +01:00
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
struct zebra_vrf *zvrf = NULL;
|
2020-01-13 22:00:33 +01:00
|
|
|
afi_t afi = AFI_UNSPEC;
|
2020-10-23 20:28:50 +02:00
|
|
|
int type = 0;
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
json_object *json = NULL;
|
|
|
|
json_object *json_vrf = NULL;
|
|
|
|
|
|
|
|
if (uj)
|
|
|
|
json = json_object_new_object();
|
2019-05-15 18:59:37 +02:00
|
|
|
|
2019-05-16 06:24:43 +02:00
|
|
|
if (id)
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
return show_nexthop_group_id_cmd_helper(vty, id, json);
|
2019-05-16 06:24:43 +02:00
|
|
|
|
2019-03-21 15:52:11 +01:00
|
|
|
if (v4)
|
|
|
|
afi = AFI_IP;
|
|
|
|
else if (v6)
|
|
|
|
afi = AFI_IP6;
|
|
|
|
|
2020-10-23 20:28:50 +02:00
|
|
|
if (type_str) {
|
|
|
|
type = proto_redistnum((afi ? afi : AFI_IP), type_str);
|
|
|
|
if (type < 0) {
|
|
|
|
/* assume zebra */
|
|
|
|
type = ZEBRA_ROUTE_NHG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-15 10:22:32 +02:00
|
|
|
if (!vrf_is_backend_netns() && (vrf_name || vrf_all)) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
else
|
|
|
|
vty_out(vty,
|
|
|
|
"VRF subcommand does not make any sense in l3mdev based vrf's\n");
|
2020-01-13 22:11:46 +01:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2019-01-24 03:16:41 +01:00
|
|
|
if (vrf_all) {
|
|
|
|
struct vrf *vrf;
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
zvrf = vrf->info;
|
|
|
|
if (!zvrf)
|
|
|
|
continue;
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (uj)
|
|
|
|
json_vrf = json_object_new_object();
|
|
|
|
else
|
|
|
|
vty_out(vty, "VRF: %s\n", vrf->name);
|
2019-01-24 03:16:41 +01:00
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
show_nexthop_group_cmd_helper(vty, zvrf, afi, type,
|
|
|
|
json_vrf);
|
|
|
|
if (uj)
|
|
|
|
json_object_object_add(json, vrf->name,
|
|
|
|
json_vrf);
|
2019-01-24 03:16:41 +01:00
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
|
2019-01-24 03:16:41 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vrf_name)
|
|
|
|
zvrf = zebra_vrf_lookup_by_name(vrf_name);
|
|
|
|
else
|
|
|
|
zvrf = zebra_vrf_lookup_by_name(VRF_DEFAULT_NAME);
|
|
|
|
|
|
|
|
if (!zvrf) {
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
else
|
|
|
|
vty_out(vty, "%% VRF '%s' specified does not exist\n",
|
|
|
|
vrf_name);
|
2019-05-16 06:24:43 +02:00
|
|
|
return CMD_WARNING;
|
2019-01-24 03:16:41 +01:00
|
|
|
}
|
|
|
|
|
zebra: JSON support for show nexthop-group rib
Added JSON support for show nexthop-group rib
command.
JSON output:
{
"10":{
"type":"zebra",
"refCount":3,
"uptime":"00:00:46",
"vrf":"default",
"valid":true,
"installed":true,
"interfaceIndex":3,
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"2001::2",
"afi":"ipv6",
"interfaceIndex":3,
"interfaceName":"eth0",
"vrf":"default",
"active":true,
"weight":1
}
]
}
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2022-12-14 19:46:32 +01:00
|
|
|
show_nexthop_group_cmd_helper(vty, zvrf, afi, type, json);
|
|
|
|
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
2019-01-24 03:16:41 +01:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-01-28 17:00:42 +01:00
|
|
|
DEFPY_HIDDEN(nexthop_group_use_enable,
|
|
|
|
nexthop_group_use_enable_cmd,
|
|
|
|
"[no] zebra nexthop kernel enable",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Nexthop configuration \n"
|
|
|
|
"Configure use of kernel nexthops\n"
|
|
|
|
"Enable kernel nexthops\n")
|
|
|
|
{
|
|
|
|
zebra_nhg_enable_kernel_nexthops(!no);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-07-28 23:36:51 +02:00
|
|
|
DEFPY_HIDDEN(proto_nexthop_group_only, proto_nexthop_group_only_cmd,
|
|
|
|
"[no] zebra nexthop proto only",
|
|
|
|
NO_STR ZEBRA_STR
|
|
|
|
"Nexthop configuration\n"
|
|
|
|
"Configure exclusive use of proto nexthops\n"
|
|
|
|
"Only use proto nexthops\n")
|
2020-05-13 21:50:14 +02:00
|
|
|
{
|
|
|
|
zebra_nhg_set_proto_nexthops_only(!no);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-02-22 21:06:28 +01:00
|
|
|
DEFPY_HIDDEN(backup_nexthop_recursive_use_enable,
|
|
|
|
backup_nexthop_recursive_use_enable_cmd,
|
|
|
|
"[no] zebra nexthop resolve-via-backup",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Nexthop configuration \n"
|
|
|
|
"Configure use of backup nexthops in recursive resolution\n")
|
|
|
|
{
|
|
|
|
zebra_nhg_set_recursive_use_backups(!no);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-03-01 16:48:05 +01:00
|
|
|
DEFPY_HIDDEN(rnh_hide_backups, rnh_hide_backups_cmd,
|
|
|
|
"[no] ip nht hide-backup-events",
|
|
|
|
NO_STR
|
|
|
|
IP_STR
|
|
|
|
"Nexthop-tracking configuration\n"
|
|
|
|
"Hide notification about backup nexthops\n")
|
|
|
|
{
|
|
|
|
rnh_set_hide_backups(!no);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-09-13 20:16:12 +02:00
|
|
|
DEFPY (show_route,
|
|
|
|
show_route_cmd,
|
|
|
|
"show\
|
2024-10-29 20:30:00 +01:00
|
|
|
<\
|
|
|
|
ip$ipv4 <fib$fib|route>\
|
|
|
|
[{\
|
|
|
|
table <(1-4294967295)$table|all$table_all>\
|
|
|
|
|mrib$mrib\
|
|
|
|
|vrf <NAME$vrf_name|all$vrf_all>\
|
|
|
|
}]\
|
|
|
|
[{\
|
|
|
|
tag (1-4294967295)\
|
|
|
|
|A.B.C.D/M$prefix longer-prefixes\
|
|
|
|
|supernets-only$supernets_only\
|
|
|
|
}]\
|
|
|
|
[<\
|
|
|
|
" FRR_IP_REDIST_STR_ZEBRA "$type_str\
|
|
|
|
|ospf$type_str (1-65535)$ospf_instance_id\
|
|
|
|
>]\
|
|
|
|
|ipv6$ipv6 <fib$fib|route>\
|
|
|
|
[{\
|
|
|
|
table <(1-4294967295)$table|all$table_all>\
|
|
|
|
|mrib$mrib\
|
|
|
|
|vrf <NAME$vrf_name|all$vrf_all>\
|
|
|
|
}]\
|
|
|
|
[{\
|
|
|
|
tag (1-4294967295)\
|
|
|
|
|X:X::X:X/M$prefix longer-prefixes\
|
|
|
|
}]\
|
|
|
|
[" FRR_IP6_REDIST_STR_ZEBRA "$type_str]\
|
|
|
|
>\
|
|
|
|
[<json$json|nexthop-group$ng>]",
|
2015-05-22 11:40:06 +02:00
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
2017-05-10 22:33:48 +02:00
|
|
|
"IP forwarding table\n"
|
2015-05-22 11:40:06 +02:00
|
|
|
"IP routing table\n"
|
2020-02-06 09:52:00 +01:00
|
|
|
"Table to display\n"
|
|
|
|
"The table number to display\n"
|
|
|
|
"All tables\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
2017-09-13 20:16:12 +02:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
2015-05-22 11:40:06 +02:00
|
|
|
"Show only routes with tag\n"
|
2017-05-22 21:56:11 +02:00
|
|
|
"Tag value\n"
|
|
|
|
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
|
|
|
"Show route matching the specified Network/Mask pair only\n"
|
|
|
|
"Show supernet entries only\n"
|
|
|
|
FRR_IP_REDIST_HELP_STR_ZEBRA
|
|
|
|
"Open Shortest Path First (OSPFv2)\n"
|
|
|
|
"Instance ID\n"
|
2017-09-13 20:16:12 +02:00
|
|
|
IPV6_STR
|
|
|
|
"IP forwarding table\n"
|
|
|
|
"IP routing table\n"
|
2020-02-06 09:52:00 +01:00
|
|
|
"Table to display\n"
|
|
|
|
"The table number to display\n"
|
|
|
|
"All tables\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
2017-09-13 20:16:12 +02:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
|
|
|
"Show only routes with tag\n"
|
|
|
|
"Tag value\n"
|
|
|
|
"IPv6 prefix\n"
|
|
|
|
"Show route matching the specified Network/Mask pair only\n"
|
|
|
|
FRR_IP6_REDIST_HELP_STR_ZEBRA
|
2021-11-29 20:59:06 +01:00
|
|
|
JSON_STR
|
|
|
|
"Nexthop Group Information\n")
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
2017-09-13 20:16:12 +02:00
|
|
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
2024-10-29 20:30:00 +01:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2024-05-24 17:06:59 +02:00
|
|
|
bool first_vrf_json = true;
|
2017-05-22 21:56:11 +02:00
|
|
|
struct vrf *vrf;
|
|
|
|
int type = 0;
|
2020-02-06 09:52:00 +01:00
|
|
|
struct zebra_vrf *zvrf;
|
zebra: fix show ip route output
Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.
When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...
Normalize the output:
- whatever the case, display the common header at most once, if there
is at least an entry to dump.
- when using a "vrf all" or "table all" command, prepend a line with
the VRF and table (even for the default vrf or table).
- when dumping a specific vrf or table, prepend a line with the VRF
and table.
Example (vrf all)
=================
router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42
Example (main vrf)
==================
router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58
Example (specific vrf)
======================
router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36
Example (all tables)
====================
router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51
Example (all vrf, all table)
============================
router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15
VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15
VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31
Example (specific table)
========================
router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric,
> - selected route, * - FIB route, q - queued route, r - rejected route
VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
2020-08-20 11:15:33 +02:00
|
|
|
struct route_show_ctx ctx = {
|
|
|
|
.multi = vrf_all || table_all,
|
|
|
|
};
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-02-06 09:52:00 +01:00
|
|
|
if (!vrf_is_backend_netns()) {
|
|
|
|
if ((vrf_all || vrf_name) && (table || table_all)) {
|
|
|
|
if (!!json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
else {
|
|
|
|
vty_out(vty, "Linux vrf backend already points to table id\n");
|
|
|
|
vty_out(vty, "Either remove table parameter or vrf parameter\n");
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 20:16:12 +02:00
|
|
|
if (type_str) {
|
|
|
|
type = proto_redistnum(afi, type_str);
|
2017-05-22 21:56:11 +02:00
|
|
|
if (type < 0) {
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty, "Unknown route type\n");
|
2017-05-22 21:56:11 +02:00
|
|
|
return CMD_WARNING;
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
2017-05-22 21:56:11 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-05-22 21:56:11 +02:00
|
|
|
if (vrf_all) {
|
2017-09-15 17:47:35 +02:00
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
2024-10-29 20:30:00 +01:00
|
|
|
if ((zvrf = vrf->info) == NULL || (zvrf->table[afi][safi] == NULL))
|
2017-05-22 21:56:11 +02:00
|
|
|
continue;
|
2024-05-24 17:06:59 +02:00
|
|
|
if (json)
|
|
|
|
vty_json_key(vty, zvrf_name(zvrf),
|
|
|
|
&first_vrf_json);
|
2020-02-06 09:52:00 +01:00
|
|
|
if (table_all)
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_ip_route_all(vty, zvrf, afi, safi, !!fib, !!json, tag,
|
|
|
|
prefix_str ? prefix : NULL, !!supernets_only,
|
|
|
|
type, ospf_instance_id, !!ng, &ctx);
|
2020-02-06 09:52:00 +01:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_ip_route(vty, zvrf_name(zvrf), afi, safi, !!fib, !!json,
|
|
|
|
tag, prefix_str ? prefix : NULL, !!supernets_only,
|
|
|
|
type, ospf_instance_id, table, !!ng, &ctx);
|
2017-05-22 21:56:11 +02:00
|
|
|
}
|
2024-05-24 17:06:59 +02:00
|
|
|
if (json)
|
|
|
|
vty_json_close(vty, first_vrf_json);
|
2017-05-22 21:56:11 +02:00
|
|
|
} else {
|
2017-09-13 20:16:12 +02:00
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
|
|
|
|
|
|
|
if (vrf_name)
|
2018-07-27 16:09:38 +02:00
|
|
|
VRF_GET_ID(vrf_id, vrf_name, !!json);
|
2017-05-22 21:56:11 +02:00
|
|
|
vrf = vrf_lookup_by_id(vrf_id);
|
2020-11-04 17:48:49 +01:00
|
|
|
if (!vrf)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
zvrf = vrf->info;
|
|
|
|
if (!zvrf)
|
2020-02-06 09:52:00 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
if (table_all)
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_ip_route_all(vty, zvrf, afi, safi, !!fib, !!json, tag,
|
|
|
|
prefix_str ? prefix : NULL, !!supernets_only, type,
|
2021-11-29 20:59:06 +01:00
|
|
|
ospf_instance_id, !!ng, &ctx);
|
2020-02-06 09:52:00 +01:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
do_show_ip_route(vty, vrf->name, afi, safi, !!fib, !!json, tag,
|
|
|
|
prefix_str ? prefix : NULL, !!supernets_only, type,
|
2021-11-29 20:59:06 +01:00
|
|
|
ospf_instance_id, table, !!ng, &ctx);
|
2015-05-22 11:40:06 +02:00
|
|
|
}
|
2017-09-13 20:16:12 +02:00
|
|
|
|
2015-05-22 11:40:06 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
ALIAS_DEPRECATED (show_route,
|
|
|
|
show_ip_rpf_cmd,
|
|
|
|
"show <ip$ipv4|ipv6$ipv6> rpf$mrib [json$json]",
|
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
|
|
|
IPV6_STR
|
|
|
|
"Display RPF information for multicast source\n"
|
|
|
|
JSON_STR);
|
|
|
|
|
2020-10-19 20:08:18 +02:00
|
|
|
ALIAS_HIDDEN (show_route,
|
|
|
|
show_ro_cmd,
|
|
|
|
"show <ip$ipv4|ipv6$ipv6> ro",
|
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
|
|
|
IPV6_STR
|
|
|
|
"IP routing table\n");
|
|
|
|
|
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
DEFPY (show_route_detail,
|
|
|
|
show_route_detail_cmd,
|
|
|
|
"show\
|
|
|
|
<\
|
2024-10-29 20:30:00 +01:00
|
|
|
ip$ipv4 <fib$fib|route>\
|
|
|
|
[{\
|
|
|
|
mrib$mrib\
|
|
|
|
|vrf <NAME$vrf_name|all$vrf_all>\
|
|
|
|
}]\
|
|
|
|
<\
|
|
|
|
A.B.C.D$address\
|
|
|
|
|A.B.C.D/M$prefix\
|
|
|
|
>\
|
|
|
|
|ipv6$ipv6 <fib$fib|route>\
|
|
|
|
[{\
|
|
|
|
mrib$mrib\
|
|
|
|
|vrf <NAME$vrf_name|all$vrf_all>\
|
|
|
|
}]\
|
|
|
|
<\
|
|
|
|
X:X::X:X$address\
|
|
|
|
|X:X::X:X/M$prefix\
|
|
|
|
>\
|
|
|
|
>\
|
|
|
|
[json$json] [nexthop-group$ng]",
|
2015-05-22 11:40:06 +02:00
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
2023-01-03 16:46:01 +01:00
|
|
|
"IP forwarding table\n"
|
2015-05-22 11:40:06 +02:00
|
|
|
"IP routing table\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
2017-09-13 22:40:19 +02:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
|
|
|
"Network in the IP routing table to display\n"
|
|
|
|
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
|
|
|
IP6_STR
|
2019-05-08 23:26:49 +02:00
|
|
|
"IPv6 forwarding table\n"
|
|
|
|
"IPv6 routing table\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
2017-09-13 22:40:19 +02:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
|
|
|
"IPv6 Address\n"
|
2018-08-08 00:15:34 +02:00
|
|
|
"IPv6 prefix\n"
|
2019-08-27 00:20:45 +02:00
|
|
|
JSON_STR
|
|
|
|
"Nexthop Group Information\n")
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
2017-09-13 22:40:19 +02:00
|
|
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
2024-10-29 20:30:00 +01:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2015-05-22 11:40:06 +02:00
|
|
|
struct route_table *table;
|
2017-09-13 22:40:19 +02:00
|
|
|
struct prefix p;
|
2015-05-22 11:40:06 +02:00
|
|
|
struct route_node *rn;
|
2019-05-09 22:36:59 +02:00
|
|
|
bool use_fib = !!fib;
|
|
|
|
rib_dest_t *dest;
|
2019-05-10 21:05:47 +02:00
|
|
|
bool network_found = false;
|
2019-08-27 00:20:45 +02:00
|
|
|
bool show_ng = !!ng;
|
2025-01-21 23:19:32 +01:00
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return error if V6 address/prefix is passed as an argument to
|
|
|
|
* "show ip route" cmd.
|
|
|
|
*
|
|
|
|
* When "show ip route <X:X::X:X|X:X::X:X/M>" is queried,
|
|
|
|
* argv[idx]->text will be set to "ipv6" but argv[idx]->arg will be set
|
|
|
|
* to "ip".
|
|
|
|
*/
|
|
|
|
if (argv_find(argv, argc, "ipv6", &idx) && !strcmp(argv[idx]->arg, "ip")) {
|
|
|
|
vty_out(vty, "%% Cannot specify IPv6 address/prefix for IPv4 table\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2016-02-28 23:03:27 +01:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (address_str)
|
|
|
|
prefix_str = address_str;
|
2025-01-21 23:19:32 +01:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (str2prefix(prefix_str, &p) < 0) {
|
|
|
|
vty_out(vty, "%% Malformed address\n");
|
2015-05-22 11:40:06 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (vrf_all) {
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct zebra_vrf *zvrf;
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
2024-10-29 20:30:00 +01:00
|
|
|
if ((zvrf = vrf->info) == NULL || (table = zvrf->table[afi][safi]) == NULL)
|
2017-09-13 22:40:19 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
rn = route_node_match(table, &p);
|
|
|
|
if (!rn)
|
|
|
|
continue;
|
|
|
|
if (!address_str && rn->p.prefixlen != p.prefixlen) {
|
|
|
|
route_unlock_node(rn);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-05-10 21:05:47 +02:00
|
|
|
dest = rib_dest_from_rnode(rn);
|
|
|
|
if (use_fib && !dest->selected_fib) {
|
|
|
|
route_unlock_node(rn);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
network_found = true;
|
2018-08-08 00:15:34 +02:00
|
|
|
if (json)
|
2019-08-27 00:20:45 +02:00
|
|
|
vty_show_ip_route_detail_json(vty, rn, use_fib);
|
2018-08-08 00:15:34 +02:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_show_ip_route_detail(vty, rn, (safi == SAFI_MULTICAST), use_fib,
|
2019-08-27 00:20:45 +02:00
|
|
|
show_ng);
|
2017-09-13 22:40:19 +02:00
|
|
|
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
2019-05-10 21:05:47 +02:00
|
|
|
|
|
|
|
if (!network_found) {
|
|
|
|
if (json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
else {
|
|
|
|
if (use_fib)
|
|
|
|
vty_out(vty,
|
|
|
|
"%% Network not in FIB\n");
|
|
|
|
else
|
|
|
|
vty_out(vty,
|
|
|
|
"%% Network not in RIB\n");
|
|
|
|
}
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2017-09-13 22:40:19 +02:00
|
|
|
} else {
|
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
|
|
|
|
|
|
|
if (vrf_name)
|
2018-07-27 16:09:38 +02:00
|
|
|
VRF_GET_ID(vrf_id, vrf_name, false);
|
2017-09-13 22:40:19 +02:00
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_vrf_table(afi, safi, vrf_id);
|
2017-09-13 22:40:19 +02:00
|
|
|
if (!table)
|
|
|
|
return CMD_SUCCESS;
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
rn = route_node_match(table, &p);
|
2019-05-10 21:05:47 +02:00
|
|
|
if (rn)
|
|
|
|
dest = rib_dest_from_rnode(rn);
|
|
|
|
|
|
|
|
if (!rn || (!address_str && rn->p.prefixlen != p.prefixlen) ||
|
|
|
|
(use_fib && dest && !dest->selected_fib)) {
|
|
|
|
if (json)
|
|
|
|
vty_out(vty, "{}\n");
|
|
|
|
else {
|
|
|
|
if (use_fib)
|
|
|
|
vty_out(vty,
|
|
|
|
"%% Network not in FIB\n");
|
|
|
|
else
|
|
|
|
vty_out(vty,
|
|
|
|
"%% Network not in table\n");
|
|
|
|
}
|
|
|
|
if (rn)
|
|
|
|
route_unlock_node(rn);
|
2017-09-13 22:40:19 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2018-08-08 00:15:34 +02:00
|
|
|
if (json)
|
2019-05-09 22:36:59 +02:00
|
|
|
vty_show_ip_route_detail_json(vty, rn, use_fib);
|
2018-08-08 00:15:34 +02:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_show_ip_route_detail(vty, rn, (safi == SAFI_MULTICAST), use_fib,
|
|
|
|
show_ng);
|
2017-09-13 22:40:19 +02:00
|
|
|
|
|
|
|
route_unlock_node(rn);
|
|
|
|
}
|
2015-05-22 11:40:06 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
DEFPY (show_route_summary,
|
|
|
|
show_route_summary_cmd,
|
2024-10-29 20:30:00 +01:00
|
|
|
"show <ip$ipv4|ipv6$ipv6> route [{mrib$mrib|vrf <NAME$vrf_name|all$vrf_all>}] \
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
summary [table (1-4294967295)$table_id] [prefix$prefix] [json]",
|
2015-05-22 11:40:06 +02:00
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
2017-09-13 22:40:19 +02:00
|
|
|
IP6_STR
|
|
|
|
"IP routing table\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
2017-09-13 22:40:19 +02:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
|
|
|
"Summary of all routes\n"
|
2019-09-07 02:31:41 +02:00
|
|
|
"Table to display summary for\n"
|
|
|
|
"The table number\n"
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
"Prefix routes\n"
|
|
|
|
JSON_STR)
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
2017-09-13 22:40:19 +02:00
|
|
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
2024-10-29 20:30:00 +01:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2015-05-22 11:40:06 +02:00
|
|
|
struct route_table *table;
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
bool uj = use_json(argc, argv);
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
json_object *vrf_json = NULL;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (vrf_all) {
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct zebra_vrf *zvrf;
|
2016-02-28 23:03:27 +01:00
|
|
|
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
if (uj && !vrf_json)
|
|
|
|
vrf_json = json_object_new_object();
|
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
2019-09-07 02:31:41 +02:00
|
|
|
if ((zvrf = vrf->info) == NULL)
|
|
|
|
continue;
|
|
|
|
|
2020-12-01 18:24:46 +01:00
|
|
|
if (table_id == 0)
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
|
2020-12-01 18:24:46 +01:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_vrf_lookup_table_with_table_id(afi, safi,
|
|
|
|
zvrf->vrf->vrf_id,
|
|
|
|
table_id);
|
2019-11-01 20:52:47 +01:00
|
|
|
|
2019-09-07 02:31:41 +02:00
|
|
|
if (!table)
|
2017-09-13 22:40:19 +02:00
|
|
|
continue;
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (prefix)
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
vty_show_ip_route_summary_prefix(vty, table,
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
vrf_json, uj);
|
2017-09-13 22:40:19 +02:00
|
|
|
else
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
vty_show_ip_route_summary(vty, table, vrf_json,
|
|
|
|
uj);
|
2017-09-13 22:40:19 +02:00
|
|
|
}
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, vrf_json);
|
2017-09-13 22:40:19 +02:00
|
|
|
} else {
|
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (vrf_name)
|
2018-07-27 16:09:38 +02:00
|
|
|
VRF_GET_ID(vrf_id, vrf_name, false);
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2020-12-01 18:24:46 +01:00
|
|
|
if (table_id == 0)
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_vrf_table(afi, safi, vrf_id);
|
2020-12-01 18:24:46 +01:00
|
|
|
else
|
2024-10-29 20:30:00 +01:00
|
|
|
table = zebra_vrf_lookup_table_with_table_id(afi, safi, vrf_id, table_id);
|
2017-09-13 22:40:19 +02:00
|
|
|
if (!table)
|
|
|
|
return CMD_SUCCESS;
|
2015-05-22 11:40:06 +02:00
|
|
|
|
2017-09-13 22:40:19 +02:00
|
|
|
if (prefix)
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
vty_show_ip_route_summary_prefix(vty, table, NULL, uj);
|
2017-09-13 22:40:19 +02:00
|
|
|
else
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
vty_show_ip_route_summary(vty, table, NULL, uj);
|
2017-09-13 22:40:19 +02:00
|
|
|
}
|
2015-05-22 11:40:06 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
DEFPY_HIDDEN (show_route_zebra_dump,
|
2020-04-29 19:06:45 +02:00
|
|
|
show_route_zebra_dump_cmd,
|
2024-10-29 20:30:00 +01:00
|
|
|
"show <ip$ipv4|ipv6$ipv6> zebra route dump [{mrib$mrib|vrf <NAME$vrf_name|all$vrf_all>}]",
|
2020-04-29 19:06:45 +02:00
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
|
|
|
IP6_STR
|
|
|
|
"Zebra daemon\n"
|
|
|
|
"Routing table\n"
|
|
|
|
"All information\n"
|
2024-10-29 20:30:00 +01:00
|
|
|
"Multicast SAFI table\n"
|
|
|
|
VRF_FULL_CMD_HELP_STR)
|
2020-04-29 19:06:45 +02:00
|
|
|
{
|
2024-10-29 20:30:00 +01:00
|
|
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2020-04-29 19:06:45 +02:00
|
|
|
struct route_table *table;
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
if (vrf_all) {
|
2020-04-29 19:06:45 +02:00
|
|
|
struct vrf *vrf;
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
zvrf = vrf->info;
|
2024-10-29 20:30:00 +01:00
|
|
|
if (zvrf == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
|
|
|
|
if (!table)
|
2020-04-29 19:06:45 +02:00
|
|
|
continue;
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
show_ip_route_dump_vty(vty, table, afi, safi);
|
2020-04-29 19:06:45 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
if (vrf_name)
|
|
|
|
VRF_GET_ID(vrf_id, vrf_name, false);
|
|
|
|
|
|
|
|
table = zebra_vrf_table(afi, safi, vrf_id);
|
2020-04-29 19:06:45 +02:00
|
|
|
|
|
|
|
if (!table)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
show_ip_route_dump_vty(vty, table, afi, safi);
|
2020-04-29 19:06:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-05-14 16:28:17 +02:00
|
|
|
static void show_ip_route_nht_dump(struct vty *vty,
|
|
|
|
const struct nexthop *nexthop,
|
|
|
|
const struct route_node *rn,
|
|
|
|
const struct route_entry *re,
|
|
|
|
unsigned int num)
|
2020-04-29 19:06:45 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
char buf[SRCDEST2STR_BUFFER];
|
|
|
|
|
|
|
|
vty_out(vty, " Nexthop %u:\n", num);
|
|
|
|
vty_out(vty, " type: %u\n", nexthop->type);
|
|
|
|
vty_out(vty, " flags: %u\n", nexthop->flags);
|
|
|
|
switch (nexthop->type) {
|
|
|
|
case NEXTHOP_TYPE_IPV4:
|
|
|
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
|
|
|
vty_out(vty, " ip address: %s\n",
|
|
|
|
inet_ntop(AF_INET, &nexthop->gate.ipv4, buf,
|
|
|
|
sizeof(buf)));
|
|
|
|
vty_out(vty, " afi: ipv4\n");
|
|
|
|
|
|
|
|
if (nexthop->ifindex) {
|
|
|
|
vty_out(vty, " interface index: %d\n",
|
|
|
|
nexthop->ifindex);
|
|
|
|
vty_out(vty, " interface name: %s\n",
|
|
|
|
ifindex2ifname(nexthop->ifindex,
|
|
|
|
nexthop->vrf_id));
|
|
|
|
}
|
|
|
|
|
2024-05-14 16:28:17 +02:00
|
|
|
if (nexthop->rmap_src.ipv4.s_addr)
|
|
|
|
vty_out(vty, " rmapsrc: %pI4\n",
|
|
|
|
&nexthop->rmap_src.ipv4);
|
|
|
|
else if (nexthop->src.ipv4.s_addr)
|
|
|
|
vty_out(vty, " source: %pI4\n",
|
|
|
|
&nexthop->src.ipv4.s_addr);
|
2020-04-29 19:06:45 +02:00
|
|
|
break;
|
|
|
|
case NEXTHOP_TYPE_IPV6:
|
|
|
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
|
|
|
vty_out(vty, " ip: %s\n",
|
|
|
|
inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf,
|
|
|
|
sizeof(buf)));
|
|
|
|
vty_out(vty, " afi: ipv6\n");
|
|
|
|
|
|
|
|
if (nexthop->ifindex) {
|
|
|
|
vty_out(vty, " interface index: %d\n",
|
|
|
|
nexthop->ifindex);
|
|
|
|
vty_out(vty, " interface name: %s\n",
|
|
|
|
ifindex2ifname(nexthop->ifindex,
|
|
|
|
nexthop->vrf_id));
|
|
|
|
}
|
|
|
|
|
2024-05-14 16:28:17 +02:00
|
|
|
/* Allow for 5549 ipv4 prefix with ipv6 nexthop */
|
|
|
|
if (rn->p.family == AF_INET && nexthop->rmap_src.ipv4.s_addr)
|
|
|
|
vty_out(vty, " rmapsrc: %pI4\n",
|
|
|
|
&nexthop->rmap_src.ipv4);
|
|
|
|
else if (!IPV6_ADDR_SAME(&nexthop->rmap_src.ipv6, &in6addr_any))
|
|
|
|
vty_out(vty, " rmapsrc: %pI6\n",
|
|
|
|
&nexthop->rmap_src.ipv6);
|
|
|
|
else if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
|
|
|
|
vty_out(vty, " source: %pI6\n", &nexthop->src.ipv6);
|
2020-04-29 19:06:45 +02:00
|
|
|
break;
|
|
|
|
case NEXTHOP_TYPE_IFINDEX:
|
|
|
|
vty_out(vty,
|
|
|
|
" Nexthop is an interface (directly connected).\n");
|
|
|
|
vty_out(vty, " interface index: %d\n", nexthop->ifindex);
|
|
|
|
vty_out(vty, " interface name: %s\n",
|
|
|
|
ifindex2ifname(nexthop->ifindex, nexthop->vrf_id));
|
|
|
|
break;
|
|
|
|
case NEXTHOP_TYPE_BLACKHOLE:
|
|
|
|
vty_out(vty, " Nexthop type is blackhole.\n");
|
|
|
|
|
|
|
|
switch (nexthop->bh_type) {
|
|
|
|
case BLACKHOLE_REJECT:
|
|
|
|
vty_out(vty, " Blackhole type: reject\n");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_ADMINPROHIB:
|
|
|
|
vty_out(vty,
|
|
|
|
" Blackhole type: admin-prohibited\n");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_NULL:
|
|
|
|
vty_out(vty, " Blackhole type: NULL0\n");
|
|
|
|
break;
|
|
|
|
case BLACKHOLE_UNSPEC:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
static void show_ip_route_dump_vty(struct vty *vty, struct route_table *table, afi_t afi,
|
|
|
|
safi_t safi)
|
2020-04-29 19:06:45 +02:00
|
|
|
{
|
|
|
|
struct route_node *rn;
|
|
|
|
struct route_entry *re;
|
|
|
|
char buf[SRCDEST2STR_BUFFER];
|
|
|
|
char time[20];
|
|
|
|
time_t uptime;
|
|
|
|
struct tm tm;
|
|
|
|
struct timeval tv;
|
|
|
|
struct nexthop *nexthop = NULL;
|
|
|
|
int nexthop_num = 0;
|
|
|
|
|
2024-10-29 20:30:00 +01:00
|
|
|
vty_out(vty, "\n%s %s Routing table dump\n", afi2str(afi), safi2str(safi));
|
2020-04-29 19:06:45 +02:00
|
|
|
vty_out(vty, "----------------------------\n");
|
|
|
|
|
|
|
|
for (rn = route_top(table); rn; rn = route_next(rn)) {
|
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
|
|
|
vty_out(vty, "Route: %s\n",
|
|
|
|
srcdest_rnode2str(rn, buf, sizeof(buf)));
|
|
|
|
vty_out(vty, " protocol: %s\n",
|
|
|
|
zebra_route_string(re->type));
|
|
|
|
vty_out(vty, " instance: %u\n", re->instance);
|
|
|
|
vty_out(vty, " VRF ID: %u\n", re->vrf_id);
|
|
|
|
vty_out(vty, " VRF name: %s\n",
|
|
|
|
vrf_id_to_name(re->vrf_id));
|
|
|
|
vty_out(vty, " flags: %u\n", re->flags);
|
|
|
|
|
*: Introduce Local Host Routes to FRR
Create Local routes in FRR:
S 0.0.0.0/0 [1/0] via 192.168.119.1, enp39s0, weight 1, 00:03:46
K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp39s0, 00:03:51
O 192.168.119.0/24 [110/100] is directly connected, enp39s0, weight 1, 00:03:46
C>* 192.168.119.0/24 is directly connected, enp39s0, 00:03:51
L>* 192.168.119.224/32 is directly connected, enp39s0, 00:03:51
O 192.168.119.229/32 [110/100] via 0.0.0.0, enp39s0 inactive, weight 1, 00:03:46
C>* 192.168.119.229/32 is directly connected, enp39s0, 00:03:46
Create ability to redistribute local routes.
Modify tests to support this change.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-05 00:32:43 +01:00
|
|
|
if (re->type != ZEBRA_ROUTE_CONNECT &&
|
|
|
|
re->type != ZEBRA_ROUTE_LOCAL) {
|
2020-04-29 19:06:45 +02:00
|
|
|
vty_out(vty, " distance: %u\n", re->distance);
|
|
|
|
vty_out(vty, " metric: %u\n", re->metric);
|
|
|
|
}
|
|
|
|
|
|
|
|
vty_out(vty, " tag: %u\n", re->tag);
|
|
|
|
|
|
|
|
uptime = monotime(&tv);
|
|
|
|
uptime -= re->uptime;
|
|
|
|
gmtime_r(&uptime, &tm);
|
|
|
|
|
|
|
|
if (uptime < ONE_DAY_SECOND)
|
|
|
|
snprintf(time, sizeof(time), "%02d:%02d:%02d",
|
|
|
|
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
|
|
else if (uptime < ONE_WEEK_SECOND)
|
|
|
|
snprintf(time, sizeof(time), "%dd%02dh%02dm",
|
|
|
|
tm.tm_yday, tm.tm_hour, tm.tm_min);
|
|
|
|
else
|
|
|
|
snprintf(time, sizeof(time), "%02dw%dd%02dh",
|
|
|
|
tm.tm_yday / 7,
|
|
|
|
tm.tm_yday - ((tm.tm_yday / 7) * 7),
|
|
|
|
tm.tm_hour);
|
|
|
|
|
|
|
|
vty_out(vty, " status: %u\n", re->status);
|
|
|
|
vty_out(vty, " nexthop_num: %u\n",
|
|
|
|
nexthop_group_nexthop_num(&(re->nhe->nhg)));
|
|
|
|
vty_out(vty, " nexthop_active_num: %u\n",
|
|
|
|
nexthop_group_active_nexthop_num(
|
|
|
|
&(re->nhe->nhg)));
|
|
|
|
vty_out(vty, " table: %u\n", re->table);
|
|
|
|
vty_out(vty, " uptime: %s\n", time);
|
|
|
|
|
|
|
|
for (ALL_NEXTHOPS_PTR(&(re->nhe->nhg), nexthop)) {
|
|
|
|
nexthop_num++;
|
2024-05-14 16:28:17 +02:00
|
|
|
show_ip_route_nht_dump(vty, nexthop, rn, re,
|
2020-04-29 19:06:45 +02:00
|
|
|
nexthop_num);
|
|
|
|
}
|
|
|
|
|
|
|
|
nexthop_num = 0;
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
static void vty_show_ip_route_summary(struct vty *vty, struct route_table *table,
|
|
|
|
json_object *vrf_json, bool use_json)
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
|
|
|
struct route_node *rn;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2015-05-22 11:40:06 +02:00
|
|
|
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
|
|
|
|
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
|
|
|
uint32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
2020-11-13 15:51:30 +01:00
|
|
|
uint32_t offload_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
|
|
|
uint32_t trap_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t i;
|
|
|
|
uint32_t is_ibgp;
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
json_object *json_route_summary = NULL;
|
|
|
|
json_object *json_route_routes = NULL;
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
const char *vrf_name = zvrf_name(
|
|
|
|
((struct rib_table_info *)route_table_get_info(table))->zvrf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-22 11:40:06 +02:00
|
|
|
memset(&rib_cnt, 0, sizeof(rib_cnt));
|
|
|
|
memset(&fib_cnt, 0, sizeof(fib_cnt));
|
2020-11-13 15:51:30 +01:00
|
|
|
memset(&offload_cnt, 0, sizeof(offload_cnt));
|
|
|
|
memset(&trap_cnt, 0, sizeof(trap_cnt));
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
|
|
|
|
if (use_json) {
|
|
|
|
json_route_summary = json_object_new_object();
|
|
|
|
json_route_routes = json_object_new_array();
|
|
|
|
json_object_object_add(json_route_summary, "routes",
|
|
|
|
json_route_routes);
|
|
|
|
}
|
|
|
|
|
2016-12-05 20:05:30 +01:00
|
|
|
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2017-06-01 13:26:25 +02:00
|
|
|
is_ibgp = (re->type == ZEBRA_ROUTE_BGP
|
|
|
|
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_IBGP));
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-04-21 07:27:29 +02:00
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
|
|
|
if (is_ibgp)
|
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP]++;
|
|
|
|
else
|
2017-06-01 13:26:25 +02:00
|
|
|
rib_cnt[re->type]++;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-03-25 18:35:02 +01:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED)) {
|
2016-04-21 07:27:29 +02:00
|
|
|
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-04-21 07:27:29 +02:00
|
|
|
if (is_ibgp)
|
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]++;
|
|
|
|
else
|
2017-06-01 13:26:25 +02:00
|
|
|
fib_cnt[re->type]++;
|
2016-04-21 07:27:29 +02:00
|
|
|
}
|
2020-11-13 15:51:30 +01:00
|
|
|
|
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED)) {
|
|
|
|
if (is_ibgp)
|
|
|
|
trap_cnt[ZEBRA_ROUTE_IBGP]++;
|
|
|
|
else
|
|
|
|
trap_cnt[re->type]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED)) {
|
|
|
|
if (is_ibgp)
|
|
|
|
offload_cnt[ZEBRA_ROUTE_IBGP]++;
|
|
|
|
else
|
|
|
|
offload_cnt[re->type]++;
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (!use_json)
|
|
|
|
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
"Routes", "FIB", vrf_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-04-21 07:27:29 +02:00
|
|
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
2017-07-22 14:52:33 +02:00
|
|
|
if ((rib_cnt[i] > 0) || (i == ZEBRA_ROUTE_BGP
|
|
|
|
&& rib_cnt[ZEBRA_ROUTE_IBGP] > 0)) {
|
2016-04-21 07:27:29 +02:00
|
|
|
if (i == ZEBRA_ROUTE_BGP) {
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (use_json) {
|
|
|
|
json_object *json_route_ebgp =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "fib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_BGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "rib",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_BGP]);
|
2020-11-13 15:51:30 +01:00
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "fibOffLoaded",
|
|
|
|
offload_cnt[ZEBRA_ROUTE_BGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "fibTrapped",
|
|
|
|
trap_cnt[ZEBRA_ROUTE_BGP]);
|
|
|
|
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
json_object_string_add(json_route_ebgp,
|
|
|
|
"type", "ebgp");
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_ebgp);
|
|
|
|
|
|
|
|
json_object *json_route_ibgp =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "fib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "rib",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP]);
|
2020-11-13 15:51:30 +01:00
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "fibOffLoaded",
|
|
|
|
offload_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "fibTrapped",
|
|
|
|
trap_cnt[ZEBRA_ROUTE_IBGP]);
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
json_object_string_add(json_route_ibgp,
|
|
|
|
"type", "ibgp");
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_ibgp);
|
|
|
|
} else {
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
"ebgp",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_BGP],
|
|
|
|
fib_cnt[ZEBRA_ROUTE_BGP]);
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
"ibgp",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP],
|
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (use_json) {
|
|
|
|
json_object *json_route_type =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"fib", fib_cnt[i]);
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"rib", rib_cnt[i]);
|
2020-11-13 15:51:30 +01:00
|
|
|
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"fibOffLoaded",
|
|
|
|
offload_cnt[i]);
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"fibTrapped",
|
|
|
|
trap_cnt[i]);
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
json_object_string_add(
|
|
|
|
json_route_type, "type",
|
|
|
|
zebra_route_string(i));
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_type);
|
|
|
|
} else
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
zebra_route_string(i),
|
|
|
|
rib_cnt[i], fib_cnt[i]);
|
|
|
|
}
|
2016-04-21 07:27:29 +02:00
|
|
|
}
|
2015-05-22 11:40:06 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (use_json) {
|
|
|
|
json_object_int_add(json_route_summary, "routesTotal",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
json_object_int_add(json_route_summary, "routesTotalFib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
if (!vrf_json)
|
|
|
|
vty_json(vty, json_route_summary);
|
|
|
|
else
|
|
|
|
json_object_object_add(vrf_json, vrf_name,
|
|
|
|
json_route_summary);
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
} else {
|
|
|
|
vty_out(vty, "------\n");
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n", "Totals",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL], fib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
2015-05-22 11:40:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Implementation of the ip route summary prefix command.
|
|
|
|
*
|
|
|
|
* This command prints the primary prefixes that have been installed by various
|
|
|
|
* protocols on the box.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static void vty_show_ip_route_summary_prefix(struct vty *vty,
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
struct route_table *table,
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
json_object *vrf_json,
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
bool use_json)
|
2015-05-22 11:40:06 +02:00
|
|
|
{
|
|
|
|
struct route_node *rn;
|
2017-06-01 13:26:25 +02:00
|
|
|
struct route_entry *re;
|
2015-05-22 11:40:06 +02:00
|
|
|
struct nexthop *nexthop;
|
|
|
|
#define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
|
|
|
|
#define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
|
|
|
uint32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
|
|
|
|
uint32_t i;
|
2015-05-22 11:40:06 +02:00
|
|
|
int cnt;
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
json_object *json_route_summary = NULL;
|
|
|
|
json_object *json_route_routes = NULL;
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
const char *vrf_name = zvrf_name(
|
|
|
|
((struct rib_table_info *)route_table_get_info(table))->zvrf);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-22 11:40:06 +02:00
|
|
|
memset(&rib_cnt, 0, sizeof(rib_cnt));
|
|
|
|
memset(&fib_cnt, 0, sizeof(fib_cnt));
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
|
|
|
|
if (use_json) {
|
|
|
|
json_route_summary = json_object_new_object();
|
|
|
|
json_route_routes = json_object_new_array();
|
|
|
|
json_object_object_add(json_route_summary, "prefixRoutes",
|
|
|
|
json_route_routes);
|
|
|
|
}
|
|
|
|
|
2016-12-05 20:05:30 +01:00
|
|
|
for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
|
2017-09-15 17:47:35 +02:00
|
|
|
RNODE_FOREACH_RE (rn, re) {
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-22 11:40:06 +02:00
|
|
|
/*
|
|
|
|
* In case of ECMP, count only once.
|
|
|
|
*/
|
|
|
|
cnt = 0;
|
2019-01-14 22:37:53 +01:00
|
|
|
if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED)) {
|
|
|
|
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
|
|
|
fib_cnt[re->type]++;
|
|
|
|
}
|
2020-02-25 14:29:46 +01:00
|
|
|
for (nexthop = re->nhe->nhg.nexthop; (!cnt && nexthop);
|
2017-06-01 13:26:25 +02:00
|
|
|
nexthop = nexthop->next) {
|
2015-05-22 11:40:06 +02:00
|
|
|
cnt++;
|
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL]++;
|
2017-06-01 13:26:25 +02:00
|
|
|
rib_cnt[re->type]++;
|
|
|
|
if (re->type == ZEBRA_ROUTE_BGP
|
|
|
|
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_IBGP)) {
|
2015-05-20 02:24:41 +02:00
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP]++;
|
2019-01-14 22:37:53 +01:00
|
|
|
if (CHECK_FLAG(re->status,
|
|
|
|
ROUTE_ENTRY_INSTALLED))
|
2015-05-20 02:24:41 +02:00
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (!use_json)
|
|
|
|
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
"Prefix Routes", "FIB", vrf_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 02:24:41 +02:00
|
|
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
|
|
|
if (rib_cnt[i] > 0) {
|
|
|
|
if (i == ZEBRA_ROUTE_BGP) {
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (use_json) {
|
|
|
|
json_object *json_route_ebgp =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "fib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_BGP]
|
|
|
|
- fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ebgp, "rib",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_BGP]
|
|
|
|
- rib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_string_add(json_route_ebgp,
|
|
|
|
"type", "ebgp");
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_ebgp);
|
|
|
|
|
|
|
|
json_object *json_route_ibgp =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "fib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_int_add(
|
|
|
|
json_route_ibgp, "rib",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
json_object_string_add(json_route_ibgp,
|
|
|
|
"type", "ibgp");
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_ibgp);
|
|
|
|
} else {
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
"ebgp",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_BGP]
|
|
|
|
- rib_cnt[ZEBRA_ROUTE_IBGP],
|
|
|
|
fib_cnt[ZEBRA_ROUTE_BGP]
|
|
|
|
- fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
"ibgp",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_IBGP],
|
|
|
|
fib_cnt[ZEBRA_ROUTE_IBGP]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (use_json) {
|
|
|
|
json_object *json_route_type =
|
|
|
|
json_object_new_object();
|
|
|
|
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"fib", fib_cnt[i]);
|
|
|
|
json_object_int_add(json_route_type,
|
|
|
|
"rib", rib_cnt[i]);
|
|
|
|
json_object_string_add(
|
|
|
|
json_route_type, "type",
|
|
|
|
zebra_route_string(i));
|
|
|
|
json_object_array_add(json_route_routes,
|
|
|
|
json_route_type);
|
|
|
|
} else
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n",
|
|
|
|
zebra_route_string(i),
|
|
|
|
rib_cnt[i], fib_cnt[i]);
|
|
|
|
}
|
2015-05-20 02:24:41 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
if (use_json) {
|
|
|
|
json_object_int_add(json_route_summary, "prefixRoutesTotal",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
json_object_int_add(json_route_summary, "prefixRoutesTotalFib",
|
|
|
|
fib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
|
zebra: Fix JSON output for `show route summary json`
Before:
```
{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
}
{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
```
After:
```
{
"ISR":{
"routes":[
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":1,
"rib":1,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":4,
"routesTotalFib":4
},
"default":{
"routes":[
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"connected"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"local"
},
{
"fib":2,
"rib":2,
"fibOffLoaded":0,
"fibTrapped":0,
"type":"static"
}
],
"routesTotal":6,
"routesTotalFib":6
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-03-30 22:04:10 +01:00
|
|
|
if (!vrf_json)
|
|
|
|
vty_json(vty, json_route_summary);
|
|
|
|
else
|
|
|
|
json_object_object_add(vrf_json, vrf_name,
|
|
|
|
json_route_summary);
|
zebra: Print json output for show_route_summary_cmd
```
spine1-debian-9# sh ip route summary json
{
"routes":[
{
"fib":1,
"rib":1,
"type":"kernel"
},
{
"fib":11,
"rib":11,
"type":"connected"
},
{
"fib":2,
"rib":2,
"type":"ebgp"
},
{
"fib":1,
"rib":1,
"type":"ibgp"
}
],
"routesTotal":15,
"routesTotalFib":15
}
spine1-debian-9# sh ipv6 route summary json
{
"routes":[
{
"fib":7,
"rib":7,
"type":"connected"
}
],
"routesTotal":7,
"routesTotalFib":7
}
```
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-09 08:33:48 +01:00
|
|
|
} else {
|
|
|
|
vty_out(vty, "------\n");
|
|
|
|
vty_out(vty, "%-20s %-20d %-20d \n", "Totals",
|
|
|
|
rib_cnt[ZEBRA_ROUTE_TOTAL], fib_cnt[ZEBRA_ROUTE_TOTAL]);
|
|
|
|
vty_out(vty, "\n");
|
|
|
|
}
|
2015-05-20 02:24:41 +02:00
|
|
|
}
|
|
|
|
|
2015-08-26 14:21:40 +02:00
|
|
|
DEFUN (allow_external_route_update,
|
|
|
|
allow_external_route_update_cmd,
|
|
|
|
"allow-external-route-update",
|
2017-03-12 01:06:09 +01:00
|
|
|
"Allow FRR routes to be overwritten by external processes\n")
|
2015-08-26 14:21:40 +02:00
|
|
|
{
|
2022-06-30 17:59:39 +02:00
|
|
|
zrouter.allow_delete = true;
|
2015-08-26 14:21:40 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (no_allow_external_route_update,
|
|
|
|
no_allow_external_route_update_cmd,
|
|
|
|
"no allow-external-route-update",
|
2017-03-12 01:06:09 +01:00
|
|
|
NO_STR
|
|
|
|
"Allow FRR routes to be overwritten by external processes\n")
|
2015-08-26 14:21:40 +02:00
|
|
|
{
|
2022-06-30 17:59:39 +02:00
|
|
|
zrouter.allow_delete = false;
|
2015-08-26 14:21:40 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-02-01 19:55:42 +01:00
|
|
|
/* show vrf */
|
|
|
|
DEFUN (show_vrf,
|
|
|
|
show_vrf_cmd,
|
|
|
|
"show vrf",
|
|
|
|
SHOW_STR
|
|
|
|
"VRF\n")
|
|
|
|
{
|
2016-10-29 02:26:04 +02:00
|
|
|
struct vrf *vrf;
|
2016-02-01 19:55:42 +01:00
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
|
2018-05-10 10:05:28 +02:00
|
|
|
if (vrf_is_backend_netns())
|
|
|
|
vty_out(vty, "netns-based vrfs\n");
|
|
|
|
|
2017-09-15 17:47:35 +02:00
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
2016-10-30 22:50:26 +01:00
|
|
|
if (!(zvrf = vrf->info))
|
2016-12-05 19:43:38 +01:00
|
|
|
continue;
|
2018-01-22 09:38:45 +01:00
|
|
|
if (zvrf_id(zvrf) == VRF_DEFAULT)
|
2016-12-05 19:43:38 +01:00
|
|
|
continue;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2016-10-30 22:50:26 +01:00
|
|
|
vty_out(vty, "vrf %s ", zvrf_name(zvrf));
|
2017-12-07 15:58:48 +01:00
|
|
|
if (zvrf_id(zvrf) == VRF_UNKNOWN || !zvrf_is_active(zvrf))
|
2016-05-03 19:54:01 +02:00
|
|
|
vty_out(vty, "inactive");
|
2017-12-07 15:58:48 +01:00
|
|
|
else if (zvrf_ns_name(zvrf))
|
|
|
|
vty_out(vty, "id %u netns %s", zvrf_id(zvrf),
|
|
|
|
zvrf_ns_name(zvrf));
|
2016-05-03 19:54:01 +02:00
|
|
|
else
|
2016-10-30 22:50:26 +01:00
|
|
|
vty_out(vty, "id %u table %u", zvrf_id(zvrf),
|
|
|
|
zvrf->table_id);
|
2017-12-07 00:19:11 +01:00
|
|
|
if (vrf_is_user_cfged(vrf))
|
|
|
|
vty_out(vty, " (configured)");
|
2017-07-13 19:04:25 +02:00
|
|
|
vty_out(vty, "\n");
|
2016-02-01 19:55:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-05-08 15:00:40 +02:00
|
|
|
DEFPY (evpn_mh_mac_holdtime,
|
|
|
|
evpn_mh_mac_holdtime_cmd,
|
|
|
|
"[no$no] evpn mh mac-holdtime (0-86400)$duration",
|
|
|
|
NO_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Multihoming\n"
|
|
|
|
"MAC hold time\n"
|
|
|
|
"Duration in seconds\n")
|
|
|
|
{
|
|
|
|
return zebra_evpn_mh_mac_holdtime_update(vty, duration,
|
|
|
|
no ? true : false);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (evpn_mh_neigh_holdtime,
|
|
|
|
evpn_mh_neigh_holdtime_cmd,
|
|
|
|
"[no$no] evpn mh neigh-holdtime (0-86400)$duration",
|
|
|
|
NO_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Multihoming\n"
|
|
|
|
"Neighbor entry hold time\n"
|
|
|
|
"Duration in seconds\n")
|
|
|
|
{
|
|
|
|
|
2021-04-17 22:29:30 +02:00
|
|
|
return zebra_evpn_mh_neigh_holdtime_update(vty, duration,
|
|
|
|
no ? true : false);
|
2020-05-08 15:00:40 +02:00
|
|
|
}
|
|
|
|
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
DEFPY (evpn_mh_startup_delay,
|
|
|
|
evpn_mh_startup_delay_cmd,
|
|
|
|
"[no] evpn mh startup-delay(0-3600)$duration",
|
|
|
|
NO_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Multihoming\n"
|
|
|
|
"Startup delay\n"
|
|
|
|
"duration in seconds\n")
|
|
|
|
{
|
|
|
|
|
|
|
|
return zebra_evpn_mh_startup_delay_update(vty, duration,
|
|
|
|
no ? true : false);
|
|
|
|
}
|
|
|
|
|
2020-05-09 03:47:52 +02:00
|
|
|
DEFPY(evpn_mh_redirect_off, evpn_mh_redirect_off_cmd,
|
|
|
|
"[no$no] evpn mh redirect-off",
|
|
|
|
NO_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Multihoming\n"
|
|
|
|
"ES bond redirect for fast-failover off\n")
|
|
|
|
{
|
|
|
|
bool redirect_off;
|
|
|
|
|
|
|
|
redirect_off = no ? false : true;
|
|
|
|
|
|
|
|
return zebra_evpn_mh_redirect_off(vty, redirect_off);
|
|
|
|
}
|
|
|
|
|
2017-10-08 03:49:27 +02:00
|
|
|
/* show vrf */
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
DEFPY (show_vrf_vni,
|
2017-10-08 03:49:27 +02:00
|
|
|
show_vrf_vni_cmd,
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
"show vrf [<NAME$vrf_name|all$vrf_all>] vni [json]",
|
2017-10-08 03:49:27 +02:00
|
|
|
SHOW_STR
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
VRF_FULL_CMD_HELP_STR
|
2017-10-17 11:30:42 +02:00
|
|
|
"VNI\n"
|
|
|
|
JSON_STR)
|
2017-10-08 03:49:27 +02:00
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct zebra_vrf *zvrf;
|
2017-10-17 11:30:42 +02:00
|
|
|
json_object *json = NULL;
|
|
|
|
json_object *json_vrfs = NULL;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
bool use_vrf = false;
|
2017-10-17 11:30:42 +02:00
|
|
|
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
if (uj)
|
2017-10-17 11:30:42 +02:00
|
|
|
json = json_object_new_object();
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
|
|
|
|
/* show vrf vni used to display across all vrfs
|
|
|
|
* This is enhanced to support only for specific
|
|
|
|
* vrf based output.
|
|
|
|
*/
|
|
|
|
if (vrf_all || !vrf_name) {
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
zvrf = vrf->info;
|
|
|
|
if (!zvrf)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
use_vrf = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (use_vrf) {
|
|
|
|
if (!uj)
|
|
|
|
vty_out(vty,
|
|
|
|
"%-37s %-10s %-20s %-20s %-5s %-18s\n",
|
|
|
|
"VRF", "VNI", "VxLAN IF", "L3-SVI",
|
|
|
|
"State", "Rmac");
|
|
|
|
else
|
|
|
|
json_vrfs = json_object_new_array();
|
|
|
|
} else {
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
else
|
|
|
|
vty_out(vty, "%% VRF does not exist\n");
|
|
|
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2017-10-17 11:30:42 +02:00
|
|
|
}
|
2017-10-08 03:49:27 +02:00
|
|
|
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
if (use_vrf) {
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
zvrf = vrf->info;
|
|
|
|
if (!zvrf)
|
|
|
|
continue;
|
2017-11-15 10:01:00 +01:00
|
|
|
|
zebra: Adding FRR support for show vrf vrf-id vni
cli & json support extended for show vrf vrf-id vni
commands:
- existing: show vrf vni
- show vrf <vrf-name> vni
- show vrf all vni
- show vrf <vrf-name> vni json
- show vrf all vni json
Before:
```
tor-1# show vrf vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
```
After:
```
tor-1# show vrf default vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
}
]
}
tor-1# show vrf default vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
tor-1#
tor-1# show vrf all vni
VRF VNI VxLAN IF
L3-SVI State Rmac
default 100 None
None Down None
sym_1 8888 vxlan99
vlan490_l3 Up 44:38:39:ff:ff:25
sym_2 8889 vxlan99
vlan491_l3 Up 44:38:39:ff:ff:25
sym_3 8890 vxlan99
vlan492_l3 Up 44:38:39:ff:ff:25
sym_4 8891 vxlan99
vlan493_l3 Up 44:38:39:ff:ff:25
sym_5 8892 vxlan99
vlan494_l3 Up 44:38:39:ff:ff:25
tor-1#
tor-1#
tor-1#
tor-1#
tor-1#
tor-1# show vrf all vni json
{
"vrfs":[
{
"vrf":"default",
"vni":100,
"vxlanIntf":"None",
"sviIntf":"None",
"state":"Down",
"routerMac":"None"
},
{
"vrf":"sym_1",
"vni":8888,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan490_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_2",
"vni":8889,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan491_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_3",
"vni":8890,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan492_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_4",
"vni":8891,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan493_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
},
{
"vrf":"sym_5",
"vni":8892,
"vxlanIntf":"vxlan99",
"sviIntf":"vlan494_l3",
"state":"Up",
"routerMac":"44:38:39:ff:ff:25"
}
]
}
tor-1#
```
Ticket:#3260835
Issue:3260835
Testing: UT done
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-03 20:09:49 +01:00
|
|
|
zebra_vxlan_print_vrf_vni(vty, zvrf, json_vrfs);
|
|
|
|
}
|
|
|
|
} else if (vrf_name) {
|
|
|
|
zvrf = zebra_vrf_lookup_by_name(vrf_name);
|
|
|
|
if (!zvrf) {
|
|
|
|
if (uj)
|
|
|
|
vty_json(vty, json);
|
|
|
|
else
|
|
|
|
vty_out(vty,
|
|
|
|
"%% VRF '%s' specified does not exist\n",
|
|
|
|
vrf_name);
|
|
|
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%-37s %-10s %-20s %-20s %-5s %-18s\n",
|
|
|
|
"VRF", "VNI", "VxLAN IF", "L3-SVI", "State",
|
|
|
|
"Rmac");
|
|
|
|
else
|
|
|
|
json_vrfs = json_object_new_array();
|
2017-10-08 03:49:27 +02:00
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
zebra_vxlan_print_vrf_vni(vty, zvrf, json_vrfs);
|
2017-10-17 11:30:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (uj) {
|
|
|
|
json_object_object_add(json, "vrfs", json_vrfs);
|
2021-11-25 16:49:46 +01:00
|
|
|
vty_json(vty, json);
|
2017-10-08 03:49:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_global,
|
|
|
|
show_evpn_global_cmd,
|
|
|
|
"show evpn [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-11-15 10:01:00 +01:00
|
|
|
|
|
|
|
zebra_vxlan_print_evpn(vty, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-12-18 20:28:49 +01:00
|
|
|
DEFPY(show_evpn_neigh, show_neigh_cmd, "show ip neigh",
|
|
|
|
SHOW_STR IP_STR "neighbors\n")
|
|
|
|
|
|
|
|
{
|
|
|
|
zebra_neigh_show(vty);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-05-27 03:42:00 +02:00
|
|
|
DEFPY(show_evpn_l2_nh,
|
|
|
|
show_evpn_l2_nh_cmd,
|
|
|
|
"show evpn l2-nh [json$json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Layer2 nexthops\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
bool uj = !!json;
|
|
|
|
|
|
|
|
zebra_evpn_l2_nh_show(vty, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-03-28 01:34:06 +01:00
|
|
|
DEFPY(show_evpn_es,
|
|
|
|
show_evpn_es_cmd,
|
zebra: add json output for zebra ES, ES-EVI and access vlan dumps
1. ES
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01 json"
|python -m json.tool
{
"accessPort": "hostbond1",
"dfPreference": 50000,
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"remote",
"readyForBgp",
"bridgePort",
"operUp",
"nexthopGroupActive"
],
"macCount": 10,
"nexthopGroup": 536870913,
"vniCount": 10,
"vteps": [
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435460,
"vtep": "27.0.0.16"
},
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435463,
"vtep": "27.0.0.17"
}
]
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. ES-EVI -
root@torm-11:mgmt:~# vtysh -c "show evpn es-evi vni 1001 detail json" |python -m json.tool
[
{
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
{
"esi": "03:44:38:39:ff:ff:01:00:00:02",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. access-vlan
root@torm-11:mgmt:~# vtysh -c "show evpn access-vlan 1001 json" |python -m json.
tool
{
"memberIfCount": 4,
"members": [
{
"ifName": "hostbond4"
},
{
"ifName": "hostbond1"
},
{
"ifName": "hostbond2"
},
{
"ifName": "hostbond3"
}
],
"vlan": 1001,
"vni": 1001,
"vxlanIf": "vx-1001"
}
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-17 19:59:30 +02:00
|
|
|
"show evpn es [NAME$esi_str|detail$detail] [json$json]",
|
2020-03-28 01:34:06 +01:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Ethernet Segment\n"
|
|
|
|
"ES ID\n"
|
2020-05-27 03:42:00 +02:00
|
|
|
"Detailed information\n"
|
|
|
|
JSON_STR)
|
2020-03-28 01:34:06 +01:00
|
|
|
{
|
|
|
|
esi_t esi;
|
|
|
|
bool uj = !!json;
|
|
|
|
|
|
|
|
if (esi_str) {
|
|
|
|
if (!str_to_esi(esi_str, &esi)) {
|
|
|
|
vty_out(vty, "%% Malformed ESI\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
zebra_evpn_es_show_esi(vty, uj, &esi);
|
|
|
|
} else {
|
|
|
|
if (detail)
|
|
|
|
zebra_evpn_es_show_detail(vty, uj);
|
|
|
|
else
|
|
|
|
zebra_evpn_es_show(vty, uj);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY(show_evpn_es_evi,
|
|
|
|
show_evpn_es_evi_cmd,
|
zebra: add json output for zebra ES, ES-EVI and access vlan dumps
1. ES
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01 json"
|python -m json.tool
{
"accessPort": "hostbond1",
"dfPreference": 50000,
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"remote",
"readyForBgp",
"bridgePort",
"operUp",
"nexthopGroupActive"
],
"macCount": 10,
"nexthopGroup": 536870913,
"vniCount": 10,
"vteps": [
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435460,
"vtep": "27.0.0.16"
},
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435463,
"vtep": "27.0.0.17"
}
]
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. ES-EVI -
root@torm-11:mgmt:~# vtysh -c "show evpn es-evi vni 1001 detail json" |python -m json.tool
[
{
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
{
"esi": "03:44:38:39:ff:ff:01:00:00:02",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. access-vlan
root@torm-11:mgmt:~# vtysh -c "show evpn access-vlan 1001 json" |python -m json.
tool
{
"memberIfCount": 4,
"members": [
{
"ifName": "hostbond4"
},
{
"ifName": "hostbond1"
},
{
"ifName": "hostbond2"
},
{
"ifName": "hostbond3"
}
],
"vlan": 1001,
"vni": 1001,
"vxlanIf": "vx-1001"
}
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-17 19:59:30 +02:00
|
|
|
"show evpn es-evi [vni (1-16777215)$vni] [detail$detail] [json$json]",
|
2020-03-28 01:34:06 +01:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Ethernet Segment per EVI\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI\n"
|
zebra: add json output for zebra ES, ES-EVI and access vlan dumps
1. ES
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01 json"
|python -m json.tool
{
"accessPort": "hostbond1",
"dfPreference": 50000,
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"remote",
"readyForBgp",
"bridgePort",
"operUp",
"nexthopGroupActive"
],
"macCount": 10,
"nexthopGroup": 536870913,
"vniCount": 10,
"vteps": [
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435460,
"vtep": "27.0.0.16"
},
{
"dfAlgorithm": "preference",
"dfPreference": 32767,
"nexthopId": 268435463,
"vtep": "27.0.0.17"
}
]
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. ES-EVI -
root@torm-11:mgmt:~# vtysh -c "show evpn es-evi vni 1001 detail json" |python -m json.tool
[
{
"esi": "03:44:38:39:ff:ff:01:00:00:01",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
{
"esi": "03:44:38:39:ff:ff:01:00:00:02",
"flags": [
"local",
"readyForBgp"
],
"vni": 1001
},
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3. access-vlan
root@torm-11:mgmt:~# vtysh -c "show evpn access-vlan 1001 json" |python -m json.
tool
{
"memberIfCount": 4,
"members": [
{
"ifName": "hostbond4"
},
{
"ifName": "hostbond1"
},
{
"ifName": "hostbond2"
},
{
"ifName": "hostbond3"
}
],
"vlan": 1001,
"vni": 1001,
"vxlanIf": "vx-1001"
}
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-17 19:59:30 +02:00
|
|
|
"Detailed information\n"
|
|
|
|
JSON_STR)
|
2020-03-28 01:34:06 +01:00
|
|
|
{
|
|
|
|
bool uj = !!json;
|
|
|
|
bool ud = !!detail;
|
|
|
|
|
|
|
|
if (vni)
|
|
|
|
zebra_evpn_es_evi_show_vni(vty, uj, vni, ud);
|
|
|
|
else
|
|
|
|
zebra_evpn_es_evi_show(vty, uj, ud);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-07-27 10:58:59 +02:00
|
|
|
DEFPY(show_evpn_access_vlan, show_evpn_access_vlan_cmd,
|
|
|
|
"show evpn access-vlan [IFNAME$if_name (1-4094)$vid | detail$detail] [json$json]",
|
2020-03-28 01:34:06 +01:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Access VLANs\n"
|
2021-07-27 17:45:09 +02:00
|
|
|
"Interface Name\n"
|
2020-03-28 01:34:06 +01:00
|
|
|
"VLAN ID\n"
|
2021-07-27 10:58:59 +02:00
|
|
|
"Detailed information\n" JSON_STR)
|
2020-03-28 01:34:06 +01:00
|
|
|
{
|
|
|
|
bool uj = !!json;
|
|
|
|
|
2021-07-27 10:58:59 +02:00
|
|
|
if (if_name && vid) {
|
|
|
|
bool found = false;
|
|
|
|
struct vrf *vrf;
|
|
|
|
struct interface *ifp;
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
if (if_name) {
|
|
|
|
ifp = if_lookup_by_name(if_name, vrf->vrf_id);
|
|
|
|
if (ifp) {
|
|
|
|
zebra_evpn_acc_vl_show_vid(vty, uj, vid,
|
|
|
|
ifp);
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
vty_out(vty, "%% Can't find interface %s\n", if_name);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2020-03-28 01:34:06 +01:00
|
|
|
} else {
|
|
|
|
if (detail)
|
|
|
|
zebra_evpn_acc_vl_show_detail(vty, uj);
|
|
|
|
else
|
|
|
|
zebra_evpn_acc_vl_show(vty, uj);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_vni,
|
|
|
|
show_evpn_vni_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn vni [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
2018-11-15 18:33:43 +01:00
|
|
|
"VxLAN Network Identifier\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_vnis(vty, zvrf, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-11-15 18:33:43 +01:00
|
|
|
DEFUN (show_evpn_vni_detail, show_evpn_vni_detail_cmd,
|
|
|
|
"show evpn vni detail [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"Detailed Information On Each VNI\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-15 18:33:43 +01:00
|
|
|
zebra_vxlan_print_vnis_detail(vty, zvrf, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_vni_vni,
|
|
|
|
show_evpn_vni_vni_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn vni " CMD_VNI_RANGE "[json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"VNI number\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[3]->arg, NULL, 10);
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2019-11-22 01:18:04 +01:00
|
|
|
zebra_vxlan_print_vni(vty, zvrf, vni, uj, NULL);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_rmac_vni_mac,
|
|
|
|
show_evpn_rmac_vni_mac_cmd,
|
|
|
|
"show evpn rmac vni " CMD_VNI_RANGE " mac WORD [json]",
|
2017-10-17 01:51:32 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"RMAC\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-17 01:51:32 +02:00
|
|
|
"VNI number\n"
|
|
|
|
"MAC\n"
|
2017-10-17 14:25:47 +02:00
|
|
|
"mac-address (e.g. 0a:0a:0a:0a:0a:0a)\n"
|
|
|
|
JSON_STR)
|
2017-10-17 01:51:32 +02:00
|
|
|
{
|
|
|
|
vni_t l3vni = 0;
|
|
|
|
struct ethaddr mac;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-17 01:51:32 +02:00
|
|
|
|
|
|
|
l3vni = strtoul(argv[4]->arg, NULL, 10);
|
|
|
|
if (!prefix_str2mac(argv[6]->arg, &mac)) {
|
|
|
|
vty_out(vty, "%% Malformed MAC address\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2017-10-17 14:25:47 +02:00
|
|
|
zebra_vxlan_print_specific_rmac_l3vni(vty, l3vni, &mac, uj);
|
2017-10-17 01:51:32 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_rmac_vni,
|
|
|
|
show_evpn_rmac_vni_cmd,
|
|
|
|
"show evpn rmac vni " CMD_VNI_RANGE "[json]",
|
2017-10-08 03:49:27 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"RMAC\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-08 03:49:27 +02:00
|
|
|
"VNI number\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
vni_t l3vni = 0;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-08 03:49:27 +02:00
|
|
|
|
|
|
|
l3vni = strtoul(argv[4]->arg, NULL, 10);
|
|
|
|
zebra_vxlan_print_rmacs_l3vni(vty, l3vni, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_rmac_vni_all,
|
|
|
|
show_evpn_rmac_vni_all_cmd,
|
|
|
|
"show evpn rmac vni all [json]",
|
2017-10-08 03:49:27 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"RMAC addresses\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-08 03:49:27 +02:00
|
|
|
"All VNIs\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-08 03:49:27 +02:00
|
|
|
|
|
|
|
zebra_vxlan_print_rmacs_all_l3vni(vty, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_nh_vni_ip,
|
|
|
|
show_evpn_nh_vni_ip_cmd,
|
|
|
|
"show evpn next-hops vni " CMD_VNI_RANGE " ip WORD [json]",
|
2017-10-17 01:51:32 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Remote Vteps\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-17 01:51:32 +02:00
|
|
|
"VNI number\n"
|
|
|
|
"Ip address\n"
|
2017-10-17 13:32:31 +02:00
|
|
|
"Host address (ipv4 or ipv6)\n"
|
|
|
|
JSON_STR)
|
2017-10-17 01:51:32 +02:00
|
|
|
{
|
|
|
|
vni_t l3vni;
|
|
|
|
struct ipaddr ip;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-17 01:51:32 +02:00
|
|
|
|
|
|
|
l3vni = strtoul(argv[4]->arg, NULL, 10);
|
|
|
|
if (str2ipaddr(argv[6]->arg, &ip) != 0) {
|
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed Neighbor address\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2017-10-17 13:32:31 +02:00
|
|
|
zebra_vxlan_print_specific_nh_l3vni(vty, l3vni, &ip, uj);
|
2017-10-17 01:51:32 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-06-11 21:31:20 +02:00
|
|
|
DEFUN_HIDDEN (show_evpn_nh_svd_ip,
|
|
|
|
show_evpn_nh_svd_ip_cmd,
|
|
|
|
"show evpn next-hops svd ip WORD [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Remote Vteps\n"
|
|
|
|
"Single Vxlan Device\n"
|
|
|
|
"Ip address\n"
|
|
|
|
"Host address (ipv4 or ipv6)\n"
|
|
|
|
JSON_STR)
|
2021-04-08 20:27:57 +02:00
|
|
|
{
|
|
|
|
struct ipaddr ip;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
|
|
|
if (str2ipaddr(argv[5]->arg, &ip) != 0) {
|
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed Neighbor address\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
zebra_vxlan_print_specific_nh_l3vni(vty, 0, &ip, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_nh_vni,
|
|
|
|
show_evpn_nh_vni_cmd,
|
|
|
|
"show evpn next-hops vni " CMD_VNI_RANGE "[json]",
|
2017-10-08 03:49:27 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Remote Vteps\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-08 03:49:27 +02:00
|
|
|
"VNI number\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
vni_t l3vni;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-08 03:49:27 +02:00
|
|
|
|
|
|
|
l3vni = strtoul(argv[4]->arg, NULL, 10);
|
|
|
|
zebra_vxlan_print_nh_l3vni(vty, l3vni, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-06-11 21:31:20 +02:00
|
|
|
DEFUN_HIDDEN (show_evpn_nh_svd,
|
|
|
|
show_evpn_nh_svd_cmd,
|
|
|
|
"show evpn next-hops svd [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Remote VTEPs\n"
|
|
|
|
"Single Vxlan Device\n"
|
|
|
|
JSON_STR)
|
2021-04-08 20:27:57 +02:00
|
|
|
{
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
|
|
|
zebra_vxlan_print_nh_svd(vty, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:01:00 +01:00
|
|
|
DEFUN (show_evpn_nh_vni_all,
|
|
|
|
show_evpn_nh_vni_all_cmd,
|
|
|
|
"show evpn next-hops vni all [json]",
|
2017-10-08 03:49:27 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Remote VTEPs\n"
|
2017-11-15 10:01:00 +01:00
|
|
|
"L3 VNI\n"
|
2017-10-08 03:49:27 +02:00
|
|
|
"All VNIs\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-10-08 03:49:27 +02:00
|
|
|
|
|
|
|
zebra_vxlan_print_nh_all_l3vni(vty, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_mac_vni,
|
|
|
|
show_evpn_mac_vni_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn mac vni " CMD_VNI_RANGE "[json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"VNI number\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
zebra: Evpn mac vni detail show command
New show command "show evpn mac vni xx detail [json]"
to display details of all the mac entries for the
requested VNI.
Output of show evpn mac vni xx detail json:
{
"numMacs":2,
"macs":{
"ca:be:63:7c:81:05":{
"type":"local",
"intf":"veth100",
"ifindex":8,
"uptime":"00:06:55",
"localSequence":0,
"remoteSequence":0,
"detectionCount":0,
"isDuplicate":false,
"syncNeighCount":0,
"neighbors":{
"active":[
"fe80::c8be:63ff:fe7c:8105"
],
"inactive":[
]
}
}
}
}
Also added remoteEs field in the JSON output of
"show evpn mac vni xx json".
Output of show evpn mac vni xx json:
"00:02:00:00:00:0d":{
"type":"remote",
"remoteEs":"03:44:38:39:ff:ff:02:00:00:02",
"localSequence":0,
"remoteSequence":0,
"detectionCount":0,
"isDuplicate":false
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-01-04 00:17:58 +01:00
|
|
|
zebra_vxlan_print_macs_vni(vty, zvrf, vni, uj, false);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (show_evpn_mac_vni_detail,
|
|
|
|
show_evpn_mac_vni_detail_cmd,
|
|
|
|
"show evpn mac vni " CMD_VNI_RANGE " detail [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VXLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Detailed Information On Each VNI MAC\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
|
|
|
zvrf = zebra_vrf_get_evpn();
|
|
|
|
zebra_vxlan_print_macs_vni(vty, zvrf, vni, uj, true);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (show_evpn_mac_vni_all,
|
|
|
|
show_evpn_mac_vni_all_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn mac vni all [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"All VNIs\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
zebra_vxlan_print_macs_all_vni(vty, zvrf, false, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-11-22 09:18:10 +01:00
|
|
|
DEFUN (show_evpn_mac_vni_all_detail, show_evpn_mac_vni_all_detail_cmd,
|
|
|
|
"show evpn mac vni all detail [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"Detailed Information On Each VNI MAC\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-22 09:18:10 +01:00
|
|
|
zebra_vxlan_print_macs_all_vni_detail(vty, zvrf, false, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_mac_vni_all_vtep,
|
|
|
|
show_evpn_mac_vni_all_vtep_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn mac vni all vtep A.B.C.D [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"Remote VTEP\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"Remote VTEP IP address\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
struct in_addr vtep_ip;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
|
|
|
if (!inet_aton(argv[6]->arg, &vtep_ip)) {
|
2017-06-22 01:37:51 +02:00
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed VTEP IP address\n");
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_macs_all_vni_vtep(vty, zvrf, vtep_ip, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DEFUN (show_evpn_mac_vni_mac,
|
|
|
|
show_evpn_mac_vni_mac_cmd,
|
2018-10-26 22:57:23 +02:00
|
|
|
"show evpn mac vni " CMD_VNI_RANGE " mac WORD [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"MAC\n"
|
2018-10-26 22:57:23 +02:00
|
|
|
"MAC address (e.g., 00:e0:ec:20:12:62)\n"
|
|
|
|
JSON_STR)
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
|
|
|
struct ethaddr mac;
|
2018-10-26 22:57:23 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2017-05-15 07:45:55 +02:00
|
|
|
if (!prefix_str2mac(argv[6]->arg, &mac)) {
|
2022-02-27 02:38:29 +01:00
|
|
|
vty_out(vty, "%% Malformed MAC address\n");
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-10-26 22:57:23 +02:00
|
|
|
zebra_vxlan_print_specific_mac_vni(vty, zvrf, vni, &mac, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (show_evpn_mac_vni_vtep,
|
|
|
|
show_evpn_mac_vni_vtep_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn mac vni " CMD_VNI_RANGE " vtep A.B.C.D" "[json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Remote VTEP\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"Remote VTEP IP address\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
|
|
|
struct in_addr vtep_ip;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2017-05-15 07:45:55 +02:00
|
|
|
if (!inet_aton(argv[6]->arg, &vtep_ip)) {
|
2017-06-22 01:37:51 +02:00
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed VTEP IP address\n");
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_macs_vni_vtep(vty, zvrf, vni, vtep_ip, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-11-04 19:17:29 +01:00
|
|
|
DEFPY (show_evpn_mac_vni_all_dad,
|
|
|
|
show_evpn_mac_vni_all_dad_cmd,
|
|
|
|
"show evpn mac vni all duplicate [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"Duplicate address list\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
zebra_vxlan_print_macs_all_vni(vty, zvrf, true, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DEFPY (show_evpn_mac_vni_dad,
|
|
|
|
show_evpn_mac_vni_dad_cmd,
|
2019-06-11 15:35:28 +02:00
|
|
|
"show evpn mac vni " CMD_VNI_RANGE " duplicate [json]",
|
2018-11-04 19:17:29 +01:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"MAC addresses\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Duplicate address list\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
|
|
|
|
zebra_vxlan_print_macs_vni_dad(vty, zvrf, vni, uj);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (show_evpn_neigh_vni_dad,
|
|
|
|
show_evpn_neigh_vni_dad_cmd,
|
2019-06-11 15:35:28 +02:00
|
|
|
"show evpn arp-cache vni " CMD_VNI_RANGE "duplicate [json]",
|
2018-11-04 19:17:29 +01:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Duplicate address list\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
zebra_vxlan_print_neigh_vni_dad(vty, zvrf, vni, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (show_evpn_neigh_vni_all_dad,
|
|
|
|
show_evpn_neigh_vni_all_dad_cmd,
|
|
|
|
"show evpn arp-cache vni all duplicate [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"Duplicate address list\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
zebra_vxlan_print_neigh_all_vni(vty, zvrf, true, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_neigh_vni,
|
|
|
|
show_evpn_neigh_vni_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn arp-cache vni " CMD_VNI_RANGE "[json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"VNI number\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_neigh_vni(vty, zvrf, vni, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (show_evpn_neigh_vni_all,
|
|
|
|
show_evpn_neigh_vni_all_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn arp-cache vni all [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"All VNIs\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-04 19:17:29 +01:00
|
|
|
zebra_vxlan_print_neigh_all_vni(vty, zvrf, false, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-11-22 10:56:52 +01:00
|
|
|
DEFUN (show_evpn_neigh_vni_all_detail, show_evpn_neigh_vni_all_detail_cmd,
|
|
|
|
"show evpn arp-cache vni all detail [json]",
|
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"Neighbor details for all vnis in detail\n" JSON_STR)
|
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2018-11-22 10:56:52 +01:00
|
|
|
zebra_vxlan_print_neigh_all_vni_detail(vty, zvrf, false, uj);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-05-15 07:45:55 +02:00
|
|
|
DEFUN (show_evpn_neigh_vni_neigh,
|
|
|
|
show_evpn_neigh_vni_neigh_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn arp-cache vni " CMD_VNI_RANGE " ip WORD [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Neighbor\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"Neighbor address (IPv4 or IPv6 address)\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
|
|
|
struct ipaddr ip;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2017-05-15 07:45:55 +02:00
|
|
|
if (str2ipaddr(argv[6]->arg, &ip) != 0) {
|
2017-06-22 01:37:51 +02:00
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed Neighbor address\n");
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_specific_neigh_vni(vty, zvrf, vni, &ip, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (show_evpn_neigh_vni_vtep,
|
|
|
|
show_evpn_neigh_vni_vtep_cmd,
|
2017-06-22 01:37:51 +02:00
|
|
|
"show evpn arp-cache vni " CMD_VNI_RANGE " vtep A.B.C.D [json]",
|
2017-05-15 07:45:55 +02:00
|
|
|
SHOW_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"ARP and ND cache\n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"Remote VTEP\n"
|
2017-06-22 01:37:51 +02:00
|
|
|
"Remote VTEP IP address\n"
|
2017-07-25 14:17:31 +02:00
|
|
|
JSON_STR)
|
2017-05-15 07:45:55 +02:00
|
|
|
{
|
|
|
|
struct zebra_vrf *zvrf;
|
|
|
|
vni_t vni;
|
|
|
|
struct in_addr vtep_ip;
|
2018-08-29 14:19:54 +02:00
|
|
|
bool uj = use_json(argc, argv);
|
2017-05-15 07:45:55 +02:00
|
|
|
|
2017-07-14 14:52:45 +02:00
|
|
|
vni = strtoul(argv[4]->arg, NULL, 10);
|
2017-05-15 07:45:55 +02:00
|
|
|
if (!inet_aton(argv[6]->arg, &vtep_ip)) {
|
2017-06-22 01:37:51 +02:00
|
|
|
if (!uj)
|
|
|
|
vty_out(vty, "%% Malformed VTEP IP address\n");
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2019-03-06 19:15:10 +01:00
|
|
|
zvrf = zebra_vrf_get_evpn();
|
2017-06-22 01:37:51 +02:00
|
|
|
zebra_vxlan_print_neigh_vni_vtep(vty, zvrf, vni, vtep_ip, uj);
|
2017-05-15 07:45:55 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-04-23 15:17:19 +02:00
|
|
|
/* policy routing contexts */
|
|
|
|
DEFUN (show_pbr_ipset,
|
|
|
|
show_pbr_ipset_cmd,
|
|
|
|
"show pbr ipset [WORD]",
|
|
|
|
SHOW_STR
|
|
|
|
"Policy-Based Routing\n"
|
|
|
|
"IPset Context information\n"
|
|
|
|
"IPset Name information\n")
|
|
|
|
{
|
|
|
|
int idx = 0;
|
|
|
|
int found = 0;
|
|
|
|
found = argv_find(argv, argc, "WORD", &idx);
|
|
|
|
if (!found)
|
|
|
|
zebra_pbr_show_ipset_list(vty, NULL);
|
|
|
|
else
|
|
|
|
zebra_pbr_show_ipset_list(vty, argv[idx]->arg);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* policy routing contexts */
|
|
|
|
DEFUN (show_pbr_iptable,
|
|
|
|
show_pbr_iptable_cmd,
|
2018-06-29 13:45:01 +02:00
|
|
|
"show pbr iptable [WORD]",
|
2018-04-23 15:17:19 +02:00
|
|
|
SHOW_STR
|
|
|
|
"Policy-Based Routing\n"
|
2018-06-29 13:45:01 +02:00
|
|
|
"IPtable Context information\n"
|
|
|
|
"IPtable Name information\n")
|
2018-04-23 15:17:19 +02:00
|
|
|
{
|
2018-06-29 13:45:01 +02:00
|
|
|
int idx = 0;
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
found = argv_find(argv, argc, "WORD", &idx);
|
|
|
|
if (!found)
|
|
|
|
zebra_pbr_show_iptable(vty, NULL);
|
|
|
|
else
|
|
|
|
zebra_pbr_show_iptable(vty, argv[idx]->arg);
|
2018-04-23 15:17:19 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-12-18 19:34:31 +01:00
|
|
|
/* policy routing contexts */
|
|
|
|
DEFPY (show_pbr_rule,
|
|
|
|
show_pbr_rule_cmd,
|
|
|
|
"show pbr rule",
|
|
|
|
SHOW_STR
|
|
|
|
"Policy-Based Routing\n"
|
|
|
|
"Rule\n")
|
|
|
|
{
|
|
|
|
zebra_pbr_show_rule(vty);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (pbr_nexthop_resolve,
|
|
|
|
pbr_nexthop_resolve_cmd,
|
|
|
|
"[no$no] pbr nexthop-resolve",
|
|
|
|
NO_STR
|
|
|
|
"Policy Based Routing\n"
|
|
|
|
"Resolve nexthop for dataplane programming\n")
|
|
|
|
{
|
|
|
|
zebra_pbr_expand_action_update(!no);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-11-04 19:55:39 +01:00
|
|
|
DEFPY (clear_evpn_dup_addr,
|
|
|
|
clear_evpn_dup_addr_cmd,
|
2019-07-25 14:35:46 +02:00
|
|
|
"clear evpn dup-addr vni <all$vni_all |" CMD_VNI_RANGE"$vni [mac X:X:X:X:X:X | ip <A.B.C.D|X:X::X:X>]>",
|
2018-11-04 19:55:39 +01:00
|
|
|
CLEAR_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Duplicate address \n"
|
|
|
|
"VxLAN Network Identifier\n"
|
|
|
|
"VNI number\n"
|
|
|
|
"All VNIs\n"
|
|
|
|
"MAC\n"
|
|
|
|
"MAC address (e.g., 00:e0:ec:20:12:62)\n"
|
|
|
|
"IP\n"
|
|
|
|
"IPv4 address\n"
|
|
|
|
"IPv6 address\n")
|
|
|
|
{
|
2020-02-06 22:32:34 +01:00
|
|
|
if (!vni_str) {
|
2024-03-18 18:08:23 +01:00
|
|
|
nb_cli_rpc_enqueue(vty, "all-vnis", NULL);
|
2020-02-06 22:32:34 +01:00
|
|
|
} else {
|
2024-03-18 18:08:23 +01:00
|
|
|
nb_cli_rpc_enqueue(vty, "vni-id", vni_str);
|
|
|
|
if (mac_str)
|
|
|
|
nb_cli_rpc_enqueue(vty, "mac-addr", mac_str);
|
|
|
|
else if (ip_str)
|
|
|
|
nb_cli_rpc_enqueue(vty, "vni-ipaddr", ip_str);
|
2018-11-04 19:55:39 +01:00
|
|
|
}
|
|
|
|
|
2024-03-18 18:08:23 +01:00
|
|
|
return nb_cli_rpc(vty, "/frr-zebra:clear-evpn-dup-addr", NULL);
|
2018-11-04 19:55:39 +01:00
|
|
|
}
|
|
|
|
|
2021-07-06 16:59:35 +02:00
|
|
|
DEFPY_HIDDEN (evpn_accept_bgp_seq,
|
|
|
|
evpn_accept_bgp_seq_cmd,
|
|
|
|
"evpn accept-bgp-seq",
|
|
|
|
"EVPN\n"
|
|
|
|
"Accept all sequence numbers from BGP\n")
|
|
|
|
{
|
|
|
|
zebra_vxlan_set_accept_bgp_seq(true);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY_HIDDEN (no_evpn_accept_bgp_seq,
|
|
|
|
no_evpn_accept_bgp_seq_cmd,
|
|
|
|
"no evpn accept-bgp-seq",
|
|
|
|
NO_STR
|
|
|
|
"EVPN\n"
|
|
|
|
"Accept all sequence numbers from BGP\n")
|
|
|
|
{
|
|
|
|
zebra_vxlan_set_accept_bgp_seq(false);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Static ip route configuration write function. */
|
|
|
|
static int zebra_ip_config(struct vty *vty)
|
|
|
|
{
|
|
|
|
int write = 0;
|
|
|
|
|
2019-06-25 23:07:30 +02:00
|
|
|
write += zebra_import_table_config(vty, VRF_DEFAULT);
|
2018-01-10 15:48:54 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
return write;
|
|
|
|
}
|
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
DEFPY (ip_zebra_import_table_distance,
|
2015-05-20 03:03:42 +02:00
|
|
|
ip_zebra_import_table_distance_cmd,
|
2024-10-28 19:55:49 +01:00
|
|
|
"ip import-table (1-252)$table_id [mrib]$mrib [distance (1-255)$distance] [route-map RMAP_NAME$rmap]",
|
2016-05-11 17:47:02 +02:00
|
|
|
IP_STR
|
|
|
|
"import routes from non-main kernel table\n"
|
|
|
|
"kernel routing table id\n"
|
2024-10-28 19:55:49 +01:00
|
|
|
"Import into the MRIB instead of the URIB\n"
|
2016-05-11 17:47:02 +02:00
|
|
|
"Distance for imported routes\n"
|
|
|
|
"Default distance value\n"
|
|
|
|
"route-map for filtering\n"
|
|
|
|
"route-map name\n")
|
|
|
|
{
|
2024-10-28 19:55:49 +01:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2017-06-10 22:39:41 +02:00
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
if (distance_str == NULL)
|
|
|
|
distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
|
2016-05-11 17:47:02 +02:00
|
|
|
|
|
|
|
if (!is_zebra_valid_kernel_table(table_id)) {
|
2024-10-28 19:55:49 +01:00
|
|
|
vty_out(vty, "Invalid routing table ID, %ld. Must be in range 1-252\n", table_id);
|
2016-05-11 17:47:02 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_zebra_main_routing_table(table_id)) {
|
2024-10-28 19:55:49 +01:00
|
|
|
vty_out(vty, "Invalid routing table ID, %ld. Must be non-default table\n", table_id);
|
2016-05-11 17:47:02 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
return zebra_import_table(AFI_IP, safi, VRF_DEFAULT, table_id, distance, rmap, true);
|
2016-05-11 17:47:02 +02:00
|
|
|
}
|
|
|
|
|
2017-10-25 17:13:42 +02:00
|
|
|
DEFUN_HIDDEN (zebra_packet_process,
|
|
|
|
zebra_packet_process_cmd,
|
|
|
|
"zebra zapi-packets (1-10000)",
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zapi Protocol\n"
|
|
|
|
"Number of packets to process before relinquishing thread\n")
|
|
|
|
{
|
|
|
|
uint32_t packets = strtoul(argv[2]->arg, NULL, 10);
|
|
|
|
|
2019-01-11 21:35:45 +01:00
|
|
|
atomic_store_explicit(&zrouter.packets_to_process, packets,
|
2018-04-27 00:30:26 +02:00
|
|
|
memory_order_relaxed);
|
2017-10-25 17:13:42 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN_HIDDEN (no_zebra_packet_process,
|
|
|
|
no_zebra_packet_process_cmd,
|
|
|
|
"no zebra zapi-packets [(1-10000)]",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zapi Protocol\n"
|
|
|
|
"Number of packets to process before relinquishing thread\n")
|
|
|
|
{
|
2019-01-11 21:35:45 +01:00
|
|
|
atomic_store_explicit(&zrouter.packets_to_process,
|
2018-04-27 00:30:26 +02:00
|
|
|
ZEBRA_ZAPI_PACKETS_TO_PROCESS,
|
|
|
|
memory_order_relaxed);
|
2017-10-25 17:13:42 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-10-25 16:47:55 +02:00
|
|
|
DEFUN_HIDDEN (zebra_workqueue_timer,
|
|
|
|
zebra_workqueue_timer_cmd,
|
|
|
|
"zebra work-queue (0-10000)",
|
|
|
|
ZEBRA_STR
|
|
|
|
"Work Queue\n"
|
|
|
|
"Time in milliseconds\n")
|
|
|
|
{
|
|
|
|
uint32_t timer = strtoul(argv[2]->arg, NULL, 10);
|
2019-01-11 21:11:38 +01:00
|
|
|
zrouter.ribq->spec.hold = timer;
|
2017-10-25 16:47:55 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN_HIDDEN (no_zebra_workqueue_timer,
|
|
|
|
no_zebra_workqueue_timer_cmd,
|
|
|
|
"no zebra work-queue [(0-10000)]",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Work Queue\n"
|
|
|
|
"Time in milliseconds\n")
|
|
|
|
{
|
2019-01-11 21:11:38 +01:00
|
|
|
zrouter.ribq->spec.hold = ZEBRA_RIB_PROCESS_HOLD_TIME;
|
2017-10-25 16:47:55 +02:00
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
DEFPY (no_ip_zebra_import_table,
|
2015-05-20 03:03:42 +02:00
|
|
|
no_ip_zebra_import_table_cmd,
|
2024-10-28 19:55:49 +01:00
|
|
|
"no ip import-table (1-252)$table_id [mrib]$mrib [distance (1-255)] [route-map NAME]",
|
2015-05-20 03:03:42 +02:00
|
|
|
NO_STR
|
|
|
|
IP_STR
|
|
|
|
"import routes from non-main kernel table\n"
|
2016-11-30 00:07:11 +01:00
|
|
|
"kernel routing table id\n"
|
2024-10-28 19:55:49 +01:00
|
|
|
"Import into the MRIB instead of the URIB\n"
|
2016-11-30 00:07:11 +01:00
|
|
|
"Distance for imported routes\n"
|
|
|
|
"Default distance value\n"
|
|
|
|
"route-map for filtering\n"
|
|
|
|
"route-map name\n")
|
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2024-10-28 19:55:49 +01:00
|
|
|
safi_t safi = mrib ? SAFI_MULTICAST : SAFI_UNICAST;
|
2015-05-20 03:03:42 +02:00
|
|
|
|
|
|
|
if (!is_zebra_valid_kernel_table(table_id)) {
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty,
|
|
|
|
"Invalid routing table ID. Must be in range 1-252\n");
|
2015-05-20 03:03:42 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_zebra_main_routing_table(table_id)) {
|
2024-10-28 19:55:49 +01:00
|
|
|
vty_out(vty, "Invalid routing table ID, %ld. Must be non-default table\n", table_id);
|
2015-05-20 03:03:42 +02:00
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
if (!is_zebra_import_table_enabled(AFI_IP, safi, VRF_DEFAULT, table_id))
|
2015-05-20 03:03:42 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
2024-10-28 19:55:49 +01:00
|
|
|
return (zebra_import_table(AFI_IP, safi, VRF_DEFAULT, table_id, 0, NULL, false));
|
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
2022-06-16 01:54:29 +02:00
|
|
|
DEFPY (zebra_nexthop_group_keep,
|
|
|
|
zebra_nexthop_group_keep_cmd,
|
|
|
|
"[no] zebra nexthop-group keep (1-3600)",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Nexthop-Group\n"
|
|
|
|
"How long to keep\n"
|
|
|
|
"Time in seconds from 1-3600\n")
|
|
|
|
{
|
|
|
|
if (no)
|
|
|
|
zrouter.nhg_keep = ZEBRA_DEFAULT_NHG_KEEP_TIMER;
|
|
|
|
else
|
|
|
|
zrouter.nhg_keep = keep;
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-08-26 14:21:40 +02:00
|
|
|
static int config_write_protocol(struct vty *vty)
|
|
|
|
{
|
2022-06-30 17:59:39 +02:00
|
|
|
if (zrouter.allow_delete)
|
2017-07-13 17:49:13 +02:00
|
|
|
vty_out(vty, "allow-external-route-update\n");
|
2015-08-26 14:21:40 +02:00
|
|
|
|
2022-06-16 01:54:29 +02:00
|
|
|
if (zrouter.nhg_keep != ZEBRA_DEFAULT_NHG_KEEP_TIMER)
|
|
|
|
vty_out(vty, "zebra nexthop-group keep %u\n", zrouter.nhg_keep);
|
|
|
|
|
2019-01-11 21:11:38 +01:00
|
|
|
if (zrouter.ribq->spec.hold != ZEBRA_RIB_PROCESS_HOLD_TIME)
|
|
|
|
vty_out(vty, "zebra work-queue %u\n", zrouter.ribq->spec.hold);
|
2017-10-25 16:47:55 +02:00
|
|
|
|
2019-01-11 21:35:45 +01:00
|
|
|
if (zrouter.packets_to_process != ZEBRA_ZAPI_PACKETS_TO_PROCESS)
|
2017-10-25 17:13:42 +02:00
|
|
|
vty_out(vty, "zebra zapi-packets %u\n",
|
2019-01-11 21:35:45 +01:00
|
|
|
zrouter.packets_to_process);
|
2017-10-25 17:13:42 +02:00
|
|
|
|
2019-09-25 20:05:50 +02:00
|
|
|
/* Include dataplane info */
|
|
|
|
dplane_config_write_helper(vty);
|
|
|
|
|
2020-05-08 15:00:40 +02:00
|
|
|
zebra_evpn_mh_config_write(vty);
|
|
|
|
|
2021-12-18 19:34:31 +01:00
|
|
|
zebra_pbr_config_write(vty);
|
|
|
|
|
2022-11-01 19:09:15 +01:00
|
|
|
if (!zebra_vxlan_get_accept_bgp_seq())
|
2021-07-06 16:59:35 +02:00
|
|
|
vty_out(vty, "no evpn accept-bgp-seq\n");
|
|
|
|
|
2020-01-28 17:00:42 +01:00
|
|
|
/* Include nexthop-group config */
|
|
|
|
if (!zebra_nhg_kernel_nexthops_enabled())
|
|
|
|
vty_out(vty, "no zebra nexthop kernel enable\n");
|
|
|
|
|
2020-05-13 21:50:14 +02:00
|
|
|
if (zebra_nhg_proto_nexthops_only())
|
|
|
|
vty_out(vty, "zebra nexthop proto only\n");
|
|
|
|
|
2021-02-22 21:06:28 +01:00
|
|
|
if (!zebra_nhg_recursive_use_backups())
|
|
|
|
vty_out(vty, "no zebra nexthop resolve-via-backup\n");
|
|
|
|
|
2024-10-18 14:36:52 +02:00
|
|
|
#ifdef HAVE_SCRIPTING
|
|
|
|
frrscript_names_config_write(vty);
|
|
|
|
#endif
|
|
|
|
|
2021-03-01 16:48:05 +01:00
|
|
|
if (rnh_get_hide_backups())
|
|
|
|
vty_out(vty, "ip nht hide-backup-events\n");
|
|
|
|
|
2020-08-03 20:23:56 +02:00
|
|
|
#ifdef HAVE_NETLINK
|
|
|
|
/* Include netlink info */
|
|
|
|
netlink_config_write_helper(vty);
|
|
|
|
#endif /* HAVE_NETLINK */
|
|
|
|
|
2015-08-26 14:21:40 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-11-06 14:56:50 +01:00
|
|
|
static inline bool zebra_vty_v6_rr_semantics_used(void)
|
|
|
|
{
|
|
|
|
if (zebra_nhg_kernel_nexthops_enabled())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (zrouter.v6_rr_semantics)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:47:30 +01:00
|
|
|
DEFUN (show_zebra,
|
|
|
|
show_zebra_cmd,
|
|
|
|
"show zebra",
|
|
|
|
SHOW_STR
|
|
|
|
ZEBRA_STR)
|
|
|
|
{
|
|
|
|
struct vrf *vrf;
|
2022-02-04 14:42:07 +01:00
|
|
|
struct ttable *table = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
|
|
|
|
char *out;
|
2024-06-27 00:49:45 +02:00
|
|
|
char timebuf[MONOTIME_STRLEN];
|
|
|
|
|
|
|
|
time_to_string(zrouter.startup_time, timebuf);
|
|
|
|
vty_out(vty, "Zebra started%s at time %s",
|
|
|
|
zrouter.graceful_restart ? " gracefully" : "", timebuf);
|
|
|
|
|
|
|
|
if (zrouter.t_rib_sweep)
|
|
|
|
vty_out(vty,
|
|
|
|
"Zebra RIB sweep timer running, remaining time %lds\n",
|
|
|
|
event_timer_remain_second(zrouter.t_rib_sweep));
|
|
|
|
else {
|
|
|
|
time_to_string(zrouter.rib_sweep_time, timebuf);
|
|
|
|
vty_out(vty, "Zebra RIB sweep happened at %s", timebuf);
|
|
|
|
}
|
2017-12-07 16:47:30 +01:00
|
|
|
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_rowseps(table, 0, BOTTOM, true, '-');
|
|
|
|
ttable_add_row(table, "OS|%s(%s)", cmd_system_get(), cmd_release_get());
|
2022-03-04 14:17:49 +01:00
|
|
|
ttable_add_row(table, "ECMP Maximum|%d", zrouter.multipath_num);
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "v4 Forwarding|%s", ipforward() ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v6 Forwarding|%s",
|
|
|
|
ipforward_ipv6() ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "MPLS|%s", mpls_enabled ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "EVPN|%s", is_evpn_enabled() ? "On" : "Off");
|
2022-05-12 16:04:17 +02:00
|
|
|
ttable_add_row(table, "Kernel socket buffer size|%d", rcvbufsize);
|
2023-11-03 17:35:45 +01:00
|
|
|
ttable_add_row(table, "v6 Route Replace Semantics|%s",
|
2023-11-06 14:56:50 +01:00
|
|
|
zebra_vty_v6_rr_semantics_used() ? "Replace"
|
|
|
|
: "Delete then Add");
|
2022-01-22 14:31:50 +01:00
|
|
|
|
2022-01-21 19:05:35 +01:00
|
|
|
#ifdef GNU_LINUX
|
|
|
|
if (!vrf_is_backend_netns())
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "VRF|l3mdev Available");
|
2022-01-21 19:05:35 +01:00
|
|
|
else
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "VRF|Namespaces");
|
2022-01-21 19:05:35 +01:00
|
|
|
#else
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "VRF|Not Available");
|
2022-01-21 19:05:35 +01:00
|
|
|
#endif
|
|
|
|
|
2023-07-24 17:16:53 +02:00
|
|
|
ttable_add_row(table, "v6 with v4 nexthop|%s",
|
|
|
|
zrouter.v6_with_v4_nexthop ? "Used" : "Unavaliable");
|
|
|
|
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "ASIC offload|%s",
|
|
|
|
zrouter.asic_offloaded ? "Used" : "Unavailable");
|
2020-09-18 21:41:19 +02:00
|
|
|
|
2022-10-05 16:04:11 +02:00
|
|
|
/*
|
|
|
|
* Do not display this unless someone is actually using it
|
|
|
|
*
|
|
|
|
* Why this distinction? I think this is effectively dead code
|
|
|
|
* and should not be exposed. Maybe someone proves me wrong.
|
|
|
|
*/
|
|
|
|
if (zrouter.asic_notification_nexthop_control)
|
|
|
|
ttable_add_row(table, "ASIC offload and nexthop control|Used");
|
|
|
|
|
2022-02-04 14:42:07 +01:00
|
|
|
ttable_add_row(table, "RA|%s",
|
|
|
|
rtadv_compiled_in() ? "Compiled in" : "Not Compiled in");
|
|
|
|
ttable_add_row(table, "RFC 5549|%s",
|
|
|
|
rtadv_get_interfaces_configured_from_bgp()
|
|
|
|
? "BGP is using"
|
|
|
|
: "BGP is not using");
|
|
|
|
|
|
|
|
ttable_add_row(table, "Kernel NHG|%s",
|
|
|
|
zrouter.supports_nhgs ? "Available" : "Unavailable");
|
2022-02-04 14:04:23 +01:00
|
|
|
|
2022-06-30 17:59:39 +02:00
|
|
|
ttable_add_row(table, "Allow Non FRR route deletion|%s",
|
|
|
|
zrouter.allow_delete ? "Yes" : "No");
|
2022-06-27 21:30:55 +02:00
|
|
|
ttable_add_row(table, "v4 All LinkDown Routes|%s",
|
|
|
|
zrouter.all_linkdownv4 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v4 Default LinkDown Routes|%s",
|
|
|
|
zrouter.default_linkdownv4 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v6 All LinkDown Routes|%s",
|
|
|
|
zrouter.all_linkdownv6 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v6 Default LinkDown Routes|%s",
|
|
|
|
zrouter.default_linkdownv6 ? "On" : "Off");
|
|
|
|
|
|
|
|
ttable_add_row(table, "v4 All MC Forwarding|%s",
|
|
|
|
zrouter.all_mc_forwardingv4 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v4 Default MC Forwarding|%s",
|
|
|
|
zrouter.default_mc_forwardingv4 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v6 All MC Forwarding|%s",
|
|
|
|
zrouter.all_mc_forwardingv6 ? "On" : "Off");
|
|
|
|
ttable_add_row(table, "v6 Default MC Forwarding|%s",
|
|
|
|
zrouter.default_mc_forwardingv6 ? "On" : "Off");
|
|
|
|
|
2022-02-04 14:42:07 +01:00
|
|
|
out = ttable_dump(table, "\n");
|
|
|
|
vty_out(vty, "%s\n", out);
|
2024-08-30 15:05:11 +02:00
|
|
|
XFREE(MTYPE_TMP_TTABLE, out);
|
2022-01-22 13:53:24 +01:00
|
|
|
|
2022-07-17 01:01:12 +02:00
|
|
|
ttable_del(table);
|
2017-12-07 16:47:30 +01:00
|
|
|
vty_out(vty,
|
|
|
|
" Route Route Neighbor LSP LSP\n");
|
|
|
|
vty_out(vty,
|
|
|
|
"VRF Installs Removals Updates Installs Removals\n");
|
|
|
|
|
|
|
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
|
|
struct zebra_vrf *zvrf = vrf->info;
|
|
|
|
|
2020-03-27 12:51:47 +01:00
|
|
|
vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64" %10" PRIu64 " %10" PRIu64 "\n",
|
2017-12-07 16:47:30 +01:00
|
|
|
vrf->name, zvrf->installs, zvrf->removals,
|
|
|
|
zvrf->neigh_updates, zvrf->lsp_installs,
|
|
|
|
zvrf->lsp_removals);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (ip_forwarding,
|
|
|
|
ip_forwarding_cmd,
|
|
|
|
"ip forwarding",
|
|
|
|
IP_STR
|
|
|
|
"Turn on IP forwarding\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward();
|
|
|
|
if (ret == 0)
|
|
|
|
ret = ipforward_on();
|
|
|
|
|
|
|
|
if (ret == 0) {
|
|
|
|
vty_out(vty, "Can't turn on IP forwarding\n");
|
|
|
|
return CMD_WARNING_CONFIG_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (no_ip_forwarding,
|
|
|
|
no_ip_forwarding_cmd,
|
|
|
|
"no ip forwarding",
|
|
|
|
NO_STR
|
|
|
|
IP_STR
|
|
|
|
"Turn off IP forwarding\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward();
|
|
|
|
if (ret != 0)
|
|
|
|
ret = ipforward_off();
|
|
|
|
|
|
|
|
if (ret != 0) {
|
|
|
|
vty_out(vty, "Can't turn off IP forwarding\n");
|
|
|
|
return CMD_WARNING_CONFIG_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only display ip forwarding is enabled or not. */
|
|
|
|
DEFUN (show_ip_forwarding,
|
|
|
|
show_ip_forwarding_cmd,
|
|
|
|
"show ip forwarding",
|
|
|
|
SHOW_STR
|
|
|
|
IP_STR
|
|
|
|
"IP forwarding status\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward();
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
vty_out(vty, "IP forwarding is off\n");
|
|
|
|
else
|
|
|
|
vty_out(vty, "IP forwarding is on\n");
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only display ipv6 forwarding is enabled or not. */
|
|
|
|
DEFUN (show_ipv6_forwarding,
|
|
|
|
show_ipv6_forwarding_cmd,
|
|
|
|
"show ipv6 forwarding",
|
|
|
|
SHOW_STR
|
|
|
|
"IPv6 information\n"
|
|
|
|
"Forwarding status\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward_ipv6();
|
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case -1:
|
|
|
|
vty_out(vty, "ipv6 forwarding is unknown\n");
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
vty_out(vty, "ipv6 forwarding is %s\n", "on");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (ipv6_forwarding,
|
|
|
|
ipv6_forwarding_cmd,
|
|
|
|
"ipv6 forwarding",
|
|
|
|
IPV6_STR
|
|
|
|
"Turn on IPv6 forwarding\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward_ipv6();
|
|
|
|
if (ret == 0)
|
|
|
|
ret = ipforward_ipv6_on();
|
|
|
|
|
|
|
|
if (ret == 0) {
|
|
|
|
vty_out(vty, "Can't turn on IPv6 forwarding\n");
|
|
|
|
return CMD_WARNING_CONFIG_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (no_ipv6_forwarding,
|
|
|
|
no_ipv6_forwarding_cmd,
|
|
|
|
"no ipv6 forwarding",
|
|
|
|
NO_STR
|
|
|
|
IPV6_STR
|
|
|
|
"Turn off IPv6 forwarding\n")
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = ipforward_ipv6();
|
|
|
|
if (ret != 0)
|
|
|
|
ret = ipforward_ipv6_off();
|
|
|
|
|
|
|
|
if (ret != 0) {
|
|
|
|
vty_out(vty, "Can't turn off IPv6 forwarding\n");
|
|
|
|
return CMD_WARNING_CONFIG_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-08-17 21:50:09 +02:00
|
|
|
/* Display dataplane info */
|
|
|
|
DEFUN (show_dataplane,
|
|
|
|
show_dataplane_cmd,
|
|
|
|
"show zebra dplane [detailed]",
|
|
|
|
SHOW_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra dataplane information\n"
|
|
|
|
"Detailed output\n")
|
|
|
|
{
|
|
|
|
int idx = 0;
|
|
|
|
bool detailed = false;
|
|
|
|
|
|
|
|
if (argv_find(argv, argc, "detailed", &idx))
|
|
|
|
detailed = true;
|
|
|
|
|
|
|
|
return dplane_show_helper(vty, detailed);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Display dataplane providers info */
|
|
|
|
DEFUN (show_dataplane_providers,
|
|
|
|
show_dataplane_providers_cmd,
|
|
|
|
"show zebra dplane providers [detailed]",
|
|
|
|
SHOW_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra dataplane information\n"
|
|
|
|
"Zebra dataplane provider information\n"
|
|
|
|
"Detailed output\n")
|
|
|
|
{
|
|
|
|
int idx = 0;
|
|
|
|
bool detailed = false;
|
|
|
|
|
|
|
|
if (argv_find(argv, argc, "detailed", &idx))
|
|
|
|
detailed = true;
|
|
|
|
|
|
|
|
return dplane_show_provs_helper(vty, detailed);
|
|
|
|
}
|
|
|
|
|
2018-09-21 20:54:02 +02:00
|
|
|
/* Configure dataplane incoming queue limit */
|
|
|
|
DEFUN (zebra_dplane_queue_limit,
|
|
|
|
zebra_dplane_queue_limit_cmd,
|
|
|
|
"zebra dplane limit (0-10000)",
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra dataplane\n"
|
|
|
|
"Limit incoming queued updates\n"
|
|
|
|
"Number of queued updates\n")
|
|
|
|
{
|
|
|
|
uint32_t limit = 0;
|
|
|
|
|
|
|
|
limit = strtoul(argv[3]->arg, NULL, 10);
|
|
|
|
|
|
|
|
dplane_set_in_queue_limit(limit, true);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reset dataplane queue limit to default value */
|
|
|
|
DEFUN (no_zebra_dplane_queue_limit,
|
|
|
|
no_zebra_dplane_queue_limit_cmd,
|
|
|
|
"no zebra dplane limit [(0-10000)]",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra dataplane\n"
|
|
|
|
"Limit incoming queued updates\n"
|
|
|
|
"Number of queued updates\n")
|
|
|
|
{
|
|
|
|
dplane_set_in_queue_limit(0, false);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2018-08-17 21:50:09 +02:00
|
|
|
|
2019-01-04 15:41:09 +01:00
|
|
|
DEFUN (zebra_show_routing_tables_summary,
|
|
|
|
zebra_show_routing_tables_summary_cmd,
|
|
|
|
"show zebra router table summary",
|
|
|
|
SHOW_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"The Zebra Router Information\n"
|
|
|
|
"Table Information about this Zebra Router\n"
|
|
|
|
"Summary Information\n")
|
|
|
|
{
|
|
|
|
zebra_router_show_table_summary(vty);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2025-03-25 15:55:16 +01:00
|
|
|
/* Display Zebra MetaQ counters */
|
|
|
|
DEFUN (show_zebra_metaq_counters,
|
|
|
|
show_zebra_metaq_counters_cmd,
|
|
|
|
"show zebra metaq [json]",
|
|
|
|
SHOW_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra MetaQ counters\n"
|
|
|
|
JSON_STR)
|
|
|
|
{
|
|
|
|
bool uj = use_json(argc, argv);
|
|
|
|
|
|
|
|
return zebra_show_metaq_counter(vty, uj);
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:47:30 +01:00
|
|
|
/* IPForwarding configuration write function. */
|
|
|
|
static int config_write_forwarding(struct vty *vty)
|
|
|
|
{
|
|
|
|
if (!ipforward())
|
|
|
|
vty_out(vty, "no ip forwarding\n");
|
|
|
|
if (!ipforward_ipv6())
|
|
|
|
vty_out(vty, "no ipv6 forwarding\n");
|
|
|
|
vty_out(vty, "!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-04-12 16:25:11 +02:00
|
|
|
DEFUN_HIDDEN (show_frr,
|
|
|
|
show_frr_cmd,
|
|
|
|
"show frr",
|
|
|
|
SHOW_STR
|
|
|
|
"FRR\n")
|
|
|
|
{
|
|
|
|
vty_out(vty, "........ .. . .. . ..... ...77:................................................\n");
|
|
|
|
vty_out(vty, ".............................7777:..............................................\n");
|
|
|
|
vty_out(vty, ".............................777777,............................................\n");
|
|
|
|
vty_out(vty, "... .........................77777777,..........................................\n");
|
|
|
|
vty_out(vty, "............................=7777777777:........................................\n");
|
|
|
|
vty_out(vty, "........................:7777777777777777,......................................\n");
|
|
|
|
vty_out(vty, ".................... ~7777777777777?~,..........................................\n");
|
|
|
|
vty_out(vty, "...................I7777777777+.................................................\n");
|
|
|
|
vty_out(vty, "................,777777777?............ .......................................\n");
|
|
|
|
vty_out(vty, "..............:77777777?..........~?77777.......................................\n");
|
|
|
|
vty_out(vty, ".............77777777~........=7777777777.......................................\n");
|
|
|
|
vty_out(vty, ".......... +7777777,.......?7777777777777.......................................\n");
|
|
|
|
vty_out(vty, "..........7777777~......:7777777777777777......77?,.............................\n");
|
|
|
|
vty_out(vty, "........:777777?......+777777777777777777......777777I,.........................\n");
|
|
|
|
vty_out(vty, ".......?777777,.....+77777777777777777777......777777777?.......................\n");
|
|
|
|
vty_out(vty, "......?777777......7777777777777777777777......,?777777777?.....................\n");
|
|
|
|
vty_out(vty, ".....?77777?.....=7777777777777777777I~............,I7777777~...................\n");
|
|
|
|
vty_out(vty, "....+77777+.....I77777777777777777:...................+777777I..................\n");
|
|
|
|
vty_out(vty, "...~77777+.....7777777777777777=........................?777777...... .......\n");
|
|
|
|
vty_out(vty, "...77777I.....I77777777777777~.........:?................,777777.....I777.......\n");
|
|
|
|
vty_out(vty, "..777777.....I7777777777777I .......?7777..................777777.....777?......\n");
|
|
|
|
vty_out(vty, ".~77777,....=7777777777777:......,7777777..................,77777+....+777......\n");
|
|
|
|
vty_out(vty, ".77777I.....7777777777777,......777777777.......ONNNN.......=77777.....777~.....\n");
|
|
|
|
vty_out(vty, ",77777.....I777777777777,.....:7777777777......DNNNNNN.......77777+ ...7777.....\n");
|
|
|
|
vty_out(vty, "I7777I.....777777777777=.....~77777777777......NNNNNNN~......=7777I....=777.....\n");
|
|
|
|
vty_out(vty, "77777:....=777777777777.....,777777777777......$NNNNND ......:77777....:777.....\n");
|
|
|
|
vty_out(vty, "77777. ...777777777777~.....7777777777777........7DZ,........:77777.....777.....\n");
|
|
|
|
vty_out(vty, "????? . ..777777777777.....,7777777777777....................:77777I....777.....\n");
|
|
|
|
vty_out(vty, "....... ..777777777777.....+7777777777777....................=7777777+...?7.....\n");
|
|
|
|
vty_out(vty, "..........77777777777I.....I7777777777777....................7777777777:........\n");
|
|
|
|
vty_out(vty, "..........77777777777I.....?7777777777777...................~777777777777.......\n");
|
|
|
|
vty_out(vty, "..........777777777777.....~7777777777777..................,77777777777777+.....\n");
|
|
|
|
vty_out(vty, "..........777777777777......7777777777777..................77777777777777777,...\n");
|
|
|
|
vty_out(vty, "..... ....?77777777777I.....~777777777777................,777777.....,:+77777I..\n");
|
|
|
|
vty_out(vty, "........ .:777777777777,.....?77777777777...............?777777..............,:=\n");
|
|
|
|
vty_out(vty, ".......... 7777777777777..... ?7777777777.............=7777777.....~777I........\n");
|
|
|
|
vty_out(vty, "...........:777777777777I......~777777777...........I7777777~.....+777I.........\n");
|
|
|
|
vty_out(vty, "..... ......7777777777777I.......I7777777.......+777777777I......7777I..........\n");
|
|
|
|
vty_out(vty, ".............77777777777777........?77777......777777777?......=7777=...........\n");
|
|
|
|
vty_out(vty, ".............,77777777777777+.........~77......777777I,......:77777.............\n");
|
|
|
|
vty_out(vty, "..............~777777777777777~................777777......:77777=..............\n");
|
|
|
|
vty_out(vty, "...............:7777777777777777?..............:777777,.....=77=................\n");
|
|
|
|
vty_out(vty, "................,777777777777777777?,...........,777777:.....,..................\n");
|
|
|
|
vty_out(vty, "........... ......I777777777777777777777I.........777777~.......................\n");
|
|
|
|
vty_out(vty, "...................,777777777777777777777..........777777+......................\n");
|
|
|
|
vty_out(vty, ".....................+7777777777777777777...........777777?.....................\n");
|
|
|
|
vty_out(vty, ".......................=77777777777777777............777777I....................\n");
|
|
|
|
vty_out(vty, ".........................:777777777777777.............I77777I...................\n");
|
|
|
|
vty_out(vty, "............................~777777777777..............+777777..................\n");
|
|
|
|
vty_out(vty, "................................~77777777...............=777777.................\n");
|
|
|
|
vty_out(vty, ".....................................:=?I................~777777................\n");
|
|
|
|
vty_out(vty, "..........................................................:777777,..............\n");
|
|
|
|
vty_out(vty, ".... ... ... . . .... ....... ....... ....................:777777..............\n");
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-08-03 20:23:56 +02:00
|
|
|
#ifdef HAVE_NETLINK
|
|
|
|
DEFUN_HIDDEN(zebra_kernel_netlink_batch_tx_buf,
|
|
|
|
zebra_kernel_netlink_batch_tx_buf_cmd,
|
|
|
|
"zebra kernel netlink batch-tx-buf (1-1048576) (1-1048576)",
|
|
|
|
ZEBRA_STR
|
|
|
|
"Zebra kernel interface\n"
|
|
|
|
"Set Netlink parameters\n"
|
|
|
|
"Set batch buffer size and send threshold\n"
|
|
|
|
"Size of the buffer\n"
|
|
|
|
"Send threshold\n")
|
|
|
|
{
|
|
|
|
uint32_t bufsize = 0, threshold = 0;
|
|
|
|
|
|
|
|
bufsize = strtoul(argv[4]->arg, NULL, 10);
|
|
|
|
threshold = strtoul(argv[5]->arg, NULL, 10);
|
|
|
|
|
|
|
|
netlink_set_batch_buffer_size(bufsize, threshold, true);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN_HIDDEN(no_zebra_kernel_netlink_batch_tx_buf,
|
|
|
|
no_zebra_kernel_netlink_batch_tx_buf_cmd,
|
|
|
|
"no zebra kernel netlink batch-tx-buf [(0-1048576)] [(0-1048576)]",
|
|
|
|
NO_STR ZEBRA_STR
|
|
|
|
"Zebra kernel interface\n"
|
|
|
|
"Set Netlink parameters\n"
|
|
|
|
"Set batch buffer size and send threshold\n"
|
|
|
|
"Size of the buffer\n"
|
|
|
|
"Send threshold\n")
|
|
|
|
{
|
|
|
|
netlink_set_batch_buffer_size(0, 0, false);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2022-01-19 20:36:10 +01:00
|
|
|
DEFPY (zebra_protodown_bit,
|
|
|
|
zebra_protodown_bit_cmd,
|
|
|
|
"zebra protodown reason-bit (0-31)$bit",
|
|
|
|
ZEBRA_STR
|
|
|
|
"Protodown Configuration\n"
|
|
|
|
"Reason Bit used in the kernel for application\n"
|
|
|
|
"Reason Bit range\n")
|
|
|
|
{
|
|
|
|
if_netlink_set_frr_protodown_r_bit(bit);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFPY (no_zebra_protodown_bit,
|
|
|
|
no_zebra_protodown_bit_cmd,
|
|
|
|
"no zebra protodown reason-bit [(0-31)$bit]",
|
|
|
|
NO_STR
|
|
|
|
ZEBRA_STR
|
|
|
|
"Protodown Configuration\n"
|
|
|
|
"Reason Bit used in the kernel for setting protodown\n"
|
|
|
|
"Reason Bit Range\n")
|
|
|
|
{
|
|
|
|
if_netlink_unset_frr_protodown_r_bit();
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2020-08-03 20:23:56 +02:00
|
|
|
#endif /* HAVE_NETLINK */
|
|
|
|
|
2021-10-13 17:08:31 +02:00
|
|
|
#ifdef HAVE_SCRIPTING
|
|
|
|
|
|
|
|
DEFUN(zebra_on_rib_process_script, zebra_on_rib_process_script_cmd,
|
|
|
|
"zebra on-rib-process script SCRIPT",
|
|
|
|
ZEBRA_STR
|
|
|
|
"on_rib_process_dplane_results hook call\n"
|
|
|
|
"Set a script\n"
|
|
|
|
"Script name (same as filename in /etc/frr/scripts/, without .lua)\n")
|
|
|
|
{
|
|
|
|
|
|
|
|
if (frrscript_names_set_script_name(ZEBRA_ON_RIB_PROCESS_HOOK_CALL,
|
|
|
|
argv[3]->arg)
|
|
|
|
== 0) {
|
|
|
|
vty_out(vty, "Successfully added script %s for hook call %s\n",
|
|
|
|
argv[3]->arg, ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
|
|
|
|
} else {
|
|
|
|
vty_out(vty, "Failed to add script %s for hook call %s\n",
|
|
|
|
argv[3]->arg, ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_SCRIPTING */
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* IP node for static routes. */
|
2018-09-08 22:31:43 +02:00
|
|
|
static int zebra_ip_config(struct vty *vty);
|
2018-09-08 21:46:23 +02:00
|
|
|
static struct cmd_node ip_node = {
|
2018-09-09 00:15:50 +02:00
|
|
|
.name = "static ip",
|
2018-09-08 21:46:23 +02:00
|
|
|
.node = IP_NODE,
|
|
|
|
.prompt = "",
|
2018-09-08 22:31:43 +02:00
|
|
|
.config_write = zebra_ip_config,
|
2018-09-08 21:46:23 +02:00
|
|
|
};
|
2018-09-08 22:31:43 +02:00
|
|
|
static int config_write_protocol(struct vty *vty);
|
2018-09-08 21:46:23 +02:00
|
|
|
static struct cmd_node protocol_node = {
|
2018-09-09 00:15:50 +02:00
|
|
|
.name = "protocol",
|
2018-09-08 21:46:23 +02:00
|
|
|
.node = PROTOCOL_NODE,
|
|
|
|
.prompt = "",
|
2018-09-08 22:31:43 +02:00
|
|
|
.config_write = config_write_protocol,
|
2018-09-08 21:46:23 +02:00
|
|
|
};
|
2018-09-08 22:31:43 +02:00
|
|
|
static int config_write_forwarding(struct vty *vty);
|
2018-09-08 21:46:23 +02:00
|
|
|
static struct cmd_node forwarding_node = {
|
2018-09-09 00:15:50 +02:00
|
|
|
.name = "forwarding",
|
2018-09-08 21:46:23 +02:00
|
|
|
.node = FORWARDING_NODE,
|
|
|
|
.prompt = "",
|
2018-09-08 22:31:43 +02:00
|
|
|
.config_write = config_write_forwarding,
|
2018-09-08 21:46:23 +02:00
|
|
|
};
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Route VTY. */
|
2005-06-28 19:17:12 +02:00
|
|
|
void zebra_vty_init(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-12-07 16:47:30 +01:00
|
|
|
/* Install configuration write function. */
|
2018-09-08 22:31:43 +02:00
|
|
|
install_node(&forwarding_node);
|
2017-12-07 16:47:30 +01:00
|
|
|
|
|
|
|
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
|
|
|
|
install_element(CONFIG_NODE, &ip_forwarding_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
|
|
|
|
install_element(ENABLE_NODE, &show_zebra_cmd);
|
|
|
|
|
|
|
|
install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
|
|
|
|
install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
|
|
|
|
|
|
|
|
/* Route-map */
|
|
|
|
zebra_route_map_init();
|
|
|
|
|
2022-11-09 15:17:19 +01:00
|
|
|
zebra_affinity_map_init();
|
2022-11-03 14:30:23 +01:00
|
|
|
|
2018-09-08 22:31:43 +02:00
|
|
|
install_node(&ip_node);
|
|
|
|
install_node(&protocol_node);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-08-26 14:21:40 +02:00
|
|
|
install_element(CONFIG_NODE, &allow_external_route_update_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_allow_external_route_update_cmd);
|
2018-05-08 13:58:32 +02:00
|
|
|
|
2022-06-16 01:54:29 +02:00
|
|
|
install_element(CONFIG_NODE, &zebra_nexthop_group_keep_cmd);
|
2015-05-20 03:03:42 +02:00
|
|
|
install_element(CONFIG_NODE, &ip_zebra_import_table_distance_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_ip_zebra_import_table_cmd);
|
2017-10-25 16:47:55 +02:00
|
|
|
install_element(CONFIG_NODE, &zebra_workqueue_timer_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_zebra_workqueue_timer_cmd);
|
2017-10-25 17:13:42 +02:00
|
|
|
install_element(CONFIG_NODE, &zebra_packet_process_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_zebra_packet_process_cmd);
|
2020-01-28 17:00:42 +01:00
|
|
|
install_element(CONFIG_NODE, &nexthop_group_use_enable_cmd);
|
2020-05-13 21:50:14 +02:00
|
|
|
install_element(CONFIG_NODE, &proto_nexthop_group_only_cmd);
|
2021-02-22 21:06:28 +01:00
|
|
|
install_element(CONFIG_NODE, &backup_nexthop_recursive_use_enable_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2019-01-24 03:16:41 +01:00
|
|
|
install_element(VIEW_NODE, &show_nexthop_group_cmd);
|
2019-05-16 06:24:43 +02:00
|
|
|
install_element(VIEW_NODE, &show_interface_nexthop_group_cmd);
|
2019-01-24 03:16:41 +01:00
|
|
|
|
2016-02-01 19:55:42 +01:00
|
|
|
install_element(VIEW_NODE, &show_vrf_cmd);
|
2017-10-08 03:49:27 +02:00
|
|
|
install_element(VIEW_NODE, &show_vrf_vni_cmd);
|
2017-09-13 20:16:12 +02:00
|
|
|
install_element(VIEW_NODE, &show_route_cmd);
|
2024-10-29 20:30:00 +01:00
|
|
|
install_element(VIEW_NODE, &show_ip_rpf_cmd);
|
2020-10-19 20:08:18 +02:00
|
|
|
install_element(VIEW_NODE, &show_ro_cmd);
|
2017-09-13 22:40:19 +02:00
|
|
|
install_element(VIEW_NODE, &show_route_detail_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_route_summary_cmd);
|
2015-05-20 02:40:34 +02:00
|
|
|
install_element(VIEW_NODE, &show_ip_nht_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-03-01 16:48:05 +01:00
|
|
|
install_element(CONFIG_NODE, &rnh_hide_backups_cmd);
|
|
|
|
|
2019-04-12 16:25:11 +02:00
|
|
|
install_element(VIEW_NODE, &show_frr_cmd);
|
2017-11-15 10:01:00 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_global_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_vni_cmd);
|
2018-11-15 18:33:43 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_vni_detail_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_vni_vni_cmd);
|
2020-05-27 03:42:00 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_l2_nh_cmd);
|
2020-03-28 01:34:06 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_es_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_es_evi_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_access_vlan_cmd);
|
2017-11-15 10:01:00 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_rmac_vni_mac_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_rmac_vni_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_rmac_vni_all_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_nh_vni_ip_cmd);
|
2021-04-08 20:27:57 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_nh_svd_ip_cmd);
|
2017-11-15 10:01:00 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_nh_vni_cmd);
|
2021-04-08 20:27:57 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_nh_svd_cmd);
|
2017-11-15 10:01:00 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_nh_vni_all_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_all_cmd);
|
2018-11-22 09:18:10 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_all_detail_cmd);
|
zebra: Evpn mac vni detail show command
New show command "show evpn mac vni xx detail [json]"
to display details of all the mac entries for the
requested VNI.
Output of show evpn mac vni xx detail json:
{
"numMacs":2,
"macs":{
"ca:be:63:7c:81:05":{
"type":"local",
"intf":"veth100",
"ifindex":8,
"uptime":"00:06:55",
"localSequence":0,
"remoteSequence":0,
"detectionCount":0,
"isDuplicate":false,
"syncNeighCount":0,
"neighbors":{
"active":[
"fe80::c8be:63ff:fe7c:8105"
],
"inactive":[
]
}
}
}
}
Also added remoteEs field in the JSON output of
"show evpn mac vni xx json".
Output of show evpn mac vni xx json:
"00:02:00:00:00:0d":{
"type":"remote",
"remoteEs":"03:44:38:39:ff:ff:02:00:00:02",
"localSequence":0,
"remoteSequence":0,
"detectionCount":0,
"isDuplicate":false
}
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-01-04 00:17:58 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_detail_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_all_vtep_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_mac_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_vtep_cmd);
|
2018-11-04 19:17:29 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_dad_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_mac_vni_all_dad_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_all_cmd);
|
2018-11-22 10:56:52 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_all_detail_cmd);
|
2017-05-15 07:45:55 +02:00
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_neigh_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_vtep_cmd);
|
2018-11-04 19:17:29 +01:00
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_dad_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_evpn_neigh_vni_all_dad_cmd);
|
2018-11-04 19:55:39 +01:00
|
|
|
install_element(ENABLE_NODE, &clear_evpn_dup_addr_cmd);
|
2021-07-06 16:59:35 +02:00
|
|
|
install_element(CONFIG_NODE, &evpn_accept_bgp_seq_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_evpn_accept_bgp_seq_cmd);
|
2017-10-08 03:49:27 +02:00
|
|
|
|
2021-12-18 20:28:49 +01:00
|
|
|
install_element(VIEW_NODE, &show_neigh_cmd);
|
|
|
|
|
2018-04-23 15:17:19 +02:00
|
|
|
install_element(VIEW_NODE, &show_pbr_ipset_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_pbr_iptable_cmd);
|
2021-12-18 19:34:31 +01:00
|
|
|
install_element(VIEW_NODE, &show_pbr_rule_cmd);
|
|
|
|
install_element(CONFIG_NODE, &pbr_nexthop_resolve_cmd);
|
2020-04-29 19:06:45 +02:00
|
|
|
install_element(VIEW_NODE, &show_route_zebra_dump_cmd);
|
2018-04-23 15:17:19 +02:00
|
|
|
|
2020-05-08 15:00:40 +02:00
|
|
|
install_element(CONFIG_NODE, &evpn_mh_mac_holdtime_cmd);
|
|
|
|
install_element(CONFIG_NODE, &evpn_mh_neigh_holdtime_cmd);
|
zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.
The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).
Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"
Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
Detection max-moves 5, time 180
EVPN MH:
mac-holdtime: 60s, neigh-holdtime: 60s
startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
uplink-cfg-cnt: 4, uplink-active-cnt: 4
protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 1 last: 2020/04/26 20:38:03.53
PTM status: disabled
vrf: default
OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote Node/s hostd-11 and Ports swp1
index 58 metric 0 mtu 9152 speed 4294967295
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type bond
Master interface: bridge
EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
protodown: off rc: startup-delay <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
Link ups: 0 last: (never)
Link downs: 3 last: 2020/04/26 20:38:03.52
PTM status: disabled
vrf: default
index 7 metric 0 mtu 9152 speed 10000
flags: <UP,BROADCAST,MULTICAST>
Type: Ethernet
HWaddr: 00:02:00:00:00:35
Interface Type Other
Master interface: hostbond1
protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-05-09 04:11:13 +02:00
|
|
|
install_element(CONFIG_NODE, &evpn_mh_startup_delay_cmd);
|
2020-05-09 03:47:52 +02:00
|
|
|
install_element(CONFIG_NODE, &evpn_mh_redirect_off_cmd);
|
2018-03-01 11:10:47 +01:00
|
|
|
|
2018-08-17 21:50:09 +02:00
|
|
|
install_element(VIEW_NODE, &show_dataplane_cmd);
|
|
|
|
install_element(VIEW_NODE, &show_dataplane_providers_cmd);
|
2018-09-21 20:54:02 +02:00
|
|
|
install_element(CONFIG_NODE, &zebra_dplane_queue_limit_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_zebra_dplane_queue_limit_cmd);
|
2025-03-25 15:55:16 +01:00
|
|
|
install_element(VIEW_NODE, &show_zebra_metaq_counters_cmd);
|
2019-01-04 15:41:09 +01:00
|
|
|
|
2020-08-03 20:23:56 +02:00
|
|
|
#ifdef HAVE_NETLINK
|
|
|
|
install_element(CONFIG_NODE, &zebra_kernel_netlink_batch_tx_buf_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_zebra_kernel_netlink_batch_tx_buf_cmd);
|
2022-01-19 20:36:10 +01:00
|
|
|
install_element(CONFIG_NODE, &zebra_protodown_bit_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_zebra_protodown_bit_cmd);
|
2020-08-03 20:23:56 +02:00
|
|
|
#endif /* HAVE_NETLINK */
|
|
|
|
|
2021-10-13 17:08:31 +02:00
|
|
|
#ifdef HAVE_SCRIPTING
|
|
|
|
install_element(CONFIG_NODE, &zebra_on_rib_process_script_cmd);
|
|
|
|
#endif /* HAVE_SCRIPTING */
|
|
|
|
|
2019-01-04 15:41:09 +01:00
|
|
|
install_element(VIEW_NODE, &zebra_show_routing_tables_summary_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|