From 9d496c685408da548accf9d6686ced5274e4dfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Compagnon?= Date: Mon, 21 Aug 2023 20:39:26 +0200 Subject: [PATCH] Check if it's a VM before running lldp related actions --- netbox_agent/network.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox_agent/network.py b/netbox_agent/network.py index e24a229..8630cc7 100644 --- a/netbox_agent/network.py +++ b/netbox_agent/network.py @@ -213,7 +213,7 @@ class Network(object): def reset_vlan_on_interface(self, nic, interface): update = False vlan_id = nic['vlan'] - lldp_vlan = self.lldp.get_switch_vlan(nic['name']) if config.network.lldp else None + lldp_vlan = self.lldp.get_switch_vlan(nic['name']) if config.network.lldp and isinstance(self, ServerNetwork) else None # For strange reason, we need to get the object from scratch # The object returned by pynetbox's save isn't always working (since pynetbox 6) interface = self.nb_net.interfaces.get(id=interface.id) @@ -301,7 +301,7 @@ class Network(object): interface.save() # cable the interface - if config.network.lldp: + if config.network.lldp and isinstance(self, ServerNetwork): switch_ip = self.lldp.get_switch_ip(interface.name) switch_interface = self.lldp.get_switch_port(interface.name) @@ -478,7 +478,7 @@ class Network(object): interface.lag = None # cable the interface - if config.network.lldp: + if config.network.lldp and isinstance(self, ServerNetwork): switch_ip = self.lldp.get_switch_ip(interface.name) switch_interface = self.lldp.get_switch_port(interface.name) if switch_ip and switch_interface: