aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Collapse)AuthorFilesLines
2022-02-01stats: vpp_get_stats crashes in stat_segment_data_freeSteven Luong1-0/+1
STAT_DIR_TYPE_EMPTY is not handled. This can happen when the interface is deleted. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ic1f5a1a0e7005059628d1dde31118d692c1967d8
2022-01-25api: vapi: honor non-blocking settingKlement Sekera2-12/+25
Pass correct conditional based on how vapi is configured wrt blocking. Type: fix Fixes: 3fca567ff438145e28dd1318ad5b1734c1091257 Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I47adca19f104d7a758cb2940e93c9fd8c7cc9bfa
2021-11-16vapi: verify message size when receivedKlement Sekera3-18/+51
Verifying message size including VLA size allows to dismiss some coverity warnings in generated code. Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I824658881254b3e7a9bfca228a266cfee448cc2e
2021-11-02tests: change code to avoid gcc-11 warningKlement Sekera1-4/+10
For some reason gcc-11 doesn't like memcpy in a particular location, change memcpy to assignment. Type: refactor Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Iddf4b788cdca8e55221b121e74cf50b1e6bdf2d5
2021-10-18interface: add api test fileFilip Tehlar5-2/+7
Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Ib07029204ecf12bf2adb5a39afa54bc98fb81f34
2021-10-14tests: fix coverity warningsKlement Sekera1-6/+2
Fix coverity warnings by initialising variables and removing dead code. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I0254b81020cdc3d7075df003309065438526918f
2021-10-13docs: convert vpp doc md->rstNathan Skrzypczak3-155/+191
Type: improvement Change-Id: If453321785b04f9c16e8cea36fb1910efaeb2c59 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-13vapi: fix vapi test coverity warningFlorin Coras1-0/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I5ecb73009c6ebb00b5d9e14bd09b4b3e80ab5601
2021-09-28api: API trace improvementsFilip Tehlar1-8/+0
Type: improvement * add support for JSON format in API trace * add ability to replay JSON API trace in both VPP and VAT2 * use CRC for backward compatibility check during JSON API replay * fix API trace CLI (and remove duplicits) * remove custom dump * remove vppapitrace.py * update docs accordingly Change-Id: I5294f68bebe6cbe738630f457f3a87720e06486b Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2021-09-28misc: vpe.api messages dynamically allocatedOle Troan2-15/+7
This is the last in the series of moving API messages from vpp/api/vpe.api to vlibmemory/memclnt.api. This patch makes the remaining vpe.api messages dynamic, to help VAT2 binary-api command. Moves the VAT test code to a separate file and removes the now unnused API meta files. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I01dd78eaff1d3715dff17d2643bf0f7f0089935b Signed-off-by: Ole Troan <ot@cisco.com>
2021-09-28build: complete python3 support, no hardcode pathNick Brown1-2/+3
find_package(Python3) will not set variables that are later used, so set those needed. Perhaps the python2 support, which is EOL, could be dropped? Use DESTDIR, instead of hardcoding the path. This allows system packaging, or local installs, to work properly. Type: make Signed-off-by: Nick Brown <nickbroon@gmail.com> Change-Id: I045516c61473c612ab70858cd9b58c4e2838b347
2021-09-27tests: don't install vapi_c{,pp}_testDmitry Valter1-0/+2
Don't install vapi_c{,pp}_test. It confuses dpkg-shlibdeps to think we need libsubunit as shared lib dependency Type: fix Fixes: a2d6d352c6926d2f8d4e50aeb1ec59802f32b37b Signed-off-by: d-valter@yandex-team.ru Change-Id: Ifb702a61be32b37e79b48780cc61cb0838e87153
2021-09-27misc: api move continuedFlorin Coras3-4/+8
Move control ping and change dependencies from vpe.api_types to memclnt.api_types Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9f8bc442e28738c48d64d1f6794082c8c4f5725b
2021-09-17build: use GNUInstallDirs install destinationsNick Brown1-1/+1
So as to be compliant with distribution layouts, as recommend by: https://cmake.org/cmake/help/latest/command/install.html#installing-files Type: make Change-Id: Ic46ace4f26aab1aa4902cbd013c40a92c480680d Signed-off-by: Nick Brown <nickbroon@gmail.com>
2021-08-31stats: check epoch in python vpp_stats lsOle Troan1-0/+3
The VPP Stats Python binding was missing checking epoch. Resulting it would not pick up changes in the directory. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I3226d71c77be2e80e24b5cd48fc9820833f7d30e Signed-off-by: Ole Troan <ot@cisco.com>
2021-07-12papi: remove shared memory transportOle Troan3-154/+6
This patch removes the papi transport shared memory plugin. It also removes any dependency on CFFI. Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ia81701c0dc506871e511495d837e41420e1fdf72 Signed-off-by: Ole Troan <ot@cisco.com>
2021-06-25stats: reverts part of a fix on Python clientArthur de Kerhor1-12/+4
Puts return statements back inside code blocks under the lock Type: fix Change-Id: I76d426f336200035026b92bcb0ffe2b472a3142d Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
2021-06-25stats: fix race conditions in vpp-api stats clientArthur de Kerhor1-4/+12
Type: fix Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: Ie5c197f6ec0d41d5e405b22662701d83ad94d29e
2021-05-27build: kindly ask python not to polute src/Damjan Marion1-2/+2
Type: make Change-Id: I1ec82e0f3c19dee79f942996339240c73d4e380c Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-05-26tests: move vapi C/C++ test files into src/Damjan Marion4-0/+1538
Type: improvement Change-Id: Iaad004661db1e9076e6c27227878f1612fa7289f Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-05-21stats: catch stat segment overrun in retry loopOle Troan1-3/+3
Raise IOError so that the blocking code retries not only on optimistic locking failures but also on data segment illegal reads. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I6bb250e239486b60192004271c1690e790513318
2021-05-13tests: move test source to vpp/testDave Wallace3-173/+0
- Generate copyright year and version instead of using hard-coded data Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e
2021-05-04stats: adding symlinks for nodes and interfaces in the stat segmentArthur de Kerhor2-47/+136
A given interface counter (e.g rx) can be accessed via /interfaces/<interface_name>/<counter_name>. Same goes with nodes: /nodes/<node_name>/<counter_name> As interfaces may contain '/' in their names, these are replaced by '_' in symlinks Also added 2 tests for the stat segment Type: feature Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Change-Id: I27da252e7b3dc177815616ca46b5c200a456bf0f Signed-off-by: Ole Troan <ot@cisco.com>
2021-04-28papi: change default to use socket transport instead of shared memory transportOle Troan1-2/+2
In preparation for removing Python shared memory support, change the default to use sockets. This may affect users of PAPI. E.g. if running against instances of VPP where the API socket is in a different location or disabled. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I96308ed70b9ff314c9b487722174f5e4b14efdd2 Signed-off-by: Ole Troan <ot@cisco.com>
2021-04-15papi: fix ubuntu 1804 make test socket.close errorTianyu Li1-1/+1
make test failed on ubuntu 18.04 File "/vpp/src/vpp-api/python/vpp_papi/vpp_stats.py", line 135, in connect socket.close(mfd) AttributeError: module 'socket' has no attribute 'close' Due to ubuntu 18.04 using python3.6 and socket.close() is introduced since python3.7 Using os.close to replace socket.close as mfd is a memory fd Type: fix Signed-off-by: Tianyu Li <tianyu.li@arm.com> Change-Id: I6d980fc87ae6c77bbed416879f9b2fcd0a0abe6a
2021-04-12tests: support attaching to existing vppKlement Sekera1-4/+4
Introduce a new option DEBUG=attach to run a test against existing already running vpp. A new target 'make test-start-gdb' will spawn VPP in gdb for this purpose. Customization options explained in test-help. Type: improvement Change-Id: Ia160a85b33da3b2df292d44bb95729af9dd9da96 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-03-30stats: python: handle when pattern is not list in lsOle Troan1-0/+9
The reimplementation of python stats module mishandled the case where pattern to ls was not a list. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I9ba189423a76f2fd4298c4c4b19a0875f705d719
2021-03-26vlib: split vlib_main_t into global and per-threadDamjan Marion2-7/+0
Type: refactor Change-Id: I8b273bc3bf16aa360f031f1b2692f766e5fc4613 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-25stats: python vpp_stats rewrite to access stat segment directlyOle Troan1-296/+482
This module implement Python access to the VPP statistics segment. It accesses the data structures directly in shared memory. VPP uses optimistic locking, so data structures may change underneath us while we are reading. Data is copied out and it's important to spend as little time as possible "holding the lock". Counters are stored in VPP as a two dimensional array. Index by thread and index (typically sw_if_index). Simple counters count only packets, Combined counters count packets and octets. Counters can be accessed in either dimension. stat['/if/rx'] - returns 2D lists stat['/if/rx'][0] - returns counters for all interfaces for thread 0 stat['/if/rx'][0][1] - returns counter for interface 1 on thread 0 stat['/if/rx'][0][1]['packets'] - returns the packet counter for interface 1 on thread 0 stat['/if/rx'][:, 1] - returns the counters for interface 1 on all threads stat['/if/rx'][:, 1].packets() - returns the packet counters for interface 1 on all threads stat['/if/rx'][:, 1].sum_packets() - returns the sum of packet counters for interface 1 on all threads stat['/if/rx-miss'][:, 1].sum() - returns the sum of packet counters for interface 1 on all threads for simple counters Type: refactor Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I1fe7f7c7d11378d06be8276db5e1900ecdb8f515 Signed-off-by: Ole Troan <ot@cisco.com>
2021-03-16api: allow specifying no timeoutKlement Sekera1-1/+1
This functionality is used in make test when DEBUG=gdb is used. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I1339e6460aa624a3bcb4b03db46991590e126f92
2021-03-15tests: use socket transport instead of shared memoryOle Troan2-7/+2
Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I9e65c94a5a05047a5104e9361ea36eac77b40442 Signed-off-by: Ole Troan <ot@cisco.com>
2021-03-05vppapigen: expose the values of per-message "options" in the api.json filesAndrew Yourtchenko1-1/+1
Also fix the vapi parser's assumption about what the container with CRC is supposed to look like.. Change-Id: I3a23ef6c1502232742c03d227eb3654fb757709c Type: improvement Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2021-02-16vapi: add dedicated return code for client timeoutPaul Vinciguerra2-4/+16
Type: refactor Change-Id: I1fbabb743f20e21557c69bdaf97eda6f63584903 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-15papi: add method to retrieve field optionsPaul Vinciguerra1-0/+9
Sample usage: cls.MEMIF_DEFAULT_BUFFER_SIZE = cls.vapi.vpp.get_field_options( 'memif_create', 'buffer_size')['default'] Type: improvement Change-Id: I298f4687623003a78c93a703d32f59a937e37bc2 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-09papi: expose vpp_papi version to clientPaul Vinciguerra1-0/+6
root@ae2a2e85c5d4:/vpp/src/vpp-api/python# python3 Python 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import vpp_papi >>> vpp_papi.__version__ '1.6.2' Type: feature Change-Id: I73025427a58214a842245fceaa77daa7acd3e6f8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-05papi: remove unused name from __all__Paul Vinciguerra1-1/+1
missed in https://gerrit.fd.io/r/c/vpp/+/30238 Type: fix Change-Id: I342868a77d7ca87896d97847ca6525ad1abcd1b6 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-18papi: remove import vpp_transport_socketPaul Vinciguerra1-2/+2
See discussion in: https://gerrit.fd.io/r/c/vpp/+/19472 Type: refactor Change-Id: Icbf686f615f13898d12fd211f68c3498d373a5d7 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-08tests: restore vapi C++ test under Centos-8Paul Vinciguerra1-2/+1
The Centos-7 compiler had problems with vapi_cpp_test.cpp. The Centos-8 compiler does not. This change adds back the test. ============================================================================== VAPI test ============================================================================== run C VAPI tests 1.55 OK run C++ VAPI tests 0.44 OK ============================================================================== TEST RESULTS: Scheduled tests: 2 Executed tests: 2 Passed tests: 2 ============================================================================== Type: test Change-Id: Ic6a655ae99eb3ba0e73b7feef4436a0ca5fd92be Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-08papi: remove old client referencePaul Vinciguerra2-4/+1
deprecated in 3/19 Type: refactor Change-Id: Ia8eebaa0cd89d1e95166a62645400946d8db2f75 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-04papi: add support for enumflag part 1 of 2Paul Vinciguerra5-19/+160
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: remove python2 patternsPaul Vinciguerra6-40/+18
Type: refactor Change-Id: I541759b4b788acf08599661eb9e7abc58e9283d2 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-03papi: allow client control over loggersPaul Vinciguerra6-8/+56
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-12-03stats: char-pointer arithmetic style-upVratko Polak1-6/+4
Char* typed shared_header value appears multiple times, so store it is a variable. Pointer "p" value is used more frequently casted to char*, so use that type for it, and convert to void* only at return. Type: style Fixes: 41f15ae1dfd4ac1777b684fdc763d12496209418 Change-Id: I7b3f1e6a43c020acd7ae561f87d12237b07fcd66 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2020-12-02papi: improve unit testabilityPaul Vinciguerra3-23/+133
refactor the code so that snippets of json can be used to test vpp_papi example unit test provided Type: improvement Change-Id: Ibec608fd2e5b12515aa4db17d85d4319134c22ea Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-02stats: void-pointer arithmetic fixElias Rudberg1-2/+3
Cast to (char *) to avoid pointer arithmetic for (void *) pointers. Type: fix Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net> Change-Id: I62607b4cbc553449e2c60d514b4b17dbb4f88216
2020-12-02papi: fix copy/paste errorPaul Vinciguerra1-2/+2
Type: fix Change-Id: I8bd20fb38e132f6ab8cbc0e73095b649b5946498 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-11-25api: vat2 and json autogeneration for api messagesOle Troan2-4/+4
VAT2: A completely auto-generated replacement of VAT. Reads input message in JSON from stdin and outputs received messages in JSON. A VAT2 plugin is automatically built for a .api file. There no longer a need for a separate _test.c. Example: vat2 show_version {} { "_msgname": "show_version_reply", "retval": 0, "program": "vpe", "version": "21.01-rc0~411-gf6eb348a6", "build_date": "2020-11-19T09:49:25", "build_directory": "/vpp/autogen3" } vat2 sw_interface_dump '{"sw_if_index": -1, "name_filter_valid": 0, "name_filter": ""}' [{ "_msgname": "sw_interface_details", "sw_if_index": 0, "sup_sw_if_index": 0, "l2_address": "00:00:00:00:00:00", "flags": "Invalid ENUM", "type": "IF_API_TYPE_HARDWARE", "link_duplex": "LINK_DUPLEX_API_UNKNOWN", "link_speed": 0, "link_mtu": 0, "mtu": [0, 0, 0, 0], "sub_id": 0, "sub_number_of_tags": 0, "sub_outer_vlan_id": 0, "sub_inner_vlan_id": 0, "sub_if_flags": "Invalid ENUM", "vtr_op": 0, "vtr_push_dot1q": 0, "vtr_tag1": 0, "vtr_tag2": 0, "outer_tag": 0, "b_dmac": "00:00:00:00:00:00", "b_smac": "00:00:00:00:00:00", "b_vlanid": 0, "i_sid": 0, "interface_name": "local0", "interface_dev_type": "local", "tag": "" }] This is the first phase and vat2 is not integrated in packaging yet. Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ib45ddeafb180ea7da8c5dc274a9274d7a4edc876 Signed-off-by: Ole Troan <ot@cisco.com>
2020-11-17papi: remove dependency on aenumPaul Vinciguerra2-18/+2
remove the dependency on the aenum package which was used to provide Enum.IntFlag which is now available in the python stdlib. aenum is not provided as a .deb and causes issues in packaging. Type: fix Change-Id: Ie45ec2130a767345f0aad038451780a5ddc7e8db Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-11-17tests: move vpp-api tests to src/vpe-api/testDave Wallace3-0/+174
- Refactor make test code to be co-located with the vpp feature source code Type: test Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: Ic42bbd4e13606a5fdc91143ecc6452102ec337fe
2020-10-21stats: missing dimension in stat_set_simple_counterOle Troan2-8/+24
A simple counter is a two dimensional array by threads and counter index. 28017 introduced an error missing the first dimension. If a vector is updated at the same time as a client reads, an invalid pointer my result. This will be caught by the optimistic locking after copying out the data, but if following a pointer outside of the stat segment then the stat client would crash. Add suitable boundary checks for access to stat memory segment. Fixes: 7d29e320fb2855a1ddb7a6af09078b8ed636de01 Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I94f124ec71d98218c4eda5d124ac5594743d93d6