251 Commits

Author SHA1 Message Date
Klement Sekera
909a6a1eb9 make test: detect hung tests
Run tests in a forked process with a set of pipes to communicate
keep-alives and overall result. This allows us to detect when e.g.
vpp dies mid-API call causing the test to hang waiting for response
(which will never come since vpp died).

Support setting a (per test case) TIMEOUT make test option to set timeout,
with a default timeout of 120 seconds.

Example - fail the test suite if any test-case fails to finish within
300s:

make TIMEOUT=300 test

Change-Id: I0d04f26a7232968f4bf043adf5d5b508f5018717
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-08-10 00:14:59 +00:00
Klement Sekera
60c1223acb make test: improve console output messages
Remove the word derp and replace it with a proper, more gramatically
correct message.

Change-Id: I04fd44cc67dace1a31ca48fc8ce67b246162ba79
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-07-18 20:52:47 +00:00
Klement Sekera
3658adcadc make test: improve debugability
Introduce faulthandler to print stack trace to stderr on python crash.
Don't disable automatic garbage collection to decrease the chances of
running out of memory.

Change-Id: I6927a5f6ea9569735d084d4ed3d258950a400d74
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-06-07 17:03:37 +00:00
Klement Sekera
3cfa558a24 make test: improve bfd reliability
Change-Id: Iaf446a2d7d8e595c3379fb9ed61a954351c17b90
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-04-20 13:29:09 +00:00
Klement Sekera
027dbd5288 make test: don't rely on cPython GC to close fds
This code improvement allows running in pypy (and other interpreters)
without exhausting file descriptors.

Change-Id: Icb692a0fe1343c12cbbb15af6c58753420e74330
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-04-12 17:12:58 +00:00
Klement Sekera
3747c75a21 make test: automatic "vpp finishes startup" check
Add code which checks if vpp doesn't crash/exit immediately after
startup to aid debugging stuff like mistyped graph node name or so.
Refuse to run tests if the vpp is unable to start, complain loudly
and print vpp's stderr at critical log level if this happens to make
spotting these problems in jenkins easy.

Change-Id: I40d3fbd05c822c0534713bae6bef05ecfb0e0c1d
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-04-10 13:43:03 +00:00
Neale Ranns
88fc83eb71 BFD-FIB interactions
- single-hop BFD: attach a delegate to the appropriate adjacency
- multi-hop BFD [not supported yet]: attach a delegate to the FIB entry.

