Open rraghav-cisco opened 8 months ago
Hi Raghav,
Which IxNetwork version are you using?
Kamal.
From: rraghav-cisco @.> Date: Tuesday, November 14, 2023 at 2:34 PM To: sonic-net/sonic-mgmt @.> Cc: Kamal Sahu @.>, Mention @.> Subject: [sonic-net/sonic-mgmt] snappi_tests/pfc/test_valid_pfc_frame_with_snappi.py attempts to use a pcap file as pcapng. (Issue #10740) When this script is run, it fails with the following error: # unpack just the header since endianness is not known shb. unpack_hdr(buf) if shb. type != PCAPNG_BT_SHB: > raise ValueError('invalid pcapng header: not a SHB') ZjQcmQRYFpfptBannerStart This Message is From an External Sender: Use caution opening files, clicking links or responding to requests. ZjQcmQRYFpfptBannerEnd
When this script is run, it fails with the following error:
# unpack just the header since endianness is not known
shb.unpack_hdr(buf)
if shb.type != PCAPNG_BT_SHB:
> raise ValueError('invalid pcapng header: not a SHB')
E ValueError: invalid pcapng header: not a SHB
buf = 'M<\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x01\x00\x00\x00{\x83Se'
fileobj = <open file 'PFC_Capture.pcapng', mode 'rb' at 0x7f5f9d2d3b70>
self = <dpkt.pcapng.Reader object at 0x7f5f9e996790>
shb = SectionHeaderBlock(type=1295823521, len=33555456, bom=0, v_major=0, sec_len=-281474959933440)
/usr/local/lib/python2.7/dist-packages/dpkt/pcapng.py:572: ValueError
After debugging I found that the saved file from ixia is in pcap format, but the script is using pcapng to parse it. This causes the above fail. If I manually convert the file to pcapng at the below point:
snappi_tests/pfc/files/helper.py:372: in run_pfc_test
is_valid_pfc_frame = validate_pfc_frame(snappi_extra_params.packet_capture_file + ".pcapng")
common/snappi_tests/read_pcap.py:27: in validate_pfc_frame
pcap = dpkt.pcapng.Reader(f)
before dkpt.pcapng.Reader(f) is called, I converted it to pcapng, and script is able to procede.
editcap -F pcapng PFC_Capture.pcapng PFC_Capture.pcapng-2
mv PFC_Capture.pcapng-2 PFC_Capture.pcapng
We need to either include the above steps into the script or, somehow match the dump file format to pcapng or viceversa.
@kamalsahu0001https://urldefense.com/v3/__https:/github.com/kamalsahu0001__;!!I5pVk4LIGAfnvw!mCpQJ1mBN6qn-2C0-zOcI7FWYeBnQynqEF49iSPecsluHaAEhDJBwZWVz2pzQNtZNWQzzxV_U4jdSlN9SBEIltRpmoc$ FYI.
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/sonic-net/sonic-mgmt/issues/10740__;!!I5pVk4LIGAfnvw!mCpQJ1mBN6qn-2C0-zOcI7FWYeBnQynqEF49iSPecsluHaAEhDJBwZWVz2pzQNtZNWQzzxV_U4jdSlN9SBEIr6xWmJ8$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANUC6S2VVCYL3NJG4R3ZMJLYEPWXNAVCNFSM6AAAAAA7LRU7D2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TGNRZGAYTANA__;!!I5pVk4LIGAfnvw!mCpQJ1mBN6qn-2C0-zOcI7FWYeBnQynqEF49iSPecsluHaAEhDJBwZWVz2pzQNtZNWQzzxV_U4jdSlN9SBEILbW4Ykc$. You are receiving this because you were mentioned.Message ID: @.***>
IxNetwork is 9.10.2011.155. I am using the ixNetwork on the chassis itself, the script is as it is.
Hi Raghav,
We do know about this issue, and it got fixed in later releases of IxNetwork. To fix that issue, you can replace below in helper file of ECN.
dpkt.pcap to dpkt.pcapng
Thanks, Kamal.
From: rraghav-cisco @.> Date: Tuesday, November 14, 2023 at 3:53 PM To: sonic-net/sonic-mgmt @.> Cc: Kamal Sahu @.>, Mention @.> Subject: Re: [sonic-net/sonic-mgmt] snappi_tests/pfc/test_valid_pfc_frame_with_snappi.py attempts to use a pcap file as pcapng. (Issue #10740) IxNetwork is 9. 10. 2011. 155. I am using the ixNetwork on the chassis itself, the script is as it is. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned. Message ID: sonic-net/sonic-mgmt/issues/10740/1811576918@ github. com ZjQcmQRYFpfptBannerStart This Message is From an External Sender: Use caution opening files, clicking links or responding to requests. ZjQcmQRYFpfptBannerEnd
IxNetwork is 9.10.2011.155. I am using the ixNetwork on the chassis itself, the script is as it is.
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/sonic-net/sonic-mgmt/issues/10740*issuecomment-1811576918__;Iw!!I5pVk4LIGAfnvw!ic-UDNZchCj3_p2aa-wZLMmr2r1yDxOJh97VyaNuwgjl-0U_mG02vDMNZheVHdtaI5dSWKDuscBZV5T4US79njfUnUM$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANUC6SYD3SWWKIKOYWC2ETLYEP765AVCNFSM6AAAAAA7LRU7D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRGU3TMOJRHA__;!!I5pVk4LIGAfnvw!ic-UDNZchCj3_p2aa-wZLMmr2r1yDxOJh97VyaNuwgjl-0U_mG02vDMNZheVHdtaI5dSWKDuscBZV5T4US79LLw6pj4$. You are receiving this because you were mentioned.Message ID: @.***>
@kamalsahu0001 : I presume you are referring to these files: /sonic-mgmt/tests/snappi_tests/ecn/files/helper.py: for ts, pkt in dpkt.pcap.Reader(open(pcap_file_name, 'rb')): /sonic-mgmt/tests/snappi_tests/ecn/files/ecnhelper.py: for ts, pkt in dpkt.pcap.Reader(open(pcap_file_name, 'rb')):
After editing these files also, I am seeing the same fails.
@rraghav-cisco : do we still have the issue . Please confirm,
When this script is run, it fails with the following error:
After debugging I found that the saved file from ixia is in pcap format, but the script is using pcapng to parse it. This causes the above fail. If I manually convert the file to pcapng at the below point:
before dkpt.pcapng.Reader(f) is called, I converted it to pcapng, and script is able to procede.
We need to either include the above steps into the script or, somehow match the dump file format to pcapng or viceversa.
@kamalsahu0001 FYI.