From fe3664e691d062acacaa6b2f040cad75d6cecbd5 Mon Sep 17 00:00:00 2001 From: ngocdo Date: Mon, 8 Feb 2021 00:32:34 -0800 Subject: [PATCH] Fix vstest for voq and fabric asics with fabric ports. Now voq and fabric asics are enabled with fabric ports. Need to fix the tests to count for fabric ports. vstest infrastructure for fabric ports merged in https://github.com/Azure/sonic-sairedis/pull/737 and 769. This infrastructure requires https://github.com/Azure/sonic-buildimage/pull/6185 to be effective. However, this PR (6185) will have some swss tests failing. We need to disable those tests, let the PR merge, and reenable the tests. --- tests/conftest.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 357cb4f15fc..614938b821f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,7 +30,7 @@ # ports in the system (much like the rest of the test suite). This should be adjusted to accomodate # a dynamic number of ports. GitHub Issue: Azure/sonic-swss#1384. NUM_PORTS = 32 - +FABRIC_NUM_PORTS = 16 def ensure_system(cmd): rc, output = subprocess.getstatusoutput(cmd) @@ -469,6 +469,12 @@ def check_swss_ready(self, timeout: int = 300) -> None: """ num_ports = NUM_PORTS + # Voq and fabric asics have fabric ports enabled + self.get_config_db() + metadata = self.config_db.get_entry('DEVICE_METADATA|localhost', '') + if metadata.get('switch_type', 'npu') in ['voq', 'fabric']: + num_ports = NUM_PORTS + FABRIC_NUM_PORTS + # Verify that all ports have been initialized and configured app_db = self.get_app_db() startup_polling_config = PollingConfig(5, timeout, strict=True) @@ -483,6 +489,11 @@ def _polling_function(): asic_db = self.get_asic_db() asic_db.wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_PORT", num_ports + 1) # +1 CPU Port + # Verify that fabric ports are monitored in STATE_DB + if metadata.get('switch_type', 'npu') in ['voq', 'fabric']: + self.get_state_db() + self.state_db.wait_for_n_keys("FABRIC_PORT_TABLE", 16) + def net_cleanup(self) -> None: """Clean up network, remove extra links.""" re_space = re.compile(r'\s+')