mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 10:50:18 +00:00
zebra: Add uptime to show evpn arp-cache vni .. detail
Add uptime data to `show evpn arp-cache vni ... detail` command. Effectively when we create a neighbor entry store the time it was created. When we modify the neighbor entry store the time it was modified. Display under detail output and json output. New output: eva# show evpn arp-cache vni all detail VNI 1000 #ARP (IPv4 and IPv6, local and remote) 8 IP: 45.0.0.5 Type: remote State: active Uptime: 00:01:59 MAC: 0a:fd:87:ca:7c:00 Sync-info: - Remote VTEP: 192.168.100.18 Local Seq: 0 Remote Seq: 0 IP: fe80::8fd:87ff:feca:7c00 Type: remote State: active Uptime: 00:01:59 MAC: 0a:fd:87:ca:7c:00 Sync-info: - Remote VTEP: 192.168.100.18 Local Seq: 0 Remote Seq: 0 IP: fe80::14e5:c2ff:fe50:fa59 Type: local State: active Uptime: 00:02:04 MAC: 16:e5:c2:50:fa:59 Sync-info: - Local Seq: 0 Remote Seq: 0 IP: 45.0.0.3 Type: remote State: active Uptime: 00:02:02 MAC: 0e:50:e8:cf:6b:eb Sync-info: - Remote VTEP: 192.168.100.16 Local Seq: 0 Remote Seq: 0 IP: 45.0.0.2 Type: local State: active Uptime: 00:02:05 MAC: 16:e5:c2:50:fa:59 Sync-info: - Local Seq: 0 Remote Seq: 0 IP: fe80::c50:e8ff:fecf:6beb Type: remote State: active Uptime: 00:02:02 MAC: 0e:50:e8:cf:6b:eb Sync-info: - Remote VTEP: 192.168.100.16 Local Seq: 0 Remote Seq: 0 IP: 45.0.0.4 Type: remote State: active Uptime: 00:01:55 MAC: 02:ad:5f:d8:da:80 Sync-info: - Remote VTEP: 192.168.100.17 Local Seq: 0 Remote Seq: 0 IP: fe80::ad:5fff:fed8:da80 Type: remote State: active Uptime: 00:01:55 MAC: 02:ad:5f:d8:da:80 Sync-info: - Remote VTEP: 192.168.100.17 Local Seq: 0 Remote Seq: 0 eva# Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
0616c6589f
commit
a05111ba3d
@ -592,6 +592,7 @@ static zebra_neigh_t *zebra_evpn_neigh_add(zebra_evpn_t *zevpn,
|
||||
n->zevpn = zevpn;
|
||||
n->dad_ip_auto_recovery_timer = NULL;
|
||||
n->flags = n_flags;
|
||||
n->uptime = monotime(NULL);
|
||||
|
||||
if (!zmac)
|
||||
zmac = zebra_evpn_mac_lookup(zevpn, mac);
|
||||
@ -802,6 +803,8 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n,
|
||||
n->ifindex = ifindex;
|
||||
inform_dataplane = true;
|
||||
}
|
||||
|
||||
n->uptime = monotime(NULL);
|
||||
}
|
||||
|
||||
/* update the neigh seq. we don't bother with the mac seq as
|
||||
@ -1798,11 +1801,18 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
|
||||
struct timeval detect_start_time = {0, 0};
|
||||
char timebuf[MONOTIME_STRLEN];
|
||||
char thread_buf[THREAD_TIMER_STRLEN];
|
||||
time_t uptime;
|
||||
char up_str[MONOTIME_STRLEN];
|
||||
|
||||
zvrf = zebra_vrf_get_evpn();
|
||||
if (!zvrf)
|
||||
return;
|
||||
|
||||
uptime = monotime(NULL);
|
||||
uptime -= n->uptime;
|
||||
|
||||
frrtime_to_interval(uptime, up_str, sizeof(up_str));
|
||||
|
||||
ipaddr2str(&n->ip, buf2, sizeof(buf2));
|
||||
prefix_mac2str(&n->emac, buf1, sizeof(buf1));
|
||||
type_str = CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL) ? "local" : "remote";
|
||||
@ -1815,6 +1825,7 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
|
||||
ipaddr2str(&n->ip, buf2, sizeof(buf2)));
|
||||
vty_out(vty, " Type: %s\n", type_str);
|
||||
vty_out(vty, " State: %s\n", state_str);
|
||||
vty_out(vty, " Uptime: %s\n", up_str);
|
||||
vty_out(vty, " MAC: %s\n",
|
||||
prefix_mac2str(&n->emac, buf1, sizeof(buf1)));
|
||||
vty_out(vty, " Sync-info:");
|
||||
@ -1841,6 +1852,7 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
|
||||
vty_out(vty, " -");
|
||||
vty_out(vty, "\n");
|
||||
} else {
|
||||
json_object_string_add(json, "uptime", up_str);
|
||||
json_object_string_add(json, "ip", buf2);
|
||||
json_object_string_add(json, "type", type_str);
|
||||
json_object_string_add(json, "state", state_str);
|
||||
|
@ -113,6 +113,8 @@ struct zebra_neigh_t_ {
|
||||
|
||||
time_t dad_dup_detect_time;
|
||||
|
||||
time_t uptime;
|
||||
|
||||
/* used for ageing out the PEER_ACTIVE flag */
|
||||
struct thread *hold_timer;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user