mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 16:26:10 +00:00
zebra: Add "show evpn vni detail" command
Change helps display detailed output for all possible VNIs without specifying VNI. It helps in troubleshooting - a single command can be fired to capture detailed info on all VNIs. Ticket: CM-22831 Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com> Reviewed-by: CCR-8013
This commit is contained in:
parent
d482ae5912
commit
09af6961d4
@ -1782,7 +1782,7 @@ DEFUN (show_evpn_vni,
|
|||||||
"show evpn vni [json]",
|
"show evpn vni [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
"EVPN\n"
|
"EVPN\n"
|
||||||
"VxLAN information\n"
|
"VxLAN Network Identifier\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
@ -1793,6 +1793,22 @@ DEFUN (show_evpn_vni,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
|
zebra_vxlan_print_vnis_detail(vty, zvrf, uj);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (show_evpn_vni_vni,
|
DEFUN (show_evpn_vni_vni,
|
||||||
show_evpn_vni_vni_cmd,
|
show_evpn_vni_vni_cmd,
|
||||||
"show evpn vni " CMD_VNI_RANGE "[json]",
|
"show evpn vni " CMD_VNI_RANGE "[json]",
|
||||||
@ -2743,6 +2759,7 @@ void zebra_vty_init(void)
|
|||||||
|
|
||||||
install_element(VIEW_NODE, &show_evpn_global_cmd);
|
install_element(VIEW_NODE, &show_evpn_global_cmd);
|
||||||
install_element(VIEW_NODE, &show_evpn_vni_cmd);
|
install_element(VIEW_NODE, &show_evpn_vni_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_evpn_vni_detail_cmd);
|
||||||
install_element(VIEW_NODE, &show_evpn_vni_vni_cmd);
|
install_element(VIEW_NODE, &show_evpn_vni_vni_cmd);
|
||||||
install_element(VIEW_NODE, &show_evpn_rmac_vni_mac_cmd);
|
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_cmd);
|
||||||
|
@ -1195,6 +1195,35 @@ static void zl3vni_print_hash(struct hash_backet *backet, void *ctx[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Private Structure to pass callback data for hash iterator */
|
||||||
|
struct zvni_evpn_show {
|
||||||
|
struct vty *vty;
|
||||||
|
json_object *json;
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* print a L3 VNI hash entry in detail*/
|
||||||
|
static void zl3vni_print_hash_detail(struct hash_backet *backet, void *data)
|
||||||
|
{
|
||||||
|
struct vty *vty = NULL;
|
||||||
|
zebra_l3vni_t *zl3vni = NULL;
|
||||||
|
json_object *json = NULL;
|
||||||
|
bool use_json = false;
|
||||||
|
struct zvni_evpn_show *zes = data;
|
||||||
|
|
||||||
|
vty = zes->vty;
|
||||||
|
json = zes->json;
|
||||||
|
|
||||||
|
if (json)
|
||||||
|
use_json = true;
|
||||||
|
|
||||||
|
zl3vni = (zebra_l3vni_t *)backet->data;
|
||||||
|
|
||||||
|
zebra_vxlan_print_vni(vty, zes->zvrf, zl3vni->vni, use_json);
|
||||||
|
vty_out(vty, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print a VNI hash entry - called for display of all VNIs.
|
* Print a VNI hash entry - called for display of all VNIs.
|
||||||
*/
|
*/
|
||||||
@ -1259,6 +1288,29 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print a VNI hash entry in detail - called for display of all VNIs.
|
||||||
|
*/
|
||||||
|
static void zvni_print_hash_detail(struct hash_backet *backet, void *data)
|
||||||
|
{
|
||||||
|
struct vty *vty;
|
||||||
|
zebra_vni_t *zvni;
|
||||||
|
json_object *json = NULL;
|
||||||
|
bool use_json = false;
|
||||||
|
struct zvni_evpn_show *zes = data;
|
||||||
|
|
||||||
|
vty = zes->vty;
|
||||||
|
json = zes->json;
|
||||||
|
|
||||||
|
if (json)
|
||||||
|
use_json = true;
|
||||||
|
|
||||||
|
zvni = (zebra_vni_t *)backet->data;
|
||||||
|
|
||||||
|
zebra_vxlan_print_vni(vty, zes->zvrf, zvni->vni, use_json);
|
||||||
|
vty_out(vty, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inform BGP about local MACIP.
|
* Inform BGP about local MACIP.
|
||||||
*/
|
*/
|
||||||
@ -5426,6 +5478,49 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display VNI hash table in detail(VTY command handler).
|
||||||
|
*/
|
||||||
|
void zebra_vxlan_print_vnis_detail(struct vty *vty, struct zebra_vrf *zvrf,
|
||||||
|
bool use_json)
|
||||||
|
{
|
||||||
|
json_object *json = NULL;
|
||||||
|
struct zebra_ns *zns = NULL;
|
||||||
|
struct zvni_evpn_show zes;
|
||||||
|
|
||||||
|
if (!is_evpn_enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
zns = zebra_ns_lookup(NS_DEFAULT);
|
||||||
|
if (!zns)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if (use_json)
|
||||||
|
json = json_object_new_object();
|
||||||
|
|
||||||
|
zes.vty = vty;
|
||||||
|
zes.json = json;
|
||||||
|
zes.zvrf = zvrf;
|
||||||
|
|
||||||
|
/* Display all L2-VNIs */
|
||||||
|
hash_iterate(zvrf->vni_table, (void (*)(struct hash_backet *,
|
||||||
|
void *))zvni_print_hash_detail,
|
||||||
|
&zes);
|
||||||
|
|
||||||
|
/* Display all L3-VNIs */
|
||||||
|
hash_iterate(zrouter.l3vni_table,
|
||||||
|
(void (*)(struct hash_backet *,
|
||||||
|
void *))zl3vni_print_hash_detail,
|
||||||
|
&zes);
|
||||||
|
|
||||||
|
if (use_json) {
|
||||||
|
vty_out(vty, "%s\n", json_object_to_json_string_ext(
|
||||||
|
json, JSON_C_TO_STRING_PRETTY));
|
||||||
|
json_object_free(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle neighbor delete notification from the kernel (on a VLAN device
|
* Handle neighbor delete notification from the kernel (on a VLAN device
|
||||||
* / L3 interface). This may result in either the neighbor getting deleted
|
* / L3 interface). This may result in either the neighbor getting deleted
|
||||||
|
@ -117,6 +117,9 @@ extern void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
vni_t vni, bool use_json);
|
vni_t vni, bool use_json);
|
||||||
extern void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
|
extern void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
|
||||||
bool use_json);
|
bool use_json);
|
||||||
|
extern void zebra_vxlan_print_vnis_detail(struct vty *vty,
|
||||||
|
struct zebra_vrf *zvrf,
|
||||||
|
bool use_json);
|
||||||
extern void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t vni,
|
extern void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t vni,
|
||||||
bool use_json);
|
bool use_json);
|
||||||
extern void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json);
|
extern void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json);
|
||||||
|
Loading…
Reference in New Issue
Block a user