Added new tool for finding packet in buffer of PTF#3525
Added new tool for finding packet in buffer of PTF#3525wangxin merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Oleksandr Kozodoi <oleksandrx.kozodoi@intel.com>
Signed-off-by: Oleksandr Kozodoi <oleksandrx.kozodoi@intel.com>
|
@bingwang-ms Can you take a look? Thank you in advance. |
|
@yxieca @wangxin @bingwang-ms Could you please review? Thank you in advance. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| ``` | ||
| ##### Received packet | ||
| ``` | ||
| >>> filter.show_packet(pkt_type='received') |
There was a problem hiding this comment.
Could there be multiple received packets? This is to list all the received packets in the buffer, right?
There was a problem hiding this comment.
show_packet(pkt_type='received') doesn't show all received packets. The method shows only received packet if this packet has fields from the match_fields and packet equals the expected packet.
There was a problem hiding this comment.
Same concern of detecting duplicated packets here.
| self.received_pkt = self.__find_pkt_in_buffer() | ||
|
|
||
| if self.received_pkt: | ||
| self.__ignore_fields() |
There was a problem hiding this comment.
This will update self.masked_exp_pkt in place. Maybe it is better to call self.__ignore_fields() in __init__.
There was a problem hiding this comment.
Good idea. Thanks!
There was a problem hiding this comment.
Done. Thanks!
| except KeyError: | ||
| break | ||
| else: | ||
| return Ether(pkt[0]) |
There was a problem hiding this comment.
Only the first packet matches the exp_pkt will be returned? What if there are multiple packets in buffer match the exp_pkt?
There was a problem hiding this comment.
The method returns the first packet which matches the exp_pkt. Do we need to return multiple packets?
There was a problem hiding this comment.
I think yes, then duplicated packets can be detected.
Signed-off-by: Oleksandr Kozodoi <oleksandrx.kozodoi@intel.com>
Summary: * Added realization of the method for finding packet in the buffer of PTF. * Added realization of the method for finding the difference between the expected packet and the received packet in the buffer of PTF. * Added realization of the function for converting scapy packet to dictionary. * Added realization of the method for printing the packet structure without ignored fields. * Added HLD What is the motivation for this PR? The investigation shows that testutils tool doesn't support verifying packets on the PTF in specific cases, but packets are verified by using tcpdump tool. So was added new method for sniffing packets inside ptfadapter buffer. How did you do it? Added realization of the method for finding packets in the buffer of PTF. How did you verify/test it? This approach is used in new sub-ports test cases. Signed-off-by: Oleksandr Kozodoi <oleksandrx.kozodoi@intel.com>
Signed-off-by: Oleksandr Kozodoi oleksandrx.kozodoi@intel.com
Description of PR
Summary:
Type of change
Approach
What is the motivation for this PR?
The investigation shows that testutils tool doesn't support verifying packets on the PTF in specific cases, but packets are verified by using tcpdump tool. So was added new method for sniffing packets inside ptfadapter buffer.
How did you do it?
Added realization of the method for finding packets in the buffer of PTF.
How did you verify/test it?
This approach is used in new sub-ports test cases.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
Link