Skip to content

Commit

Permalink
Modify teamd retry count script to base BGP status on default BGP sta…
Browse files Browse the repository at this point in the history
…tus (sonic-net#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 <[email protected]>
  • Loading branch information
saiarcot895 authored and mssonicbld committed Jan 11, 2024
1 parent d4e0317 commit 651a80b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/teamd_increase_retry_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,22 @@ 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:
neighborData = bgpTable.get(bgpNeighbor)
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:
Expand Down

0 comments on commit 651a80b

Please sign in to comment.