summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi/tests
AgeCommit message (Collapse)AuthorFilesLines
2019-07-12papi: fix vpp_format from change in vl_api_prefix_tPaul Vinciguerra1-10/+8
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-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-18misc: vpp_papi- add tests, clean up pep8Paul Vinciguerra1-0/+130
Type: test Change-Id: Ic81bd4a9eba3c89a746e7a9b9e471b59cd87fa40 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-06-07vpp_papi: Context_id allocator for running forked.Paul Vinciguerra1-0/+53
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-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-28vpp_papi: MACAddress equals fails in unittest.Paul Vinciguerra1-0/+10
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-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 Troan2-0/+226
Change-Id: I67a0f168254367c657eb11d4413f9dc0c5356b3c Signed-off-by: Ole Troan <ot@cisco.com>