Skip to content
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

MIGSMSFT-765 & MIGSMSFT-778 Sequential udp ports for different priorities #15755

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging # noqa: F401
import random
from math import ceil
from tests.common.helpers.assertions import pytest_assert, pytest_require # noqa: F401
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
Expand Down Expand Up @@ -322,10 +321,6 @@ def __gen_data_flow(testbed_config,
flow.tx_rx.port.tx_name = testbed_config.ports[src_port_id].name
flow.tx_rx.port.rx_name = testbed_config.ports[dst_port_id].name
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
Expand All @@ -345,6 +340,11 @@ def __gen_data_flow(testbed_config,
elif 'Test Flow 2 -> 0' in flow.name:
eth.pfc_queue.value = pfcQueueValueDict[flow_prio[1]]

src_port = 5000 + eth.pfc_queue.value * 1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. can you use a global variable for the starting port 5000
  2. I would prefer to remove the *1000 steps, just use 5000 + eth.pfc_queue.value. For two flows, port 5000 and 6000 may still hash to the same port, but 5000 and 5001 are unlikely to be hashed to same port in most platform.

udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

ipv4.src.value = tx_port_config.ip
ipv4.dst.value = rx_port_config.ip
ipv4.priority.choice = ipv4.priority.DSCP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import time
import logging
import random

from tests.common.helpers.assertions import pytest_assert
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
Expand Down Expand Up @@ -146,10 +145,6 @@ def __gen_traffic(testbed_config,
data_flow.tx_rx.port.rx_name = rx_port_name

eth, ipv4, udp = data_flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
Expand All @@ -158,6 +153,11 @@ def __gen_traffic(testbed_config,
else:
eth.pfc_queue.value = pfcQueueValueDict[prio]

src_port = 5000 + eth.pfc_queue.value * 1000
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

ipv4.src.value = tx_port_config.ip
ipv4.dst.value = rx_port_config.ip
ipv4.priority.choice = ipv4.priority.DSCP
Expand Down
Loading