adjacency/fib_entry state tracks the BFD session state. when the state is down the object does not contribute forwarding hence and hence dependent objects will not use it.
For example, if a route is ECMP via two adjacencies and one of them is BFD down, then only the other is used to forward (i.e. we don't drop half the traffic).

Change-Id: I0ef53e20e73b067001a132cd0a3045408811a822
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-04-06 15:18:44 +00:00
Neale Ranns
9a69a6095f Sub-net broadcast addresses for IPv4
Change-Id: Ib2189d01e8bc61de57404159690fb70f89c47277
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-03-29 12:06:13 +00:00
Klement Sekera
6abbc2884a make test: fix broken plugin paths
Change-Id: I25a6882ec503fc5bb3694411fbdc2eb1f1e1fafc
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-03-24 06:52:21 +01:00
Klement Sekera
47e275bbe4 make test: support out-of-tree plugins
usage:

env EXTERN_PLUGINS=/path/to/plugins make test

Change-Id: I8eece726dfafeff1cffd921c1e18cd3eb7eb64ed
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-03-22 10:48:26 +00:00
Pavel Kotucek
59dda065bb ACL plugin rejects ICMP messages (VPP-624)
Change-Id: I95113a277b94cce5ff332fcf9f57ec6f385acec0
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
2017-03-13 13:17:00 +00:00
Damjan Marion
374e2c5fc3 Retire vpp_lite
vpp_lite platform is not needed anymore as same efect can be
achieved with following startup.conf config:

plugins {
	plugin dpdk_plugin.so { disable }
}

Change-Id: I690ea8ceb1c6e1fe32e01e7da54e9958019a93bf
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-10 19:35:49 +00:00
Klement Sekera
871349371a make test: split into basic and extended tests
Implement plumbing to allow decorating tests as extended, e.g.:

@unittest.skipUnless(running_extended_tests(), "part of extended tests")

both methods and classes can be decorated this way.

Change make test and make test-debug to run only non-extended tests.
Introduce make test-all and make test-all-debug to run the full suite.
Run full suite as part of make verify.
Decorate most BFD tests as extended.

Change-Id: I3bc64f59e9fe238f7f767d7e043dc165d03e9dfa
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-03-08 21:56:59 +00:00
Klement Sekera
1b68640930 make test: reset object registry if vpp dies
Change-Id: If0e30837e07a21f3912676f5147cb242d3d2b235
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-03-06 16:17:21 +00:00
Klement Sekera
80a7f0a81c make test: tell vpp to set coredump size
Unless overridden by COREDUMP_SIZE env variable, tell VPP to set
coredump size to unlimited, otherwise use $COREDUMP_SIZE as
the argument.

Change-Id: Ia2a6508207c66a171b33d272c820b1deb4a83e82
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-03-06 16:17:21 +00:00
Klement Sekera
239790fd91 BFD: echo function
Change-Id: Ib1e301d62b687d4e42434239e7cd412065c28da0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-26 14:20:24 +00:00
Dave Wallace
90c55724b5 make test: save + dump VPP api trace log; VPP-640
Change-Id: I20aacc927f2b04f42b0a7220c4283560b4d2a359
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2017-02-19 13:51:11 +00:00
Klement Sekera
aeeac3bf44 BFD: loop back echo packets
Change-Id: I772b63ac25ebfccaff9ab9d8d0b1445e85f21df7
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-15 12:10:23 +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
a57a970952 BFD: modify session parameters
Change-Id: I666e5c0cc71a3693640960c93cdd1907f84fbe23
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-08 07:47:00 +01:00
Klement Sekera
104543fa6a make test: improve test filtering
Implement fine-grained test filtering by supporting more complicated
filters beside the original file name suffix filter.

Change-Id: If5a166d08cffe8c58cc6cf174e6df861c34dbaa6
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-06 23:33:52 +00:00
Klement Sekera
b17dd9607e BFD: SHA1 authentication
Add authentication support to BFD feature. Out of three existing
authentication types, implement SHA1 (sole RFC requirement). Simple
password is insecure and MD5 is discouraged by the RFC, so ignore
those.
Add/change APIs to allow configuring BFD authentication keys
and their usage with BFD sessions.

Change-Id: Ifb0fb5b19c2e72196d84c1cde919bd4c074ea415
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-02-02 12:04:30 +00:00
Klement Sekera
7a161da36e make test: fix text output when non-interactive
Output everything to stdout instead of mixing stdout and stderr.

Change-Id: I3146760e068fda7f1ffaaf36683d5153dcda4561
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-17 22:02:16 +00:00
Klement Sekera
52e84f3cad make test: improve test results printing
Accomodate longer test descriptions by increasing the headings
size.

Change-Id: I51c90b8d91feaa83b78972d0802d3054f8510f36
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-13 07:28:52 +01: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
Klement Sekera
10db26f7bf BFD: fix bfd_udp_add API
Fix reporting of bs_index in the return message. Enhance test suite
to cover this case.

Change-Id: I37d35b850818bc1a05abe67ca919c22aeac978b6
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-11 19:49:31 +00:00
Matej Klotton
8d8a1da529 make test: Loopback interface CRUD test
Change-Id: I0581da7a682bfe4dd6520ecf1b2ea6bd8c20b1b3
Signed-off-by: Matej Klotton <mklotton@cisco.com>
2017-01-09 13:33:39 +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
6c7440ca95 make test: add log.txt
Always create a log.txt under test's temporary directory containing
V=2 output for debugging purposes.

Change-Id: If149c8126f42f80724ee17b63c411ddec6645f85
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-23 09:16:39 +01: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
Matej Klotton
16a14cdb16 make test: FIB add/update/delete - ip4 routes
- JIRA:CSIT-483

Change-Id: Idb4c5bd7a234bc975f3380ece58c0e8d4bfdafd9
Signed-off-by: Matej Klotton <mklotton@cisco.com>
2016-12-09 09:03:19 +00:00
Klement Sekera
e4504c6320 BFD: fix timing in the main loop
Properly wakeup the main process loop only when necessary to avoid
missed events. Improve BFD unit test reliability and speed. Add
timestamps to logs and replace Queue with more efficient deque.

Change-Id: I01255a02057d3146917b43b669ccdc74f31ef0c8
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-09 09:00:26 +00:00
Klement Sekera
0c1519b5e7 BFD: improve ip header handling, fix assert
Instead of storing a pointer, store an offset within vlib_buffer marking
the start of the ip header (similar to storing start of ethernet
header). Handle negative timeout in the bfd process main loop.

Change-Id: I05a1ff3ac41da5bdc3b2ac6f9e03b3241994688b
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-08 12:16:42 +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
Klement Sekera
0529a743cc make test: handle exceptions from VppPapiProvider.__init__
Change-Id: I3c0372d5d09d554ad4ebe0adfa97c111571f628a
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-02 14:20:29 +00:00
Klement Sekera
085f5c0066 make test: detect early vpp crash
If VPP process dies right at start, do a quick detection instead of being
stuck in the connect timeout (60s).

Change-Id: I41675181635fb81a6a7d93fbf652480a16bf78a0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-28 11:54:47 +00:00
Neale Ranns
177bbdcd8f GRE tests and fixes
Change-Id: I234240e9bdd4b69ad64a17b1449ae1e81c0edaca
Signed-off-by: Neale Ranns <nranns@cisco.com>
2016-11-22 21:26:55 +00:00
Matej Klotton
86d87c40dd Update test documentation.
- update IRB, IPv4, ipv6 doc
- revert 778c2765c8ea5c6628f6d668847f0b9ae06dbf3d

Change-Id: I9af5ed9329ce5fe01392cf28d5bf321cfc647e48
Signed-off-by: Matej Klotton <mklotton@cisco.com>
2016-11-15 15:32:48 +00:00
Jan
49c0fcabad Add single-loop test variant to L2BD and L2XC tests
- create single-loop version of tests
 - update doc strings

 - add possibility to log CLI string for logging level "info"

Change-Id: Ibc9e5650b8a33d2ed168a8440c2ae03227be60bb
Signed-off-by: Jan <jgelety@cisco.com>
2016-11-11 18:06:15 +00:00
Matej Klotton
0178d52384 Add IRB test
- JIRA: CSIT-255
- create loopback interfaces
- move pg-interface specific arp and neighbor discovery from vpp_interface to vpp_pg_interface
- base configuration of IRB tests
- IP test scenario

Change-Id: I9945a188163652a4e22325877aef008c4d029557
Signed-off-by: Matej Klotton <mklotton@cisco.com>
2016-11-11 10:29:04 +00:00
Klement Sekera
931be3aca2 Test framework: improve gdbserver handling
Produce a user-friendly message if gdbserver is not available, instead
of cryptic exception.

Change-Id: Ia0d99e0488d2ee6e8af764b466dae2639f17ea55
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-03 16:43:04 +00:00
Klement Sekera
01bbbe91fa Improve debug-cli in test framework
Opening debug-cli only makes sense if there is time for user to use it,
so either the run must be debugged or stepped. Only open the debug-cli
in these cases.

Change-Id: Ied276071797a549880d730cda43c59230a412efe
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-02 14:14:28 +00:00
Neale Ranns
8fe8cc21d1 MPLS Exp-null Tests
Add some 'make test' unit tests for MPLS explicit NULL label handling.
Fix the stacking of the MPLS load-balance result form the lookup onto the IPx lookup object.

Change-Id: I890d1221b8e3dea99bcc714ed9d0154a5f602c52
Signed-off-by: Neale Ranns <nranns@cisco.com>
2016-11-01 19:26:24 +00:00
Klement Sekera
277b89c946 add vpp debugging support to test framework
improve test documentation

Change-Id: Ia9678aa2532ecb4cb33736aedb4a31aa3f2a3f93
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-10-31 23:48:25 +00:00
Klement Sekera
f62ae1288a refactor test framework
Change-Id: I31da3b1857b6399f9899276a2d99cdd19436296c
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Signed-off-by: Matej Klotton <mklotton@cisco.com>
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2016-10-26 17:42:19 +02:00
Peter Ginchev
749294dfeb Disable colored output for tests, when not tty
Change-Id: I73f01bd3a8e7caa00c75b845b9e61d3cb0f34877
Signed-off-by: Peter Ginchev <pginchev@cisco.com>
2016-10-25 13:34:06 +00:00
Pierre Pfister
cd8e318a76 Test Infra: Add plugin support
This patch adds plugin path to vpp commandline arguments
when 'make test' is run.
Hence, test cases can test plugins.

Change-Id: Ib90efa1f62e03b45b84533c49c7a5d040aa8cddf
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2016-10-07 21:34:59 +00:00
Klement Sekera
b80f9d1b73 don't require root privileges when running the tests
Change-Id: Ib67bf1a898e3c1e4038698f1cb068ae9099d7921
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-10-05 16:43:25 +00:00
Damjan Marion
f56b77a076 test: new test infrastructure
Change-Id: I73ca19c431743f6b39669c583d9222a6559346ef
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Signed-off-by: Stefan Kobza <skobza@cisco.com>
Signed-off-by: Matej Klotton <mklotton@cisco.com>
Signed-off-by: Maciek Konstantynowicz <mkonstan@cisco.com>
Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-10-03 19:58:19 +00:00