-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
T2/Snappi: Move global definitions of test and background flow rates to be local to the function they are used. #15964
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…hat the different scripts that call this function get the same values.
alpeshspatel
approved these changes
Dec 10, 2024
sdszhang
approved these changes
Dec 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
auspham
approved these changes
Dec 10, 2024
mssonicbld
pushed a commit
to mssonicbld/sonic-mgmt
that referenced
this pull request
Dec 10, 2024
…hat the different scripts that call this function get the same values. (sonic-net#15964) Description of PR Summary: Fixes this problem: * 1e9 * data_flow_dur_sec / 8.0 / data_pkt_size > deviation = (rx_frames - exp_bg_flow_rx_pkts) / float(exp_bg_flow_rx_pkts) E ZeroDivisionError: float division by zero bg_flow_name = 'Background Flow' bg_flow_rate_percent = 0 data_flow_dur_sec = 2 data_pkt_size = 1024 dst_port_id = 0 exp_bg_flow_rx_pkts = 0.0 exp_test_flow_rx_pkts = 1953125.0 flow_name = 'Background Flow 1 -> 0 Prio 1' pause_flow_name = 'Pause Storm' pause_port_id = 0 row = <snappi.snappi.FlowMetric object at 0x7ff2ccffa980> rows = <snappi.snappi.FlowMetricIter object at 0x7ff2cd3df880> rx_frames = 1 speed_gbps = 400 src_port_id = 2 test_flow_name = 'Test Flow' test_flow_rate_percent = 2 tolerance = 0.05 trigger_pfcwd = True tx_frames = 1 snappi_tests/multidut/pfcwd/files/pfcwd_multidut_multi_node_helper.py:633: ZeroDivisionError This issue happens since the initialization for TEST_FLOW_AGGR_RATE_PERCENT and BG_FLOW_AGGR_RATE_PERCENT are global, and everytime the function run_pfcwd_multi_node_test() is called, their value is halved. After 4-5 times of halving, the int() value of the above variables is zero. This results in the above traceback at the 4th or 5th call. Approach What is the motivation for this PR? Fixing the ZeroDivision problem. How did you do it? Moved the global definition to the function scope. How did you verify/test it? Ran it on my TB: =========================================================================================================================== PASSES =========================================================================================================================== ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info0-True] ______________________________________________________________________________________________________ ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info1-True] ______________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info0-False] __________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info1-False] __________________________________________________________________________________________________ ------------------------------------------------------------------------------ generated xml file: /run_logs/ixia/zero-division/2024-12-09-02-43-06/tr_2024-12-09-02-43-06.xml ------------------------------------------------------------------------------- INFO:root:Can not get Allure report URL. Please check logs ------------------------------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------------------------- 02:55:06 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ================================================================================================================== short test summary info =================================================================================================================== PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info0-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info1-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info0-False] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info1-False] ========================================================================================================= 4 passed, 8 warnings in 717.52s (0:11:57) ========================================================================================================== Any platform specific information? The issue is specific to cisco-8000.
Cherry-pick PR to 202405: #15988 |
8 tasks
mssonicbld
pushed a commit
that referenced
this pull request
Dec 11, 2024
…hat the different scripts that call this function get the same values. (#15964) Description of PR Summary: Fixes this problem: * 1e9 * data_flow_dur_sec / 8.0 / data_pkt_size > deviation = (rx_frames - exp_bg_flow_rx_pkts) / float(exp_bg_flow_rx_pkts) E ZeroDivisionError: float division by zero bg_flow_name = 'Background Flow' bg_flow_rate_percent = 0 data_flow_dur_sec = 2 data_pkt_size = 1024 dst_port_id = 0 exp_bg_flow_rx_pkts = 0.0 exp_test_flow_rx_pkts = 1953125.0 flow_name = 'Background Flow 1 -> 0 Prio 1' pause_flow_name = 'Pause Storm' pause_port_id = 0 row = <snappi.snappi.FlowMetric object at 0x7ff2ccffa980> rows = <snappi.snappi.FlowMetricIter object at 0x7ff2cd3df880> rx_frames = 1 speed_gbps = 400 src_port_id = 2 test_flow_name = 'Test Flow' test_flow_rate_percent = 2 tolerance = 0.05 trigger_pfcwd = True tx_frames = 1 snappi_tests/multidut/pfcwd/files/pfcwd_multidut_multi_node_helper.py:633: ZeroDivisionError This issue happens since the initialization for TEST_FLOW_AGGR_RATE_PERCENT and BG_FLOW_AGGR_RATE_PERCENT are global, and everytime the function run_pfcwd_multi_node_test() is called, their value is halved. After 4-5 times of halving, the int() value of the above variables is zero. This results in the above traceback at the 4th or 5th call. Approach What is the motivation for this PR? Fixing the ZeroDivision problem. How did you do it? Moved the global definition to the function scope. How did you verify/test it? Ran it on my TB: =========================================================================================================================== PASSES =========================================================================================================================== ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info0-True] ______________________________________________________________________________________________________ ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info1-True] ______________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info0-False] __________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info1-False] __________________________________________________________________________________________________ ------------------------------------------------------------------------------ generated xml file: /run_logs/ixia/zero-division/2024-12-09-02-43-06/tr_2024-12-09-02-43-06.xml ------------------------------------------------------------------------------- INFO:root:Can not get Allure report URL. Please check logs ------------------------------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------------------------- 02:55:06 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ================================================================================================================== short test summary info =================================================================================================================== PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info0-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info1-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info0-False] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info1-False] ========================================================================================================= 4 passed, 8 warnings in 717.52s (0:11:57) ========================================================================================================== Any platform specific information? The issue is specific to cisco-8000.
mssonicbld
added
Included in 202405 branch
and removed
Created PR to 202405 branch
labels
Dec 11, 2024
mssonicbld
pushed a commit
to mssonicbld/sonic-mgmt
that referenced
this pull request
Jan 3, 2025
…hat the different scripts that call this function get the same values. (sonic-net#15964) Description of PR Summary: Fixes this problem: * 1e9 * data_flow_dur_sec / 8.0 / data_pkt_size > deviation = (rx_frames - exp_bg_flow_rx_pkts) / float(exp_bg_flow_rx_pkts) E ZeroDivisionError: float division by zero bg_flow_name = 'Background Flow' bg_flow_rate_percent = 0 data_flow_dur_sec = 2 data_pkt_size = 1024 dst_port_id = 0 exp_bg_flow_rx_pkts = 0.0 exp_test_flow_rx_pkts = 1953125.0 flow_name = 'Background Flow 1 -> 0 Prio 1' pause_flow_name = 'Pause Storm' pause_port_id = 0 row = <snappi.snappi.FlowMetric object at 0x7ff2ccffa980> rows = <snappi.snappi.FlowMetricIter object at 0x7ff2cd3df880> rx_frames = 1 speed_gbps = 400 src_port_id = 2 test_flow_name = 'Test Flow' test_flow_rate_percent = 2 tolerance = 0.05 trigger_pfcwd = True tx_frames = 1 snappi_tests/multidut/pfcwd/files/pfcwd_multidut_multi_node_helper.py:633: ZeroDivisionError This issue happens since the initialization for TEST_FLOW_AGGR_RATE_PERCENT and BG_FLOW_AGGR_RATE_PERCENT are global, and everytime the function run_pfcwd_multi_node_test() is called, their value is halved. After 4-5 times of halving, the int() value of the above variables is zero. This results in the above traceback at the 4th or 5th call. Approach What is the motivation for this PR? Fixing the ZeroDivision problem. How did you do it? Moved the global definition to the function scope. How did you verify/test it? Ran it on my TB: =========================================================================================================================== PASSES =========================================================================================================================== ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info0-True] ______________________________________________________________________________________________________ ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info1-True] ______________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info0-False] __________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info1-False] __________________________________________________________________________________________________ ------------------------------------------------------------------------------ generated xml file: /run_logs/ixia/zero-division/2024-12-09-02-43-06/tr_2024-12-09-02-43-06.xml ------------------------------------------------------------------------------- INFO:root:Can not get Allure report URL. Please check logs ------------------------------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------------------------- 02:55:06 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ================================================================================================================== short test summary info =================================================================================================================== PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info0-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info1-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info0-False] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info1-False] ========================================================================================================= 4 passed, 8 warnings in 717.52s (0:11:57) ========================================================================================================== Any platform specific information? The issue is specific to cisco-8000.
Cherry-pick PR to 202411: #16329 |
8 tasks
mssonicbld
pushed a commit
that referenced
this pull request
Jan 3, 2025
…hat the different scripts that call this function get the same values. (#15964) Description of PR Summary: Fixes this problem: * 1e9 * data_flow_dur_sec / 8.0 / data_pkt_size > deviation = (rx_frames - exp_bg_flow_rx_pkts) / float(exp_bg_flow_rx_pkts) E ZeroDivisionError: float division by zero bg_flow_name = 'Background Flow' bg_flow_rate_percent = 0 data_flow_dur_sec = 2 data_pkt_size = 1024 dst_port_id = 0 exp_bg_flow_rx_pkts = 0.0 exp_test_flow_rx_pkts = 1953125.0 flow_name = 'Background Flow 1 -> 0 Prio 1' pause_flow_name = 'Pause Storm' pause_port_id = 0 row = <snappi.snappi.FlowMetric object at 0x7ff2ccffa980> rows = <snappi.snappi.FlowMetricIter object at 0x7ff2cd3df880> rx_frames = 1 speed_gbps = 400 src_port_id = 2 test_flow_name = 'Test Flow' test_flow_rate_percent = 2 tolerance = 0.05 trigger_pfcwd = True tx_frames = 1 snappi_tests/multidut/pfcwd/files/pfcwd_multidut_multi_node_helper.py:633: ZeroDivisionError This issue happens since the initialization for TEST_FLOW_AGGR_RATE_PERCENT and BG_FLOW_AGGR_RATE_PERCENT are global, and everytime the function run_pfcwd_multi_node_test() is called, their value is halved. After 4-5 times of halving, the int() value of the above variables is zero. This results in the above traceback at the 4th or 5th call. Approach What is the motivation for this PR? Fixing the ZeroDivision problem. How did you do it? Moved the global definition to the function scope. How did you verify/test it? Ran it on my TB: =========================================================================================================================== PASSES =========================================================================================================================== ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info0-True] ______________________________________________________________________________________________________ ______________________________________________________________________________________________________ test_pfcwd_many_to_one[multidut_port_info1-True] ______________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info0-False] __________________________________________________________________________________________________ _________________________________________________________________________________________________ test_multidut_pfcwd_all_to_all[multidut_port_info1-False] __________________________________________________________________________________________________ ------------------------------------------------------------------------------ generated xml file: /run_logs/ixia/zero-division/2024-12-09-02-43-06/tr_2024-12-09-02-43-06.xml ------------------------------------------------------------------------------- INFO:root:Can not get Allure report URL. Please check logs ------------------------------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------------------------- 02:55:06 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ================================================================================================================== short test summary info =================================================================================================================== PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info0-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_m2o_with_snappi.py::test_pfcwd_many_to_one[multidut_port_info1-True] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info0-False] PASSED snappi_tests/multidut/pfcwd/test_multidut_pfcwd_a2a_with_snappi.py::test_multidut_pfcwd_all_to_all[multidut_port_info1-False] ========================================================================================================= 4 passed, 8 warnings in 717.52s (0:11:57) ========================================================================================================== Any platform specific information? The issue is specific to cisco-8000.
mssonicbld
added
Included in 202411 branch
and removed
Created PR to 202411 branch
labels
Jan 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Fixes this problem:
This issue happens since the initialization for TEST_FLOW_AGGR_RATE_PERCENT and BG_FLOW_AGGR_RATE_PERCENT are global, and everytime the function run_pfcwd_multi_node_test() is called, their value is halved. After 4-5 times of halving, the int() value of the above variables is zero. This results in the above traceback at the 4th or 5th call.
Type of change
Back port request
Approach
What is the motivation for this PR?
Fixing the ZeroDivision problem.
How did you do it?
Moved the global definition to the function scope.
How did you verify/test it?
Ran it on my TB:
Any platform specific information?
The issue is specific to cisco-8000.