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

vEOS switch device - 'get_environment' fails due to "missing power supplies" #1986

Open
1 task done
sygibson opened this issue Aug 1, 2023 · 3 comments
Open
1 task done

Comments

@sygibson
Copy link

sygibson commented Aug 1, 2023

Description of Issue/Question

On a Virtual EOS Arista device, execute get_environment fails because the virtual environment does not have any defined power supplies connected. Running the get_environment command results in a Python stack trace as noted below.

Expected results

Should not stacktrace barf when running in Virtual EOS environment due to missing Power Supplies.

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==4.1.0
napalm-aos==0.3.0
napalm-aruba-cx==0.1.4
napalm-arubaos-switch==0.2.0
napalm-asa==0.1.4
napalm-ce==0.2.0
napalm-ciena-saos==0.1.0
napalm-dellos10==1.0.7
napalm-dlink==0.1.0
napalm-fsos-ssh==1.0.2
napalm-ftos==0.1.2
napalm-huawei-vrp==1.1.0
napalm-mos==4.0.1
napalm-oneaccess-oneos==0.1.3
napalm-opengear==0.3.6
napalm-ros==1.2.4
napalm-ruckus-fastiron==1.0.26
napalm-s350==0.3.1
napalm-sros==1.0.0
napalm-vyos==0.2.1
napalm-yang==0.1.0

Network operating system version

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

Arista vEOS-lab
Hardware version:
Serial number: 429F6A1989123487E3409B030A5412B4
Hardware MAC address: 3aa4.bd14.5ec7
System MAC address: 3aa4.bd14.5ec7

Software image version: 4.28.3M
Architecture: x86_64
Internal build version: 4.28.3M-28837868.4283M
Internal build ID: e950541d-fc75-4ced-a669-6fd2007c17b7
Image format version: 1.0
Image optimization: None

Uptime: 7 hours and 27 minutes
Total memory: 3999888 kB
Free memory: 2737676 kB

Steps to Reproduce the Issue

napalm --vendor ios --user <username> --password <password> <device-ip> call get_environment
# technically via Python:
import json
from napalm import get_network_driver
driver = get_network_driver('eos')
with driver('10.1.1.28', 'admin', '...snip...' ,optional_args={"port": 443}) as device:
  environ = device.get_environment()

Error Traceback

NAPALM didn't catch this exception. Please, fill a bugfix on https://github.com/napalm-automation/napalm/issues
Don't forget to include this traceback.
Traceback (most recent call last):
File "/tmp/py/./inv.py", line 27, in <module>
environ = device.get_environment()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/napalm/eos/eos.py", line 838, in get_environment
fans_output, temp_output, power_output = self._run_commands(commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/napalm/eos/eos.py", line 289, in _run_commands
return self.device.run_commands(commands, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/napalm/eos/pyeapi_syntax_wrapper.py", line 42, in run_commands
return super(Node, self).run_commands(commands, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pyeapi/client.py", line 887, in run_commands
response = self._connection.execute(commands, encoding, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pyeapi/eapilib.py", line 627, in execute
response = self.send(request)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pyeapi/eapilib.py", line 461, in send
raise CommandError(code, msg, command_error=err, output=out)
pyeapi.eapilib.CommandError: Error [1000]: CLI command 4 of 4 'show environment power' failed: could not run command [defaultZones: False, numCoolingZones: [], coolingMode: 'automatic', shutdownOnInsufficientFans:True, airflowDirection: 'unknownAirflowDirection', overrideFanSpeed: 0, powerSupplySlots: [], fanTraySlots: [], minFanSpeed: 0, currentZones: 1, configuredZones: 0, systemStatus: 'unknownCoolingAlarmLevel', powercycleOnOverheat: False, ambientThreshold: 45, cardSlots: [], powerSupplySlots: [], shutdownOnOverheat: True, tempSensors: [], systemStatus: 'unknownTemperatureAlarmLevel', recoveryModeOnOverheat: 'recoveryModeNA',errors: ['There seem to be no power supplies connected.']]
@bewing
Copy link
Member

bewing commented Aug 1, 2023

Can you provide the output of
show version | json
for your virtual device? I believe I may have already fixed this in a branch I am working on
2a0e36d

@sygibson
Copy link
Author

sygibson commented Aug 1, 2023

@bewing - thank you for the fast response ... here's the output as requested:

{
"imageFormatVersion": "1.0",
"uptime": 87150.18,
"modelName": "vEOS-lab",
"internalVersion": "4.28.3M-28837868.4283M",
"memTotal": 3999888,
"mfgName": "Arista",
"serialNumber": "429F6A1989123487E3409B030A5412B4",
"systemMacAddress": "3a:a4:bd:14:5e:c7",
"bootupTimestamp": 1690830021.0080218,
"memFree": 2737172,
"version": "4.28.3M",
"configMacAddress": "00:00:00:00:00:00",
"isIntlVersion": false,
"imageOptimization": "None",
"internalBuildId": "e950541d-fc75-4ced-a669-6fd2007c17b7",
"hardwareRevision": "",
"hwMacAddress": "00:00:00:00:00:00",
"architecture": "x86_64"
}

Incidentally - I apologize for semi-hijacking this - do you know of any Cisco IOS similar virtual switch/router appliances like the vEOS? NOT the Nexus stuff. I need a pure IOS like device. I build automation for infrastructure, and we're adding in the NAPALM fabulous stuff for general switch/router capabilities.

sygibson referenced this issue Aug 1, 2023
Use new-format "show system ..." command for environment
Update to also detect cEOS systems not having power supplies
@sygibson
Copy link
Author

sygibson commented Aug 1, 2023

Commented on line 823 of napalm/eos/eos.py:

2a0e36d#diff-c33f60453329944c74a7bdfb2416f90a5fe0debffbe70a7aefb83a07dc6c81d0R823

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

3 participants