Adds error management for lldp
This commit is contained in:
parent
74c8876984
commit
fee663856f
1 changed files with 3 additions and 3 deletions
|
|
@ -51,7 +51,7 @@ class LLDP():
|
|||
return output_dict
|
||||
|
||||
def get_switch_ip(self, interface):
|
||||
if self.data['lldp'] is None:
|
||||
if 'lldp' not in self.data:
|
||||
return None
|
||||
# lldp.eth0.chassis.mgmt-ip=100.66.7.222
|
||||
if self.data['lldp'].get(interface) is None:
|
||||
|
|
@ -59,7 +59,7 @@ class LLDP():
|
|||
return self.data['lldp'][interface]['chassis'].get('mgmt-ip')
|
||||
|
||||
def get_switch_port(self, interface):
|
||||
if self.data['lldp'] is None:
|
||||
if 'lldp' not in self.data:
|
||||
return None
|
||||
# lldp.eth0.port.descr=GigabitEthernet1/0/1
|
||||
if self.data['lldp'].get(interface) is None:
|
||||
|
|
@ -69,7 +69,7 @@ class LLDP():
|
|||
return self.data['lldp'][interface]['port']['descr']
|
||||
|
||||
def get_switch_vlan(self, interface):
|
||||
if self.data['lldp'] is None:
|
||||
if 'lldp' not in self.data:
|
||||
return None
|
||||
# lldp.eth0.vlan.vlan-id=296
|
||||
if self.data['lldp'].get(interface) is None:
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue