From 4cc37cd8d2c75a8c2838eb9b9ac2a978c13bdf2b 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 79c0e6c9684..08fc6e50c5e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,7 +31,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) @@ -470,6 +470,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) @@ -484,6 +490,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+')