Skip to content

Commit

Permalink
Merge branch 'develop' into feature/cisco_ios_get_probes_results
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic authored Sep 1, 2020
2 parents d1979cd + 4b17b93 commit b570363
Show file tree
Hide file tree
Showing 4 changed files with 720 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
author="David Barroso, Kirk Byers, Mircea Ulinic",
author_email="dbarrosop@dravetech.com, ping@mirceaulinic.net, ktbyers@twb-tech.com",
description="Network Automation and Programmability Abstraction Layer with Multivendor support",
license="Apache 2.0",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Topic :: Utilities",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
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

0 comments on commit b570363

Please sign in to comment.