From 9ecb9227effd57b9a4fe9708b61a5666abb3a8bc Mon Sep 17 00:00:00 2001 From: AJ Cruz Date: Thu, 10 Nov 2022 09:20:09 -0600 Subject: [PATCH] Fix Arista EOS Driver get_vlans --- network_importer/drivers/arista_eos.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/network_importer/drivers/arista_eos.py b/network_importer/drivers/arista_eos.py index 37e2d6c5..06b111b7 100644 --- a/network_importer/drivers/arista_eos.py +++ b/network_importer/drivers/arista_eos.py @@ -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())