aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/python/vpp_papi
AgeCommit message (Collapse)AuthorFilesLines
2017-01-24Fix PAPI async responseWojciech Dec1-1/+1
Previous changes forgot to return the decoded result Change-Id: I4eb27802eb2672532d856d9b9671ef806374bcd0 Signed-off-by: Wojciech Dec <wdec@cisco.com>
2017-01-20Python API: Missing locking of results data structure.Ole Troan1-84/+219
The wrong assumption that the GIL combined with CPython's "mostly" thread safe assurance does not hold. The combination of a slow event handler for notification and calling the API at the same time let to contention on the results data structure. Added suitable locking. Also added an atexit() to attempt a VPP disconnect on shutdown. Also: lots more comments, docstrings, duplicated code removed. Some of the problem here was a disagreement between caller and author as to how the API should be used; the comments should help. Change-Id: I0cb7d0026db660ec141425c5ad474f14bacea36e Signed-off-by: Ole Troan <ot@cisco.com> Co-Authored-By: Ian Wells <iawells@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2016-12-21Python API: Incorrect error for empty VLA list.Ole Troan1-3/+0
Change-Id: Ie3e9a54ca23af6b9ee43615f59a48cb05e3906d4 Signed-off-by: Ole Troan <ot@cisco.com>
2016-12-19Python API: Add back support for old-style VLA, e.g. mask[0]Ole Troan1-25/+42
Change-Id: I5be6bfe522e5ea93934f0ddf75d4e4707376dc0c Signed-off-by: Ole Troan <ot@cisco.com>
2016-12-13vpp_papi: Add help() support for python interactive modeChristophe Fontaine1-4/+13
The python api 1.3 removed the ability to call 'help' in interactive mode. example: > help(vpp.sw_interface_span_enable_disable) Help on function sw_interface_span_enable_disable in module vpp_papi.vpp_papi: sw_interface_span_enable_disable(**kwargs) u16 _vl_msg_id, u32 client_index, u32 context, u32 sw_if_index_from, u32 sw_if_index_to, u8 state Change-Id: Iea1944fdc862482490174ff966592cf3c8208a98 Signed-off-by: Christophe Fontaine <christophe.fontaine@qosmos.com>
2016-12-12Fix for PAPI async call registrationWojciech Dec1-5/+8
Introduce async API call registration Change-Id: Iccc89eca1b6e7dcce96a8e7bc5da80d9abc363fc Signed-off-by: Wojciech Dec <wdec@cisco.com>
2016-12-06SPAN API: Fix various errors making SPAN break make tests.Ole Troan1-3/+1
- s/l2/span in span_api.c in foreach macro - Not installing .json from Makefile.am Change-Id: I2469fe01138d62e044b8262cdb5a6e3b009bb43e Signed-off-by: Ole Troan <ot@cisco.com>
2016-12-06API: Adapt make test to Python API changes.Ole Troan1-8/+44
Change the test wrapper script for the updated Python API. All tests but the L2BD multi instance runs fine. That is currently skipped. I see intermittent failures when an MLD message is received before the ND NA in MPLS and IPV6 FIB tests. Change-Id: If809877c9abdf596dbb0a419ce5429552f63d212 Signed-off-by: Ole Troan <ot@cisco.com>
2016-12-02Python API: Support for per message CRC and API split.Ole Troan2-244/+365
These changes are incompatible with Python VPP API 1.2 There is now a new VPP Class and it can be used like: from vpp_papi import VPP jsonfiles = [] for root, dirnames, filenames in os.walk('../../../build-root/'): if root.find('install-') == -1: continue for filename in fnmatch.filter(filenames, '*.api.json'): jsonfiles.append(os.path.join(root, filename)) vpp = VPP(jsonfiles) rv = vpp.show_version() print('RV', rv.program.decode().rstrip('\0x00')) vpp.disconnect() Change-Id: Ic92d226de2cf3626e750404012247e7fc24fb7fc Signed-off-by: Ole Troan <ot@cisco.com>
2016-11-21Add client-side msg_name_and_crc -> msg_index tableDave Barach1-18/+51
vppapigen now generates per-message crcs. Verified that whitespace and real changes in message A don't change the crc for message B, etc. Fixed the sample and flowperpkt plugins to participate. Others need the same treatment. They don't build due to python/java language binding build issues. To use the scheme: Client connects as usual. Then call: u32 vl_api_get_msg_index(char * name_and_crc) name_and_crc is a string like: "flowperpkt_tx_interface_add_del_753301f3", aka the message name with _%08x <expected crc> appended. Try these vpp-api-test commands to play with it: vat# dump_msg_api_table <snip> [366]: punt_reply_cca27fbe [367]: ipsec_spd_dump_5e9ae88e [368]: ipsec_spd_details_6f7821b0 [369]: sample_macswap_enable_disable_0f2813e2 [370]: sample_macswap_enable_disable_reply_476738e5 [371]: flowperpkt_tx_interface_add_del_753301f3 [372]: flowperpkt_tx_interface_add_del_reply_d47e6e0b vat# get_msg_id sample_macswap_enable_disable_reply_476738e5 'sample_macswap_enable_disable_reply_476738e5' has message index 370 vat# get_msg_id sample_macswap_enable_disable_reply_476738e3 'sample_macswap_enable_disable_reply_476738e3' not found CRCs may vary, etc. vppapigen is used to build a set of JSON representations of each API file from vpp-api/Makefile.am and that is in turn used by each language binding (Java, Python, Lua). Change-Id: I3d64582e779dac5f20cddec79c562c288d8fd9c6 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Ole Troan <ot@cisco.com>
2016-10-05Python API: Add support for shared memory prefixOle Troan2-6/+10
Recheck. This is to support multiple VPP instances on same host. Change-Id: Ibe511b1f790fc8771900085577423f7e71dc45df Signed-off-by: Ole Troan <ot@cisco.com>
2016-09-23Python API: Preparation for RPM/DEB packaging.Ole Troan3-18/+23
Recheck. Repackage the Python API binding to include all necessary modules in a single Python package. Change-Id: I5e35141d413bfb1aad650217e1ca07d85646c349 Signed-off-by: Ole Troan <ot@cisco.com>
2016-09-13Python API: Re-adding rudimentary variable length array pack support.Ole Troan1-17/+18
Fixed bug in message-id mapping with non-consequtive APIs. Change-Id: Icd6073e4655f7ce5432816861ae58915e5b336af Signed-off-by: Ole Troan <ot@cisco.com>
2016-09-02Add in-message cli_request/cli_reply APIOle Troan1-0/+6
This new CLI API is meant to replace the cli_request/cli_reply that uses shared memory. PS: checkstyle -- *hate* Change-Id: I6318f8f6b9be2c2398b49dac9e2193c1998ea724 Signed-off-by: Ole Troan <ot@cisco.com>
2016-08-25VPP Python language binding - plugin supportOle Troan4-8/+277
- Moved Python generator tool to tools directory - Added build-vpp-api Makefile target - Generator now only creates a Python representation of the .api the rest of the framework is in the vpp_papi script - Each plugin has its own namespace. - Plugin Python files are installed in vpp_papi_plugins for easy use inside the build tree. Change-Id: I272c83bb7e5d5e416bdbd8a790a3cc35c5a04e38 Signed-off-by: Ole Troan <ot@cisco.com>
2016-04-25Python-API: Python 2 support.Ole Troan1-10/+42
Change-Id: I6bc656caf22e284233e27f9e003f11502f306c11 Signed-off-by: Ole Troan <ot@cisco.com>
2016-04-20Python-API: Inital commit of Python bindings for the VPP API.Ole Troan2-0/+122
See: https://wiki.fd.io/view/VPP/Python_API Change-Id: If135fc32208c7031787e1935b399d930e0e1ea1f Signed-off-by: Ole Troan <ot@cisco.com>