From 343a59b376e3124e65f5b45b4e9b4d9a495dfd82 Mon Sep 17 00:00:00 2001
From: Pim van Pelt <pim@ipng.nl>
Date: Mon, 18 Jul 2022 07:37:00 +0000
Subject: [PATCH] bugfix: remove addresses also when there is a diff, not only
 when the interface is not present; remove duplicate block of code

---
 vppcfg/vpp/reconciler.py | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/vppcfg/vpp/reconciler.py b/vppcfg/vpp/reconciler.py
index 73ff406..578b617 100644
--- a/vppcfg/vpp/reconciler.py
+++ b/vppcfg/vpp/reconciler.py
@@ -448,7 +448,7 @@ class Reconciler:
         for idx, vpp_vxlan in self.vpp.cache["vxlan_tunnels"].items():
             vpp_ifname = self.vpp.cache["interfaces"][idx].interface_name
             config_ifname, config_iface = vxlan_tunnel.get_by_name(self.cfg, vpp_ifname)
-            if not config_iface:
+            if not config_iface or self.__vxlan_tunnel_has_diff(config_ifname):
                 self.prune_addresses(vpp_ifname, [])
                 cli = (
                     f"create vxlan tunnel instance {vpp_vxlan.instance} "
@@ -457,14 +457,6 @@ class Reconciler:
                 self.cli["prune"].append(cli)
                 removed_interfaces.append(vpp_ifname)
                 continue
-            if self.__vxlan_tunnel_has_diff(config_ifname):
-                cli = (
-                    f"create vxlan tunnel instance {vpp_vxlan.instance} "
-                    f"src {vpp_vxlan.src_address} dst {vpp_vxlan.dst_address} vni {vpp_vxlan.vni} del"
-                )
-                self.cli["prune"].append(cli)
-                removed_interfaces.append(vpp_ifname)
-                continue
             config_ifname, config_iface = interface.get_by_name(self.cfg, vpp_ifname)
             if config_iface:
                 addresses = []