mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 20:51:17 +00:00
zebra: print rmac nexthop list
Ticket:#2798406 Reviewed By: Testing Done: Before change: -------------- TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 1 Prefixes: [1]:[00:00:00:00:00:00:00:00:00:00]:[::]/352 TORS1# TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 json { "routerMac":"44:38:39:ff:ff:01", "vtepIp":"36.0.0.11", "refCount":1, "localSequence":0, "remoteSequence":0, "prefixList":[ "[1]:[00:00:00:00:00:00:00:00:00:00]:[::]\/352" ] } After change: ------------- TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 0 Prefixes: TORS1# TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 json { "routerMac":"44:38:39:ff:ff:01", "vtepIp":"36.0.0.11", "nexthops":[ "36.0.0.11" ] } Signed-off-by: Chirag Shah <chirag@nvidia.com>
This commit is contained in:
parent
ae9e6beaea
commit
4a8e182a66
@ -398,8 +398,12 @@ static void zl3vni_print_nh(struct zebra_neigh *n, struct vty *vty,
|
|||||||
static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty,
|
static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty,
|
||||||
json_object *json)
|
json_object *json)
|
||||||
{
|
{
|
||||||
|
char buf[INET6_ADDRSTRLEN];
|
||||||
char buf1[ETHER_ADDR_STRLEN];
|
char buf1[ETHER_ADDR_STRLEN];
|
||||||
char buf2[PREFIX_STRLEN];
|
char buf2[PREFIX_STRLEN];
|
||||||
|
struct listnode *node = NULL;
|
||||||
|
struct ipaddr *vtep = NULL;
|
||||||
|
json_object *json_nhs = NULL;
|
||||||
json_object *json_hosts = NULL;
|
json_object *json_hosts = NULL;
|
||||||
struct host_rb_entry *hle;
|
struct host_rb_entry *hle;
|
||||||
|
|
||||||
@ -414,11 +418,18 @@ static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty,
|
|||||||
vty_out(vty, " %pFX\n", &hle->p);
|
vty_out(vty, " %pFX\n", &hle->p);
|
||||||
} else {
|
} else {
|
||||||
json_hosts = json_object_new_array();
|
json_hosts = json_object_new_array();
|
||||||
|
json_nhs = json_object_new_array();
|
||||||
json_object_string_add(
|
json_object_string_add(
|
||||||
json, "routerMac",
|
json, "routerMac",
|
||||||
prefix_mac2str(&zrmac->macaddr, buf1, sizeof(buf1)));
|
prefix_mac2str(&zrmac->macaddr, buf1, sizeof(buf1)));
|
||||||
json_object_string_addf(json, "vtepIp", "%pI4",
|
json_object_string_addf(json, "vtepIp", "%pI4",
|
||||||
&zrmac->fwd_info.r_vtep_ip);
|
&zrmac->fwd_info.r_vtep_ip);
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(zrmac->nh_list, node, vtep)) {
|
||||||
|
json_object_array_add(json_nhs,
|
||||||
|
json_object_new_string(ipaddr2str(
|
||||||
|
vtep, buf, sizeof(buf))));
|
||||||
|
}
|
||||||
|
json_object_object_add(json, "nexthops", json_nhs);
|
||||||
json_object_int_add(json, "refCount",
|
json_object_int_add(json, "refCount",
|
||||||
rb_host_count(&zrmac->host_rb));
|
rb_host_count(&zrmac->host_rb));
|
||||||
RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
|
RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb)
|
||||||
|
Loading…
Reference in New Issue
Block a user