[container_checker] Exclude the 'always_disabled' container from expected running container list (#7217)

Signed-off-by: Yong Zhao yozhao@microsoft.com

Why I did it
Since we introduced a new value always_disabled for the state field in FEATURE table, the expected running container list
should exclude the always_diabled containers. This bug was found by nightly test and posted at here: issue. This PR fixes #7210.

How I did it
I added a logic condition to decide whether the value of state field of a container was always_disabled or not.

How to verify it
I verified this on the device str-dx010-acs-1.

Which release branch to backport (provide reason below if selected)
 201811
 201911
 202006
[ x] 202012
This commit is contained in:
yozhao101 2021-04-02 08:05:46 -07:00 committed by Danny Allen
parent 3e8022c0f6
commit c63b59698c

View File

@ -48,11 +48,11 @@ def get_command_result(command):
def get_expected_running_containers():
"""
@summary: This function will get the expected running containers by following the rule:
The 'state' field of container in 'FEATURE' table should not be 'disabled'. Then
if the device has Multi-ASIC, this function will get container list by determining the
The 'state' field of container in 'FEATURE' table should not be 'disabled' or 'always_disabled'.
If the device has Multi-ASIC, this function will get container list by determining the
value of field 'has_global_scope', the number of ASICs and the value of field
'has_per_asic_scope'. If the device has single ASIC, the container name was put into
the list.
'has_per_asic_scope'.
If the device has single ASIC, the container name was put into the list.
@return: A set which contains the expected running containers.
"""
config_db = swsssdk.ConfigDBConnector()
@ -62,7 +62,7 @@ def get_expected_running_containers():
expected_running_containers = set()
for container_name in feature_table.keys():
if feature_table[container_name]["state"] != "disabled":
if feature_table[container_name]["state"] not in ["disabled", "always_disabled"]:
if multi_asic.is_multi_asic():
if feature_table[container_name]["has_global_scope"] == "True":
expected_running_containers.add(container_name)