aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
AgeCommit message (Collapse)AuthorFilesLines
2022-08-02Change module name to go.fd.io/govppHEADv0.6.0-alphamasterNathan Skrzypczak3-17/+17
We are changing the module name from git.fd.io/govpp.git to go.fd.io/govpp to make repository migration easier. Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Change-Id: Idd6e0d583a92f6b82fe9adeffd026cd6b856038b
2022-05-30binapi: remove internal/testbinapiNathan Skrzypczak1-1/+1
This patch is a proposal to remove the necessity to version two versions of the generated api. We would rely on `./binapi/` for 'internal' logic, making the dependancy on VPP a bit stronger, but removing a folder and a .json file we don't upgrade regularly. Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Change-Id: I99063ed571eb193271b3cda805d692155ac90f61
2022-05-30Update generated binapi to v22.02 & makefile changesNathan Skrzypczak2-4/+6
This patch does some small updates to the Makefile. * `make gen-binapi-from-code` is removed, and moves to `gen-binapi-local` * `make build` is patched to build cmd & examples * `make binapi-generator` to build the api-generator without other binaries, as they typically require its output to build. * `make gen-binapi-local` runs the locally built binapi-generator to update the local bindings. It expects ${VPP_DIR} to be set and to point to a local vpp repository checked out with the right version * `make gen-binapi-internal` runs the locally built binapi-generator to update the bindings in `internal/testbinapi/binapi2001` Regarding VPP, notable changes when moving to v22.02 are : - ControlPing moved from vpe to memclnt - CliInband went from vpe to vlib Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Change-Id: Ie5cd2d5ded7ecaffd9abc3ca675df40be272b1fa
2021-02-02binapigen: added enumflags typeVladimir Lavor1-2/+2
Change-Id: I2f46504bd05862e415dab518fad349d08aedf919 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-12-03Fixed incorrect message error in the stream APIVladimir Lavor1-2/+4
The message package is passed to the stream object and used to evaluate correct reply message type Change-Id: I2c9844d6447d024af1693205efd5721e2f89f22d Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-10-13Generate VPE HTTP handlerVladimir Lavor1-1/+1
* This should fix GoVPP build Change-Id: If53177253ad4a6616860aad50ce54e5944bbea6e Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-09-03Improve doc & fix import orderingNathan Skrzypczak1-8/+21
This also updates /binapi and adds a new make command to generate api files out of a local vpp repo clone Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Change-Id: Iff7965388a74ecd21af80f10b5a59d4ed8da6340
2020-08-25Binapi generator: improved file inputVladimir Lavor1-0/+1
In addition to the standard file name input (for example "vpe"), binary API generator now again accepts full file path like "/usr/share/vpp/api/core/vpe.api.json" as an input direcotry or argument. Change-Id: I591b5d26e7f101cdcc4af64d3bdabaab48b5b2ef Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-08-21Expose version info control flagsNathan Skrzypczak1-4/+8
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Change-Id: Ida098149bdf23dccafb7b1f2ac2bb83f21f918c9
2020-07-17Improve binapi generatorOndrej Fabry4-152/+305
- simplified Size/Marshal/Unmarshal methods - replace struc in unions with custom marshal/unmarshal - fix imports in generated files - fix mock adapter - generate rpc service using low-level stream API (dumps generate control ping or stream msg..) - move examples/binapi to binapi and generate all API for latest release - add binapigen.Plugin for developing custom generator plugins - optionally generate HTTP handlers (REST API) for RPC services - add govpp program for browsing VPP API Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-06-24Fix codec fallback and generate type importsOndrej Fabry1-7/+3
Change-Id: Idd76c7f19d952939caf153928ac60175845078ff Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-06-22Refactored binapi generator with message encodingOndrej Fabry17-6044/+160
Change-Id: I5a6abb68b9d058866f94818169300e5c2fc43895 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-04-17Format generated Go source code in-processv0.3.4Ondrej Fabry2-17/+15
This commit: - removes dependency on gofmt tool - cleans up package imports - re-generates binapi for VPP 20.01 Change-Id: Ie4347720f92a87eb278be66c9f9ed9719c7bbbc3 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-03-18Release 0.3.0v0.3.0Ondrej Fabry3-7/+21
- regenerate examples/binapi for latest VPP from stable/2001 - add import-prefix flag to set custom prefix (fallbacks to using go list) Change-Id: Ib09f134cf9662e348be2575448964de2b9e5c1ee Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-01-31Support imported type aliasesOndrej Fabry4-31/+207
Change-Id: I2e6ad9fb51e1cf55a52267720f2394e792946f7e Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-01-27Update jsongo depOndrej Fabry2-10/+10
Change-Id: I10dfbaa38de67835a84f5112d6b16bbe466c3bfe Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-01-20Fix parsing default meta parameterOndrej Fabry2-2/+2
Change-Id: Ibfc1f97e299256809978cb84f1685aa6729e898c Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-10-30fix data races in proxy serverMatus Mrekaj1-2/+7
Signed-off-by: Matus Mrekaj <matus.mrekaj@pantheon.tech> Change-Id: I932d560548ee816e28683243a7318a2a7fbbb24a
2019-10-17add missing implementation for proxyMatus Mrekaj1-0/+8
Signed-off-by: Matus Mrekaj <matus.mrekaj@pantheon.tech> Change-Id: I1ab9efb9e575e7993501e7774628cbb60d16ec43
2019-10-10Introduce proxy for VPPOndrej Fabry1-0/+131
- proxy server defines RPC service for proxying binapi/stats to VPP - use cmd/vpp-proxy for proxy server/client Change-Id: I6e698e166ecf6db7109ae5adf8a93f308d3f3f2a Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-09-09Fix compatibility with latest master (20.01-rc0)Ondrej Fabry3-16/+29
- fixed generator for new string types - update simple client example - regenerate examples binapi for VPP 19.08 Change-Id: If4fe78c130d95641f35f75cd0262b35b032acaf8 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-08-02Migrate to modules, refactor Makefile and use Travis for CIOndrej Fabry1-5/+31
- migrate to Go modules and remove vendor - refactor Makefile - add version package and store version - split extras from the rest - use travis for CI Change-Id: I81b35220653b0f7c9a0fcdd4c527d691ec1e96c1 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-08-01Fix unit testsOndrej Fabry2-13/+22
Change-Id: I49e0ec8420cf2563b77ec2b5a9cf9674286d5e5d Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-07-02Fix duplicate typesOndrej Fabry1-13/+37
- .api.json input files from VPP now sometimes contain duplicate objects - parsing is skipped if type is already known Change-Id: Ibf28f5baa68f6cfb40aeb75e1bde72241120ac23 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-27Improvements for binapi-generator and support VPP 19.04 in statsclientOndrej Fabry5-212/+223
- RPC service client implementation for dumps requests now streams responses - RPC service generation is now enabled by default - examples now allow setting binapi socket address - input dir flag for binapi-generator will recursively look into dirs to support core/plugins in /usr/share/vpp/api - minor improvements in debug logs - add support for VPP 19.04 for statsclient Change-Id: I0939ee3aa6e9f850d073fc5c87aff4ccc56b0d70 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-12Fix parsing API with removed CRC for types and unionsOndrej Fabry3-15/+27
- method GetCrcString() was also removed from DataType interface - fix generated comment for services - fix permissions for created files and directories Change-Id: If0b7a57e01f1128b5ba574fc5ee13b6a7c6aa6fd Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-06Add various generator improvementsOndrej Fabry6-169/+260
- generate service implementation for modules - generate conversion maps and String() method for enums - generate module name and version as constants - rename Union_data field to XXX_UnionData for consistency - generate constant GoVppAPIPackageIsVersionN for checking compatibility with API - add example for using service clients - add some documentation to socketclient adapter - cleanup gen.go file used for generating binapi - regenerate binapi with latest VPP release (19.04.1) - change global variables Messages into a function AllMessages Change-Id: Id1ef97764570759eaa3e5a4dc14ecda7a168ee39 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-04Fix union data size for types with enumsOndrej Fabry4-32/+95
- this also fixed proper alphabetical order for struct tags - env var DEBUG_BINAPI_GENERATOR=y can be used to enable debug mode Change-Id: I5b08a696ad2ff2a297872f231f9229cd956ee443 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-05-27Add support for field meta data to binapi-generatorOndrej Fabry3-14/+62
Change-Id: Id0164d36727d070e395a522000f2e09ee5444bd0 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-02-08Add support for using multiple generated versionsOndrej Fabry1-0/+8
- added CheckCompatibility for checking if given messages are compatible - generating Messages global for easier usage of compatibility check - added ReconnectInterval and MaxReconnectAttempts for reconnecting - added Failed state that is sent after exceeding max reconnect attempts Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-02-08Generator improvements and cleanupOndrej Fabry6-248/+292
- generator now supports include-comments flag (as opt-in) - minor code cleanup in binapi-generator - remove obsolete unit tests - flatten examples from examples/cmd folder - introduce constant for checking compatibility in future versions Change-Id: I3545f2ba4b869a3b51d6d0de7e742f3f1e1be392 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-01-31Generator improvementsOndrej Fabry3-71/+93
- all objects are now sorted alphabetically for more consistent output - unions now have constructor generated - log level for warnings was changed to debug - GetAllMessages renamed to GetRegisteredMessages Change-Id: I976453004a2fd8b6cb95ca0acfcef56913bf8d38 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-01-10Add support for string typesOndrej Fabry3-58/+70
- strings are now generated as two fields for length and string itself - aliases are now sorted by name to prevent generating different code - dependencies are now managed by dep - binapi files are regenerated using VPP 19.01-rc0~622-g7b01e9e8 - old stats binary api has been deprecated and removed from VPP Change-Id: Ieb8515c73021339a45f407386f8e3d87dcf4469e Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-01-02added support for string typeVladimir Lavor2-13/+11
Change-Id: I2de04fba137004d1d7148ae910e9ccbd47589611 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2018-12-13Add support for aliases and boolean typeOndrej Fabry4-95/+240
- aliases are now generated as new types or arrays (if length > 0) - bool is recognized as a boolean type and generated as Go bool - comment with original JSON is now prepended for each object type - interface Services is now generated at the top of the file to provide overview of what RPC services does the current module consists of - dump services now correctly return slice of the particular details type Change-Id: I788babc1c0f2de33e0febd87e5b200d54065b244 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-10-03Omit message factory and line numbers from generated outputOndrej Fabry1-20/+5
Change-Id: Ie48cc0a641242625daf55caf00ab630e78aa86b7 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-08-24Simplify subscribing to events and fix eventsOndrej Fabry1-1/+2
- there is no need for sending subscription requests through channels, since all the messages are registered and no communication with VPP is needed Change-Id: Ibc29957be02a32e26309f66c369a071559b822a9 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-08-22Show VPPApiError value always and remove RegisterBinAPITypes for mock adapterOndrej Fabry2-28/+27
Change-Id: I3b216748df1a372f25cc94e3df5d7b1b2b7a8a40 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-08-21Make the warnings for validating services more obviousOndrej Fabry4-125/+169
- there is currently simple validation for services, which checks type of services and its name for request/reply - there is one known warning in dhcp package for dhcp_client_config, since it is single case for normal requests subscribing to event Change-Id: I504a52b9a1823ced841b2ead712318ef5e5477b1 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-08-16Refactor GoVPPOndrej Fabry8-678/+1581
Squashed commit of the following: commit 348930db31575e9f59b3834d9fec07411f011e05 Author: Ondrej Fabry <ofabry@cisco.com> Date: Wed Aug 15 11:30:13 2018 +0200 Use debug level for log about different context commit 9fc963c559cea67a41b85c6cdadc322fb3b1fc7c Author: Ondrej Fabry <ofabry@cisco.com> Date: Wed Aug 15 11:22:03 2018 +0200 Remove annoying logs and add env vars for debugging commit fdc9fd624d13feadb602e0d03d58f8a44b7a565f Author: Ondrej Fabry <ofabry@cisco.com> Date: Wed Aug 15 11:18:47 2018 +0200 Fix printing unknown VPPApiError commit 8f968be36a91de4d4a8ea17593ba314f82aa9583 Author: Ondrej Fabry <ofabry@cisco.com> Date: Tue Aug 14 17:25:10 2018 +0200 Refactor entire GoVPP - fix some cases with inconsistent VPP messages, causing messages to be incorrectly identified as event or request - simplify API, remove direct access to internal Go channels - add module name with message to registration of messages - start watching filesystem only when vpe-api file does not exist - simplify code in message codec and remove unneeded parts - retrieve IDs of all registered messages after connect to VPP - define fallback for control ping in core to avoid duplicate registration - add SetLogLevel function to set logger level more easily - remove lot of unused code commit 34dd1b7e10ef0324aa8c4e4cc42375bd6021c6cb Author: Ondrej Fabry <ofabry@cisco.com> Date: Mon Aug 13 11:29:54 2018 +0200 Rename VnetError to VPPApiError commit c6549d6f77847a1367a12ff47fb716e2955e973a Author: Ondrej Fabry <ofabry@cisco.com> Date: Mon Aug 13 10:23:43 2018 +0200 Fix examples and regenerate binapi commit 4612e36b416779771f5efab4fc654c2766d2cb1c Author: Ondrej Fabry <ofabry@cisco.com> Date: Mon Aug 13 09:51:22 2018 +0200 Add parsing and generation for services commit ac9c5280c5aa27e325f327609e2364cc66f3723f Author: Ondrej Fabry <ofabry@cisco.com> Date: Fri Aug 10 14:30:15 2018 +0200 Fix exit status on error and add continue-onerror flag commit 9b3f4ef9fc7c8c62037fa107085eae18a8725314 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 15:20:56 2018 +0200 Return VnetError when Retval != 0 commit 8fd21a907b5e628ec4d2026215b83d15da96c297 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 14:59:05 2018 +0200 Add all missing errors from api_errno.h commit 08450f288d3046ebaecf40203174ae342a07f1eb Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 14:29:27 2018 +0200 Update README commit d8dced0728dd62243539be741868fb7d9b8de4cc Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 13:59:59 2018 +0200 Regenerate vpe in core commit 254da7592cdbf634cf7aa46ae36ce7bb6d4ee555 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 13:37:00 2018 +0200 Add VnetError type for Retvals commit 4475c1087fb53ab4c788e530bc7fef7cfc89d2cd Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 13:36:07 2018 +0200 Add registration API commit 892a3ea5a2c703e2f7c29331663f6a6fa706bff5 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 13:30:43 2018 +0200 Generate registration for messages and check all IDs on connect commit 389ed03b6e7082260281866c3449d72d72347c99 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 11:32:41 2018 +0200 Show error for empty adapter (on Darwin/Windows) commit ef1ea040d656ade64242432dc5f06810ed8dcde6 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 11:31:37 2018 +0200 Improve logged info commit d4adae3b14ed54c8d693060dd857fa9ba5ec8e06 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 11:27:48 2018 +0200 Update examples commit 63921e1346014701a22639a2611129563bb1eb78 Author: Ondrej Fabry <ofabry@cisco.com> Date: Thu Aug 9 11:02:56 2018 +0200 Generate unions and fix some issues - add comments between sections - define structs on single line if it has no fields - generate unions with setters/getters for each field - fix detection of message type commit 6ab3e3fa590b245898306a6ffaf32c7721eab60c Author: Ondrej Fabry <ofabry@cisco.com> Date: Wed Aug 8 15:37:10 2018 +0200 Refactor binapi-generator - split JSON parsing from code generation - parse and generate enums - parse unions (no generation yet) - change output file suffix to '.ba.go' - cleanup and simplify code - split code into files - add flag for debug mode Change-Id: I58f685e0d4c7a38e9a7b6ea0a1f47792d95d7399 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-01-26Make including VlAPIVersion in generated file as opt-inOndrej Fabry1-9/+13
Change-Id: I6ce52a539afe8af90858718a788dd310e735dff5 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-01-25Update examples, tests and testdata after binapi-generator update.Milan Lenco4-383/+3330
Change-Id: I738d501cbbb6673010a32847df3f1c87050b8d36 Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2018-01-24Update binapi-generator for the new VPPAPIGEN.Milan Lenco1-11/+28
Change-Id: Ifedb62b9bd04842257bbed89999add275ed2de23 Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2017-11-28Add WaitReady to VppAdapterOndrej Fabry1-2/+2
- this fixes issue with mocked adapter during AsyncConnect Change-Id: I952025fec865422f9e83cec9383d96f79a639c90 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2017-09-25generator fix - add new message typeRastislav Szabo1-0/+5
Change-Id: I5e2b312e086d18eb7fa3f349750caea20005f530 Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
2017-09-25generator fix - better identification of message typesRastislav Szabo2-16/+23
Change-Id: I00dbd57acba706b4a842e2b6c6df2d7b7ab7c37a Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
2017-07-26Modify the generator to generate the code that is ignored by golint ↵Lukas Macko1-1/+2
https://github.com/golang/go/issues/13560#issuecomment-288457920 Change-Id: I30482b6322b2cfa397541fb96aa7ba8fb72dec0a Signed-off-by: Lukas Macko <lmacko@cisco.com>
2017-05-22binapi-generator renamed & moved, finished documentationRastislav Szabo9-0/+1480
Change-Id: I7d3b53fa238e822b36a6a82c61ffb792da3898bf Signed-off-by: Rastislav Szabo <raszabo@cisco.com>