Refactor the BGP check in config_reload.py to combine the single and multi asic scenarios into one.
Summary:
Fixes # (issue) Microsoft ADO 28459397
Type of change
[ ] Bug fix
[ ] Testbed and Framework(new/improvement)
[x] Test case(new/improvement)
Back port request
[ ] 202012
[ ] 202205
[ ] 202305
[ ] 202311
[x] 202405
Approach
What is the motivation for this PR?
In the previous PR #13471, we added multi asic support when wait_for_bgp is True in common/config_reload.py. It turns out we don't need to differentiate the single and multi asic scenarios. For a single asic Testbed, we can also use the sonic_host.get_bgp_neighbors_per_asic() and sonic_host.check_bgp_session_state_all_asics() to confirm the BGP session status.
One thing we need to be aware of is that sonic_host.get_bgp_neighbors_per_asic() will return a dictionary with None as the key for a single asic Testbed. This is because for a single asic Testbed, its default namespace is always None, but any hashable value is a valid Python dictionary key, so it should be fine to use None as the key.
How did you do it?
How did you verify/test it?
I manually ran the config_reload(..., wait_for_bgp=True) function in a single asic Testbed, and I can confirm it's working fine.
Any platform specific information?
Supported testbed topology if it's a new test case?
Description of PR
Refactor the BGP check in
config_reload.py
to combine the single and multi asic scenarios into one.Summary: Fixes # (issue) Microsoft ADO 28459397
Type of change
Back port request
Approach
What is the motivation for this PR?
In the previous PR #13471, we added multi asic support when
wait_for_bgp
is True incommon/config_reload.py
. It turns out we don't need to differentiate the single and multi asic scenarios. For a single asic Testbed, we can also use thesonic_host.get_bgp_neighbors_per_asic()
andsonic_host.check_bgp_session_state_all_asics()
to confirm the BGP session status.One thing we need to be aware of is that
sonic_host.get_bgp_neighbors_per_asic()
will return a dictionary withNone
as the key for a single asic Testbed. This is because for a single asic Testbed, its default namespace is alwaysNone
, but any hashable value is a valid Python dictionary key, so it should be fine to useNone
as the key.How did you do it?
How did you verify/test it?
I manually ran the
config_reload(..., wait_for_bgp=True)
function in a single asic Testbed, and I can confirm it's working fine.Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation