Merge branch 'develop' into napalm3

This commit is contained in:
Piotr Pieprzycki
2020-05-17 23:43:38 +02:00
committed by GitHub
4 changed files with 95 additions and 1 deletions

View File

@@ -343,6 +343,7 @@ class VyOSDriver(NetworkDriver):
"is_enabled": bool(is_enabled),
"description": description,
"last_flapped": float(-1),
"mtu": -1,
"speed": int(speed),
"mac_address": hw_id,
}
@@ -584,6 +585,29 @@ class VyOSDriver(NetworkDriver):
(minutes * self._MINUTE_SECONDS) + seconds)
return uptime
def get_lldp_neighbors(self):
# Multiple neighbors per port are not implemented
# The show lldp neighbors commands lists port descriptions, not IDs
output = self.device.send_command("show lldp neighbors detail")
pattern = r'''(?s)Interface: +(?P<interface>\S+), [^\n]+
.+?
+SysName: +(?P<hostname>\S+)
.+?
+PortID: +ifname (?P<port>\S+)'''
def _get_interface(match):
return [
{
'hostname': match.group('hostname'),
'port': match.group('port'),
}
]
return {
match.group('interface'): _get_interface(match)
for match in re.finditer(pattern, output)
}
def get_interfaces_counters(self):
# 'rx_unicast_packet', 'rx_broadcast_packets', 'tx_unicast_packets',
# 'tx_multicast_packets' and 'tx_broadcast_packets' are not implemented yet