bgpd: Print out vrf name as well as id

The vrf_id is not enough context for people.  Use the
actual name of the vrf if you can.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2020-02-14 00:14:03 -05:00
parent c479e75665
commit 137147c66a
4 changed files with 32 additions and 13 deletions

View File

@ -329,19 +329,22 @@ static int bgp_bfd_dest_update(ZAPI_CALLBACK_ARGS)
&remote_cbit, vrf_id); &remote_cbit, vrf_id);
if (BGP_DEBUG(zebra, ZEBRA)) { if (BGP_DEBUG(zebra, ZEBRA)) {
struct vrf *vrf;
char buf[2][PREFIX2STR_BUFFER]; char buf[2][PREFIX2STR_BUFFER];
vrf = vrf_lookup_by_id(vrf_id);
prefix2str(&dp, buf[0], sizeof(buf[0])); prefix2str(&dp, buf[0], sizeof(buf[0]));
if (ifp) { if (ifp) {
zlog_debug( zlog_debug(
"Zebra: vrf %u interface %s bfd destination %s %s %s", "Zebra: vrf %s(%u) interface %s bfd destination %s %s %s",
vrf_id, ifp->name, buf[0], VRF_LOGNAME(vrf), vrf_id, ifp->name,
bfd_get_status_str(status), buf[0], bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : ""); remote_cbit ? "(cbit on)" : "");
} else { } else {
prefix2str(&sp, buf[1], sizeof(buf[1])); prefix2str(&sp, buf[1], sizeof(buf[1]));
zlog_debug( zlog_debug(
"Zebra: vrf %u source %s bfd destination %s %s %s", "Zebra: vrf %s(%u) source %s bfd destination %s %s %s",
vrf_id, buf[1], buf[0], VRF_LOGNAME(vrf), vrf_id, buf[1], buf[0],
bfd_get_status_str(status), bfd_get_status_str(status),
remote_cbit ? "(cbit on)" : ""); remote_cbit ? "(cbit on)" : "");
} }

View File

@ -1403,11 +1403,16 @@ void bgp_pbr_print_policy_route(struct bgp_pbr_entry_main *api)
ptr += sprintf(ptr, ptr += sprintf(ptr,
"@redirect ip nh %s", local_buff); "@redirect ip nh %s", local_buff);
break; break;
case ACTION_REDIRECT: case ACTION_REDIRECT: {
struct vrf *vrf;
vrf = vrf_lookup_by_id(api->actions[i].u.redirect_vrf);
INCREMENT_DISPLAY(ptr, nb_items); INCREMENT_DISPLAY(ptr, nb_items);
ptr += sprintf(ptr, "@redirect vrf %u", ptr += sprintf(ptr, "@redirect vrf %s(%u)",
VRF_LOGNAME(vrf),
api->actions[i].u.redirect_vrf); api->actions[i].u.redirect_vrf);
break; break;
}
case ACTION_MARKING: case ACTION_MARKING:
INCREMENT_DISPLAY(ptr, nb_items); INCREMENT_DISPLAY(ptr, nb_items);
ptr += sprintf(ptr, "@set dscp %u", ptr += sprintf(ptr, "@set dscp %u",

View File

@ -8867,8 +8867,13 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
} else { } else {
if (nexthop_vrfid == VRF_UNKNOWN) if (nexthop_vrfid == VRF_UNKNOWN)
vty_out(vty, " vrf ?"); vty_out(vty, " vrf ?");
else else {
vty_out(vty, " vrf %u", nexthop_vrfid); struct vrf *vrf;
vrf = vrf_lookup_by_id(nexthop_vrfid);
vty_out(vty, " vrf %s(%u)",
VRF_LOGNAME(vrf), nexthop_vrfid);
}
} }
} }

View File

@ -284,8 +284,11 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
*/ */
if (bgp->established_peers == 0) { if (bgp->established_peers == 0) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("RID change : vrf %u, RTR ID %s", zlog_debug(
bgp->vrf_id, inet_ntoa(*addr)); "RID change : vrf %s(%u), RTR ID %s",
bgp->name_pretty,
bgp->vrf_id,
inet_ntoa(*addr));
bgp_router_id_set(bgp, addr, false); bgp_router_id_set(bgp, addr, false);
} }
} }
@ -304,8 +307,11 @@ void bgp_router_id_zebra_bump(vrf_id_t vrf_id, const struct prefix *router_id)
*/ */
if (bgp->established_peers == 0) { if (bgp->established_peers == 0) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("RID change : vrf %u, RTR ID %s", zlog_debug(
bgp->vrf_id, inet_ntoa(*addr)); "RID change : vrf %s(%u), RTR ID %s",
bgp->name_pretty,
bgp->vrf_id,
inet_ntoa(*addr));
bgp_router_id_set(bgp, addr, false); bgp_router_id_set(bgp, addr, false);
} }
} }