Closed mykolaf closed 4 years ago
Issue is observed due to RAW
socket used by ptf_nn_agent
module for sending/receiving packets. It happens because Linux kernel does VLAN offloading on receiving packets and stores the tag in a different place. In order to fetch VLAN tag additional logic is required or PCAP library can be used. ptf
already uses such approach for ptf dataplane
implementation and looks like the same should be done for ptf_nn_agent
.
Implementation of fetching VLAN tag is here: https://github.com/p4lang/ptf/blob/master/src/ptf/afpacket.py#L112
Below is example of using above approach: https://github.com/p4lang/ptf/blob/master/src/ptf/dataplane.py#L163
ptf_nn_agent
module is part of ptf
repository and sonic-buildimage
just downloads it, so it should be properly fixed in ptf
repository. ptf_nn_agent
itself is located here:
https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
Also below is example how it is downloaded in SONiC PTF docker image: https://github.com/Azure/sonic-buildimage/blob/master/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2#L51
Description When running traffic test (written in pytest) using ptf_nn_agent infrastructure, any test involving vlan tagging will fail. The cause for that that the RAW socket strips the vlan tag automatically. There was a similar issue with arp_responder I believe ( #1201 ).
Steps to reproduce the issue:
testutils.verify_packet(ptfadapter, tagged_pkt, ptf_port_num)
Describe the results you received:
At the same time I capture the packet with the tag on ptf interface with
tcpdump -e icmp -vvv -i eth5
Describe the results you expected:
The ptf_nn_agent receives the packet with the vlan tag, so that the
testutils.verify_packet()
can match it.Additional information you deem important: