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

[TestUtils]: fix the issue of verify_packet_any_port #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sihuihan88
Copy link

Failing to include port_number when calling dp_poll in verify_packet_any_port, will result in dataplane warning as follows:

"dataplane : WARNING : Dataplane poll with exp_pkt but no port number "

Copy link
Member

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

It is possible that the current implementation is not ideal, but what you are proposing is definitely wrong IMO. I don't think port_number can be an iterable object.

@@ -2356,7 +2356,7 @@ def verify_packet_any_port(test, pkt, ports=[], device_number=0):
Returns the index of the port on which the packet is received and the packet.
"""
logging.debug("Checking for pkt on device %d, port %r", device_number, ports)
result = dp_poll(test, device_number=device_number, exp_pkt=pkt, timeout=1)
result = dp_poll(test, device_number=device_number, exp_pkt=pkt, timeout=1, port_number= ports)
Copy link
Member

Choose a reason for hiding this comment

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

the whitespace is wrong

@sihuihan88
Copy link
Author

Could you elaborate a little bit on why the current fix is wrong? IMO To prevent having this warning when calling verify_packet_any_port, we should pass the right value to the port_number argument when it calls dp_poll.

@antoninbas
Copy link
Member

antoninbas commented Jun 7, 2017

dp_poll(test, device_number=device_number, exp_pkt=pkt, timeout=1, port_number=ports)

You pass ports as port_number, but ports is an iterable object, like a Python list. I believe dp_poll expects a single integer for port_number (see https://github.com/p4lang/ptf/tree/master/src/ptf#L815). I don't see how your fix can even work. If you are convinced that your change is correct, maybe you could add a unit test there: https://github.com/p4lang/ptf/blob/master/ptf_nn/ptf_nn_test/test.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants