aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Collapse)AuthorFilesLines
2019-07-12papi: fix vpp_format from change in vl_api_prefix_tPaul Vinciguerra2-12/+10
cherry picking fix for bug introduced by https://gerrit.fd.io/r/#/c/20011/ - also fixes unit tests. Type: fix Fixes: ab05508e1eb96749b68de8ccd2f6f88ff3e64fad Change-Id: I8287385f094911ea70de4751a716a7e0e6521b64 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-07-09papi: update VPPEnumType for python3Paul Vinciguerra1-1/+4
Python3 uses __bool__ instead of __nonzero__ Type: fix Depends-on: https://gerrit.fd.io/r/#/c/20484/ Change-Id: I7dd13d0508ab18d6c50c235f4186006799e92b45 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-07-08map gbp papi: match endianess of f64Paul Vinciguerra1-1/+1
clib_net_to_host_f64, clib_host_to_net_f64 are now implemented as '=', https://gerrit.fd.io/r/#/c/20406/ set papi to match. - all f64 api references are now wrapped with clib_net_to_host_f64 or clib_host_to_net_f64. IEEE f64 endianess is not defined. If clib_net_to_host_f64 and clib_host_to_net_f64 are later defined in VPP as big-endian, it is a single character change in the papi vpp_serializer. Note: This breaks the api in a manner that would not be detected by the flag day initiative. The scope is small. This only impacts map.api, which applied the u64 transformation, while the gbp api uses '='. The implementation of "=" raises issues for the papi socket implementation if used between systems of differing endianess. See Vratko's comments. - Added get_f64_endian_value() to api to allow client to verify endianess of f64's. Type: fix Depends-on: https://gerrit.fd.io/r/#/c/20484/ Change-Id: I00fc64a6557ba0190398df211aa0ea5c7eb101df Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-07-05sctp: move to plugins, disabled by defaultFlorin Coras1-0/+3
Removed sctp buffer metadata from vnet/buffer.h, added it to the plugin. Add registration APIs for plugin-based vlib_buffer_opaque / opaque2 decoders, used by "pcap dispatch trace ..." for display in the wireshark dissector. Type:refactor Not actively maintained. Change-Id: Ie4cb6ba66f68b3b3a7d7d2c63c917fdccf994371 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2019-07-01papi: refactor set_errors_strPaul Vinciguerra1-3/+3
Assuming 2500 50 char lines: string_concat elapsed: 5.919933e-04 string_join elapsed: 2.830029e-04 string_concat size: 156,312,500 string_join size: 125,000 Type: refactor Change-Id: I0a400265426bde492e9a651d24996ddcfe954aa1 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-26papi: prevent message_table inconsistenciesVratko Polak1-0/+2
Socket transport is maintaining message_table to map message name to index. After disconnect and re-connect, the VPP may have been restarted with different set of plugins, so message_table has to be wiped. + Edited MAINTAINERS to recognize "papi" as a separate component. Type: fix Change-Id: I1f16ad7ee0886e03bbc6a17bcddbfcaa322354e5 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-06-26api: refactor format_vl_api_prefix_t return keysPaul Vinciguerra2-13/+13
format_vl_api_prefix_t returns a dict with keys 'address' and 'address_length', but other format_vl_api_prefix functions return a dict with 'prefix', and 'len'. Refactor all format_vl_api_prefix_t to return consistent keys 'address' and 'len'. Type: refactor Change-Id: I5f9558fc2da8742a303266e011102f5b2db80aad Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-25api: fix vac_read return codesPaul Vinciguerra2-4/+13
- vac_read was returning the same code for multiple errors. - Refactor VppTransportShmemIOError to capture rv and description. Type: refactor Change-Id: Ifb8ca5ff679f658bcd92a43ecddaffd2fc18dbd5 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-20misc: papi - add __repr__ to FuncWrapperPaul Vinciguerra1-0/+3
Eases troubleshooting. Changes: <FuncWrapper object at 0x7fa7402de790> to <FuncWrapper(func=<want_ip6_ra_events(u16 _vl_msg_id, u32 client_index, u32 context, u8 enable_disable, u32 pid)>)> Type: refactor Change-Id: I3a893090e024a63a0b3b0de51cb3bb2d2a1678c5 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-18misc: vpp_papi- add tests, clean up pep8Paul Vinciguerra7-18/+202
Type: test Change-Id: Ic81bd4a9eba3c89a746e7a9b9e471b59cd87fa40 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-17misc: vpp-api - add __repr__ to VPPApiClient.Paul Vinciguerra1-0/+13
Show the constructor of the object instead of the memory location. api client: <VPPApiClient apifiles=None, testmode=False, async_thread=True, logger=<logging.Logger object at 0x7f35d1bd2590>, read_timeout=1, use_socket=False, server_address='/tmp/vpp-unittest-TestGbpApi-pOKbWg/api.sock'> vs. api client: <vpp_papi.vpp_papi.VPPApiClient object at 0x7fa0003df750> Type: feature Change-Id: I1460d76f6796776dd525c0844e9e426ec2d52398 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-14stats: add version field to stat segment base headerOle Troan3-0/+19
Add a version in the base header of the stat segment To make support for multiple reader implementations safer. Change-Id: I6816e2a51a98c2df1e621e80d4ef0b4ba4e9f47b Type: feature Signed-off-by: Ole Troan <ot@cisco.com>
2019-06-12papi: make socket disconnect more robustVratko Polak1-1/+1
Previusly, read error could happen before message_thread starts, so do not attempt to join in that case. Change-Id: Ie119916831e320e38eb02e48515b4c6a9cb937e5 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-06-07API: Add support for "defaults"Ole Troan4-28/+82
Add support in the API language for specifying a field default. Add default support in Python binding. define foo { u16 mtu [default = 1500]; }; This is client side only. I.e. if the mtu argument is not passed to the foo function, the client language binding will set it default to 1500. Change-Id: I5df43f3cd87cb300b40ca38e15dcab25b40e424a Signed-off-by: Ole Troan <ot@cisco.com>
2019-06-07vppapigen: Fold up CRC from dependent types.Ole Troan1-3/+2
Change-Id: Id51f26f225cd567ca19efc2301e94fa88840ae8f Signed-off-by: Ole Troan <ot@cisco.com> Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
2019-06-07vpp_papi: Context_id allocator for running forked.Paul Vinciguerra2-5/+60
When running forked, distinct copies of the 'get_context' singleton are created for each process. To run under forked processes, (as with make test TEST_JOBS=10), we need to use a shared memory value across the processes. Type: fix Change-Id: I9eab8ce46ec23584e5bd651735ad75fd3f018e1a Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-07vpp_papi: Fix missing dependency.Paul Vinciguerra1-2/+8
Since we test vpp_papi as part of tests, the need for ipaddress under python2.7 is masked. Add ipaddress to setup.py for python <=3.3. Change-Id: I01c2f5560eeb740e546024e84028d5a2fb2ace45 Type: fix Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-07vpp_papi: Fix format_vl_api_address_t under python3.Paul Vinciguerra1-1/+3
Under PY3, inet_pton returns OSError, not socket.error. Type: fix Change-Id: Id270a684c0ab124cbe1ddcb7123e14e85af844b8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-07vpp_papi: Accept ipaddress.Network objects on prefix_t methods.Paul Vinciguerra1-1/+16
vl_api_prefix_t returns ipaddress.<IPv[46]>Network objects. Accept Network objects as well as existing string format. Type: refactor. Change-Id: Iba5403724a7b3e1da3b3740027fccd43631bf31e Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-07vpp_papi: Fix vapi.disconnect exception.Paul Vinciguerra1-0/+1
Traceback (most recent call last): File "/vpp/test/framework.py", line 521, in setUpClass cls.quit() File "/vpp/test/framework.py", line 556, in quit cls.vapi.disconnect() File "/vpp/test/vpp_papi_provider.py", line 308, in disconnect self.vpp.disconnect() File "/vpp/src/vpp-api/python/vpp_papi/vpp_papi.py", line 500, in disconnect if self.event_thread is not None: AttributeError: 'VPPApiClient' object has no attribute 'event_thread' Type: fix Change-Id: I7a8db08b0922bf92ab42df121b1707073af9cedf Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-04stats: removing empty object in stats vectorOle Troan1-1/+3
Type: fix Change-Id: I9b6bdacdb9a0750834de9a93d8c3f7ed827ce3c8 Signed-off-by: Ole Troan <ot@cisco.com>
2019-05-28papi: avoid IOError on disconnectVratko Polak2-6/+18
Change-Id: I331efb20b98a7e3c507d9158d0221ee7d5353b18 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-23vpp_papi: Do not raise before find_api_dir()Vratko Polak1-4/+1
The change https://gerrit.fd.io/r/18352 has introduced a check which raises when neither apifiles nor apidir are set. This change removes that check, as it broke CSIT. If such a check is intended, find_api_dir() should be removed. Also, make sure you do not break CSIT next time. Change-Id: I0faab7c41d199e3aa5d5bc6aab0defd1ab9e10da Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-22stats: support multiple works for error countersOle Troan3-11/+27
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-15vpp_papi: remove dependency on environment var. VPP_API_DIR.Paul Vinciguerra1-6/+9
Change-Id: I9e3af8674e8aae27079fd03f6286f165d777814f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-05-10vpp_transport_socket: make connect more resilientVratko Polak1-11/+32
This should make connect() partially retriable, at least against "No such file or directory on socket", and when disconnect() is called before retrying connect(). Added TODOs for future improvements. Change-Id: I5ee727fbc17d66446589b8c781f270055187db68 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-09Improve exceptions in vpp_transport_socket.pyVratko Polak1-2/+4
Added TODOs for further improvements. Change-Id: I6724dd8b3de5537518a5c6e0ee9abe72f57b273e Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-09Fix copypaste in vpp_papi/vpp_transport_socket.pyVratko Polak1-3/+2
Change-Id: I80e6ccd6f63e3eca2ba723f3b39a47475ae9aed0 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-08Fix Exception typo in vpp_papi/vpp_transport_socket.py.Paul Vinciguerra1-1/+1
Change-Id: I80ef74abcb14136984a4c94ba60414a1348015d3 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-05-07Allow repeated connects on PAPI socket transportVratko Polak1-1/+10
The previous implementation fails with RuntimeError("cannot set daemon status of active thread") when a second connect() follows first disconnect(). Change-Id: I671005923eb020130a57b0b484a3386a05d7be33 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-04-30stats: Add version defines in stat_client.hOle Troan1-0/+3
Change-Id: I9894a0c613b0486112623920d49371ceec9e6111 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-29API: Add support for limits to language.Ole Troan3-10/+46
string name [limit = 64]; Meta-data to do argument validation. Change-Id: I1f3e0f09b2d5285224399413d25206f77bd3f4b1 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-24NAT: VPP-1531 api cleanup & updateFilip Varga1-1/+1
Change-Id: I2492400a67b39a3adbc24ab7cf1ba17a409e95a8 Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-04-23API: Python and Unix domain socket improvementOle Troan1-27/+19
Handle the case where buffer overflows. Then SOCK_SEQPACKET assumption that multiple API messages are not returned by recv() is broken. Use SOCK_STREAM for API exchanges instead. Add support for running tests over sockets. make test SOCKET=1 Change-Id: Ibe5fd69b1bf617de4c7ba6cce0a7c2b3f97a2821 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-23Revert "NAT: VPP-1531 api cleanup & update"Ole Trøan1-1/+1
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-1/+1
Change-Id: I519d7efc8ee3c86381d96be2e2a46017cd948895 Signed-off-by: Filip Varga <fivarga@cisco.com>
2019-04-16stats: Add name vectors to Python clientOle Troan3-45/+78
Change-Id: Ic62dfa0bf3e082a0b999026830c64a9c543da586 Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-16API: Handle pthread cond signal case where signal is missed.Ole Troan1-1/+8
Especially on a single core setup the RX thread could signal the main thread that it was done, before main thread listened to the signal. Change-Id: Ib70337b21bcf77787ce4ee0aa9cf80c6da2215af Signed-off-by: Ole Troan <ot@cisco.com>
2019-04-08GBP: drop and contract countersNeale Ranns1-1/+1
Change-Id: Ib436512a26e53f70f7b5e47bf34224ab73e5244e Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-03-22vppapigen: allow for enum size other than u32Andrew Yourtchenko1-3/+5
Change-Id: If20d2fbab9b854b7db276c81918fdff6abcb8385 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-03-20vpp_papi: Expose the list of field attributes to the client.Paul Vinciguerra1-0/+1
Change-Id: I7aba1760f68798fc5bea1244ce798e4b528a4df4 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-19vpp_papi: specify encoding for .encode()/.decode()Paul Vinciguerra3-9/+10
py2 defaults to 'ascii', py3 defaults to 'utf-8'. Change-Id: Ib76d0ec56f24535e4bafd397cc6fb5e85967d508 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-1/+1
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-1/+1
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-03-11VPP-1486: stat segment file descriptor leakOle Troan1-0/+3
Close the mmap file descriptor at first opportunity. Change-Id: If8faa1de0a57dc7d8abb3eed97861813b841bd92 Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-07vpp_papi: Adjust aenum import for python3.Paul Vinciguerra2-4/+11
The stdlib introduced IntEnum in python 3.4 and IntFlag in python 3.6. Change-Id: I3ac278a9d5a97eefa9fc4f1491f0cd030e40c3b2 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-07API: Add python2.7 support for enum flags via aenumOle Troan2-4/+8
Change-Id: I77a43bfb37d827727c331cd65eee77536cc15953 Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-04test framework: add factory function and default parametersOle Troan1-0/+2
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-28vpp_papi.py: Change VppEnum from explicit metaclass to metaclass ↵Paul Vinciguerra1-4/+11
wrapper/decorator. Change-Id: Iab41bb972e3c7ec005a1a13d5a25f654ae8c3932 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-02-28stats: Add interface name to sw_if_index as /if/namesOle Troan2-1/+24
Expose interface name to sw_if_index table as a directory node in the stats segment. Change-Id: Ie50e4af01997d141880f02e3a8496bfeb91b9944 Signed-off-by: Ole Troan <ot@cisco.com>