From 2163a6cb0cde6cc11b36b9822a44cb75f7a236fb Mon Sep 17 00:00:00 2001 From: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com> Date: Tue, 3 Jun 2025 08:44:45 +0800 Subject: [PATCH] [CRM AVAILABLE] To enhance the crm tests for TD3 and Cisco devices (#18733) For TD3, the maximum number of nexthop groups is 255, which is below the minimum requirement of 256, resulting in test failures. To address this, TD3 should be added to SKU_NEXTHOP_THRESHOLDS. Additionally, some HWSKUs require more time for the crm command to become operational. To accommodate this, the wait time has been increased from 90 seconds to 360 seconds in worst case. What is the motivation for this PR? To fix the flaky failure on Cisco devices and the consistent failure on TD3 How did you do it? For TD3, add 255 as a threshold. Extend maximum wait time from 90 seconds to 360 seconds. How did you verify/test it? Run test on TD3 and Cisco devices. --- tests/crm/conftest.py | 4 ++-- tests/crm/test_crm_available.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/crm/conftest.py b/tests/crm/conftest.py index 798e332433a..c98db41abed 100755 --- a/tests/crm/conftest.py +++ b/tests/crm/conftest.py @@ -353,8 +353,8 @@ def get_crm_resources(resources_dict): } return True if resources_dict else False - # Wait up to 90 seconds, checking every 5 seconds - wait_until(90, 5, 0, get_crm_resources, resources) + # Wait up to 360 seconds, checking every 5 seconds + wait_until(360, 5, 0, get_crm_resources, resources) if not resources: pytest.fail("CRM counters are not ready after multiple retries.") diff --git a/tests/crm/test_crm_available.py b/tests/crm/test_crm_available.py index 7d01e6f9b39..c542ef8c859 100644 --- a/tests/crm/test_crm_available.py +++ b/tests/crm/test_crm_available.py @@ -15,6 +15,9 @@ 'nokia-m0-7215': 126, 'nokia-7215-a1': 126, 'nokia-7215': 126, + 'arista-7050cx3-32s-c28s4': 255, + 'Arista-7050CX3-32S-C32': 255, + 'arista-7050cx3-32s-s128': 255, } DEFAULT_NEXTHOP_THRESHOLD = 256 @@ -29,8 +32,8 @@ def test_crm_next_hop_group(duthosts, enum_rand_one_per_hwsku_frontend_hostname, duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] hwsku = duthost.facts["hwsku"].lower() - - nexthop_group_threshold = SKU_NEXTHOP_THRESHOLDS.get(hwsku, DEFAULT_NEXTHOP_THRESHOLD) + lower_sku_nexthop_thresholds = {k.lower(): v for k, v in SKU_NEXTHOP_THRESHOLDS.items()} + nexthop_group_threshold = lower_sku_nexthop_thresholds.get(hwsku, DEFAULT_NEXTHOP_THRESHOLD) resource_name = "nexthop_group" if resource_name in crm_resources: