-
Notifications
You must be signed in to change notification settings - Fork 1k
[snappi]:Change ipv4 to random-src-port udp traffic. #14029
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9485816
Change ipv4 to random-src-port udp traffic.
rraghav-cisco 09588a9
Fix the typo in randint calls.
rraghav-cisco 8b35017
Fix typo coun to count
rraghav-cisco 6ce9dff
Change the count to 2 in multidut_pfcwd_basic_helper.
rraghav-cisco 407bfed
Implementing the review comments. Check for cisco platforms for multi…
rraghav-cisco 4bdbb53
Fix pre commit error.
rraghav-cisco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import time | ||
| from math import ceil | ||
| import logging | ||
| import random | ||
|
|
||
| from tests.common.helpers.assertions import pytest_assert | ||
| from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 | ||
|
|
@@ -125,6 +126,7 @@ def run_pfcwd_basic_test(api, | |
| flow1_min_loss_rate = 0 | ||
|
|
||
| exp_dur_sec = flow2_delay_sec + flow2_dur_sec + 1 | ||
| cisco_platform = "Cisco" in egress_duthost.facts['hwsku'] | ||
|
|
||
| """ Generate traffic config """ | ||
| __gen_traffic(testbed_config=testbed_config, | ||
|
|
@@ -140,7 +142,9 @@ def run_pfcwd_basic_test(api, | |
| warm_up_traffic_dur_sec, flow1_dur_sec, flow2_dur_sec], | ||
| data_pkt_size=DATA_PKT_SIZE, | ||
| prio_list=prio_list, | ||
| prio_dscp_map=prio_dscp_map) | ||
| prio_dscp_map=prio_dscp_map, | ||
| traffic_rate=99.98 if cisco_platform else 100.0, | ||
| number_of_streams=2 if cisco_platform else 1) | ||
|
|
||
| flows = testbed_config.flows | ||
|
|
||
|
|
@@ -204,7 +208,9 @@ def __gen_traffic(testbed_config, | |
| data_flow_dur_sec_list, | ||
| data_pkt_size, | ||
| prio_list, | ||
| prio_dscp_map): | ||
| prio_dscp_map, | ||
| traffic_rate, | ||
| number_of_streams): | ||
| """ | ||
| Generate configurations of flows, including data flows and pause storm. | ||
|
|
||
|
|
@@ -220,6 +226,8 @@ def __gen_traffic(testbed_config, | |
| data_pkt_size (int): size of data packets in byte | ||
| prio_list (list): priorities of data flows and pause storm | ||
| prio_dscp_map (dict): Priority vs. DSCP map (key = priority). | ||
| traffic_rate: Total rate of traffic for all streams together. | ||
| number_of_streams: The number of UDP streams needed. | ||
|
|
||
| Returns: | ||
| N/A | ||
|
|
@@ -292,7 +300,7 @@ def __gen_traffic(testbed_config, | |
|
|
||
| tx_port_name = testbed_config.ports[tx_port_id].name | ||
| rx_port_name = testbed_config.ports[rx_port_id].name | ||
| data_flow_rate_percent = int(100 / len(prio_list)) | ||
| data_flow_rate_percent = int(traffic_rate / len(prio_list)) | ||
|
|
||
| """ For each data flow """ | ||
| for i in range(len(data_flow_name_list)): | ||
|
|
@@ -304,7 +312,12 @@ def __gen_traffic(testbed_config, | |
| data_flow.tx_rx.port.tx_name = tx_port_name | ||
| data_flow.tx_rx.port.rx_name = rx_port_name | ||
|
|
||
| eth, ipv4 = data_flow.packet.ethernet().ipv4() | ||
| eth, ipv4, udp = data_flow.packet.ethernet().ipv4().udp() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems only packet-chassis will be affected by the backplane issue. Should we use an if..else.. to show it's platform specific behavior? |
||
| src_port = random.randint(5000, 6000) | ||
| udp.src_port.increment.start = src_port | ||
| udp.src_port.increment.step = 1 | ||
| udp.src_port.increment.count = number_of_streams | ||
|
|
||
| eth.src.value = tx_mac | ||
| eth.dst.value = rx_mac | ||
| if pfcQueueGroupSize == 8: | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
if the total count is 1, one flow will use only one UDP port. When test case has two test flows, there is still 50% chance that two flows may be sent on the same physical link.
maybe we should increase the total count to 2 or higher? better to define it as a common variable in case it needs to be changed.
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.
we can leave this as it is for now. and monitor it for further improvements when needed.
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.
If traffic on each queue <= 200G, we can remove random and set fixed udp port for each queue.
Something like src_port = 5000 + queue_id