From 6bab80fe4a74da0066a1fa0a02ea233d85ca4bfe Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Wed, 17 Mar 2021 19:14:37 +0100
Subject: vrf: ospf: T2271: when removing the entire process cleanup all
 interfaces

During assembly of the required config changes we also must move the
interfaces_removed assignemnt to an earlier stage so the value is also populated
when the entire process is removed to cleanup all remaining OSPF process assigned
interfaces.

This was yet not the case and when deleting OSPF I still got my "interface eth0"
with the area key configured.
---
 src/conf_mode/protocols_ospf.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index ef2aeda7f..30246594a 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -57,6 +57,14 @@ def get_config(config=None):
     # instead of the VRF instance.
     if vrf: ospf['vrf'] = vrf
 
+    # As we no re-use this Python handler for both VRF and non VRF instances for
+    # OSPF we need to find out if any interfaces changed so properly adjust
+    # the FRR configuration and not by acctident change interfaces from a
+    # different VRF.
+    interfaces_removed = node_changed(conf, base + ['interface'])
+    if interfaces_removed:
+        ospf['interface_removed'] = list(interfaces_removed)
+
     # Bail out early if configuration tree does not exist
     if not conf.exists(base):
         ospf.update({'deleted' : ''})
@@ -119,14 +127,6 @@ def get_config(config=None):
             ospf['interface'][interface] = dict_merge(default_values,
                 ospf['interface'][interface])
 
-    # As we no re-use this Python handler for both VRF and non VRF instances for
-    # OSPF we need to find out if any interfaces changed so properly adjust
-    # the FRR configuration and not by acctident change interfaces from a
-    # different VRF.
-    interfaces_removed = node_changed(conf, base + ['interface'])
-    if interfaces_removed:
-        ospf['interface_removed'] = list(interfaces_removed)
-
     # We also need some additional information from the config, prefix-lists
     # and route-maps for instance. They will be used in verify()
     base = ['policy']
-- 
cgit v1.2.3