get_lldp_neighbours tests for SG350X-48P-K9

This commit is contained in:
Petr Klima committed 2020-11-03 15:22:11 +01:00
1 parent 231574090e
commit 89c020d1d4
4 files changed
+44 -8

No files matched your search

+12 -2
View File
@@ -369,16 +369,26 @@ class S350Driver(NetworkDriver):
#output = self._send_command('show lldp neighbors | begin \ \ Port') #output = self._send_command('show lldp neighbors | begin \ \ Port')
output = self._send_command('show lldp neighbors') output = self._send_command('show lldp neighbors')
for line in output.splitlines()[2:]: header = True # cycle trought header
for line in output.splitlines():
if header:
# last line of header
match = re.match(r'^--------- -+ .*$', line)
if match:
header = False
continue
line_elems = line.split() line_elems = line.split()
local_port = line_elems[0] local_port = line_elems[0]
remote_port = line_elems[2] remote_port = line_elems[2]
remote_name = line_elems[3] remote_name = line_elems[3]
neighbors[local_port] = { neighbor = {
'hostname': remote_name, 'hostname': remote_name,
'port': remote_port, 'port': remote_port,
} }
neighbor_list= [ neighbor, ]
neighbors[local_port] = neighbor_list
return neighbors return neighbors
@@ -6,7 +6,9 @@ TP - Two Ports MAC Relay; S - S-VLAN; C - C-VLAN; O - Other
Port Device ID Port ID System Name Capabilities TTL Port Device ID Port ID System Name Capabilities TTL
--------- ----------------- ----------------- ----------------- ------------ ----- --------- ----------------- ----------------- ----------------- ------------ -----
gi1/0/37 b0:b8:67:c2:32:aa b0:b8:67:c2:32:aa AM W 110 gi1/0/1 74:ac:aa:ff:1a:5f 74:ac:aa:ff:1a:5f UBNT B, W 90
te1/0/3 00:8e:73:24:5d:e2 gi28 sw1 B, R 116 gi1/0/35 34:e6:aa:ff:53:a8 34:e6:aa:ff:53:a8 O 3119
te1/0/4 sw2 te1/0/4 sw2 B, R 100 te1/0/1 00:16:ff:aa:bb:00 Gi0/23 swzdsadas-vedc B 107
te1/0/3 00:8e:ff:aa:bb:e2 gi28 sw1dsafdsfsdfsdd B, R 95
te1/0/4 sw2dsdfssddfd te1/0/4 sw2dsdfssddfd B, R 105
@@ -0,0 +1,22 @@
{
"gi1/0/1" : [ {
"hostname" : "UBNT",
"port" : "74:ac:aa:ff:1a:5f"
} ],
"gi1/0/35" : [ {
"hostname" : "O",
"port" : "34:e6:aa:ff:53:a8"
} ],
"te1/0/1" : [ {
"hostname" : "swzdsadas-vedc",
"port" : "Gi0/23"
} ],
"te1/0/3" : [ {
"hostname" : "sw1dsafdsfsdfsdd",
"port" : "gi28"
} ],
"te1/0/4" : [ {
"hostname" : "sw2dsdfssddfd",
"port" : "te1/0/4"
} ]
}
@@ -6,7 +6,9 @@ TP - Two Ports MAC Relay; S - S-VLAN; C - C-VLAN; O - Other
Port Device ID Port ID System Name Capabilities TTL Port Device ID Port ID System Name Capabilities TTL
--------- ----------------- ----------------- ----------------- ------------ ----- --------- ----------------- ----------------- ----------------- ------------ -----
gi1/0/37 b0:b8:67:c2:32:aa b0:b8:67:c2:32:aa AM W 110 gi1/0/1 74:ac:aa:ff:1a:5f 74:ac:aa:ff:1a:5f UBNT B, W 90
te1/0/3 00:8e:73:24:5d:e2 gi28 sw1 B, R 116 gi1/0/35 34:e6:aa:ff:53:a8 34:e6:aa:ff:53:a8 O 3119
te1/0/4 sw2 te1/0/4 sw2 B, R 100 te1/0/1 00:16:ff:aa:bb:00 Gi0/23 swzdsadas-vedc B 107
te1/0/3 00:8e:ff:aa:bb:e2 gi28 sw1dsafdsfsdfsdd B, R 95
te1/0/4 sw2dsdfssddfd te1/0/4 sw2dsdfssddfd B, R 105