53 Commits

Author SHA1 Message Date
Mohsin Kazmi
0b1bd9df33 pg: add support to delete pg interface
Type: improvement

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I3102fded415c644673fb79a0fdb7a7448ce20f26
2024-10-07 08:39:23 +00:00
Dave Wallace
0da0883453 tests: output raw packet data when decoding pcap files
Type: test

Change-Id: I4e945b2bd067466afdaa58a6f07a1ab2c567bc2b
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2024-07-18 14:45:49 +00:00
Dave Wallace
87a8826d17 tests: refactor pcap file deletion to improve robustness
Type: test

Change-Id: I504c079126bd8b33c5e217a1b9086788a8c778e5
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-11-28 03:34:49 +00:00
Dave Wallace
8800f732f8 tests: refactor asf framework code
- Make framework.py classes a subset of asfframework.py classes
- Remove all packet related code from asfframework.py
- Add test class and test case set up debug output to log
- Repatriate packet tests from asf to test directory
- Remove non-packet related code from framework.py and
  inherit them from asfframework.py classes
- Clean up unused import variables
- Re-enable BFD tests on Ubuntu 22.04 and fix
  intermittent test failures in echo_looped_back
  testcases (where # control packets verified but
  not guaranteed to be received during test)
- Re-enable Wireguard tests on Ubuntu 22.04 and fix
  intermittent test failures in handshake ratelimiting
  testcases and event testcase
- Run Wiregard testcase suites solo
- Improve debug output in log.txt
- Increase VCL/LDP post sleep timeout to allow iperf server
  to finish cleanly.
- Fix pcap history files to be sorted by suite and testcase
  and ensure order/timestamp is correct based on creation
  in the testcase.
- Decode pcap files for each suite and testcase for all
  errors or if configured via comandline option / env var
- Improve vpp corefile detection to allow complete corefile
  generation
- Disable vm vpp interfaces testcases on debian11
- Clean up failed unittest dir when retrying failed testcases
  and unify testname directory and failed linknames into
  framwork functions

Type: test

Change-Id: I0764f79ea5bb639d278bf635ed2408d4d5220e1e
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-11-03 05:06:43 +00:00
Dave Wallace
7b8b465269 tests docs: update python3 venv packages
- Package update performed by
  1. updating pip, pip-tools, setuptools
  2. 'make test-refresh-deps' on ubuntu 22.04
  3. fixing 'make test' and 'make docs' issues
     on ubuntu 22.04
  4. 'make test-refresh-deps' on ubuntu 20.04
- Add dependency for 'make test-refresh-deps'
  to insure python venv is set up.
- Update of python formatter, black,
  caused reformating of 41 python code
  files.

Type: make

Change-Id: I7cafdf4b5189065ac57cb6b254937f6e0897a924
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-08-16 19:53:12 +00:00
Dmitry Valter
71d02aa631 tests: support tmp-dir on different filesystem
Support running tests with `--tmp-dir` on a filesystem different from /tmp.
os.rename withs only within a single FS whereas shutil.move works accross
different filesystems.

Type: improvement
Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru>
Change-Id: I5371f5d75386bd2b82a75b3e6c1f2c850bc62356
2023-02-14 01:26:01 +00:00
Klement Sekera
d9b0c6fbf7 tests: replace pycodestyle with black
Drop pycodestyle for code style checking in favor of black. Black is
much faster, stable PEP8 compliant code style checker offering also
automatic formatting. It aims to be very stable and produce smallest
diffs. It's used by many small and big projects.

Running checkstyle with black takes a few seconds with a terse output.
Thus, test-checkstyle-diff is no longer necessary.

Expand scope of checkstyle to all python files in the repo, replacing
test-checkstyle with checkstyle-python.

Also, fixstyle-python is now available for automatic style formatting.

Note: python virtualenv has been consolidated in test/Makefile,
test/requirements*.txt which will eventually be moved to a central
location.  This is required to simply the automated generation of
docker executor images in the CI.

Type: improvement
Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-05-10 18:52:08 +00:00
Klement Sekera
16ce09db9e tests: fix assert_nothing_captured
Type: fix
Fixes: 26cd0242c95025e0d644db3a80dfe8dee83b6d7a
Change-Id: I9a88221af65f170dc6b1f0dc0992df401e489fa2
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
2022-04-29 09:57:47 +00:00
Klement Sekera
26cd0242c9 tests: better reporting for unexpected packets
Raise a new UnexpectedPacketErrror, when a packet is captured
unexpectedly. This pretty-prints a terse description of said packet.

Type: improvement
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Change-Id: Ibac19fc5bbd82a150fec3c90940a37af6344fd4f
2022-02-24 12:51:33 +00:00
Klement Sekera
b23ffd7ef2 tests: make tests less make dependent
Implement command line argument parsing instead of passing arguments via
environment variables. Add script for running tests without having to
invoke make. Deprecate running tests via make.

Type: improvement
Change-Id: I2e3054a61a2ae25d460e9be00be7d7705fbf943e
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-02-17 18:02:35 +00:00
Ray Kinsella
064b77c742 build: remove unnecessary executable bits
Run 'find src -executable -type f', remove unnecessary executable bits from the
source tree.

Type: refactor

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: I070e22c8fb2ef8712bc3ea620727ee5ab3d9a9fb
2021-11-02 22:26:34 +00:00
Neale Ranns
6197cb730e pg: A Tunnel mode variant of a pg interface
Type: feature

this allows VPP to simulate linux tun devices.

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I3adf38b49a254804370f78edd5d275d192fd00a6
2021-06-14 13:12:34 +00:00
Klement Sekera
3ff6ffce03 tests: improve naming
Change capture to pcap to remove confusion in framework.py

Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: Idf8bd61f174b8b2df3bbd13908e54d597da4a83b
2021-04-09 21:12:46 +00:00
Klement Sekera
7ba9fae554 tests: support injecting multiple worker pcaps on one PG
This change allows one to inject multiple streams for different workers
on the same PG interface at the same time.

Type: improvement
Change-Id: I29d80369aabada261eda466e5a5d8d3518bb8bc8
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-04-01 15:29:42 +00:00
Benoît Ganne
2699fe2ba8 ip: add IPv6 ping test for link-layer address
Type: improvement

Change-Id: I9f60e29462c7cb193a8594b7de06418b40573103
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-01-20 13:53:33 +00:00
Mohsin Kazmi
f382b06feb gso: packet coalesce library
Type: feature

Change-Id: Ia19d3611e596d9ec47509889b34e8fe793a0ccc3
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-08-14 09:38:58 +00:00
Paul Vinciguerra
582eac5c30 misc: fix python sonarcloud BLOCKER level issues
Fix of the top 11 python issues flagged as BLOCKER.

Ticket: VPP-1856
Type: fix

Change-Id: Icf4691e62f4a69d6ee196b6d6e2ab52d961b5c76
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-04-06 11:30:05 +00:00
snaramre
5d4b8912d2 tests: changes for scapy 2.4.3 migration
Type: fix
Change-Id: I7e041b666dabd90df23a920a1f1d99db4c10ddfe
Signed-off-by: snaramre <snaramre@cisco.com>
2019-12-14 22:14:12 +00:00
Andrew Yourtchenko
3d36f19a0f tests: explicitly wait for the PG to finish before looking for capture file
Rather than only using time-based method of periodically checking
whether the pcap file appeared, first check that the packet generator
has stopped. To make this change fail-safe, have a 5-minute timeout
on this activity, just in case the things go terribly wrong.

Type: test
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Id16b2802b2de8a4cafb5d9f0a8c9ba62ec89dc32
2019-10-11 13:36:01 +00:00
Klement Sekera
4ecbf105a4 tests: support worker threads
Add support for specifying the worker thread when adding packet stream.

Type: feature

Change-Id: I8a98b91c211e60cd53e1166f9f51365394ecacfd
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2019-08-20 12:25:42 +00:00
Andrew Yourtchenko
cb265c6948 tests: disable pg capture before enabling it
In a lot of places within the unit tests pg_start() starts
the capture with an already existing capture running
for the same test.

If the pcap file already exists, then it is renamed and there
is no problem.

However, there is a potential for race if the previous
pg_start() has enabled the capture, but the check for
renaming it happened just slightly earlier than the first
packet has arrived.

Then a second call to pg_start() will hit a check that
a file exists, and will cause an error. This is especially
visible when running the tests in parallel due to increased
load.

Solution: disable the capture before enabling it.
This will flush the aready running capture and eliminate the race.

The additional delay that flushing of the pcap creates has exposed
several other race conditions:

NAT tests: Some of the NAT reassembly tests
verify that the entries were added to the reassembly data structures,
but do so by comparing the quantities of entries. With the default
timeout being 2s, some of the entries might timeout,
resulting in a bogus test failure.

Solution: Bump the timeout to 20s for the affected tests.

Punt tests: nr_packets == 3 makes test intermittently fail,
nr_packets > 3 make it reliably fail, and nr_packets = 2 works

Solution: set nr_packets == 2 for the time being

IGMP tests: the leave-group calls get a spurious packet
from the time the new groups were configured

Solution: add 1 second delay before starting to delete the groups

Type: test

