Skip to content

Commit 0da55ed

Browse files
authored
snappi:issue-16304-remove reference of sudo ip netns exec asic for ECN configuration in common_helpers file (sonic-net#16305)
Description of PR Summary: The ECN configuration commands still used 'sudo ip netns exec asicX' command to check and configure the ECN. In 202405, there were changes done to fix the ECN configuration CLIs and hence the above needs to modified. The correct way to reference ECN configuration is : sudo ecnconfig -n asicX - to check and configure ECN on SONIC DUTs. Fixes # (issue) sonic-net#16304 Approach What is the motivation for this PR? The use of 'sudo ip netns exec asic' to check and configure ECN fails in 2405 release. With new changes, the ecnconfig -n asic - will be required to check and change ECN configuration. How did you do it? All changes are done in tests/common/snappi_tests/common_helpers.py: For enable_ecn and disable_ecn functions, changed the reference from - sudo ip netns exec asic - to - sudo ecnconfig -n asic. For config_wred function, changed kmax_cmd, kmin_cmd and kdrop_cmd to use - sudo ecnconfig -n instead of - sudo ip netns exec asic. How did you verify/test it? Verification logs: Running the ECN test with specific Kmin, Kmax and Pmax values set. Test is setting Kmin, Kmax and Pmax to 800k, 2000k and 25 respectively. It is enabling ECN configuration for Priority#3. ---------------------------------------------------------------------------------------------------- live log call ---------------------------------------------------------------------------------------------------- 18:34:45 test_multidut_dequeue_ecn_brcm_dnx.test_ L0101 INFO | Running test for testbed subtype: multi-dut-single-asic 18:34:48 snappi_fixtures.__intf_config_multidut L0933 INFO | Configuring Dut: ixre-egl-board73 with port Ethernet8 with IP 20.10.1.0/31 18:34:49 snappi_fixtures.__intf_config_multidut L0933 INFO | Configuring Dut: ixre-egl-board74 with port Ethernet0 with IP 20.10.1.2/31 18:34:51 test_multidut_dequeue_ecn_brcm_dnx.test_ L0111 INFO | Selected lossless priority:3 18:34:51 test_multidut_dequeue_ecn_brcm_dnx.test_ L0131 INFO | Selecting different Kmin, Kmax and Pmax for DNX based platform 18:34:51 test_multidut_dequeue_ecn_brcm_dnx.test_ L0137 INFO | Running ECN dequeue test with params: {'kmin': 800000, 'kmax': 2000000, 'pmax': 25} and 800 packets 18:34:51 restpy_multidut_helper.run_ecn_test L0068 INFO | Stopping PFC watchdog 18:34:52 restpy_multidut_helper.run_ecn_test L0072 INFO | Disabling packet aging if necessary 18:34:56 restpy_multidut_helper.run_ecn_test L0077 INFO | Configuring WRED and ECN thresholds >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > /data/tests/snappi_tests/multidut/ecn/files/restpy_multidut_helper.py(80)run_ecn_test() -> if (not default_ecn): Checking the ECN configuration before the test: On board#74 admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -l Thu Jan 2 06:35:17 PM UTC 2025 Profile: AZURE_LOSSLESS ----------------------- -------- ecn ecn_all green_drop_probability 5 green_max_threshold 10000000 green_min_threshold 2000000 red_drop_probability 5 red_max_threshold 10000000 red_min_threshold 2000000 wred_green_enable true wred_red_enable true wred_yellow_enable true yellow_drop_probability 5 yellow_max_threshold 10000000 yellow_min_threshold 2000000 ----------------------- -------- On board#73: admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -l Thu Jan 2 06:36:12 PM UTC 2025 Profile: AZURE_LOSSLESS ----------------------- -------- ecn ecn_all green_drop_probability 5 green_max_threshold 10000000 green_min_threshold 2000000 red_drop_probability 5 red_max_threshold 10000000 red_min_threshold 2000000 wred_green_enable true wred_red_enable true wred_yellow_enable true yellow_drop_probability 5 yellow_max_threshold 10000000 yellow_min_threshold 2000000 ----------------------- -------- Setting the ECN configuration and checking the values: On board#73: admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -l Thu Jan 2 06:36:58 PM UTC 2025 Profile: AZURE_LOSSLESS ----------------------- -------- ecn ecn_all green_drop_probability 5 green_max_threshold 10000000 green_min_threshold 2000000 red_drop_probability 25 red_max_threshold 2000000 red_min_threshold 800000 wred_green_enable true wred_red_enable true wred_yellow_enable true yellow_drop_probability 5 yellow_max_threshold 10000000 yellow_min_threshold 2000000 ----------------------- -------- On board#74: admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -l Thu Jan 2 06:37:06 PM UTC 2025 Profile: AZURE_LOSSLESS ----------------------- -------- ecn ecn_all green_drop_probability 5 green_max_threshold 10000000 green_min_threshold 2000000 red_drop_probability 25 red_max_threshold 2000000 red_min_threshold 800000 wred_green_enable true wred_red_enable true wred_yellow_enable true yellow_drop_probability 5 yellow_max_threshold 10000000 yellow_min_threshold 2000000 ----------------------- -------- Setting the queue for priority 3 on both board#73 and board#74: Before the test: admin@ixre-egl-board74:~$ ### modifying the queue configuration admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -q 4 Thu Jan 2 06:37:50 PM UTC 2025 ECN status for namespace asic0: queue 4: off admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -q 3 Thu Jan 2 06:38:11 PM UTC 2025 ECN status for namespace asic0: queue 3: off admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -q 4 Thu Jan 2 06:38:01 PM UTC 2025 ECN status for namespace asic0: queue 4: off admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -q 3 Thu Jan 2 06:38:07 PM UTC 2025 ECN status for namespace asic0: queue 3: off Test: > /data/tests/snappi_tests/multidut/ecn/files/restpy_multidut_helper.py(80)run_ecn_test() -> if (not default_ecn): (Pdb) c >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB continue (IO-capturing resumed) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > /data/tests/snappi_tests/multidut/ecn/files/restpy_multidut_helper.py(99)run_ecn_test() -> logger.info("Enabling ECN markings") (Pdb) c After the test: admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -q 4 Thu Jan 2 06:38:29 PM UTC 2025 ECN status for namespace asic0: queue 4: off admin@ixre-egl-board73:~$ date; sudo ecnconfig -n asic0 -q 3 Thu Jan 2 06:38:32 PM UTC 2025 ECN status for namespace asic0: queue 3: on admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -q 4 Thu Jan 2 06:38:36 PM UTC 2025 ECN status for namespace asic0: queue 4: off admin@ixre-egl-board74:~$ date; sudo ecnconfig -n asic0 -q 3 Thu Jan 2 06:38:38 PM UTC 2025 ECN status for namespace asic0: queue 3: on Any platform specific information? co-authorized by: jianquanye@microsoft.com
1 parent 4dff622 commit 0da55ed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/common/snappi_tests/common_helpers.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ def config_wred(host_ans, kmin, kmax, pmax, kdrop=None, profile=None, asic_value
500500
kdrop_cmd = ' '.join(['sudo ecnconfig -p {}', kdrop_arg, '{}'])
501501

502502
if asic_value is not None:
503-
kmax_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kmax_arg, '{}'])
504-
kmin_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kmin_arg, '{}'])
505-
kdrop_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kdrop_arg, '{}'])
503+
kmax_cmd = ' '.join(['sudo ecnconfig -n', asic_value, '-p {}', kmax_arg, '{}'])
504+
kmin_cmd = ' '.join(['sudo ecnconfig -n', asic_value, '-p {}', kmin_arg, '{}'])
505+
kdrop_cmd = ' '.join(['sudo ecnconfig -n', asic_value, '-p {}', kdrop_arg, '{}'])
506506
if asic_type == 'broadcom':
507507
disable_packet_aging(host_ans, asic_value)
508508

