diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2020-10-26 16:34:05 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2020-10-26 16:47:07 -0400 |
| commit | a05111ba3d7ac808e3e14a2c97e708c565b8f62b (patch) | |
| tree | 537664d227f77514ffa77d2f4d6a6e233a53df7a | |
| parent | 0616c6589f5bb0a9e5ffe31d9119de953881a26e (diff) | |
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>
| -rw-r--r-- | zebra/zebra_evpn_neigh.c | 12 | ||||
| -rw-r--r-- | zebra/zebra_evpn_neigh.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index bb848255d0..e4f38008ac 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -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); diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index 4b98266c86..50efdc0e0d 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -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; }; |
