From fa3b454d58eb22df2503537d26537f57a82f6cc9 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Mon, 20 Nov 2023 14:25:25 +0100 Subject: [PATCH] interface: Add check if there is already the same ipv4_address_secondary configured for avoid 500 error --- pyaoscx/interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyaoscx/interface.py b/pyaoscx/interface.py index 54273e2..d79576c 100644 --- a/pyaoscx/interface.py +++ b/pyaoscx/interface.py @@ -1328,7 +1328,9 @@ def configure_loopback(self, vrf, ipv4=None, description=None): if i == 0: self.ip4_address = ipv4[i] else: - self.ip4_address_secondary.append(ipv4[i]) + #Check if there is already the same ip4_address_secondary configured + if ipv4[i] not in self.ip4_address_secondary: + self.ip4_address_secondary.append(ipv4[i]) # If IPv4 is empty, delete elif ipv4 == []: self.ip4_address = None @@ -1338,7 +1340,6 @@ def configure_loopback(self, vrf, ipv4=None, description=None): self.description = description # Set all remaining attributes to create a loopback - # when configuring a loopback interface, it must be powered on self.admin_state = "up"