summaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Collapse)AuthorFilesLines
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>
2019-02-26vpp-papi: Only install enum34 for python<=3.4.Paul Vinciguerra1-14/+17
Change-Id: I20d7c8c1a59b3a9aa016bec860289b7aef4ce06b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-01-17cmake: initial cross-compilation supportDamjan Marion1-1/+0
Change-Id: Ib9c2aba1eda08a22465441e33553b9b744c79d56 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-06vpp-api: Add context to VPPStatsIOError.Paul Vinciguerra2-7/+29
* Provide context information and return meaningful information. VPPStatsIOError: Stat segment client connection returned: -2 Stat client socket open but couldn't connect. Change-Id: I14ea35c58452a2cb7598a7efd136f0c7e1f5743a Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-28vpp_papi: MACAddress equals fails in unittest.Paul Vinciguerra2-0/+21
Before: EqualsAssertionError: :: MACAddress(11:22:33:44:55:66) != MACAddress(11:22:33:44:55:66) ---------------------------------------------------------------------- Ran 1 test in 0.002s FAILED (failures=1) MACAddress(11:22:33:44:55:66) != MACAddress(11:22:33:44:55:66) After: ---------------------------------------------------------------------- Ran 1 test in 0.001s OK Change-Id: I89896a823b8f8a861813dabf23e7c9207e4fabb6 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-18VAPI/VOM: Removing legacy stats tests, add string type.Ole Troan2-0/+2
Fix misc VAPI/VOM generation and test cases. Change-Id: I1abf9ecdb6f8a2129f11e0a9ed1c0fe04cdf5c47 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan4-3/+67
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-13API: Use string type instead of u8.Ole Troan3-17/+80
The new string type is modelled after string in proto3. It is always variable length. Change-Id: I64884067e28a80072c8dac31b7c7c82d6e306051 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Michal Cmarada <mcmarada@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-13vapi: code cleanupKlement Sekera1-5/+4
Change-Id: If3bdb4369d6055e06a9b29bcba37785dbd32eb71 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-12-12PAPI: Allow ipaddress object as argument and return values from API callsOle Troan4-220/+266
The API calls that use any of vl_api_address_t, vl_api_ip4_address, vl_api_ip6_address_t, vl_api_prefix_t, vl_api_ip4_prefix_t, vl_api_ip6_prefix_t now accepts either the old style dictionary, a text string (2001:db8::/32) or an ipaddress ojbect. Unless it is called with '_no_type_conversion':True, it will also return an appropriate ipaddress object. Change-Id: I84e4a1577bd57f6b5ae725f316a523988b6a955b Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-10Python API: Use services to determine stream RPCOle Troan1-4/+11
The services {} definitions contain which APIs are streaming. In addition only create function definition for the client side (not for reply messages). Change-Id: I8e83d35386cdd9ebee83d4571eaebdc6dff19e82 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-2/+7
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-12-06stat_client: Fix the type castingMohsin Kazmi2-7/+10
Change-Id: I9726ac5cc7292a492928b213bc85ccfa8a26c1cb Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-12-06API: Change ip4_address and ip6_address to use type alias.Ole Troan4-20/+39
Change-Id: Id8669bbadd1d6b2054865a310a654e9b38d1667d Signed-off-by: Ole Troan <ot@cisco.com>