Change-Id: I931182a7b2860cf670e030ee7da8038f6e87356d
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-07-31 13:00:35 +00:00
Mohsin Kazmi
22e9cfd760 pg: add GSO support
Type: feature

Change-Id: I72676495a85fbecc946aa266a75234cce70c3a5e
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-07-28 14:20:06 +00:00
Paul Vinciguerra
44b0b07bc1 tests: rename stream name in tests
PacketGenerator streams were named based on their sw_if_index but without
knowing that, it looked like it was paired with the interface instance value.

Reencode the name to encode the data in a clearer way.

20:48:12,859 CLI: packet-generator new pcap
  /tmp/vpp-unittest-TestClassifierPBR-6DVQW2/pg0_in.pcap
  source pg0 name pcap0-sw_if_index-1

Change-Id: I5b82193943fee0cf060900d73aaaaecca1247105
Type: style
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-27 15:45:15 +00:00
Paul Vinciguerra
4b58a86da4 Tests: simple refactor in vpp_pg_interface.
Pull common code into a single method.

Type: refactor

Change-Id: Ic540d23eebbd17f838ed7a1a9dee80815a27847c
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-04 16:05:57 +00:00
Paul Vinciguerra
02d576b754 Tests: vpp_pg_interface. Don't rewrite Dot1AD ethertype.
Type: Refactor

Change-Id: I42f65bcc76e4b0fcfbfe051c1c382a940bff1b3a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-05-29 13:09:24 +00:00
Alexandre Poirrier
a618e2082d make test: add option in pg interfaces for duplicating packets
Change-Id: Ia6d6de5de0414291d5637fb4b8c1480925f646d3
Signed-off-by: Alexandre Poirrier <apoirrie@cisco.com>
2019-05-28 15:05:12 +00:00
Paul Vinciguerra
a7427ec6f8 VPP-1508: Use scapy.compat to manage packet level library differences.
Change-Id: Icdf6abc9e53d33b26fd1d531c7dda6be0bb9cb55
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11 08:11:16 +00:00
Paul Vinciguerra
0f6602cb24 Tests: fix time.sleep(0) # yield. Reduce sleep related log messages.
Reduce the incidence of:
20:04:23,606 unexpected time.sleep() result - slept for 2.187967e-03s instead of ~6.837845e-04s!

Change-Id: Ic576fda7f75e571c9019111588a6a936ee2cf5c2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11 08:10:34 +00:00
Klement Sekera
31da2e3031 Revert "Revert "ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums""
This reverts commit e0d2bd6bd7fc59c0c6ac48195d7f825dc99bfd91.

Change-Id: If491e16f9ea66b2493a6a7c7f3c684ed585f8f51
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-06-24 22:53:37 +02:00
Ole Troan
e0d2bd6bd7 Revert "ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums"
This reverts commit a98346f664aae148d26a8e158008b773d73db96f.

Change-Id: Iee5b3a5ddff0e8fd3a30fe5973cee24de434fe12
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-22 22:37:55 +02:00
Klement Sekera
a98346f664 ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums
Calculate IP/TCP/UDP checksums in software before adding authentication.

Change-Id: I3e121cb00aeba667764f39ade8d62170f18f8b6b
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-06-21 14:50:10 +00:00
Jan Gelety
057bb8c3a4 test: ip6 vrf instances multi-context test (CSIT-497)
- add/delete IPv6 VRF instances and verify results by parsing output
  of ip6_fib_dump API command and by traffic

- small changes in assert_nothing_captured and get_capture to get logged
  unexpected packets

Change-Id: I32207447be2df942e335aa9890ff52fb88e46597
Signed-off-by: Jan Gelety <jgelety@cisco.com>
2017-02-21 22:20:58 +00:00
Klement Sekera
acb9b8e8c3 make test: improve stability
Disable automatic garbage collection and run it manually before
running each test case to minimize stalls. Improve vpp subprocess
cleanup. Reduce helper thread count to one and properly clean that
thread once it's not needed.

Change-Id: I3ea78ed9628552b5ef3ff29cc7bcf2d3fc42f2c3
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-14 03:38:37 +01:00
Klement Sekera
b91017a30b make test: work around scapy truncated packets
Under stress, it's possible to hit a race condition, when the packet
header is fully written to pcap, but not all packet data - yet.
Scapy is stupid enough to:
1. not detect and report this error, truncating the packet instead
2. continue munching more data from wrong offset
The work around is to scan the file ahead, parse the packet header,
figure out how much data we need, wait for the file to be big
enough, then restore the file position back to where it was
and finally let scapy parse the packet.

