Skip to content

Commit

Permalink
Merge pull request #1966 from jlixfeld/last_flapped
Browse files Browse the repository at this point in the history
Use `LastStateTransitionTime` to populate `last_flapped` for `get_interfaces()` in IOS-XR
  • Loading branch information
mirceaulinic authored Mar 21, 2024
2 parents aa91517 + f4a73a4 commit f432be6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions napalm/iosxr/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ def get_interfaces(self):

mtu = int(napalm.base.helpers.find_txt(interface_tree, "MTU"))
description = napalm.base.helpers.find_txt(interface_tree, "Description")
last_flapped = napalm.base.helpers.convert(
float,
napalm.base.helpers.find_txt(
interface_tree, "LastStateTransitionTime", -1
),
-1,
)
interfaces[interface_name] = copy.deepcopy(INTERFACE_DEFAULTS)
interfaces[interface_name].update(
{
Expand All @@ -311,6 +318,9 @@ def get_interfaces(self):
"is_enabled": enabled,
"mac_address": mac_address,
"description": description,
"last_flapped": last_flapped / 1e9
if last_flapped != -1.0
else -1.0,
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@
<StateTransitionCount>
0
</StateTransitionCount>
<LastStateTransitionTime>
1682947558700282575
</LastStateTransitionTime>
<IsDampeningEnabled>
false
</IsDampeningEnabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"TenGigE0/0/0/14": {
"is_enabled": true,
"description": "",
"last_flapped": -1.0,
"last_flapped": 1682947558.7002826,
"is_up": false,
"mac_address": "E0:AC:F1:64:71:52",
"mtu": 1514,
Expand Down

0 comments on commit f432be6

Please sign in to comment.