napalm icon indicating copy to clipboard operation
napalm copied to clipboard

Cisco IOS , UnboundLocalError exception in get_environment

Open z2mi opened this issue 3 years ago • 0 comments

Description of Issue/Question

Note: Please check https://guides.github.com/features/mastering-markdown/ to see how to properly format your request.

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

(Place an x between the square brackets where applicable)

  • [x] Yes
  • [] No

Setup

napalm version

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

napalm==3.3.1

Network operating system version

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

Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Mon 28-Jan-13 10:28 by prod_rel_team
Image text-base: 0x00003000, data-base: 0x01B00000

ROM: Bootstrap program is Alpha board boot loader
BOOTLDR: C2960S Boot Loader (C2960S-HBOOT-M) Version 12.2(55r)SE, RELEASE SOFTWARE (fc1)

F5-SW1 uptime is 28 weeks, 1 day, 7 hours, 54 minutes
System returned to ROM by power-on
System restarted at 10:03:02 UTC Sat Feb 6 2021
System image file is "flash:/c2960s-universalk9-mz.122-55.SE7/c2960s-universalk9-mz.122-55.SE7.bin"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
[email protected].

cisco WS-C2960S-48TS-L (PowerPC) processor (revision J0) with 131072K bytes of memory.
Processor board ID FOC1823Z3VY
Last reset from power-on
3 Virtual Ethernet interfaces
1 FastEthernet interface
52 Gigabit Ethernet interfaces
The password-recovery mechanism is enabled.

512K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address       : 50:1C:BF:22:53:00
Motherboard assembly number     : 73-17923-09
Power supply part number        : 352-0327-04
Motherboard serial number       : FOC22210EZW
Power supply serial number      : DCA1926M1B3
Model revision number           : J0
Motherboard revision number     : A0
Model number                    : WS-C2960S-48TS-L
Daughterboard assembly number   : 72-14733-05
Daughterboard serial number     : FOC18265LQY
System serial number            : FOC1593Z3VY
Top Assembly Part Number        : 800-56998-04
Top Assembly Revision Number    : B0
Version ID                      : V05
CLEI Code Number                : CONGQ00BRD
Daughterboard revision number   : A0
Hardware Board Revision Number  : 0x01


Switch Ports Model              SW Version            SW Image
------ ----- -----              ----------            ----------
*    1 52    WS-C2960S-48TS-L   12.2(55)SE7           C2960S-UNIVERSALK9-M


Configuration register is 0xF

Steps to Reproduce the Issue

In running

napalm --vendor ios --user <username> --password <password> <device-ip> call get_environment

output of the device for command show env temperature status

Temperature Value: 37 Degree Celsius
Temperature State: GREEN
Yellow Threshold : 50 Degree Celsius
Red Threshold    : 60 Degree Celsius

Error Traceback

(Paste the complete traceback of the exception between quotes below)

2021-08-22 19:17:52,006 - napalm - ERROR - method - Failed: local variable 'temp_value' referenced before assignment

================= Traceback =================

Traceback (most recent call last):
  File "/home/ubuntu/venv/bin/napalm", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/venv/lib/python3.8/site-packages/napalm/base/clitools/cl_napalm.py", line 308, in main
    run_tests(args)
  File "/home/ubuntu/venv/lib/python3.8/site-packages/napalm/base/clitools/cl_napalm.py", line 291, in run_tests
    call_getter(device, args.method, **method_kwargs)
  File "/home/ubuntu/venv/lib/python3.8/site-packages/napalm/base/clitools/cl_napalm.py", line 27, in wrapper
    r = func(*args, **kwargs)
  File "/home/ubuntu/venv/lib/python3.8/site-packages/napalm/base/clitools/cl_napalm.py", line 255, in call_getter
    r = func(**kwargs)
  File "/home/ubuntu/venv/lib/python3.8/site-packages/napalm/ios/ios.py", line 2259, in get_environment
    if temp_value > system_temp_alert:
UnboundLocalError: local variable 'temp_value' referenced before assignment

z2mi avatar Aug 22 '21 15:08 z2mi