Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxos get_environment does not check for power supply status as 'ok' or 'Ok' #1371

Closed
1 task done
kaibabbob opened this issue Feb 11, 2021 · 2 comments
Closed
1 task done

Comments

@kaibabbob
Copy link

Description of Issue/Question

Some models or maybe versions report a good power supply status as “Ok” and others as lower case “ok”

The _process_pdus() function in nxos.py only looks for the lower case string and so reports a failed power supply that was "Ok".

I propose as the fix to change the return value to lower case before comparing to 'ok'

'''
psinfo.get("ps_status", "ok").lower() == "ok"
'''

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

(Place an x between the square brackets where applicable)

  • Yes
  • [] No

Setup

napalm version

(Paste verbatim output from pip freeze | grep napalm between quotes below)

napalm==3.2.0
napalm-panos==0.5.2

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html
Copyright (c) 2002-2019, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php

Software
  BIOS:      version 2.12.0
  kickstart: version 7.3(5)D1(1)
  system:    version 7.3(5)D1(1)
  BIOS compile time:       05/29/2013
  kickstart image file is: bootflash:///n7000-s2-kickstart.7.3.5.D1.1.bin
  kickstart compile time:  9/30/2019 21:00:00 [11/09/2019 05:55:30]
  system image file is:    bootflash:///n7000-s2-dk9.7.3.5.D1.1.bin
  system compile time:     9/30/2019 21:00:00 [11/09/2019 08:12:42]


Hardware
  cisco Nexus7000 C7004 (4 Slot) Chassis ("Supervisor Module-2")
  Intel(R) Xeon(R) CPU         with 32940104 kB of memory.
  Processor Board ID xxxx

  Device name: my_router
  bootflash:    1966080 kB
  slot0:              0 kB (expansion flash)

Kernel uptime is 352 day(s), 3 hour(s), 58 minute(s), 46 second(s)

Last reset at 966994 usecs after  Tue Feb 25 09:19:35 2020

  Reason: Reset due to upgrade
  System version: 7.3(3)D1(1)
  Service:

plugin
  Core Plugin, Ethernet Plugin

Active Package(s)

Steps to Reproduce the Issue

I executed the napalm call from saltstack:

'''
salt my_router napalm.call get_environment
sb1agrt732:
----------
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:
786.0
status:
False
2:
----------
capacity:
0.0
output:
0.0
status:
False
'''

While running the RPC call shows the switch was returning the power supply status as 'Ok':

'''
salt my_router napalm.nxos_api_rpc 'show environment'
my_router:
|_
----------
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)

no traceback
@kaibabbob
Copy link
Author

with further testing on additional Nexus switches, it turns out that each of the other places in the file where "ok" or "Ok" are checked need to be converted to lower case and compared with 'ok'

@mirceaulinic
Copy link
Member

Resolved via #1809.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants