From a5901375dfd53b5859af6d5b8a01c4287ef045d1 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 22 Dec 2020 17:18:53 +0100 Subject: [PATCH] Cast uptime values to int before processing I ran into a TypeError here: TypeError: unsupported operand type(s) for +=: 'int' and 'str' Casting the uptime values (days, hours, mins, seconds) to int before processing fixes this issue. --- napalm/nxos/nxos.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/napalm/nxos/nxos.py b/napalm/nxos/nxos.py index 47a3c198b..ad14ed537 100644 --- a/napalm/nxos/nxos.py +++ b/napalm/nxos/nxos.py @@ -837,10 +837,10 @@ def get_facts(self): "sys_ver_str", show_version.get("kickstart_ver_str", "") ) - uptime_days = show_version.get("kern_uptm_days", 0) - uptime_hours = show_version.get("kern_uptm_hrs", 0) - uptime_mins = show_version.get("kern_uptm_mins", 0) - uptime_secs = show_version.get("kern_uptm_secs", 0) + uptime_days = int(show_version.get("kern_uptm_days", 0)) + uptime_hours = int(show_version.get("kern_uptm_hrs", 0)) + uptime_mins = int(show_version.get("kern_uptm_mins", 0)) + uptime_secs = int(show_version.get("kern_uptm_secs", 0)) uptime = 0 uptime += uptime_days * 24 * 60 * 60