Improves error detection

This commit is contained in:
Pierre Lannoy 2024-03-12 09:16:38 +01:00
commit 8476bd3c73
Signed by: Pierre Lannoy
GPG key ID: D27231EF87D53F31

View file

@ -52,6 +52,7 @@ class LLDP():
def get_switch_ip(self, interface): def get_switch_ip(self, interface):
# lldp.eth0.chassis.mgmt-ip=100.66.7.222 # lldp.eth0.chassis.mgmt-ip=100.66.7.222
return None
if self.data['lldp'].get(interface) is None: if self.data['lldp'].get(interface) is None:
return None return None
return self.data['lldp'][interface]['chassis'].get('mgmt-ip') return self.data['lldp'][interface]['chassis'].get('mgmt-ip')