Skip to content

Commit

Permalink
Use natsort instead of sort for sorting the asic list in disable_pfcw…
Browse files Browse the repository at this point in the history
…d and enable_pfcwd functions. (#16176)

Description of PR
Summary:
Even after #15863, the problem is still seen in RP. The issue is that the sort() function only sorts alphabetically, not numerically. So we need to use natsort module instead of normal sort() in these functions.

Approach
What is the motivation for this PR?
Seeing a lot of loganalyzer messages, but in RP only.

How did you do it?
Change sort to natsort().

How did you verify/test it?
Running in my TB, I don't see the LA error anymore.

Any platform specific information?
T2 mAsic only.

co-authorized by: [email protected]
  • Loading branch information
rraghav-cisco authored and mssonicbld committed Jan 2, 2025
1 parent 267022f commit d671010
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/common/snappi_tests/qos_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
import time
import json
from natsort import natsorted
from tests.common.snappi_tests.common_helpers import \
stop_pfcwd, disable_packet_aging, enable_packet_aging
from tests.override_config_table.utilities import get_running_config
Expand Down Expand Up @@ -125,7 +126,7 @@ def get_pfcwd_config(duthost):
all_configs = []
output = duthost.shell("ip netns | awk '{print $1}'")['stdout']
all_asic_list = output.split("\n")
all_asic_list.sort()
all_asic_list = natsorted(all_asic_list)
all_asic_list.insert(0, None)
for space in all_asic_list:
config = get_running_config(duthost, space)
Expand All @@ -145,7 +146,7 @@ def reapply_pfcwd(duthost, pfcwd_config):
elif type(pfcwd_config) is list:
output = duthost.shell("ip netns | awk '{print $1}'")['stdout']
all_asic_list = output.split("\n")
all_asic_list.sort()
all_asic_list = natsorted(all_asic_list)
all_asic_list.insert(0, None)

all_files = []
Expand Down

0 comments on commit d671010

Please sign in to comment.