napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.2k stars 547 forks source link

local variable 'system_temp' referenced before assignment - get_environment, napalm-ios 0.8.1 #582

Closed slinderud closed 6 years ago

slinderud commented 6 years ago

Using netbox and trying to retrieve data via napalm. Getting the error "local variable 'system_temp' referenced before assignment"

kcelenza from slack suggested this could be related to different output from sh env temp status. Looks like he's correct:

sh environment temperature status

Inlet Temperature Value: 25 Degree Celsius Temperature State: GREEN Yellow Threshold : 46 Degree Celsius Red Threshold : 56 Degree Celsius

Hotspot Temperature Value: 38 Degree Celsius Temperature State: GREEN Yellow Threshold : 105 Degree Celsius Red Threshold : 125 Degree Celsius

This output is from a 3850 running IOS-XE 16.06

expected:

https://github.com/napalm-automation/napalm/blob/develop/test/ios/mocked_data/test_get_environment/normal/show_env_temperature_status.txt

cspeidel commented 6 years ago

Can you provide output for the following commands in case there are other quirks in get_environment:

show memory statistics show proc cpu

slinderud commented 6 years ago

Sure.

https://pastebin.com/0LsHHsuQ

ktbyers commented 6 years ago

Okay, someone will have to do a PR to create a fix...to handle the output variations in the command.