nxos get_environment does not parse power supply output with alternate key name #1372
Closed
1 task done
Labels
Milestone
Description of Issue/Question
Some Nexus models or NXOS versions have a different key for the power load. The function is expecting 'watts' but some switches return the key 'actual_out' instead.
I propose the following update to the _process_pdus() function in nxos.py
'''
< normalized[psinfo["psnum"]]["output"] = float(psinfo.get("watts", -1.0))
'''
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an
x
between the square brackets where applicable)Setup
napalm version
(Paste verbatim output from
pip freeze | grep napalm
between quotes below)Network operating system version
(Paste verbatim output from
show version
- or equivalent - between quotes below)Steps to Reproduce the Issue
The output is shown as -1 from the following command
'''
salt my_router napalm.call get_environment
my_router:
----------
comment:
out:
----------
cpu:
----------
0:
----------
%usage:
-1.0
fans:
----------
Fan1(sys_fan1):
----------
status:
True
memory:
----------
available_ram:
178000
used_ram:
55000
power:
----------
1:
----------
capacity:
3000.0
output:
-1.0
status:
True
2:
----------
capacity:
0.0
output:
-1.0
status:
False
'''
Here is what you get from the rpc call:
'''
salt sb1agrt732 napalm.nxos_api_rpc 'show environment'
sb1agrt732:
|_
----------
command:
show environment
id:
1
jsonrpc:
2.0
result:
----------
body:
----------
powersup:
----------
TABLE_psinfo:
----------
ROW_psinfo:
|_
----------
actual_out:
782 W
ps_status:
Ok
psmodel:
N7K-AC-3KW
psnum:
1
tot_capa:
3000 W
|_
----------
actual_out:
0 W
ps_status:
Shutdown
psmodel:
N7K-AC-3KW
psnum:
2
tot_capa:
0 W
|_
'''
Error Traceback
(Paste the complete traceback of the exception between quotes below)
The text was updated successfully, but these errors were encountered: