From 862ec93cd1e1eeb25a5a4fd0f31935b10048deb0 Mon Sep 17 00:00:00 2001 From: Baorong Liu Date: Mon, 22 May 2023 12:00:34 -0700 Subject: [PATCH] add comment for skip_appl_del --- src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py index 7e26c1d0a456..951ee4a43863 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py @@ -81,6 +81,18 @@ def set_handler(self, key, data): def skip_appl_del(self, vrf, ip_prefix): + """ + If a static route is bfd enabled, the processed static route is written into application DB by staticroutebfd. + When we disable bfd for that route at runtime, that static route entry will be removed from APPL_DB STATIC_ROUTE_TABLE. + In the case, the StaticRouteMgr(appl_db) cannot uninstall the static route from FRR if the static route is still in CONFIG_DB, + so need this checking (skip appl_db deletion) to avoid race condition between StaticRouteMgr(appl_db) and StaticRouteMgr(config_db) + For more detailed information: + https://github.com/sonic-net/SONiC/blob/master/doc/static-route/SONiC_static_route_bfd_hld.md#bfd-field-changes-from-true-to-false + + :param vrf: vrf from the split_key(key) return + :param ip_prefix: ip_prefix from the split_key(key) return + :return: True if the deletion comes from APPL_DB and the vrf|ip_prefix exists in CONFIG_DB, otherwise return False + """ if self.db_name == "CONFIG_DB": return False