From ffc50094a6afe5ff4625f952be2873815f1b0944 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 14 Jan 2017 12:09:12 -0500 Subject: [PATCH] bgpd rfapi: add NVE/VRF name to show vnc registrations Signed-off-by: Lou Berger --- bgpd/rfapi/bgp_rfapi_cfg.c | 10 +++++----- bgpd/rfapi/rfapi_backend.h | 9 --------- bgpd/rfapi/rfapi_import.c | 4 +++- bgpd/rfapi/rfapi_import.h | 6 ++++++ bgpd/rfapi/rfapi_vty.c | 17 ++++++++++++----- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index a2b0be3cc6..10b365c1c8 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -2463,7 +2463,7 @@ DEFUN (vnc_nve_group, rfg->rt_import_list = ecommunity_dup (bgp->rfapi_cfg->default_rt_import_list); rfg->rfapi_import_table = - rfapiImportTableRefAdd (bgp, rfg->rt_import_list); + rfapiImportTableRefAdd (bgp, rfg->rt_import_list, rfg); } /* @@ -2903,7 +2903,7 @@ DEFUN (vnc_nve_group_rt_import, */ if (rfg->rfapi_import_table) rfapiImportTableRefDelByIt (bgp, rfg->rfapi_import_table); - rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list); + rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list, rfg); if (is_export_bgp) vnc_direct_bgp_add_group (bgp, rfg); @@ -3010,7 +3010,7 @@ DEFUN (vnc_nve_group_rt_both, */ if (rfg->rfapi_import_table) rfapiImportTableRefDelByIt (bgp, rfg->rfapi_import_table); - rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list); + rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list, rfg); if (is_export_bgp) vnc_direct_bgp_add_group (bgp, rfg); @@ -3494,7 +3494,7 @@ DEFUN (vnc_vrf_policy_rt_import, */ if (rfg->rfapi_import_table) rfapiImportTableRefDelByIt (bgp, rfg->rfapi_import_table); - rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list); + rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list, rfg); if (is_export_bgp) vnc_direct_bgp_add_group (bgp, rfg); @@ -3613,7 +3613,7 @@ DEFUN (vnc_vrf_policy_rt_both, */ if (rfg->rfapi_import_table) rfapiImportTableRefDelByIt (bgp, rfg->rfapi_import_table); - rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list); + rfg->rfapi_import_table = rfapiImportTableRefAdd (bgp, rfg->rt_import_list, rfg); if (is_export_bgp) vnc_direct_bgp_add_group (bgp, rfg); diff --git a/bgpd/rfapi/rfapi_backend.h b/bgpd/rfapi/rfapi_backend.h index 788ec73751..9e5b0dc5cb 100644 --- a/bgpd/rfapi/rfapi_backend.h +++ b/bgpd/rfapi/rfapi_backend.h @@ -36,15 +36,6 @@ extern void rfapi_delete (struct bgp *); struct rfapi *bgp_rfapi_new (struct bgp *bgp); void bgp_rfapi_destroy (struct bgp *bgp, struct rfapi *h); -struct rfapi_import_table *rfapiImportTableRefAdd (struct bgp *bgp, - struct ecommunity - *rt_import_list); - -void -rfapiImportTableRefDelByIt (struct bgp *bgp, - struct rfapi_import_table *it_target); - - extern void rfapiProcessUpdate (struct peer *peer, void *rfd, diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 5ba98e55d0..235992d5bf 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -4644,7 +4644,8 @@ bgp_rfapi_destroy (struct bgp *bgp, struct rfapi *h) } struct rfapi_import_table * -rfapiImportTableRefAdd (struct bgp *bgp, struct ecommunity *rt_import_list) +rfapiImportTableRefAdd (struct bgp *bgp, struct ecommunity *rt_import_list, + struct rfapi_nve_group_cfg *rfg) { struct rfapi *h; struct rfapi_import_table *it; @@ -4670,6 +4671,7 @@ rfapiImportTableRefAdd (struct bgp *bgp, struct ecommunity *rt_import_list) h->imports = it; it->rt_import_list = ecommunity_dup (rt_import_list); + it->rfg = rfg; it->monitor_exterior_orphans = skiplist_new (0, NULL, (void (*)(void *)) prefix_free); diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index 51afa0002f..3ba76539dd 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -38,6 +38,7 @@ struct rfapi_import_table { struct rfapi_import_table *next; + struct rfapi_nve_group_cfg *rfg; struct ecommunity *rt_import_list; /* copied from nve grp */ int refcount; /* nve grps and nves */ uint32_t l2_logical_net_id; /* L2 only: EVPN Eth Seg Id */ @@ -90,6 +91,11 @@ rfapiShowImportTable ( struct route_table *rt, int isvpn); +extern struct rfapi_import_table * +rfapiImportTableRefAdd ( + struct bgp *bgp, + struct ecommunity *rt_import_list, + struct rfapi_nve_group_cfg *rfg); extern void rfapiImportTableRefDelByIt ( diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index f8142ed299..7fbfae2951 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1446,17 +1446,24 @@ rfapiShowRemoteRegistrationsIt ( if (pLni) { - fp (out, "%s[%s] L2VPN Network 0x%x (%u) RT={%s}%s", - HVTY_NEWLINE, type, *pLni, (*pLni & 0xfff), s, - HVTY_NEWLINE); + fp (out, "%s[%s] L2VPN Network 0x%x (%u) RT={%s}", + HVTY_NEWLINE, type, *pLni, (*pLni & 0xfff), s); } else { - fp (out, "%s[%s] Prefix RT={%s}%s", - HVTY_NEWLINE, type, s, HVTY_NEWLINE); + fp (out, "%s[%s] Prefix RT={%s}", + HVTY_NEWLINE, type, s); } XFREE (MTYPE_ECOMMUNITY_STR, s); + if (it->rfg && it->rfg->name) + { + fp (out, " %s \"%s\"", + (it->rfg->type == RFAPI_GROUP_CFG_VRF ? + "VRF" : "NVE group"), + it->rfg->name); + } + fp (out, "%s", HVTY_NEWLINE); if (show_expiring) { #if RFAPI_REGISTRATIONS_REPORT_AGE -- 2.39.5