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

Add get_vlans getter to EOS network driver #1279

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1990,3 +1990,16 @@ def ping(
)
ping_dict["success"].update({"results": results_array})
return ping_dict

def get_vlans(self):
command = ["show vlan"]
output = self.device.run_commands(command, encoding="json")[0]["vlans"]

vlans = {}
for vlan, vlan_config in output.items():
vlans[vlan] = {
"name": vlan_config["name"],
"interfaces": list(vlan_config["interfaces"].keys()),
}

return vlans
4 changes: 2 additions & 2 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -3047,8 +3047,8 @@ def get_route_to(self, destination="", protocol="", longer=False):
destination, _vrf, nh, ip_version
)
nh_line_found = (
False
) # for next RT entry processing ...
False # for next RT entry processing ...
)
routes[route_match].append(route_entry)
return routes

Expand Down
216 changes: 216 additions & 0 deletions test/eos/mocked_data/test_get_vlans/normal/expected_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"1": {
"name": "default",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet3",
"Ethernet4",
"Ethernet49/1",
"Ethernet50/1"
]
},
"10": {
"name": "VLAN0010",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"11": {
"name": "VLAN0011",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"12": {
"name": "VLAN0012",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"13": {
"name": "VLAN0013",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"14": {
"name": "VLAN0014",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"15": {
"name": "VLAN0015",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet49/1",
"Ethernet50/1"
]
},
"100": {
"name": "VLAN0100",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"101": {
"name": "VLAN0101",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"102": {
"name": "VLAN0102",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"103": {
"name": "VLAN0103",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"104": {
"name": "VLAN0104",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"105": {
"name": "VLAN0105",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet1/1/1",
"Ethernet2/1/1",
"Ethernet3/1/1"
]
},
"200": {
"name": "VLAN0200",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"201": {
"name": "VLAN0201",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"202": {
"name": "VLAN0202",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"203": {
"name": "VLAN0203",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"204": {
"name": "VLAN0204",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"205": {
"name": "VLAN0205",
"interfaces": [
"Port-Channel1",
"Ethernet1",
"Ethernet2",
"Ethernet4/1/1",
"Ethernet4/1/2",
"Ethernet4/1/3",
"Ethernet4/1/4"
]
},
"1000": {
"name": "VLAN1000",
"interfaces": []
}
}
Loading