From 6fb4ec0c0916ce3eb1e75328de9c92a3c651127a Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 13 Dec 2023 19:06:30 -0800 Subject: [PATCH] Modify teamd retry count script to base BGP status on default BGP status (#3069) For each BGP status, if the `admin_status` field is not present, then whether the BGP session is admin up or admin down depends on the default BGP status (in the `default_bgp_status` field coming from `init_cfg.json`), which is specified during image build. If the default BGP status is up, then `admin_status` will be created only when the BGP session is brought down; similarly, if the default BGP status is down, then `admin_status` will be created when the BGP session is brought up. Because of that, modify the script to use the default BGP status as the initial value. Signed-off-by: Saikrishna Arcot --- scripts/teamd_increase_retry_count.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/teamd_increase_retry_count.py b/scripts/teamd_increase_retry_count.py index 34238b3fee..d5151b69b9 100755 --- a/scripts/teamd_increase_retry_count.py +++ b/scripts/teamd_increase_retry_count.py @@ -130,6 +130,14 @@ def getPortChannels(): "adminUp": False } + deviceMetadataTable = Table(configDb, "DEVICE_METADATA") + metadata = deviceMetadataTable.get("localhost") + defaultBgpStatus = True + for key, value in metadata[1]: + if key == "default_bgp_status": + defaultBgpStatus = value == "up" + break + bgpTable = Table(configDb, "BGP_NEIGHBOR") bgpNeighbors = bgpTable.getKeys() for bgpNeighbor in bgpNeighbors: @@ -137,7 +145,7 @@ def getPortChannels(): if not neighborData[0]: continue localAddr = None - isAdminUp = False + isAdminUp = defaultBgpStatus for key, value in neighborData[1]: if key == "local_addr": if value not in portChannelData: