Skip to content

Commit

Permalink
Merge pull request #286 from aj-cruz/eos-vlan-fix
Browse files Browse the repository at this point in the history
Fix Arista EOS Driver get_vlans
  • Loading branch information
jvanderaa authored Nov 21, 2022
2 parents 79d597a + 9ecb922 commit 1872b82
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions network_importer/drivers/arista_eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def get_vlans(task: Task) -> Result:

nr_device = task.host.get_connection("napalm", task.nornir.config)
eos_device = nr_device.device
results = eos_device.run_commands(["show vlan"])
device_results = eos_device.run_commands(["show vlan"])

if not isinstance(results[0], dict) or "vlans" not in results[0]:
if not isinstance(device_results[0], dict) or "vlans" not in device_results[0]:
LOGGER.warning("%s | No vlans information returned", task.host.name)
return Result(host=task.host, result=False)

for vid, data in results[0]["vlans"].items():
results.vlans.append(Vlan(name=data["name"], id=vid))
for vid, data in device_results[0]["vlans"].items():
results.vlans.append(Vlan(name=data["name"], vid=int(vid)))

return Result(host=task.host, result=results)
return Result(host=task.host, result=results.dict())

0 comments on commit 1872b82

Please sign in to comment.