summaryrefslogtreecommitdiffstats
path: root/test/test_nat.py
AgeCommit message (Collapse)AuthorFilesLines
2019-08-22tests: move plugin tests to src/plugins/*/testDave Wallace1-9575/+0
- Relocate plugin tests for 'make test' into src/plugins/*/test so that plugin test cases are co-located with the plugin source code. Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I503e6a43528e14981799b735fa65674155713f67 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2019-08-20api: Cleanup APIs interface.apiJakub Grajciar1-18/+17
Use of consistent API types for interface.api Type: fix Change-Id: I88206d7d0907cffd564031f73c9a996df2e5e21a Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-07-31tests: disable pg capture before enabling itAndrew Yourtchenko1-0/+22
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-06-25tests: one more ipfix flush cli to api replacementVratko Polak1-1/+1
Type: fix Fixes: 21b83e96d6076cda01ee80343840bc1166557150 Change-Id: I8216127ddbbf3301d2602bab54dbc433233387a2 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-06-24api: implement ipfix_flushPaul Vinciguerra1-11/+11
-Migrate tests to api and cleanup: '# FIXME this should be an API call' in tests. Type: feature Change-Id: I715f9f8acc0f2af9c974ea221b2aea46692a6218 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-20tests: move output from CI results and put in logPaul Vinciguerra1-1/+1
NAT session details are output to the test results. Twice NAT44 OK Acquire twice NAT44 addresses from interface OK 21:10:42,661 NAT44 sessions: -------- thread 0 vpp_main: 1 sessions -------- 172.16.1.2: 0 dynamic translations, 1 static translations i2o 172.16.1.2 proto tcp port 8080 fib 0 o2i 10.0.0.3 proto tcp port 80 fib 0 external host o2i 172.16.2.2:4567 i2o 10.0.1.3:42296 index 1869 last heard 97.99 total pkts 2, total bytes 80 static translation load-balancing twice-nat Twice NAT44 local service load balancing OK NAT44 translate packet with unknown protocol OK Type: test Change-Id: I932a4a1133d597bb82da6e04f2ea833094a481da Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-18fib: fib api updatesNeale Ranns1-134/+78
Enhance the route add/del APIs to take a set of paths rather than just one. Most unicast routing protocols calcualte all the available paths in one run of the algorithm so updating all the paths at once is beneficial for the client. two knobs control the behaviour: is_multipath - if set the the set of paths passed will be added to those that already exist, otherwise the set will replace them. is_add - add or remove the set is_add=0, is_multipath=1 and an empty set, results in deleting the route. It is also considerably faster to add multiple paths at once, than one at a time: vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.11 100000 routes in .572240 secs, 174751.80 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.12 100000 routes in .528383 secs, 189256.54 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.13 100000 routes in .757131 secs, 132077.52 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.14 100000 routes in .878317 secs, 113854.12 routes/sec vat# ip_route_add_del 1.1.1.1/32 count 100000 multipath via 10.10.10.11 via 10.10.10.12 via 10.10.10.13 via 10.10.10.14 100000 routes in .900212 secs, 111084.93 routes/sec Change-Id: I416b93f7684745099c1adb0b33edac58c9339c1a Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-05-22stats: support multiple works for error countersOle Troan1-52/+61
The current code only allowed access to the main thread error counters. That is not so useful for a multi worker instance. No return a vector indexed by thread of counter_t values. Type: fix Change-Id: Ie322c8889c0c8175e1116e71de04a2cf453b9ed7 Signed-off-by: Ole Troan <ot@cisco.com>
2019-05-17Tests: Refactor. Remove copies of enums.Paul Vinciguerra1-6/+14
Use the enums provided from the api definitions instead. Change-Id: I43b7591df920c984e439efc4b3ec3c4121c539d8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-05-06NAT: VPP-1646 test case assertsFilip Varga1-0/+1
Change-Id: I466cea5cbe82a34d4b0b20a76bf5df4d529670e4 Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-05-02NAT: VPP-1661 - test case cleanup and refactoringFilip Varga1-716/+1175
Change-Id: I0eb85252d4b489ba25dcf59252e2bcf3b0cd5c6a Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-04-24NAT: VPP-1531 api cleanup & updateFilip Varga1-577/+714
Change-Id: I2492400a67b39a3adbc24ab7cf1ba17a409e95a8 Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-04-23Revert "NAT: VPP-1531 api cleanup & update"Ole Trøan1-714/+577
This reverts commit bed1421b9f1b3643d93384084972337b596aec73. /vpp/master3/src/plugins/nat/nat_api.c: In function ‘send_nat_worker_details’: /vpp/master3/src/vppinfra/clib.h:62:33: error: division ‘sizeof (u8 * {aka unsigned char *}) / sizeof (u8 {aka unsigned char})’ does not compute the number of array elements [-Werror=sizeof-pointer-div] #define ARRAY_LEN(x) (sizeof (x)/sizeof (x[0])) ^ /vpp/master3/src/plugins/nat/nat_api.c:205:43: note: in expansion of macro ‘ARRAY_LEN’ rmp = vl_msg_api_alloc (sizeof (*rmp) + ARRAY_LEN (w->name) - 1); ^~~~~~~~~ Change-Id: Ie82672c145fb2f6580827f95e535435307bc7a23 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-23NAT: VPP-1531 api cleanup & updateFilip Varga1-577/+714
Change-Id: I519d7efc8ee3c86381d96be2e2a46017cd948895 Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-04-11Tests: Refactor tearDown show command logging, add lifecycle markers.Paul Vinciguerra1-47/+56
This change adds a consistent interface for adding test-specific show commands to log.txt. It also adds log markers for the execution of setUp[Class], tearDown[Class] in the logs. Change-Id: I7d42e396e594a59e866a7d55dac0af25548e657a Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-04-10Tests Cleanup: Fix missing calls to setUpClass/tearDownClass.Paul Vinciguerra1-0/+32
Continuation/Part 2 of https://gerrit.fd.io/r/#/c/17092/ Change-Id: Id0122d84eaf2c05d29e5be63a594d5e528ee7c9a Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-24/+24
Change-Id: I53ab8d17914e6563110354e4052109ac02bf8f3b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-17/+18
This reverts commit e63325e3ca03c847963863446345e6c80a2c0cfd. Allow time for CSIT to accommodate. Change-Id: I59435e4ab5e05e36a2796c3bf44889b5d4823cc2 Signed-off-by: ot@cisco.com
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar1-18/+17
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-03-11vpp_papi_provider: Remove more wrapper functions.Ole Troan1-12/+11
Split this work up into pieces. Please don't add new wrappers to vpp_papi_provider.py. Change-Id: I0f8f2afc4cd2bba07ea70ddecea2d7319f7b2e10 Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-11VPP-1508: Tests: Fix vpp_api struct.error under py3.Paul Vinciguerra1-9/+9
Fix struct.error: expected bytes object got <class 'str'> Change-Id: I837ae6e97e44c789a9372677151b157956525334 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11VPP-1508: Use scapy.compat to manage packet level library differences.Paul Vinciguerra1-41/+44
Change-Id: Icdf6abc9e53d33b26fd1d531c7dda6be0bb9cb55 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11Tests: use self.assertNotIn().Paul Vinciguerra1-2/+2
Many tests use self.assertEqual(error.find("failed"), -1) Use self.assertNotIn("failed", error) to provide more meaningful errors such as AssertionError: 'Failed' not found in '' instead of 0 != -1. Change-Id: I670acdc977b788b2cedf94cfeafc12097781463f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-06test framework: vpp_papi_provider.py - further cleanupOle Troan1-23/+24
Part of further cleanups of this file. Removed most wrappers that don't have conflicting signature with message API. Change-Id: I6acd93d20291feb7731eb35ab2eb8c9f22f4632c Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-04test framework: Fix wrapper functions to match API message names.Ole Troan1-31/+34
In preparation to remove the wrappers in vpp_papi_provider.py, ensure names used in tests match the actual API message names. Change-Id: I230ca4eb75aa727ff68d702e085a2edbbc6b6d19 Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-04test framework: add factory function and default parametersOle Troan1-4/+4
This is the first step to be able to remove all the API message wrappers in vpp_papi_provider.py. This allows to remove all functions that do not override parameters (different from zero), and a separate dictionary for messages requiring different defaults. The general requirement is that all new tests should use named arguments directly. Not positional arguments through the wrapper. Note when removing functions, the calls in vpp_papi_provider wrappers do not necessarily follow message order. Change-Id: If64916c07f8622c138db3a9d7c4a98b93a058e68 Signed-off-by: Ole Troan <ot@cisco.com>
2019-02-27NAT44: active-passive HA (VPP-1571)Matus Fabian1-2/+351
session synchronization so that we can build a plain active-passive HA NAT pair Change-Id: I21db200491081ca46b7af3e82afc677c1985abf4 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2019-01-30Use IP and MAC API types for neighborsNeale Ranns1-30/+44
use address_t and mac_address_t for IPv6 and ARP entries and all other API calls in ip.api aprat from the route ones, that will follow in a separate commit Change-Id: I67161737c2184d3f8fc1e79ebd2b55121c5b0191 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-18VTL: Don't swallow exceptions from syslog_rfc5424_parserPaul Vinciguerra1-6/+11
Change-Id: I4e93073ceb7b75476e847ae8d56301770c8b264f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-21MAP: Convert from DPO to input feature.Jon Loeliger1-2/+1
Change-Id: I25c86aea23dff19656449b23133db27b1f062ac0 Signed-off-by: Jon Loeliger <jdl@netgate.com> Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-20NAT: total users and sessions gauges (VPP-1484)Matus Fabian1-0/+33
Change-Id: I41a82e21571d5c64d01af72cd88c3983afac26ed Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-12-20Tests: Cleanup @skip decorator.Paul Vinciguerra1-10/+10
The runnning environment is static as of module load time, so only evalute the conditions once at module load time. Track-by: VPP-1518 Change-Id: I73b0d17ae1ff90789e70307f168d43921829aec8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-18NAT44: nat44_add_del_lb_static_mapping enhancements (VPP-1514)Matus Fabian1-0/+60
Change-Id: I5419e06592b0402e911e132796368800321f355a Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan1-7/+7
Change the definition of vl_api_mac_address_t to an aliased type. Change-Id: I1434f316d0fad6a099592f39bceeb8faeaf1d134 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-14NAT: counters (VPP-1484)Matus Fabian1-1/+115
Change-Id: I5d1852a09712adfe7547c200d161539736aca6f5 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-6/+6
Add 2/3 support to binarytomac and mactobinary and move to vpp_mac.py Change-Id: I3dc7e4a24486aee22140c781aae7e44e58935877 Signed-off-by: Ole Troan <ot@cisco.com>
2018-11-30Tests: Fix traceback.Paul Vinciguerra1-15/+14
self.assertTrue(packet.haslayer(msg_type)) File "/usr/lib/python2.7/unittest/case.py", line 422, in assertTrue raise self.failureException(msg) AssertionError: 0 is not true * Scapy packet.haslayer() returns 1 or 0. Replace with assertEqual(packet.haslayer(), 1) to fix tracebacks. * Scapy has multiple layers called TCP/UDP Specify the module name to prevent namespace collisions. * Remove duplicate import. Change-Id: I600f9f330075cd40e1da50f8b2ceb24f645f2c20 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-29NAT: syslog - sessions logging (VPP-1139)Matus Fabian1-1/+173
Change-Id: I6e0b7cf37c1a9ac66f8ac011db29504e57844ee9 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-11-26Python3 tests: Fix asserts.Paul Vinciguerra1-4/+4
Use assert(Not)Equal() Use assert{Greater,Less}[Equal] Change-Id: I7c14570b8dce463ee13a67e9c1f10beb1a0308a8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-23NAT44: improve expired sessions reuse (VPP-1503)Matus Fabian1-17/+2
Change-Id: Iab506f127136c94a641df31ded108016de26260b Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-11-22MAP: Use explicit address/prefix types in APIOle Troan1-0/+2
Change-Id: Ic751fecc4a060eedcdb9eaf5d02e1416c838fd63 Signed-off-by: Ole Troan <ot@cisco.com>
2018-11-22NAT44: Apply transitory timeout on TCP RST (VPP-1494)Matus Fabian1-0/+51
RFC7857 section 2.2. Change-Id: I031af5fe379b72262e83fd8565c34fa1b772f2c8 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-11-20NAT44: fix virtual fragmentation reassembly in forwarding mode (VPP-1501)Matus Fabian1-0/+26
Change-Id: Id86d8aa8753b9b2ff4c709b11e3901ba8d552918 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-11-19NAT44: fix bug in TCP close with output-feature interface (VPP-1493)Matus Fabian1-0/+82
Change-Id: If8c883d6b1ee58de9a03012d3567ec82211a0225 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-10-19NAT44: fix ICMP virtual fragmentation reassembly (VPP-1466)Matus Fabian1-109/+22
Change-Id: I8006bca02948d9121f474a3d14f0576747bb3c51 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-10-12NAT44: identity NAT fix (VPP-1441)Matus Fabian1-0/+4
Change-Id: Ic4affc54d15d08b9b730f6ec6146ee053b28b4b6 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-10-08NAT44: do not create session record for identity mapping (VPP-1439)Matus Fabian1-0/+3
Change-Id: I39a3146a4e4ba8eadf50af7113b9ae6b1c1d688f Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-09-24NAT44: endpoint-dependent mode session timeout improvement (VPP-1423)Matus Fabian1-0/+10
Change-Id: I630f3da1ea4e6e50a50f1352c097becef1efe3c0 Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-09-20NAT44 virtual fragmentation reassembly for endpoint-dependent mode (VPP-1325)Juraj Sloboda1-16/+518
Change-Id: I36ece2ef2eaef9fa559d69ec7f7f07e7c16a7a9d Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-09-13NAT: TCP MSS clampingMatus Fabian1-0/+52
NAT plugin changes the MSS value in TCP SYN packets to avoid fragmentation. If the negotiated MSS value is greater than the configured value it is changed to the configured value. If the negotiated MSS value is smaller than the configured value it remains unchanged. Change-Id: Ic3c4f94a2f1b76e2bf79f50f3ad36a4097f3f188 Signed-off-by: Matus Fabian <matfabia@cisco.com>