mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
Merge pull request #12578 from Pdoijode/evpn-mac-vni-det
zebra: Evpn mac vni detail show command
This commit is contained in:
commit
4b6667ce61
@ -502,3 +502,11 @@ the creation of the VLAN subinterfaces and directly enslave "eth0" to "br10".
|
||||
ip link set eth0 master br10
|
||||
|
||||
This completes the necessary configuration for an L2VNI.
|
||||
|
||||
Displaying EVPN information
|
||||
---------------------------
|
||||
|
||||
.. clicmd:: show evpn mac vni (1-16777215) detail [json]
|
||||
|
||||
Display detailed information about MAC addresses for
|
||||
a specified VNI.
|
@ -653,7 +653,12 @@ void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json)
|
||||
json_object_int_add(json_mac, "vlan", vid);
|
||||
} else if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) {
|
||||
json_object_string_add(json_mac, "type", "remote");
|
||||
json_object_string_addf(json_mac, "remoteVtep", "%pI4",
|
||||
if (mac->es)
|
||||
json_object_string_add(json_mac, "remoteEs",
|
||||
mac->es->esi_str);
|
||||
else
|
||||
json_object_string_addf(
|
||||
json_mac, "remoteVtep", "%pI4",
|
||||
&mac->fwd_info.r_vtep_ip);
|
||||
} else if (CHECK_FLAG(mac->flags, ZEBRA_MAC_AUTO))
|
||||
json_object_string_add(json_mac, "type", "auto");
|
||||
@ -937,7 +942,12 @@ void zebra_evpn_print_mac_hash(struct hash_bucket *bucket, void *ctxt)
|
||||
"", mac->loc_seq, mac->rem_seq);
|
||||
} else {
|
||||
json_object_string_add(json_mac, "type", "remote");
|
||||
json_object_string_addf(json_mac, "remoteVtep", "%pI4",
|
||||
if (mac->es)
|
||||
json_object_string_add(json_mac, "remoteEs",
|
||||
mac->es->esi_str);
|
||||
else
|
||||
json_object_string_addf(
|
||||
json_mac, "remoteVtep", "%pI4",
|
||||
&mac->fwd_info.r_vtep_ip);
|
||||
json_object_object_add(json_mac_hdr, buf1, json_mac);
|
||||
json_object_int_add(json_mac, "localSequence",
|
||||
|
@ -3511,7 +3511,26 @@ DEFUN (show_evpn_mac_vni,
|
||||
|
||||
vni = strtoul(argv[4]->arg, NULL, 10);
|
||||
zvrf = zebra_vrf_get_evpn();
|
||||
zebra_vxlan_print_macs_vni(vty, zvrf, vni, uj);
|
||||
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);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -4819,6 +4838,7 @@ void zebra_vty_init(void)
|
||||
install_element(VIEW_NODE, &show_evpn_mac_vni_cmd);
|
||||
install_element(VIEW_NODE, &show_evpn_mac_vni_all_cmd);
|
||||
install_element(VIEW_NODE, &show_evpn_mac_vni_all_detail_cmd);
|
||||
install_element(VIEW_NODE, &show_evpn_mac_vni_detail_cmd);
|
||||
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);
|
||||
|
@ -2869,7 +2869,7 @@ void zebra_vxlan_print_neigh_vni_dad(struct vty *vty,
|
||||
* Display MACs for a VNI (VTY command handler).
|
||||
*/
|
||||
void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
|
||||
vni_t vni, bool use_json)
|
||||
vni_t vni, bool use_json, bool detail)
|
||||
{
|
||||
struct zebra_evpn *zevpn;
|
||||
uint32_t num_macs;
|
||||
@ -2902,17 +2902,28 @@ void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
|
||||
wctx.json = json_mac;
|
||||
|
||||
if (!use_json) {
|
||||
if (detail) {
|
||||
vty_out(vty, "\nVNI %u #MACs (local and remote) %u\n\n",
|
||||
zevpn->vni, num_macs);
|
||||
} else {
|
||||
vty_out(vty,
|
||||
"Number of MACs (local and remote) known for this VNI: %u\n",
|
||||
num_macs);
|
||||
vty_out(vty,
|
||||
"Flags: N=sync-neighs, I=local-inactive, P=peer-active, X=peer-proxy\n");
|
||||
vty_out(vty, "%-17s %-6s %-5s %-30s %-5s %s\n", "MAC", "Type",
|
||||
"Flags", "Intf/Remote ES/VTEP", "VLAN", "Seq #'s");
|
||||
vty_out(vty, "%-17s %-6s %-5s %-30s %-5s %s\n", "MAC",
|
||||
"Type", "Flags", "Intf/Remote ES/VTEP", "VLAN",
|
||||
"Seq #'s");
|
||||
}
|
||||
} else
|
||||
json_object_int_add(json, "numMacs", num_macs);
|
||||
|
||||
hash_iterate(zevpn->mac_table, zebra_evpn_print_mac_hash, &wctx);
|
||||
if (detail)
|
||||
hash_iterate(zevpn->mac_table, zebra_evpn_print_mac_hash_detail,
|
||||
&wctx);
|
||||
else
|
||||
hash_iterate(zevpn->mac_table, zebra_evpn_print_mac_hash,
|
||||
&wctx);
|
||||
|
||||
if (use_json) {
|
||||
json_object_object_add(json, "macs", json_mac);
|
||||
|
@ -95,7 +95,7 @@ extern void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni,
|
||||
struct ethaddr *rmac,
|
||||
bool use_json);
|
||||
extern void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
|
||||
vni_t vni, bool use_json);
|
||||
vni_t vni, bool use_json, bool detail);
|
||||
extern void zebra_vxlan_print_macs_all_vni(struct vty *vty,
|
||||
struct zebra_vrf *zvrf,
|
||||
bool print_dup,
|
||||
|
Loading…
Reference in New Issue
Block a user