@@ -537,8 +537,8 @@ def enable_ecn(host_ans, prio, asic_value=None):
537537
if re.search("queue {}: on".format(prio), results['stdout']):
538538
return True
539539
else:
540-
host_ans.shell('sudo ip netns exec {} ecnconfig -q {} on'.format(asic_value, prio))
541-
results = host_ans.shell('sudo ip netns exec {} ecnconfig -q {}'.format(asic_value, prio))
540+
host_ans.shell('sudo ecnconfig -n {} -q {} on'.format(asic_value, prio))
541+
results = host_ans.shell('sudo ecnconfig -n {} -q {}'.format(asic_value, prio))
542542
if re.search("queue {}: on".format(prio), results['stdout']):
543543
return True
544544
return False
@@ -560,7 +560,7 @@ def disable_ecn(host_ans, prio, asic_value=None):
560560
host_ans.shell('sudo ecnconfig -q {} off'.format(prio))
561561
else:
562562
asic_type = str(host_ans.facts["asic_type"])
563-
host_ans.shell('sudo ip netns exec {} ecnconfig -q {} off'.format(asic_value, prio))
563+
host_ans.shell('sudo ecnconfig -n {} -q {} off'.format(asic_value, prio))
564564
if asic_type == 'broadcom':
565565
enable_packet_aging(host_ans, asic_value)
566566

0 commit comments

Comments
 (0)