do not make netbox call if lldp doesnt return switch ip and interface (#54)

This commit is contained in:
Solvik 2019-09-03 11:57:17 +02:00 committed by GitHub
parent 197a8babaf
commit c5707e8413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -307,7 +307,7 @@ class Network():
switch_ip = self.lldp.get_switch_ip(interface.name)
switch_interface = self.lldp.get_switch_port(interface.name)
if switch_ip is not None and switch_interface is not None:
if switch_ip and switch_interface:
nic_update, interface = self.create_or_update_cable(
switch_ip, switch_interface, interface
)
@ -569,10 +569,11 @@ class Network():
if NETWORK_LLDP:
switch_ip = self.lldp.get_switch_ip(interface.name)
switch_interface = self.lldp.get_switch_port(interface.name)
ret, interface = self.create_or_update_cable(
switch_ip, switch_interface, interface
)
nic_update += ret
if switch_ip and switch_interface:
ret, interface = self.create_or_update_cable(
switch_ip, switch_interface, interface
)
nic_update += ret
if nic['ip']:
# sync local IPs