Closed dhoutz closed 8 years ago
Verified this bug on an MX80 as well:
>>> import napalm
>>> driver = napalm.get_network_driver('junos')
>>> mx = driver(hostname='10.0.0.66', username='root', password='juniper1')
>>> mx.open()
>>> mx.get_environment()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/napalm_junos/junos.py", line 288, in get_environment
float(structured_object_data['temperature'])
TypeError: float() argument must be a string or a number
I believe this issue is primarily being caused because on the MX, Junos is erroneously reporting the PEMs as being of Class "Temp" (but providing no Temperature) instead of Class "Power" like it does on other platforms. Examples below:
bdale@lab-mx80a> show chassis environment | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1F4/junos">
<environment-information xmlns="http://xml.juniper.net/junos/15.1F4/junos-chassis">
<environment-item>
<name>PEM 0</name>
<class>Temp</class> <-------
<status>OK</status>
</environment-item>
<environment-item>
<name>PEM 1</name>
<class>Temp</class> <-------
<status>Absent</status>
</environment-item>
<environment-item>
<name>RE 0 Intake</name>
<class>Temp</class>
<status>OK</status>
<temperature junos:celsius="35">35 degrees C / 95 degrees F</temperature>
</environment-item>
bdale@ex42vc# run show chassis environment | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1R4/junos">
<environment-information xmlns="http://xml.juniper.net/junos/15.1R4/junos-chassis">
<environment-item>
<name>FPC 0 Power Supply 0</name>
<class>Power</class> <-------
<status>OK</status>
</environment-item>
<environment-item>
<name>FPC 0 Power Supply 1</name>
<class>Power</class> <-------
<status>Absent</status>
</environment-item>
<environment-item>
<name>FPC 1 Power Supply 0</name>
<class>Power</class>
<status>OK</status>
</environment-item>
<environment-item>
<name>FPC 1 Power Supply 1</name>
<class>Power</class>
<status>OK</status>
</environment-item>
<environment-item>
<name>FPC 0 CPU</name>
<class>Temp</class>
<status>OK</status>
<temperature junos:celsius="38">38 degrees C / 100 degrees F</temperature>
</environment-item>
Description of Issue/Question
Running get_environment against MX240 failed with the following error:
Traceback (most recent call last): File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/napalm_junos/junos.py", line 288, in get_environment
float(structured_object_data['temperature'])
TypeError: float() argument must be a string or a number
Other NAPALM function do work correctly with the device
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
Setup
napalm-junos version
(Paste verbatim output from
pip freeze | grep napalm-junos
between quotes below)JunOS version
(Paste verbatim output from
show version and haiku
between quotes below)Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)