Change-Id: I9fc71d3ebdc62ecab6c90b90f177d0eaeb09b8bb
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-09 06:10:47 +01:00
Klement Sekera
97f6edc1f5 make test: fix capture handling special-case
Change-Id: I4fc5dce832f9a6162181967c5290e6d0daa4f9f0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-12 20:32:51 +00:00
Klement Sekera
da505f608e make test: improve documentation and PEP8 compliance
Change-Id: Ib4f0353aab6112fcc3c3d8f0bcbed5bc4b567b9b
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-11 23:26:16 +00:00
Jan
e546d3b0f7 test: ip4 vrf instances multi-context test (CSIT-492)
- add/delete IPv4 VRF instances and verify results by parsing output
  of ip_fib_dump API command and by traffic

Change-Id: I61ed5013adca29afd00b942f65be7bf964f38d85
Signed-off-by: Jan Gelety <jgelety@cisco.com>
2017-01-11 11:57:39 +00:00
Neale Ranns
7515228928 IPv6 NS RS tests and fixes
includes Fix for VPP-584 with API change to remove prefix length from LL programming

Change-Id: If860751c35e60255fb977f73bc33e8c2649e728e
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-01-10 14:09:55 +00:00
Neale Ranns
465a1a3a46 In python tests send NS packets to the solicited mcast address with correct mcast MAC, rather than to quiered addr and broadcast MAC
Change-Id: Idb2f8ad09ccb421b7974b8a944cb411cfb4be9d5
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-01-09 08:53:57 +00:00
Klement Sekera
b12794e1bf make test: fix debug print
Change-Id: Id31a1a3644bdc245f12f3c9bce211099c5ef48f8
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-02 22:55:42 +00:00
Klement Sekera
a913534837 make test: rotate capture files after consuming arp/ndp
Change-Id: I512dc07638b4539d4a75e2ac40d3acee77f0bba6
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-02 22:55:09 +00:00
Klement Sekera
c86fa02201 make test: fix assert_nothing_captured api
Change-Id: I5cd11adcbd90a018deb3cd7cf157f72d9ab76e1c
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-02 22:54:45 +00:00
Klement Sekera
dab231a11e make test: improve handling of packet captures
Perform accounting of expected packets based on created packet infos.
Use this accounting info to automatically expect (and verify) the
correct number of packets to be captured. Automatically retry the read
of the capture file if scapy raises an exception while doing so to
handle rare cases when capture file is read while only partially
written during busy wait. Don't fail assert_nothing_captured if only
junk packets arrived.

Change-Id: I16ec2e9410ef510d313ec16b7e13c57d0b2a63f5
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-23 17:38:33 +00:00
Klement Sekera
65cc8c0dbf make test: filter IPv6 RAs out by default
Most of the test cases are not interested in IPv6 Router Alerts,
so change the default behaviour of get_capture to filter out
these packets with the possibility of turning the filtering off,
for test cases which are interested in the RAs.

Change-Id: I0b5ee685f82c49cd32c6d6a4638eb3493d2988fc
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-19 21:33:42 +00:00
Klement Sekera
9225dee965 make test: improve robustness and performance
Introduce an API which asserts empty capture for interface.
Throw exception in old API if the capture does not exist, thus
making it clear if the test expects packets to arrive or not.
Improve performance by not doing sleeps after starting the packet
generator, rather lazily deleting captures when needed.
Fix wrong usage of packet.show() in various tests.

Change-Id: I456cb23316eef99b3f35f80344fe595c4db9a21c
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-16 08:09:40 +00:00
Neale Ranns
82a06a9335 When waiting for an IPv6 response, filter non-ND packets
Change-Id: Ia5f5e00db84022bb7ee89a1b9d036fffa734295a
Signed-off-by: Neale Ranns <nranns@cisco.com>
2016-12-09 09:02:36 +00:00
Klement Sekera
0e3c0de1ed BFD: basic asynchronous session up/down
This is a work-in-progress basic BFD session handling. Only
asynchronous mode is supported at the moment. Setting the session flags
doesn't work.

Change-Id: Idba27f721b5c35be5a66a6d202a63d23ff7ecf6f
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-07 19:54:12 +00:00
Klement Sekera
7bb873a4cc make test: fix missing log/packet messages
Change-Id: Idb3119792943664748c4abc3829ad723f4156dfe
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-05 18:44:45 +00:00
Matej Klotton
c5bf07fabe Remove postinit from make-test interfaces
Change-Id: I1eb0f735c5d025e6096d5760eb01419a1c58530a
Signed-off-by: Matej Klotton <mklotton@cisco.com>
2016-11-24 09:32:57 +00:00
Klement Sekera
74dcdbfb2c make test: improve naming of temporary pcap files
Change-Id: I0f4e83aab8bec80562bd90e8035f602ce903cd3e
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-14 09:49:09 +01:00