summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
AgeCommit message (Collapse)AuthorFilesLines
2022-05-10tests: replace pycodestyle with blackKlement Sekera1-378/+397
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>
2020-12-04papi: add support for enumflag part 1 of 2Paul Vinciguerra1-1/+4
Allow for papi to accept the new enumflag type. Change-Id: I8d8dc8fdb122e9a1b1881f5b2558635c75e4a299 Type: feature Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com> (cherry picked from commit 299abebe2942b4c78b85f9f3b8843f8213bf1efe)
2020-12-03papi: allow client control over loggersPaul Vinciguerra1-4/+23
This change enables a client to set debug levels globally as well as individually. exposes loggers as vpp_papi vpp_papi.serializer vpp_papi.transport Type: improvement Change-Id: Ib6bd1a1f552b51a22c9fe3de819a5fb970963ae5 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-08-11papi: allow unknown address familyOle Troan1-0/+52
In unions all representations of the union are decoded. Which means trying to decode something that isn't an address might have invalid address family types. Type: fix Ticket: VPP-1884 Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Id3381ef8cc885952c1eb488ebc70e276eaceb366
2019-11-05misc: Fix python scripts shebang lineRenato Botelho do Couto1-1/+1
Type: fix Since CentOS 8, RPM build script doesn't accept '#!/usr/bin/env python' as a valid shebang line. It requires scripts to explicitly chose between python2 or python3. Change all to use python3 as suggested by Paul Vinciguerra. Depends-On: https://gerrit.fd.io/r/23170 Signed-off-by: Renato Botelho do Couto <renato@netgate.com> Change-Id: Ie72af9f60fd0609e07f05b70f8d96e738b2754d1
2019-10-23papi: fix default handlingOle Troan1-1/+30
The BaseTypers object were reused, so a default for anyother mesage would be inherited in new messages. Type: fix Fixes: 85465588b18fef9c4712f864f512e00741e2d4f2 Change-Id: Ie1efb85a76b088653eb9ea4b88540c98b6b0aad0 Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-19api: split vl_api_prefix into twoOle Troan1-0/+94
One type for address with prefix and one type for prefix. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Icfec51d9b7d5cde1d69fbecdd97498688ab7b295 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Klement Sekera <ksekera@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-03api: enforce vla is last and fixed string typeOle Troan1-2/+38
Enforce that variable length fields are the last element of API messages. Add a 'fixed' version of string type, since dealing with multiple variable length strings turned out too painful for the C language bindings. The string type is now: { string name[64]; // NUL terminated C-string. Essentially decays to u8 name[64] string name[]; // Variable length string with embedded len field (vl_api_string_t) }; The latter notation could be made available to other types as well. e.g. { vl_api_address_t addresses[]; } instead of { u32 n_addr; vl_api_address_t addresses[n_addr]; }; Type: fix Change-Id: I18fa17ef47227633752ab50453e8d20a652a9f9b Signed-off-by: Ole Troan <ot@cisco.com>
2019-06-26api: refactor format_vl_api_prefix_t return keysPaul Vinciguerra1-1/+1
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-07API: Add support for "defaults"Ole Troan1-4/+18
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-04-29API: Add support for limits to language.Ole Troan1-1/+16
string name [limit = 64]; Meta-data to do argument validation. Change-Id: I1f3e0f09b2d5285224399413d25206f77bd3f4b1 Signed-off-by: Ole Troan <ot@cisco.com>
2019-03-19vpp_papi: specify encoding for .encode()/.decode()Paul Vinciguerra1-2/+2
py2 defaults to 'ascii', py3 defaults to 'utf-8'. Change-Id: Ib76d0ec56f24535e4bafd397cc6fb5e85967d508 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-12PAPI: Allow ipaddress object as argument and return values from API callsOle Troan1-35/+57
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-06API: Change ip4_address and ip6_address to use type alias.Ole Troan1-3/+18
Change-Id: Id8669bbadd1d6b2054865a310a654e9b38d1667d Signed-off-by: Ole Troan <ot@cisco.com>
2018-10-22PAPI: Add support for format/unformat functions.Ole Troan1-2/+62
With the introduction of new types, like vl_api_address_t it is now possible to call a message using one of those functions with a string representation. E.g. for an IP address ip_add_address(address="1.1.1.1/24") The language wrapper will automatically convert the string into the vl_api_address_t representation. Currently the caller must do the reverse conversion from the returned named tuple with the unformat function. rv = get_address_on_interface(sw_if_index=1) print(VPPFormat.unformat(rv.address)) Change-Id: Ic872b4560b2f4836255bd5260289bfa38c75bc5d Signed-off-by: Ole Troan <ot@cisco.com>
2018-09-07PAPI: Unpack embedded types with variable length arrays.Ole Troan1-13/+63
Change-Id: Ic952ed5b837ac8409fd95e2b5cb92eb028ba0c40 Signed-off-by: Ole Troan <ot@cisco.com>
2018-08-07PAPI: Move unit tests to fix packaging issues.Ole Troan1-0/+226
Change-Id: I67a0f168254367c657eb11d4413f9dc0c5356b3c Signed-off-by: Ole Troan <ot@cisco.com>