summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi/vpp_papi.py
AgeCommit message (Collapse)AuthorFilesLines
2018-11-29vpp_papi: Add custom exceptions.Paul Vinciguerra1-12/+37
This patchset adds and raises the following custom exception classes: * class VPPApiError(Exception): * class VPPNotImplementedError(NotImplementedError): * class VPPIOError(IOError): * class VPPRuntimeError(RuntimeError): * class VPPValueError(ValueError): * class VPPSerializerValueError(ValueError): * class VPPStatsIOError(IOError): * class VPPStatsClientLoadError(RuntimeError): * class VppTransportShmemIOError(IOError): * class VppTransportSocketIOError(IOError) Change-Id: Ia40900fd2dcef148d01125d6c691329fc666901e Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-29API: Add support for type aliasesOle Troan1-2/+9
Previously all types are compound. This adds support for aliases, so one can do things like: typedef u32 interface_index; or typedef u8 ip4_address[4]; Change-Id: I0455cad0123fc88acb491d2a3ea2725426bdb246 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-11-28vpp_papi: Use new style classes.Paul Vinciguerra1-2/+2
Python2 defaults to old style classes to maintain compatability with python 2.1. Moving to new style classes will ensure consistent behavior across interpreters. Change-Id: I89493d608d1edb63989000c17a9566a97785a4aa Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-11-05Alter logging semantics for VPP PAPI objectIgor Mikhailov (imichail)1-1/+1
Restore parts of commit d0e812f wiped out by a7564e80 The full description of the change is in d0e812f Change-Id: I632476cb10678a725396462f90f9b0bea9e572fa Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
2018-10-22PAPI: Add support for format/unformat functions.Ole Troan1-0/+1
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-10-18PAPI: Expose API enums to tests / applicationsOle Troan1-16/+33
e.g: from vpp_papi import VppEnum VppEnum.vl_api_address_family_t.ADDRESS_IP4 Change-Id: I10c22d57234a1a06e98a889cf80b19085b468ed3 Signed-off-by: Ole Troan <ot@cisco.com>
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan1-109/+37
Adds support for running the API purely across Unix domain sockets. Usage: vpp = VPP(use_socket=True) Change-Id: Iafc1301e03dd3edc3f4d702dd6c0b98d3b50b69e Signed-off-by: Ole Troan <ot@cisco.com>
2018-09-07PAPI: Unpack embedded types with variable length arrays.Ole Troan1-4/+2
Change-Id: Ic952ed5b837ac8409fd95e2b5cb92eb028ba0c40 Signed-off-by: Ole Troan <ot@cisco.com>
2018-08-23CSIT-1139: Implement parallel test executionjuraj.linkes1-1/+1
The implementation of parallel test execution in VPP Test Framework. - VPPTestCase test methods are grouped together - tests are running in separate processes - VPP instances spawned by tests are assigned to different cores - output from these processes is redirected through pipes and printed out testcase by testcase - TEST_JOBS env var is used to specify the number of parallel processes - improved test summary - a bit of code cleanup Change-Id: I9ca93904d9fe2c3daf980500c64a8611838ae28c Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2018-08-09PAPI: Python 3.7 uses async keyword.Ole Troan1-11/+11
Change-Id: I01e99c85598a7cb5bc1a506c7fd1fc3f6789d72e Signed-off-by: Ole Troan <ot@cisco.com>
2018-07-18vpp-api: improve naming for easier debuggingKlement Sekera1-2/+2
Change-Id: I487ccf2adabfbd22dac9f492ecff679d38046724 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-06-22Python API: Add enum and union support.Ole Troan1-0/+679
As well as a rewrite of the encoders/decoders to make it more readable and extensible. (Re-commit after fix to verify build.) Change-Id: Ic244d3cebe070bb2570491f8a24f4a1e203f889a Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-18Revert "Python API: Add enum and union support."Ole Trøan1-678/+0
This reverts commit a5ee900fb75201bbfceaf13c8bc57a13ed094988. Some of the unit tests breaks. Backing out until fixed. Change-Id: I1846fb417db44a2a772f7b59cda8bcfe6d39f8c3 Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-17Python API: Add enum and union support.Ole Troan1-0/+678
As well as a rewrite of the encoders/decoders to make it more readable and extensible. Change-Id: I253369ac76303922bf9c11377622c8974fa92f19 Signed-off-by: Ole Troan <ot@cisco.com>
2017-03-15Python API: Change from cPython to CFFI.Ole Troan1-599/+0
Change-Id: I03e52466fb3f909ae52b8fba601168f3eadbd972 Signed-off-by: Ole Troan <ot@cisco.com>
2017-03-07Python API: Synchronous mode.Ole Troan1-105/+89
Change-Id: Ic8f186dbb35bb4e2e191d311cab51315a88a2d81 Signed-off-by: Ole Troan <ot@cisco.com>
2017-03-03python API: work towards python/vpp api separationKlement Sekera1-1/+30
This change improves vpp_papi behaviour by introducing alternate way of calling vpp APIs. The common code is the same: vpp = VPP(...) vpp.connect(...) Calling VPP API is different, instead of deprecated: vpp.show_version() # deprecated one should write vpp.api.show_version() this allows VPP messages like "connect" and "disconnect" to be used, once the old API is dropped (in 17.07). Also part of this patch is a check for name conflict, to prevent VPP object overwriting its own functionality with generated code based on json files. Change-Id: I22e573b6a45f8b2a1f0340c5c2597c194fe42ca4 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-27Python API: event_callback not initialised.Ole Troan1-0/+1
Even when not requesting notification the VPP API sends event notifications on certain calls. E.g. creating interfaces. Traceback (most recent call last): File "/vpp/ipfix/src/vpp-api/python/vpp_papi/vpp_papi.py", line 447, in msg_handler_sync if self.event_callback: AttributeError: VPP instance has no attribute 'event_callback' Change-Id: I4ca30c49df298655dc8948c5ebd68de0b3d6a592 Signed-off-by: Ole Troan <ot@cisco.com>
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>
2017-01-06python clients can set the API rx message queue lengthDave Barach1-3/+3
Change-Id: I7af1493a823747e0f7389ad6c2093e4cec6c2ce9 Signed-off-by: Dave Barach <dave@barachs.net>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+450
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>