Skip to content
This repository has been archived by the owner on Feb 10, 2018. It is now read-only.

fixes #176 get_facts uptime against patch in pyeznc 2.1.5 #205

Merged
merged 2 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
David Barroso <dbarrosop@dravetech.com>
Elisa Jasinska <elisa@bigwaveit.org>
John Anderson <lampwins@gmail.com>
7 changes: 2 additions & 5 deletions napalm_junos/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
# import NAPALM Base
import napalm_base.helpers
from napalm_base.base import NetworkDriver
from napalm_base.utils import string_parsers
from napalm_base.utils import py23_compat
import napalm_junos.constants as C
from napalm_base.exceptions import ConnectionException
Expand Down Expand Up @@ -256,9 +255,7 @@ def get_facts(self):
"""Return facts of the device."""
output = self.device.facts

uptime = '0'
if 'RE0' in output:
uptime = output['RE0']['up_time']
uptime = self.device.uptime or -1

interfaces = junos_views.junos_iface_table(self.device)
interfaces.get()
Expand All @@ -271,7 +268,7 @@ def get_facts(self):
'os_version': py23_compat.text_type(output['version']),
'hostname': py23_compat.text_type(output['hostname']),
'fqdn': py23_compat.text_type(output['fqdn']),
'uptime': string_parsers.convert_uptime_string_seconds(uptime),
'uptime': uptime,
'interface_list': interface_list
}

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
napalm-base>=0.24.1
junos-eznc>=2.1.3
junos-eznc>=2.1.5
5 changes: 5 additions & 0 deletions test/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def __init__(self):
'vc_capable': False,
'personality': 'SRX_BRANCH'
}
self._uptime = 4380

@property
def facts(self):
Expand All @@ -88,6 +89,10 @@ def facts(self):
self._facts = self.default_facts
return self._facts

@property
def uptime(self):
return self._uptime

def open(self):
pass

Expand Down