summaryrefslogtreecommitdiffstats
path: root/src/tools
AgeCommit message (Collapse)AuthorFilesLines
2021-12-08api: improve REPLY_MACRO safetyKlement Sekera1-1/+3
Improve vppapigen to generate per-message #define indicating whether said message is dynamically sized (due to VLA or string) or not. Use these #defines in REPLY_MACROs to prevent improper usage. Fix existing improper REPLY_MACRO* usage. Type: improvement Change-Id: Ia77aaf9f6cf3ed68ea21075a4cc8deda78a68651 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-11-25vppapigen: coverity 219549, dead code in generated fileOle Troan1-0/+2
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I64804092917f1d8dc520549bacae81672a95cd1e
2021-10-13docs: convert vpp doc md->rstNathan Skrzypczak2-346/+404
Type: improvement Change-Id: If453321785b04f9c16e8cea36fb1910efaeb2c59 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-09-28api: API trace improvementsFilip Tehlar3-511/+53
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-27misc: api move continuedFlorin Coras1-2/+2
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-27misc: move part of vpe apis to vlibmemoryFlorin Coras1-5/+1
VPE apis are actually vlib apis. This moves those that are not tightly coupled with vapi to vlib_api Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I456a64ce49a0cdeff4a0931c6ea513cb639f683e Signed-off-by: Ole Troan <ot@cisco.com>
2021-08-18vat2: add shared memory argumentOle Troan1-2/+2
Add prefix argument to specifiy shared memory segment. Add long arguments. Add argument to dump apis. Add help. Add template argument E.g: vat2 --template sw_interface_add_del_address { "_msgname": "sw_interface_add_del_address", "sw_if_index": 0, "is_add": false, "del_all": false, "prefix": "0.0.0.0" } Usage: vat2 [OPTION] <message-name> <JSON object> Send API message to VPP and print reply -d, --debug Print additional information -p, --prefix Specify shared memory prefix to connect to a given VPP instance -f, --file File containing a JSON object with the arguments for the message to send --dump-apis List all APIs available from connected VPP instance Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I2d32483a727bc16990c9a30dfa9bc1fa7b1fa85a Signed-off-by: Ole Troan <ot@cisco.com>
2021-07-22api: enable trace / replay flag on messagesOle Troan1-0/+2
For an unknown reason the trace/replay flags where missed when moving API message registration code from manually cut and pasted to aut-generated. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ib7625a57d3a263aac154682007459648953b1803
2021-07-13misc: remove vnet_all_api_h and vnet_msg_enumFilip Tehlar1-1/+3
These file are no longer needed Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I34f8e0b7e17d9e8c06dcd6c5ffe51aa273cdec07
2021-05-06vlib: rename vl_counter_t to vlib_error_desc_tOle Troan1-2/+2
Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I368b0410db2d633d3c52199c840e24d21952c1b4
2021-04-27misc: auto-generate go bindingsVladimir Lavor1-0/+183
Type: feature Added target 'make go-api-files' creating compatible go bindings using JSON API definition and GoVPP binary API generator. Signed-off-by: Vladimir Lavor <vlavor@cisco.com> Change-Id: I5bae113b85eaf5ebda8e292d34c9826075ef19b5
2021-04-26vppapigen: remove flag day codePaul Vinciguerra1-296/+0
The flag day for the crc algorithm change has long passed and should not be carried into the next release. Type: refactor Change-Id: I1b1027139a778907926e48a8a553b908a79db08f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-03-05vppapigen: expose the values of per-message "options" in the api.json filesAndrew Yourtchenko1-0/+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-03-05api: crchcecker ignore version < 1.0.0 and outside of src directoryOle Troan1-0/+3
- For check patchset ignore files outside of src directory - For check patchset ignore files that have version < 1.0.0 - fix Pylint warnings - Modify vppapigen_crc to include version in JSON output Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I171cf6397e129e2438b2a494c5656236a7810f7b
2021-02-17vat2: add sanity checking - coverity errorsOle Troan1-0/+9
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I3cd56690fe52402d4cfa9ea67f1de53d8d919dee
2021-02-17vppapigen: resource leakage in fromjson array - coverityOle Troan1-1/+1
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I43283c59fd121dcb2486b26151108c90b027748b
2021-02-17vppapigen: more _fromjson autogeneration coverity fixesOle Troan1-6/+10
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I9a7bb617a3fa87d6ef49c75277e53425310cdcf9 Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-15vppapigen: py2 cleanup - remove subclassing of objectPaul Vinciguerra1-3/+3
Type: refactor Change-Id: I7136cb8ba101ea3917dacc31ceb3a76a31328301 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-12vppapigen: coverity issues in autogenerated code pass 3.Ole Troan1-14/+15
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I5ee2e8aba3ee7281bbca11825dece79983e52f06
2021-02-11vppapigen: fix fromjson coverity errors in generationOle Troan1-27/+30
Fix memory leak coverity errors where free was not called on error conditions. Or called twice. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I21cffa8b01e4f72f10501f202f6a762ae300a941 Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-09nat: fix coverity errorsOle Troan1-1/+1
Including a general missing free in fromjson autogenerated code. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I9ab2b0193135e2fb3d62d51b3c114df56969e341 Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-05nat: 1:1 policy NATOle Troan2-5/+12
A NAT sub-plugin doing statically configured match/rewrite on IP4 input or output. It's stateless (no connection tracking). Currently it supports rewriting of SA, DA and TCP/UDP ports. It should be simple to add new rewrites if required. API: pnat_binding_add, pnat_binding_del, pnat_bindings_get, pnat_interfaces_get CLI: set pnat translation interface <name> match <5-tuple> rewrite <5-tuple> {in|out} [del] show pnat translations show pnat interfaces Trying a new C based unit testing scheme. Where the graph node is tested in isolation. See pnat/pnat_test.c. Also added new cmake targets to generate coverage directly. E.g.: make test_pnat-ccov-report File '/vpp/sdnat/src/plugins/nat/pnat/pnat.c': Name Regions Miss Cover Lines Miss Cover ------------------------------------------------------------------------------------ pnat_interface_by_sw_if_index 39 8 79.49% 13 0 100.00% pnat_instructions_from_mask 9 0 100.00% 13 0 100.00% pnat_binding_add 64 8 87.50% 31 2 93.55% pnat_flow_lookup 4 4 0.00% 10 10 0.00% pnat_binding_attach 104 75 27.88% 33 6 81.82% pnat_binding_detach 30 5 83.33% 23 2 91.30% pnat_binding_del 97 33 65.98% 17 3 82.35% pnat.c:pnat_calc_key_from_5tuple 9 1 88.89% 14 1 92.86% pnat.c:pnat_interface_check_mask 10 2 80.00% 11 2 81.82% pnat.c:pnat_enable 5 0 100.00% 11 0 100.00% pnat.c:pnat_enable_interface 107 26 75.70% 60 15 75.00% pnat.c:pnat_disable_interface 91 30 67.03% 32 7 78.12% pnat.c:pnat_disable 7 2 71.43% 13 7 46.15% ------------------------------------------------------------------------------------ TOTAL 576 194 66.32% 281 55 80.43% File '/vpp/sdnat/src/plugins/nat/pnat/pnat_node.h': Name Regions Miss Cover Lines Miss Cover ------------------------------------------------------------------------------------ pnat_test.c:pnat_node_inline 67 11 83.58% 115 1 99.13% pnat_test.c:pnat_calc_key 9 2 77.78% 14 2 85.71% pnat_test.c:pnat_rewrite_ip4 55 11 80.00% 60 12 80.00% pnat_test.c:format_pnat_trace 1 1 0.00% 12 12 0.00% pnat_node.c:pnat_node_inline 63 63 0.00% 115 115 0.00% pnat_node.c:pnat_calc_key 9 9 0.00% 14 14 0.00% pnat_node.c:pnat_rewrite_ip4 55 55 0.00% 60 60 0.00% pnat_node.c:format_pnat_trace 5 5 0.00% 12 12 0.00% ------------------------------------------------------------------------------------ TOTAL 264 157 40.53% 402 228 43.28% Type: feature Change-Id: I9c897f833603054a8303e7369ebff6512517c9e0 Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-03vppapigen: Support an 'autoendian' keyword for message definitions inNeale Ranns2-4/+11
.api files Type: feature Make the auto-endian nature explicit, rather than hidden in the x_api.c file. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ibe647117ceeaf6f99a38a96576a5a41a3cbb1615
2021-02-03vppapigen: fix enum typesPaul Vinciguerra1-2/+11
enums can return signed or unsigned integers enumflags are unsigned integers Type: fix Change-Id: Iafc8f8f09c96679c5983d2cb807699fcf90ca0d7 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-01-06api: fromjson/tojson generated code memory leakOle Troan1-1/+1
Found by coverity. Fix potential memory leakage in generated code. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If492541b8b66e574f30ecdd0dd533099cbe068ad
2020-12-15api: crchcecker ignore version < 1.0.0 and outside of src directoryOle Tr�an1-3/+0
This reverts commit 510aaa8911843206f7b9ff48b41e3c7b8c4a99fe. Reason for revert: failed in case of no api file in changeset. Change-Id: I2c6f01b25a35128df870418eef0008766bb590df Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
2020-12-15api: crchcecker ignore version < 1.0.0 and outside of src directoryOle Troan1-0/+3
- For check patchset ignore files outside of src directory - For check patchset ignore files that have version < 1.0.0 - fix Pylint warnings - Modify vppapigen_crc to include version in JSON output Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I93f7bebeeaeedc19b2b1e5e135ea1035517d7f76 Signed-off-by: Ole Troan <ot@cisco.com>
2020-12-11api: fromjson/tojson enum flag supportOle Troan1-2/+36
Represent enum flags as JSON arrays (as these can have multiple values). Add unit tests. Type: improvement Change-Id: I680c5b6f76ef6f05f360e2f3b9c4cbb927e15d7d Signed-off-by: Ole Troan <ot@cisco.com>
2020-12-10api: remove unused singular optionOle Troan1-7/+1
The singular option to the API language was added as a way to deal with messages that do not have a reply message. Examples in memclnt.api. Instead dealt with these messages using the service {} construct. Type: refactor Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If01b390b24b7539d1f93de4b8edfe1dad08e509d
2020-12-04vppapigen: add parser support for enumflagsPaul Vinciguerra4-57/+221
Type: improvement Change-Id: I0f15862cc8399a4f7c8a81fe44ba8b27d8772278 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com> Signed-off-by: Ole Troan <ot@cisco.com> (cherry picked from commit e15523297bb3905f2e0eef4272fc69a8a92463cc)
2020-11-25api: vat2 and json autogeneration for api messagesOle Troan2-443/+1345
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-21vppapigen: move import processing logic to individual pluginsPaul Vinciguerra4-37/+50
Vppapigen currently embeds the import following control logic in the runner. This change delegates the control to the plugins. Type: refactor Change-Id: Iad20341bc9d652bedb71ca7037d3957fe60c7a0d Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-10-13stats: counters data modelOle Troan3-12/+162
This adds a new data model for counters. Specifying the errors severity and unit. A later patch will update vpp_get_stats to take advantage of this. Only the map plugin is updates as an example. New .api language: A new "counters" keyword to define counter sets. counters map { none { severity info; type counter64; units "packets"; description "valid MAP packets"; }; bad_protocol { severity error; type counter64; units "packets"; description "bad protocol"; }; }; Each counter has 4 keywords. severity, which is one of error, info or warn. A type, which is one of counter64 or gauge64. units, which is a text field using units from YANG. paths { "/err/ip4-map" "map"; "/err/ip6-map" "map"; "/err/ip4-t-map" "map"; "/err/ip6-t-map" "map"; }; A new paths keyword that maps the counter-set to a path in the stats segment KV store. Updated VPP CLI to include severity so user can see error counter severity. DBGvpp# show errors Count Node Reason Severity 13 ethernet-input no error error Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ib2177543f49d4c3aef4d7fa72476cff2068f7771 Signed-off-by: Ole Troan <ot@cisco.com>
2020-10-06feature: Add packet trace APIJon Loeliger1-4/+10
Also spiffed up the vpp_api_test plugin loader so it executes VLIB_INIT_FUNCTIONs and VLIB_API_INIT_FUNCTIONs. Type: feature Change-Id: Id9a4f455d73738c41bcfea220df2112bb9679681 Signed-off-by: Jon Loeliger <jdl@netgate.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2020-09-18vat: add infrastructure to align vnet test code and plugin test codeOle Troan1-10/+11
Split vat/api_format.c also for VNET features. Use auto-generated VAT test code and support dynamic message ID allocation as for plugins. The arp and geneve features as Guinea pigs. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I461591496766bdf10c5f950fd30f1a0ae05909da Signed-off-by: Ole Troan <ot@cisco.com>
2020-09-11build: fix build for Debian 9 and Debian 10Benoît Ganne1-4/+5
Type: fix Change-Id: Ic07d0ae313b32e420ba93693cb75960a86f752a9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-01vppapigen: supports backwards compatible marking of enumsOle Troan1-18/+38
enum bar_enum { BAR1 = 0, BAR2, BAR3 [backwards_compatible], BAR4 = 9 [backwards_compatible], }; This allows adding backwards compatible (as guaranteed by the developer) enums. The enums marked backwards compatible are not considered in the CRC calculation. Type: improvement Change-Id: I6fc0c21b19e1a02cff7f5d279a0f3a32d2f8b630 Signed-off-by: Ole Troan <ot@cisco.com>
2020-08-25api: register endian handlers for reply messagesOle Troan1-0/+13
Endian handlers was not registered for reply messages. Causing endian-neutral handlers to crash. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Id14173300ee1ab2601e92d58c70d2fa260814b69
2020-08-21vppapigen: Fix missing api dirNathan Skrzypczak1-0/+1
Type: fix pci_types.api lives in vlib/pci which wasn't included in the generate_json.py script Change-Id: I15649786282584b7aefb9ace83c5154eb697b50b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-08-19vppinfra: minor tweaks for cgo interoperationDave Barach2-11/+11
'type' is a keyword in golang, so s/type/event_type/ in elog.h and elsewhere. Add vec_len_not_inline(...), elog_write_file_not_inline(...) and elog_read_file_not_inline(...) since the inline forms aren't usable. More such tweaks may follow. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9a80a6afa635f5cdedee554ee9abe400fafc1cb6
2020-08-17vppapigen: generate define for module_semverOle Troan1-0/+7
Generate a semver define for API modules in the VPP side C generator. E.g in map.api_types.h \#define VL_API_MAP_API_VERSION_MAJOR 4 \#define VL_API_MAP_API_VERSION_MINOR 2 \#define VL_API_MAP_API_VERSION_PATCH 1 Type: improvement Change-Id: I2ab86154e85e26fb075c4e91a01ff3692640654b Signed-off-by: Ole Troan <ot@cisco.com>
2020-08-13vppapigen: remove unreachable codeOle Troan1-1/+0
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ifd81acaa020f6ebff20ec4eff4370d8a18323860
2020-08-11vppapigen: add support for empty optionsOle Troan2-3/+17
Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I59323447bee7bb4f0563251a5df80cbefb9bd89e Signed-off-by: Ole Troan <ot@cisco.com>
2020-08-06misc: harmonize namesDave Barach2-10/+10
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ibad744788e200ce012ad88ff59c2c34920742454
2020-07-23vppapigen: missing crcs in user-defined typesOle Troan2-3/+403
make the change backwards compatible Change-Id: I379691aa5972f99b2144deda4b7ef9e6ba4af67d Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
2020-06-17docs: add more FEATURE.yaml documentationDave Barach1-0/+12
For src/tools/g2, src/vlibapi, and src/vlibmemory Type: docs Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I800c3e3a1ecb011d5e692d78a015e78342706786
2020-05-27api: make vpp api handlers endian independentOle Troan1-4/+15
Add a new boolean to signal that the API infrastructure should performan any required endian conversions for the API handler. am->is_autoendian[mm->msg_id_base + VL_API_MAP_ADD_DOMAIN] = 1; Similarly add new REPLY_ macros that perform endian conversion. These changes do not change the on-the-wire encoding of the API messages, and therefore the API CRC is not changed. Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I7588f8ccb38b2d1e8d85ea17be99bac43f756267 Signed-off-by: Ole Troan <ot@cisco.com>
2020-05-25api: add new stream message conventionOle Troan2-1/+8
Instead of having to wrap dump/detail calls in control ping, send details messages in between a normal reply / request pair. As expressed in the below service statement. Example: service { rpc map_domains_gets returns map_domains_get_reply stream map_domain_details; }; define map_domains_get { u32 client_index; u32 context; u32 cursor; }; define map_domains_get_reply { u32 context; i32 retval; u32 cursor; }; To avoid blocking the main thread for too long, the replies are now sent in client message queue size chunks. The reply message returns VNET_API_ERROR_EAGAIN when there is more to read. The API handler must also include a "cursor" that is used to the next call to the get function. API handler example: REPLY_AND_DETAILS_MACRO (VL_API_MAP_DOMAINS_GET_REPLY, mm->domains, ({ send_domain_details (cursor, rp, mp->context); })); The macro starts from cursor and iterates through the pool until vl_api_process_may_suspend() returns true or the iteration reaches the end of the list. Client Example: cursor = 0 d = [] while True: rv, details = map_domains_get(cursor=cursor) d += details if rv.retval == 0 or rv.retval != -165: break cursor = rv.cursor or the convenience iterator: for x in vpp.details_iter(vpp.api.map_domains_get): pass or list(details_iter(map_domains_get)) Change-Id: Iad9f6b41b0ef886adb584c97708dd91cf552749e Type: feature Signed-off-by: Ole Troan <ot@cisco.com>
2020-05-19vppapigen: handle new api file for crcchekcerOle Troan1-2/+9
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I1b3ae8b348eb3cba628a55ea3e72e85b9a4288d5
2020-05-16vppapigen: add assert for python versionOle Troan1-2/+4
The recent introduction of f-strings require >=Python3.6 Fix a couple of pycodestyle warnings. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Id9e375bb8febb157d7f9d7fa21808724770df6f8