mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 06:50:17 +00:00
bgpd: add 'show bgp mplsvpn-nh-label-bind' command
There is no 'show command' to use for troubleshooting purposes. Add a new show command to dump the cache entry of the MPLS VPN nexthop label bind cache table. > show bgp [vrf NAME] mplsvpn-nh-label-bind [detail] The below command illustrates its output: > dut# show bgp mplsvpn-nh-label-bind detail > Current BGP mpls-vpn nexthop label bind cache, VRF default > 192.168.1.3, label 102, local label 18 #paths 3 > interface r2-eth1 > Last update: Mon May 22 14:39:42 2023 > Paths: > 1/3 172.31.3.0/24 VRF default flags 0x418 > 1/3 172.31.2.0/24 VRF default flags 0x418 > 1/3 172.31.1.0/24 VRF default flags 0x418 > 192.0.2.1, label 101, local label 19 #paths 1 > interface r2-eth0 > Last update: Mon May 22 14:39:43 2023 > Paths: > 1/3 172.31.0.0/24 VRF default flags 0x418 Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
27f4deed0a
commit
f766bb0c0f
@ -4161,3 +4161,85 @@ void bgp_mplsvpn_nh_label_bind_register_local_label(struct bgp *bgp,
|
||||
bmnc, ZEBRA_MPLS_LABELS_REPLACE);
|
||||
}
|
||||
}
|
||||
|
||||
static void show_bgp_mplsvpn_nh_label_bind_internal(struct vty *vty,
|
||||
struct bgp *bgp,
|
||||
bool detail)
|
||||
{
|
||||
struct bgp_mplsvpn_nh_label_bind_cache_head *tree;
|
||||
struct bgp_mplsvpn_nh_label_bind_cache *iter;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
struct bgp_dest *dest;
|
||||
struct bgp_path_info *path;
|
||||
struct bgp *bgp_path;
|
||||
struct bgp_table *table;
|
||||
time_t tbuf;
|
||||
|
||||
vty_out(vty, "Current BGP mpls-vpn nexthop label bind cache, %s\n",
|
||||
bgp->name_pretty);
|
||||
|
||||
tree = &bgp->mplsvpn_nh_label_bind;
|
||||
frr_each (bgp_mplsvpn_nh_label_bind_cache, tree, iter) {
|
||||
if (iter->nexthop.family == AF_INET)
|
||||
vty_out(vty, " %pI4", &iter->nexthop.u.prefix4);
|
||||
else
|
||||
vty_out(vty, " %pI6", &iter->nexthop.u.prefix6);
|
||||
vty_out(vty, ", label %u, local label %u #paths %u\n",
|
||||
iter->orig_label, iter->new_label, iter->path_count);
|
||||
if (iter->nh)
|
||||
vty_out(vty, " interface %s\n",
|
||||
ifindex2ifname(iter->nh->ifindex,
|
||||
iter->nh->vrf_id));
|
||||
tbuf = time(NULL) - (monotime(NULL) - iter->last_update);
|
||||
vty_out(vty, " Last update: %s", ctime(&tbuf));
|
||||
if (!detail)
|
||||
continue;
|
||||
vty_out(vty, " Paths:\n");
|
||||
LIST_FOREACH (path, &(iter->paths),
|
||||
mplsvpn.bmnc.nh_label_bind_thread) {
|
||||
dest = path->net;
|
||||
table = bgp_dest_table(dest);
|
||||
assert(dest && table);
|
||||
afi = family2afi(bgp_dest_get_prefix(dest)->family);
|
||||
safi = table->safi;
|
||||
bgp_path = table->bgp;
|
||||
|
||||
vty_out(vty, " %d/%d %pBD %s flags 0x%x\n", afi,
|
||||
safi, dest, bgp_path->name_pretty, path->flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DEFUN(show_bgp_mplsvpn_nh_label_bind, show_bgp_mplsvpn_nh_label_bind_cmd,
|
||||
"show bgp [<view|vrf> VIEWVRFNAME] mplsvpn-nh-label-bind [detail]",
|
||||
SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR
|
||||
"BGP mplsvpn nexthop label binding entries\n"
|
||||
"Show detailed information\n")
|
||||
{
|
||||
int idx = 0;
|
||||
char *vrf = NULL;
|
||||
struct bgp *bgp;
|
||||
bool detail = false;
|
||||
|
||||
if (argv_find(argv, argc, "vrf", &idx)) {
|
||||
vrf = argv[++idx]->arg;
|
||||
bgp = bgp_lookup_by_name(vrf);
|
||||
} else
|
||||
bgp = bgp_get_default();
|
||||
|
||||
if (!bgp)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
if (argv_find(argv, argc, "detail", &idx))
|
||||
detail = true;
|
||||
|
||||
show_bgp_mplsvpn_nh_label_bind_internal(vty, bgp, detail);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void bgp_mplsvpn_nexthop_init(void)
|
||||
{
|
||||
install_element(VIEW_NODE, &show_bgp_mplsvpn_nh_label_bind_cmd);
|
||||
}
|
||||
|
@ -390,5 +390,6 @@ bgp_mplsvpn_nh_label_bind_new(struct bgp_mplsvpn_nh_label_bind_cache_head *tree,
|
||||
struct bgp_mplsvpn_nh_label_bind_cache *bgp_mplsvpn_nh_label_bind_find(
|
||||
struct bgp_mplsvpn_nh_label_bind_cache_head *tree, struct prefix *p,
|
||||
mpls_label_t orig_label);
|
||||
void bgp_mplsvpn_nexthop_init(void);
|
||||
|
||||
#endif /* _QUAGGA_BGP_MPLSVPN_H */
|
||||
|
@ -8268,6 +8268,7 @@ void bgp_init(unsigned short instance)
|
||||
bgp_lp_vty_init();
|
||||
|
||||
bgp_label_per_nexthop_init();
|
||||
bgp_mplsvpn_nexthop_init();
|
||||
|
||||
cmd_variable_handler_register(bgp_viewvrf_var_handlers);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user