From 2c193f25dad12a63c2d2bea862556c150b7af359 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Tue, 13 Aug 2019 09:41:13 +0200 Subject: [PATCH] Release v2.2.0-beta (#1434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update NAT example for VPP 19.04. Signed-off-by: Milan Lenco * Remove unused dep from Gopkg.toml Signed-off-by: Ondrej Fabry * Install vpp-plugin-dpdk package Signed-off-by: Ondrej Fabry * Install python3-cffi package (dependency for python3-vpp-api) Signed-off-by: Ondrej Fabry * Rework RxPlacement and RxMode to allow per-queue configuration Signed-off-by: Milan Lenco * Fix build. Signed-off-by: Milan Lenco * remove tapv1 test and fix tests (#1339) Signed-off-by: AndrejKilvady * Use arrays instead of maps for RxMode and placement. Signed-off-by: Milan Lenco * Fix for SRv6 localsid delete in nonzero vrf tables (#1338) Signed-off-by: Filip Gschwandtner * fix robot test (#1340) Signed-off-by: AndrejKilvady * Add etcd ansible python plugin (#1336) * Add etcd ansible python plugin * Add example ansible playbook * Fix indentation * Update example playbook Signed-off-by: miroslav.kovac * Fix stats publishers (#1341) * Fix *-ifplugin config names * Unset default stats publishers used as fallback without config Signed-off-by: Ondrej Fabry * Define datasyncs used for setting publishers from config or env Signed-off-by: Ondrej Fabry * Add dependency on link-state for rx placement and rx mode. Signed-off-by: Milan Lenco * Update and add UTs for rx placement and rx mode Signed-off-by: Milan Lenco * Adapter for rx mode descriptor Signed-off-by: Milan Lenco * Update GoVPP (#1342) Signed-off-by: Ondrej Fabry * Bug fixing txn post-processing in kvscheduler. Signed-off-by: Milan Lenco * Add example for rx-placement and rx-mode. Signed-off-by: Milan Lenco * Pluralize rx-mode and rx-placement Signed-off-by: Milan Lenco * Add check for multiple descriptors matching the same key. Signed-off-by: Milan Lenco * Pluralize also key for all rx-modes of an interface Signed-off-by: Milan Lenco * Remove unnecessary LinkIsUp from interface metadata Signed-off-by: Milan Lenco * Refactor image building to use ligato/vpp-base (#1343) * Refactor image builds to use ligato/vpp-base Signed-off-by: Ondrej Fabry * Fixed automatic launching of SRv6 crud robot tests (#1346) Signed-off-by: Filip Gschwandtner * remove agent-ctl and kafka (#1345) Signed-off-by: AndrejKilvady * Define env vars for overriding start/stop timeouts of agent Signed-off-by: Ondrej Fabry * Support building images with different VPP versions (#1348) Signed-off-by: Ondrej Fabry * Pass image_tag Signed-off-by: Ondrej Fabry * Fix installing deb packages for VPP 19.01 Signed-off-by: Ondrej Fabry * DHCP proxy for VPP (#1349) * Add DHCP proxy plugin initial commit Signed-off-by: miroslav.kovac * Fix nil dump Signed-off-by: miroslav.kovac * Update dhcp_proxy.go Signed-off-by: miroslav.kovac * Update plugin fix namings add validate and dependecy implementation fix validation in write new dhcp proxy Signed-off-by: miroslav.kovac * Change isIPv6 to 0 if IPv4 Signed-off-by: miroslav.kovac * Update dump function Signed-off-by: miroslav.kovac * Update Ip formatting Signed-off-by: miroslav.kovac * Fix older version Signed-off-by: miroslav.kovac * Add DHCPv6 support Signed-off-by: miroslav.kovac * Fix bugs, clean up Signed-off-by: miroslav.kovac * Clean up and update validate implementation Signed-off-by: miroslav.kovac * Add messages to handler Signed-off-by: miroslav.kovac * Update error message Signed-off-by: miroslav.kovac * remove unused ipToAddress Signed-off-by: miroslav.kovac * Update error message Signed-off-by: miroslav.kovac * Update validate implementation Signed-off-by: miroslav.kovac * Update error message Signed-off-by: miroslav.kovac * Regenerate proto files Signed-off-by: Ondrej Fabry * Fix travis errors Signed-off-by: miroslav.kovac Co-authored-by: Ondrej Fabry * Fix caching for building docker images Signed-off-by: Ondrej Fabry * Make channel for notifications buffered (#1352) Even though notifications are processed quickly in separate go routines, it still may not be enough if multiple of them are received at roughly the same time, causing potential drops. Added small buffer for the notification channel. * Remove default for agent version and add grpc perf to dockerignore Signed-off-by: Ondrej Fabry * Add interfaces metrics to telemetry plugin (#1351) * Add interface metrics to telemetry plugin * Change telemetry URL for prometheus export to `/metrics/vpp` * Cleanup metric names * Rename node count to counter Signed-off-by: Ondrej Fabry * Fix IPv6 detection (#1355) Signed-off-by: Ondrej Fabry * add ABF to config data model (#1356) Signed-off-by: Vladimir Lavor * Improve error logs for invalid key value pairs (#1359) Signed-off-by: Ondrej Fabry * Minor Code Fixes (#1361) * fix panic if model is registered without name * fix key variable shadowed * Allow disabling interface stats reading Signed-off-by: Ondrej Fabry * replace supervisord with vpp-agent-init (#1318) * update cn-infra dep * add vpp-agent-init * fix deps * remove logfile paths from supervisor conf * update to latest supervisor Signed-off-by: Vladimir Lavor * Allow skipping binapi check in dev docker image Signed-off-by: Ondrej Fabry * fix crash for iptables rulechain with default microservice Signed-off-by: Vladimir Lavor * Support for VPP 19.08-rc0 (#1357) * Add preliminary support for VPP 19.08 Signed-off-by: Ondrej Fabry * updated govppmux to 1908 Signed-off-by: Vladimir Lavor * updated abf and acl plugins to 1908 Signed-off-by: Vladimir Lavor * updated ifplugin and ipsec plugin to 1908 Signed-off-by: Vladimir Lavor * update l2 and l3 plugin to 1908 Signed-off-by: Vladimir Lavor * updated nat and punt plugins to 1908 Signed-off-by: Vladimir Lavor * update sr and stn plugin to 1908 Signed-off-by: Vladimir Lavor * regenerate binapi for ip, nat and session Signed-off-by: Vladimir Lavor * improvements Signed-off-by: Vladimir Lavor * telemetry 1908 Signed-off-by: Vladimir Lavor * Update VPP images Signed-off-by: Ondrej Fabry * Fix VPP version in vppcalls handlers Signed-off-by: Ondrej Fabry * Add config status publishing for config items (#1364) Signed-off-by: Ondrej Fabry * Add some (temporary) debug logs for interface state updates (#1367) Signed-off-by: Milan Lenco * vpp updated to v19.08-rc0.324-g2ecf18a55 (#1366) * update govpp * update vpp to v19.08-rc0~324-g2ecf18a55 * update vppcalls * update punt tests Signed-off-by: Vladimir Lavor * Update CHANGELOG for v2.1.1 Signed-off-by: Ondrej Fabry * Update README.md * add rest support for ipsec and punt (#1368) * remove nul chars from retrieved punt socket path * add rest support for ipsec and punt Signed-off-by: Vladimir Lavor * Fix init order of state channel (#1369) Signed-off-by: Ondrej Fabry * initialize abf plugin handler in configurator (#1371) Signed-off-by: Vladimir Lavor * Add env var (RESYNC_TIMEOUT) for setting resync timeout (#1372) Signed-off-by: Ondrej Fabry * Minor enhancements in Linux interface descriptor (#1374) Signed-off-by: Ondrej Fabry * tweaked interface statistics Signed-off-by: Vladimir Lavor * wip Signed-off-by: Vladimir Lavor * Revert "wip" This reverts commit e993d3bc6989f671a57915d591d03e21fdc10a44. * Revert "tweaked interface statistics" This reverts commit 8715c9699d2c713ae532e2aea2c4d51d3a5b6141. * Retrieve cmdline (config) after conencting to VPP (#1381) Signed-off-by: Ondrej Fabry * fix punt dump for all vpp versions (#1379) * fix dump punt log * fix punt dump for all vpp versions Signed-off-by: Vladimir Lavor * Fix dumps for unavailable handlers - do not return error for dumps when some handlers are not available - log all unavailable handlers during initialization of restapi/configurator - remove unused dump channels from vppcalls Signed-off-by: Ondrej Fabry * Revert "fix punt dump for all vpp versions" (#1385) This reverts commit 36636ab7f0c992b3e81b9f1fa194a0613430001b. * Remove unused dump channel Signed-off-by: Ondrej Fabry * vpp.punt: Add support for punt exceptions (#1384) * Add support for punt exceptions - added support for punt exceptions in puntplugin - fixed deleting of registered sockets after resync - forcing recreation of registered sockets using prefix '!' in socket path - SetPunt is not used anymore Signed-off-by: Ondrej Fabry * Update documentation for VPP Punt API Signed-off-by: Ondrej Fabry * Add punt exceptions to clientv2 Signed-off-by: Ondrej Fabry * Add fixes for punt plugin (#1389) - do not check socket path for punt exceptions to prevent recreation - add depenency for RX interface to ip redirect punt - implement IP redirect dump (only for 19.08) - add workaround for publishing socket to punt exceptions as well - properly deregister punt exeption on delete - return pathname from registration when adding punt exception - add workaround with ! prefix to punt exceptions - publish socket paths to status with client TTL Signed-off-by: Ondrej Fabry * Update VPP 19.08 (#1394) * update to vpp v19.08-rc0~432-gb63dbc537 (#1390) Signed-off-by: Vladimir Lavor * Update GoVPP and vpp.env Signed-off-by: Ondrej Fabry * Fix nil stats in telemetry Signed-off-by: Ondrej Fabry * Regenerate binapi for VPP 19.04 Signed-off-by: Ondrej Fabry * fix IPSec security associations tunnel mode (#1395) Signed-off-by: Vladimir Lavor * fix building of docker images for ARM64 (make images) (#1376) * agentctl: Add import command for importing config from file Signed-off-by: Ondrej Fabry * agentctl: Fix import of full keys Signed-off-by: Ondrej Fabry * agentctl: Add flag to set number of ops per transaction Signed-off-by: Ondrej Fabry * agentctl: Add gRPC support to import command Signed-off-by: Ondrej Fabry * Move debugging into debug package (#1397) Signed-off-by: Ondrej Fabry * govppmux stats REST handler (#1396) * Add govppmux stats handler for REST and improve stats Signed-off-by: Ondrej Fabry * Allow disabling status publishing and interface stats collection Signed-off-by: Ondrej Fabry * agentctl: Remove unused type Signed-off-by: Ondrej Fabry * Update README.md (#1400) * Performance improvements around isNodeReady (#1402) * Add some (temporary) debug logs for interface state updates Signed-off-by: Milan Lenco * Performance improvements around isNodeReady Signed-off-by: Milan Lenco * Update GoVPP and use pure Go client adapters by default (#1401) * Update GoVPP and use pure Go client adapters by default Signed-off-by: Ondrej Fabry * Update GoVPP with fix for duplicate objects Signed-off-by: Ondrej Fabry * Add derived (property) key-value marking interface with at leas… (#1403) Signed-off-by: Milan Lenco * Update perf tests (#1404) * Update perf test Signed-off-by: Ondrej Fabry * Update perf test Signed-off-by: Ondrej Fabry * Update perf test Signed-off-by: Ondrej Fabry * Cleanup puntplugin (#1405) Signed-off-by: Ondrej Fabry * vpp19.08 updated to rc0.581-g3eea9de89 (#1407) * update abf plugin * update interface plugin * update l2 plugin * update L3 plugin * removed redundant log * code improvements and cleanup * added support for VRF index map * l3 plugin dumps ipv4 and ipv6 routes * add vrf proto to metadata Signed-off-by: Vladimir Lavor * VPP integration tests (#1409) * Add initial vpp integration test Signed-off-by: Ondrej Fabry * Test integration tests on travis Signed-off-by: Ondrej Fabry * Skip integration tests on travis Signed-off-by: Ondrej Fabry * Update vpp integration tests Signed-off-by: Ondrej Fabry * Set govpp logger level on debug Signed-off-by: Ondrej Fabry * Add integration test for interface Signed-off-by: Ondrej Fabry * Run integration tests and verify binapi for each VPP version in travis Signed-off-by: Ondrej Fabry * Fix env matrix Signed-off-by: Ondrej Fabry * Try fix env Signed-off-by: Ondrej Fabry * Try travis fix Signed-off-by: Ondrej Fabry * Add README for vpp integration tests Signed-off-by: Ondrej Fabry * Clean stages Signed-off-by: Ondrej Fabry * Fix stages Signed-off-by: Ondrej Fabry * Add go_import_path back Signed-off-by: Ondrej Fabry * Regenerate binapi for VPP 19.01 Signed-off-by: Ondrej Fabry * Update Go in docker Signed-off-by: Ondrej Fabry * Add abf patch to VPP 1901 binapi Signed-off-by: Ondrej Fabry * Fix binapi patches for VPP 19.08 Signed-off-by: Ondrej Fabry * Fix binapi patches for VPP 19.08 Signed-off-by: Ondrej Fabry * Update GoVPP & aggregated watcher (#1410) * Update GoVPP Signed-off-by: Ondrej Fabry * Add aggregated watcher from vpp1908 branch Signed-off-by: Ondrej Fabry * Fix key collisions for vpp routes (#1411) * Add outgoing interface to route key Signed-off-by: Ondrej Fabry * Add unit tests for vpp route key Signed-off-by: Ondrej Fabry * added memif interface test to tests/integration (#1412) Signed-off-by: Stanislav Chlebec * Update VPP to 19.08-rc0.666-g9082b43dd (#1413) * Update VPP to 19.08-rc0.666-g9082b43dd Signed-off-by: Ondrej Fabry * Update VPP to 19.08-rc0.673-ga2e4451db Signed-off-by: Ondrej Fabry * Fix in Telemetry plugin and improvements for integration tests (#1414) * Add DumpInterface to vppcalls in ifplugin Signed-off-by: Ondrej Fabry * Cleanup vpp integration tests Signed-off-by: Ondrej Fabry * Fix file name Signed-off-by: Ondrej Fabry * Hide iptables warning when no config found Signed-off-by: Ondrej Fabry * Print shm warning directly into stderr Signed-off-by: Ondrej Fabry * Fix single interface dump for older VPP Signed-off-by: Ondrej Fabry * Fix retrieving memory stats in telemetry for VPP 19.08 Signed-off-by: Ondrej Fabry * Add tests for telemetry to VPP integration tests Signed-off-by: Ondrej Fabry * Fix integration tests - Skip some telemetry integration tests for VPP<=19.04 - Fix GetMemory in telemetry for VPP<=19.04 - Use hard-coded config for VPP - Use DOCKER_ARGS for custom arguments for docker Signed-off-by: Ondrej Fabry * Update GoVPP Signed-off-by: Ondrej Fabry * Fix URL for VPP metrics in telemetry plugin (#1416) * Fix URL for VPP metrics in telemetry plugin Signed-off-by: Ondrej Fabry * Update Gopkg.lock * Optimize interface state dump for specific interfaces (#1415) * Optimize interface state dump for specific interfaces - define env var for printing debug logs about interface states - extend interface state info in vppcalls for ifplugin - return error when loading config fails - minor improvements for VPP integration testing Signed-off-by: Ondrej Fabry * Remove obsolete function Signed-off-by: Ondrej Fabry * Add option for skipping metrics in telemetry plugin (#1417) Signed-off-by: Ondrej Fabry * Added CRUD integration tests for IPv4/IPv6 (#1419) * Added CRUD integration tests for IPv4/IPv6 routes in default VRF and VRF=2 Signed-off-by: Stanislav Chlebec * improving code Signed-off-by: Stanislav Chlebec * removed comments and parametrized value of VRF (vrfMetaIdx) * removed redundant initialisation to default value causes warnings in travis Signed-off-by: Stanislav Chlebec * Minor enhancements and code cleanups (#1420) * Minor enhancement for transaction summary log Signed-off-by: Ondrej Fabry * Add make target for remote debugging with delve Signed-off-by: Ondrej Fabry * Minor code cleanup in vpp ifplugin Signed-off-by: Ondrej Fabry * Fix error check when renaming tap and cleanup code Signed-off-by: Ondrej Fabry * Add integration test for IP address (#1421) Signed-off-by: Ondrej Fabry * added arp crud integration test (#1422) * added arp crud integration test Signed-off-by: Stanislav Chlebec * comments removed * added more asserts - asserts related to number of arp entries in arp dump - asserting of fields of arp entry - assert non presence in arp dump - hard-coded index replaced by generated one stored in the variable ifIdx Signed-off-by: Stanislav Chlebec * simplify assert (omitting assert of Static field) Signed-off-by: Stanislav Chlebec * Update VPP to 19.08-rc0.699-gf7c30df4b (#1424) Signed-off-by: Ondrej Fabry * kvscheduler: keep node in the graph during recreate (#1423) This patch fixes issues reported in #1418. During recreate (Delete+Create) the node would be completely removed from the graph by Delete and all the associated flags (metadata) were therefore lost. When the subsequent Create fails, the scheduler needs to access the flags, which in this case are undefined, causing the scheduler to panic by dereferencing nil pointer. This patch ensures that the node and its flags are preserved during re-creation. An in-progress refactor of the scheduling algorithm will approach value recreation in a much cleaner way... Signed-off-by: Milan Lenco * Update VPP to 19.08-rc0.706-ga58fec168 (#1426) Signed-off-by: Ondrej Fabry * Define VRF as retrieve dependency for routes (#1429) Signed-off-by: Ondrej Fabry * extend linux plugin (#1431) * add "EXISTING" interface type Signed-off-by: Matus Mrekaj * update interface descriptor Signed-off-by: Matus Mrekaj * update interface descriptor Signed-off-by: Matus Mrekaj * WIP integration test ACL IP CRUD (#1428) * integration test ACL IP rule CRUD Signed-off-by: Stanislav Chlebec * renamed to 040_acl_test.go Signed-off-by: Stanislav Chlebec * to satisfy lint Signed-off-by: Stanislav Chlebec * Trying to loop over acl dump * Looping over IP rule * acl IP rule CRUD almost finished Signed-off-by: Stanislav Chlebec * acl IP rule CRUD Signed-off-by: Stanislav Chlebec * satisfy lint * added acl integration test for MAC IP rules fixed comments in interface definition Signed-off-by: Stanislav Chlebec * fix comments - they should start with space Signed-off-by: Stanislav Chlebec * create a helper function that returns ACL rule - for IP rule - for IP MAC rule Signed-off-by: Stanislav Chlebec * acl integration test - refactoring - introducing of helper functions to eliminate declaration of acl_rule variables - removing needless convert with uint32 - simplifying code with expect functions - improving logged messages to improve understanding Signed-off-by: Stanislav Chlebec * satisfy lint Signed-off-by: Stanislav Chlebec * Fix Retrieve for TAPv2 interface without Linux-side NB config (#1432) Signed-off-by: Milan Lenco * Update VPP 19.08 to stable (rc1) Signed-off-by: Ondrej Fabry * Update VPP 19.08 to stable (rc1) (#1433) Signed-off-by: Ondrej Fabry * Release v2.2.0-beta Signed-off-by: Ondrej Fabry * Changelog for vpp-agent v2.2.0-beta Signed-off-by: Vladimir Lavor --- .dockerignore | 5 +- .travis.yml | 91 +- CHANGELOG.md | 66 + Gopkg.lock | 49 +- Gopkg.toml | 2 +- Makefile | 161 +- README.md | 2 +- api/genericmanager/genericmanager.pb.go | 346 +- api/genericmanager/genericmanager.proto | 37 +- api/models/linux/interfaces/interface.pb.go | 79 +- api/models/linux/interfaces/interface.proto | 1 + api/models/vpp/abf/keys_test.go | 6 +- api/models/vpp/interfaces/interface.pb.go | 409 +- api/models/vpp/interfaces/interface.proto | 27 +- api/models/vpp/interfaces/keys.go | 190 + api/models/vpp/interfaces/keys_test.go | 393 ++ api/models/vpp/l3/keys.go | 29 +- api/models/vpp/l3/keys_test.go | 124 +- api/models/vpp/l3/l3.pb.go | 176 +- api/models/vpp/l3/l3.proto | 12 + api/models/vpp/punt/keys.go | 29 +- api/models/vpp/punt/punt.pb.go | 219 +- api/models/vpp/punt/punt.proto | 71 +- api/models/vpp/vpp.pb.go | 96 +- api/models/vpp/vpp.proto | 1 + client/client_api.go | 25 +- client/local_client.go | 7 +- client/remoteclient/grpc_client.go | 38 +- clientv2/linux/data_change_api.go | 10 +- clientv2/linux/data_resync_api.go | 6 +- clientv2/linux/dbadapter/data_change_db.go | 25 +- clientv2/linux/dbadapter/data_resync_db.go | 18 +- clientv2/linux/localclient/localclient_api.go | 5 +- clientv2/vpp/data_change_api.go | 6 +- clientv2/vpp/data_resync_api.go | 2 + clientv2/vpp/dbadapter/data_change_db.go | 20 +- clientv2/vpp/dbadapter/data_resync_db.go | 13 +- clientv2/vpp/localclient/localclient_api.go | 6 +- cmd/agentctl/cmd/generate.go | 18 +- cmd/agentctl/cmd/import.go | 258 ++ cmd/agentctl/cmd/put.go | 19 +- cmd/agentctl/cmd/root.go | 32 +- cmd/agentctl/cmd/show.go | 28 +- cmd/agentctl/utils/common_utils.go | 17 +- cmd/agentctl/utils/db_write_utils.go | 1 - cmd/vpp-agent-ctl/data/ifplugin.go | 1 + cmd/vpp-agent-ctl/data/ipsecplugin.go | 4 + cmd/vpp-agent-ctl/data/l3plugins.go | 38 +- cmd/vpp-agent-ctl/main.go | 4 + cmd/vpp-agent-init/main.go | 30 + cmd/vpp-agent/app/vpp_agent.go | 3 +- cmd/vpp-agent/debug.go | 115 - cmd/vpp-agent/main.go | 37 +- docker/dev/Dockerfile | 172 +- docker/dev/build.sh | 101 +- docker/dev/exec_agent.sh | 10 - docker/dev/exec_vpp.sh | 13 - docker/dev/init_hook.sh | 17 + docker/dev/linux-ifplugin.conf | 1 - docker/dev/supervisor.conf | 9 + docker/dev/supervisord.conf | 26 - docker/dev/supervisord_kill.py | 66 - docker/prod/Dockerfile | 81 +- docker/prod/build.sh | 36 +- docker/prod/exec_agent.sh | 10 - docker/prod/init_hook.sh | 17 + docker/prod/linux-ifplugin.conf | 1 - docker/prod/supervisor.conf | 9 + docker/prod/supervisord.conf | 26 - docker/prod/supervisord_kill.py | 66 - docker/prod/vpp-ifplugin.conf | 1 - docs/kvscheduler/cfd/af_packet_interface.md | 2 +- examples/custom_model/main.go | 120 +- examples/kvscheduler/rxplacement/govpp.conf | 4 + .../kvscheduler/rxplacement/kvscheduler.conf | 3 + examples/kvscheduler/rxplacement/main.go | 264 ++ examples/kvscheduler/vpp-l3/main.go | 2 +- examples/localclient_vpp/plugins/main.go | 6 +- pkg/debug/debug.go | 99 + pkg/metrics/metrics.go | 59 +- pkg/models/{encoding.go => item.go} | 25 +- pkg/models/models.go | 11 + pkg/models/spec.go | 49 +- plugins/configurator/configurator.go | 14 + plugins/configurator/dump.go | 281 +- plugins/configurator/options.go | 4 + plugins/configurator/plugin.go | 73 +- plugins/govppmux/adapter_puregoclient.go | 52 + plugins/govppmux/adapter_stubs.go | 4 +- plugins/govppmux/adapter_vppapiclient.go | 7 +- .../{govpp_channel.go => binapi_client.go} | 71 +- ..._channel_test.go => binapi_client_test.go} | 0 plugins/govppmux/config.go | 68 + plugins/govppmux/options.go | 2 + plugins/govppmux/plugin_impl_govppmux.go | 259 +- plugins/govppmux/rest.go | 39 + plugins/govppmux/stats.go | 59 +- plugins/govppmux/stats_client.go | 77 + .../govppmux/vppcalls/vpp1901/vpe_vppcalls.go | 9 +- .../govppmux/vppcalls/vpp1904/vpe_vppcalls.go | 9 +- .../govppmux/vppcalls/vpp1908/vpe_vppcalls.go | 130 + plugins/govppmux/vppcalls/vppcalls_api.go | 8 + plugins/kvscheduler/api/kv_scheduler_api.go | 4 +- plugins/kvscheduler/api/txn_options.go | 2 +- plugins/kvscheduler/api/txn_record.go | 8 +- plugins/kvscheduler/datachange_test.go | 160 + .../kvscheduler/internal/graph/graph_api.go | 9 + .../kvscheduler/internal/graph/node_read.go | 26 + .../internal/registry/registry_impl.go | 6 +- .../internal/test/model/values.pb.go | 47 +- .../internal/test/model/values.proto | 1 + .../kvscheduler/internal/test/southbound.go | 16 +- plugins/kvscheduler/internal/test/values.go | 8 +- plugins/kvscheduler/node_utils.go | 60 +- plugins/kvscheduler/notification_test.go | 26 +- plugins/kvscheduler/plugin_scheduler.go | 20 +- plugins/kvscheduler/refresh.go | 2 +- plugins/kvscheduler/txn_exec.go | 26 +- plugins/kvscheduler/txn_process.go | 226 +- plugins/kvscheduler/txn_record.go | 32 +- .../ifplugin/descriptor/adapter/interface.go | 2 +- .../linux/ifplugin/descriptor/interface.go | 177 +- .../ifplugin/descriptor/interface_tap.go | 19 +- .../ifplugin/descriptor/interface_veth.go | 13 +- plugins/linux/ifplugin/descriptor/watcher.go | 9 +- .../iptablesplugin/descriptor/rulechain.go | 2 +- .../linux/iptablesplugin/iptablesplugin.go | 6 +- .../linux/nsplugin/descriptor/microservice.go | 19 +- plugins/linux/nsplugin/ns_plugin.go | 31 +- plugins/orchestrator/dispatcher.go | 114 +- plugins/orchestrator/genericmanager.go | 92 +- plugins/orchestrator/orchestrator.go | 97 +- plugins/orchestrator/store.go | 45 +- plugins/orchestrator/watcher/aggregator.go | 329 ++ plugins/restapi/handlers.go | 84 +- plugins/restapi/options.go | 2 + plugins/restapi/plugin_restapi.go | 109 +- plugins/restapi/resturl/urls.go | 17 +- plugins/telemetry/config.go | 10 + plugins/telemetry/metrics.go | 521 +++ plugins/telemetry/prometheus.go | 389 -- plugins/telemetry/telemetry.conf | 4 + plugins/telemetry/telemetry.go | 15 +- .../vppcalls/vpp1901/telemetry_vppcalls.go | 14 +- .../vppcalls/vpp1904/telemetry_vppcalls.go | 20 +- .../vppcalls/vpp1908/telemetry_vppcalls.go | 464 ++ .../vpp1908/telemetry_vppcalls_test.go | 550 +++ plugins/telemetry/vppcalls/vppcalls_api.go | 51 +- plugins/vpp/abfplugin/abfplugin.go | 9 +- .../vpp/abfplugin/vppcalls/abf_vppcalls.go | 6 +- .../vppcalls/vpp1901/abf_vppcalls_test.go | 7 +- .../vppcalls/vpp1901/dump_abf_vppcalls.go | 4 +- .../vppcalls/vpp1901/vppcalls_handlers.go | 27 +- .../vppcalls/vpp1904/abf_vppcalls_test.go | 7 +- .../vppcalls/vpp1904/dump_abf_vppcalls.go | 4 +- .../vppcalls/vpp1904/vppcalls_handlers.go | 27 +- .../vppcalls/vpp1908/abf_vppcalls.go | 189 + .../vppcalls/vpp1908/abf_vppcalls_test.go | 276 ++ .../vppcalls/vpp1908/dump_abf_vppcalls.go | 177 + .../vppcalls/vpp1908/vppcalls_handlers.go | 55 + plugins/vpp/aclplugin/aclplugin.go | 9 +- .../vpp/aclplugin/descriptor/adapter/acl.go | 2 +- .../vpp/aclplugin/vppcalls/acl_vppcalls.go | 10 +- .../vppcalls/vpp1901/acl_vppcalls_test.go | 2 +- .../vppcalls/vpp1901/dump_vppcalls.go | 20 +- .../vppcalls/vpp1901/vppcalls_handlers.go | 8 +- .../vppcalls/vpp1904/acl_vppcalls_test.go | 2 +- .../vppcalls/vpp1904/dump_vppcalls.go | 20 +- .../vppcalls/vpp1904/vppcalls_handlers.go | 8 +- .../vppcalls/vpp1908/acl_vppcalls.go | 341 ++ .../vppcalls/vpp1908/acl_vppcalls_test.go | 487 ++ .../vppcalls/vpp1908/dump_vppcalls.go | 650 +++ .../vppcalls/vpp1908/dump_vppcalls_test.go | 401 ++ .../vppcalls/vpp1908/interfaces_vppcalls.go | 338 ++ .../vpp1908/interfaces_vppcalls_test.go | 166 + .../vppcalls/vpp1908/vppcalls_handlers.go | 48 + plugins/vpp/binapi/vpp1901/abf.patch | 15 + plugins/vpp/binapi/vpp1901/abf/abf.ba.go | 211 +- plugins/vpp/binapi/vpp1901/acl/acl.ba.go | 505 ++- .../binapi/vpp1901/af_packet/af_packet.ba.go | 161 +- plugins/vpp/binapi/vpp1901/bfd/bfd.ba.go | 372 +- plugins/vpp/binapi/vpp1901/bond/bond.ba.go | 220 +- plugins/vpp/binapi/vpp1901/dhcp/dhcp.ba.go | 339 +- plugins/vpp/binapi/vpp1901/gen.go | 40 + .../vpp1901/interfaces/interfaces.ba.go | 589 ++- plugins/vpp/binapi/vpp1901/ip.patch | 15 + plugins/vpp/binapi/vpp1901/ip/ip.ba.go | 1220 +++-- plugins/vpp/binapi/vpp1901/ipsec/ipsec.ba.go | 670 ++- plugins/vpp/binapi/vpp1901/l2/l2.ba.go | 683 ++- .../vpp/binapi/vpp1901/memclnt/memclnt.ba.go | 293 +- plugins/vpp/binapi/vpp1901/memif/memif.ba.go | 197 +- plugins/vpp/binapi/vpp1901/nat/nat.ba.go | 1592 +++++-- plugins/vpp/binapi/vpp1901/punt/punt.ba.go | 201 +- .../vpp/binapi/vpp1901/session/session.ba.go | 507 ++- plugins/vpp/binapi/vpp1901/sr.patch | 16 + plugins/vpp/binapi/vpp1901/sr/sr.ba.go | 302 +- plugins/vpp/binapi/vpp1901/stn/stn.ba.go | 127 +- plugins/vpp/binapi/vpp1901/tap/tap.ba.go | 161 +- plugins/vpp/binapi/vpp1901/tapv2/tapv2.ba.go | 146 +- .../vpp/binapi/vpp1901/vmxnet3/vmxnet3.ba.go | 146 +- plugins/vpp/binapi/vpp1901/vpe/vpe.ba.go | 249 +- plugins/vpp/binapi/vpp1901/vxlan/vxlan.ba.go | 161 +- plugins/vpp/binapi/vpp1904/abf/abf.ba.go | 213 +- plugins/vpp/binapi/vpp1904/acl/acl.ba.go | 507 ++- .../binapi/vpp1904/af_packet/af_packet.ba.go | 163 +- plugins/vpp/binapi/vpp1904/bfd/bfd.ba.go | 374 +- plugins/vpp/binapi/vpp1904/bond/bond.ba.go | 222 +- plugins/vpp/binapi/vpp1904/dhcp/dhcp.ba.go | 341 +- plugins/vpp/binapi/vpp1904/gen.go | 4 +- .../vpp1904/interfaces/interfaces.ba.go | 591 ++- plugins/vpp/binapi/vpp1904/ip/ip.ba.go | 1246 +++-- plugins/vpp/binapi/vpp1904/ipsec/ipsec.ba.go | 621 ++- plugins/vpp/binapi/vpp1904/l2/l2.ba.go | 725 ++- .../vpp/binapi/vpp1904/memclnt/memclnt.ba.go | 295 +- plugins/vpp/binapi/vpp1904/memif/memif.ba.go | 199 +- plugins/vpp/binapi/vpp1904/nat/nat.ba.go | 1758 +++++-- plugins/vpp/binapi/vpp1904/punt/punt.ba.go | 203 +- .../vpp/binapi/vpp1904/session/session.ba.go | 452 +- plugins/vpp/binapi/vpp1904/sr/sr.ba.go | 304 +- plugins/vpp/binapi/vpp1904/stn/stn.ba.go | 129 +- plugins/vpp/binapi/vpp1904/tapv2/tapv2.ba.go | 148 +- .../vpp/binapi/vpp1904/vmxnet3/vmxnet3.ba.go | 150 +- plugins/vpp/binapi/vpp1904/vpe/vpe.ba.go | 251 +- plugins/vpp/binapi/vpp1904/vxlan/vxlan.ba.go | 163 +- plugins/vpp/binapi/vpp1908/abf.patch | 15 + plugins/vpp/binapi/vpp1908/abf/abf.ba.go | 814 ++++ plugins/vpp/binapi/vpp1908/acl/acl.ba.go | 1053 +++++ .../binapi/vpp1908/af_packet/af_packet.ba.go | 260 ++ plugins/vpp/binapi/vpp1908/bfd/bfd.ba.go | 760 ++++ plugins/vpp/binapi/vpp1908/bond/bond.ba.go | 379 ++ plugins/vpp/binapi/vpp1908/dhcp/dhcp.ba.go | 1084 +++++ plugins/vpp/binapi/vpp1908/gen.go | 39 + .../vpp1908/interfaces/interfaces.ba.go | 1304 ++++++ plugins/vpp/binapi/vpp1908/ip.patch | 15 + plugins/vpp/binapi/vpp1908/ip/ip.ba.go | 3083 +++++++++++++ plugins/vpp/binapi/vpp1908/ipsec/ipsec.ba.go | 1439 ++++++ plugins/vpp/binapi/vpp1908/l2/l2.ba.go | 1731 +++++++ .../vpp/binapi/vpp1908/memclnt/memclnt.ba.go | 595 +++ plugins/vpp/binapi/vpp1908/memif/memif.ba.go | 337 ++ plugins/vpp/binapi/vpp1908/nat/nat.ba.go | 4025 +++++++++++++++++ plugins/vpp/binapi/vpp1908/punt/punt.ba.go | 775 ++++ .../vpp/binapi/vpp1908/session/session.ba.go | 995 ++++ plugins/vpp/binapi/vpp1908/sr.patch | 16 + plugins/vpp/binapi/vpp1908/sr/sr.ba.go | 579 +++ plugins/vpp/binapi/vpp1908/stn/stn.ba.go | 172 + plugins/vpp/binapi/vpp1908/tapv2/tapv2.ba.go | 252 ++ .../vpp/binapi/vpp1908/vmxnet3/vmxnet3.ba.go | 253 ++ plugins/vpp/binapi/vpp1908/vpe/vpe.ba.go | 757 ++++ plugins/vpp/binapi/vpp1908/vxlan/vxlan.ba.go | 278 ++ plugins/vpp/ifplugin/config.go | 66 + .../ifplugin/descriptor/adapter/interface.go | 2 +- .../vpp/ifplugin/descriptor/adapter/rxmode.go | 233 + .../descriptor/adapter/rxplacement.go | 233 + plugins/vpp/ifplugin/descriptor/dhcp.go | 16 +- plugins/vpp/ifplugin/descriptor/interface.go | 102 +- .../vpp/ifplugin/descriptor/interface_crud.go | 83 +- .../descriptor/interface_with_address.go | 85 + plugins/vpp/ifplugin/descriptor/link_state.go | 153 + plugins/vpp/ifplugin/descriptor/rx_mode.go | 307 ++ .../vpp/ifplugin/descriptor/rx_placement.go | 118 + plugins/vpp/ifplugin/descriptor/unnumbered.go | 4 +- plugins/vpp/ifplugin/ifplugin.go | 155 +- plugins/vpp/ifplugin/interface_state.go | 150 +- plugins/vpp/ifplugin/publish_state.go | 21 +- plugins/vpp/ifplugin/vppcalls/if_vppcalls.go | 23 +- .../vpp1901/dump_interface_vppcalls.go | 131 +- .../vpp1901/dump_interface_vppcalls_test.go | 116 + .../vppcalls/vpp1901/rx_mode_vppcalls.go | 9 +- .../vppcalls/vpp1901/rx_mode_vppcalls_test.go | 48 +- .../vppcalls/vpp1901/rx_placement_vppcalls.go | 6 +- .../vpp1901/rx_placement_vppcalls_test.go | 46 +- .../vppcalls/vpp1901/vppcalls_handler.go | 24 +- .../vppcalls/vpp1901/watch_vppcalls.go | 2 +- .../vpp1904/dump_interface_vppcalls.go | 135 +- .../vpp1904/dump_interface_vppcalls_test.go | 112 + .../vppcalls/vpp1904/ip_container_vppcalls.go | 4 +- .../vppcalls/vpp1904/ipsec_vppcalls_test.go | 4 +- .../vppcalls/vpp1904/rx_mode_vppcalls.go | 9 +- .../vppcalls/vpp1904/rx_mode_vppcalls_test.go | 48 +- .../vppcalls/vpp1904/rx_placement_vppcalls.go | 6 +- .../vpp1904/rx_placement_vppcalls_test.go | 46 +- .../vppcalls/vpp1904/vppcalls_handler.go | 22 +- .../vppcalls/vpp1904/watch_vppcalls.go | 2 +- .../vppcalls/vpp1908/admin_vppcalls.go | 79 + .../vppcalls/vpp1908/admin_vppcalls_test.go | 181 + .../vppcalls/vpp1908/afpacket_vppcalls.go | 59 + .../vpp1908/afpacket_vppcalls_test.go | 165 + .../vppcalls/vpp1908/bond_vppcalls.go | 117 + .../vppcalls/vpp1908/dhcp_vppcalls.go | 47 + .../vppcalls/vpp1908/dhcp_vppcalls_test.go | 104 + plugins/vpp/ifplugin/vppcalls/vpp1908/doc.go | 17 + .../vpp1908/dump_interface_vppcalls.go | 1022 +++++ .../vpp1908/dump_interface_vppcalls_test.go | 418 ++ .../vppcalls/vpp1908/ip_container_vppcalls.go | 64 + .../vpp1908/ip_container_vppcalls_test.go | 167 + .../ifplugin/vppcalls/vpp1908/ip_vppcalls.go | 97 + .../vppcalls/vpp1908/ip_vppcalls_test.go | 269 ++ .../vppcalls/vpp1908/ipsec_vppcalls.go | 111 + .../vppcalls/vpp1908/ipsec_vppcalls_test.go | 134 + .../ifplugin/vppcalls/vpp1908/l2_vppcalls.go | 64 + .../vppcalls/vpp1908/loopback_vppcalls.go | 46 + .../vpp1908/loopback_vppcalls_test.go | 99 + .../ifplugin/vppcalls/vpp1908/mac_vppcalls.go | 41 + .../vppcalls/vpp1908/mac_vppcalls_test.go | 74 + .../vppcalls/vpp1908/memif_vppcalls.go | 83 + .../vppcalls/vpp1908/memif_vppcalls_test.go | 201 + .../ifplugin/vppcalls/vpp1908/mtu_vppcalls.go | 34 + .../vppcalls/vpp1908/mtu_vppcalls_test.go | 61 + .../vppcalls/vpp1908/rx_mode_vppcalls.go | 38 + .../vppcalls/vpp1908/rx_mode_vppcalls_test.go | 98 + .../vppcalls/vpp1908/rx_placement_vppcalls.go | 37 + .../vpp1908/rx_placement_vppcalls_test.go | 98 + .../vppcalls/vpp1908/subif_vppcalls.go | 48 + .../vppcalls/vpp1908/subif_vppcalls_test.go | 74 + .../ifplugin/vppcalls/vpp1908/tap_vppcalls.go | 85 + .../vppcalls/vpp1908/tap_vppcalls_test.go | 73 + .../vppcalls/vpp1908/vmxnet3_vppcalls.go | 85 + .../vppcalls/vpp1908/vmxnet3_vppcalls_test.go | 114 + .../vppcalls/vpp1908/vppcalls_handler.go | 88 + .../ifplugin/vppcalls/vpp1908/vrf_vppcalls.go | 72 + .../vppcalls/vpp1908/vrf_vppcalls_test.go | 121 + .../vppcalls/vpp1908/vxlan_vppcalls.go | 75 + .../vppcalls/vpp1908/vxlan_vppcalls_test.go | 236 + .../vppcalls/vpp1908/watch_vppcalls.go | 133 + .../vppcalls/vpp1908/watch_vppcalls_test.go | 138 + .../vpp/ipsecplugin/descriptor/adapter/spd.go | 4 +- plugins/vpp/ipsecplugin/ipsecplugin.go | 1 + .../vppcalls/vpp1901/vppcalls_handlers.go | 2 +- .../vppcalls/vpp1904/ipsec_vppcalls.go | 41 +- .../vppcalls/vpp1904/ipsec_vppcalls_test.go | 86 + .../vppcalls/vpp1904/vppcalls_handlers.go | 2 +- .../vppcalls/vpp1908/dump_vppcalls.go | 224 + .../vppcalls/vpp1908/ipsec_vppcalls.go | 241 + .../vppcalls/vpp1908/ipsec_vppcalls_test.go | 332 ++ .../vppcalls/vpp1908/vppcalls_handlers.go | 78 + .../descriptor/adapter/bridgedomain.go | 4 +- plugins/vpp/l2plugin/l2plugin.go | 1 + .../vppcalls/vpp1901/vppcalls_handler.go | 2 +- .../vppcalls/vpp1904/vppcalls_handler.go | 2 +- .../vppcalls/vpp1908/arp_term_vppcalls.go | 67 + .../vpp1908/arp_term_vppcalls_test.go | 138 + .../vpp1908/bridge_domain_vppcalls.go | 64 + .../vpp1908/bridge_domain_vppcalls_test.go | 144 + plugins/vpp/l2plugin/vppcalls/vpp1908/doc.go | 17 + .../vppcalls/vpp1908/dump_vppcalls.go | 243 + .../vppcalls/vpp1908/dump_vppcalls_test.go | 304 ++ .../vppcalls/vpp1908/interface_vppcalls.go | 69 + .../vpp1908/interface_vppcalls_test.go | 143 + .../vppcalls/vpp1908/l2fib_vppcalls.go | 78 + .../vppcalls/vpp1908/l2fib_vppcalls_test.go | 110 + .../vppcalls/vpp1908/vppcalls_handler.go | 124 + .../vppcalls/vpp1908/xconnect_vppcalls.go | 59 + .../vpp1908/xconnect_vppcalls_test.go | 128 + .../l3plugin/descriptor/adapter/dhcpproxy.go | 233 + .../l3plugin/descriptor/adapter/vrftable.go | 15 +- plugins/vpp/l3plugin/descriptor/dhcp_proxy.go | 156 + plugins/vpp/l3plugin/descriptor/route.go | 29 +- plugins/vpp/l3plugin/descriptor/vrf_table.go | 30 +- plugins/vpp/l3plugin/l3plugin.go | 38 +- plugins/vpp/l3plugin/l3plugin_api.go | 23 + plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go | 28 +- .../vppcalls/vpp1901/dhcpproxy_dump.go | 88 + .../vppcalls/vpp1901/dhcpproxy_vppcalls.go | 72 + .../vppcalls/vpp1901/vppcalls_handlers.go | 29 +- .../vppcalls/vpp1904/dhcpproxy_dump.go | 85 + .../vppcalls/vpp1904/dhcpproxy_vppcalls.go | 72 + .../vppcalls/vpp1904/vppcalls_handlers.go | 30 +- .../vpp/l3plugin/vppcalls/vpp1908/arp_dump.go | 90 + .../l3plugin/vppcalls/vpp1908/arp_vppcalls.go | 74 + .../vppcalls/vpp1908/arp_vppcalls_test.go | 92 + .../vppcalls/vpp1908/dhcpproxy_dump.go | 85 + .../vppcalls/vpp1908/dhcpproxy_vppcalls.go | 72 + plugins/vpp/l3plugin/vppcalls/vpp1908/doc.go | 2 + .../vppcalls/vpp1908/ipneigh_vppcalls.go | 107 + .../vppcalls/vpp1908/ipneigh_vppcalls_test.go | 89 + .../vppcalls/vpp1908/proxyarp_dump.go | 85 + .../vppcalls/vpp1908/proxyarp_vppcalls.go | 85 + .../vpp1908/proxyarp_vppcalls_test.go | 74 + .../l3plugin/vppcalls/vpp1908/route_dump.go | 210 + .../vppcalls/vpp1908/route_dump_test.go | 82 + .../vppcalls/vpp1908/route_vppcalls.go | 142 + .../vppcalls/vpp1908/route_vppcalls_test.go | 97 + .../vppcalls/vpp1908/vppcalls_handlers.go | 243 + .../vpp/l3plugin/vppcalls/vpp1908/vrf_dump.go | 56 + .../vppcalls/vpp1908/vrf_dump_test.go | 77 + .../l3plugin/vppcalls/vpp1908/vrf_vppcalls.go | 48 + .../vppcalls/vpp1908/vrf_vppcalls_test.go | 138 + plugins/vpp/l3plugin/vrfidx/doc.go | 3 + plugins/vpp/l3plugin/vrfidx/vrfidx.go | 186 + plugins/vpp/l3plugin/vrfidx/vrfidx_test.go | 121 + plugins/vpp/natplugin/natplugin.go | 1 + .../vppcalls/vpp1901/vppcalls_handler.go | 2 +- .../vppcalls/vpp1904/vppcalls_handler.go | 2 +- .../vppcalls/vpp1908/dump_nat_vppcalls.go | 569 +++ .../vpp1908/dump_nat_vppcalls_test.go | 376 ++ .../vppcalls/vpp1908/nat_vppcalls.go | 471 ++ .../vppcalls/vpp1908/nat_vppcalls_test.go | 893 ++++ .../vppcalls/vpp1908/vppcalls_handler.go | 59 + .../descriptor/adapter/puntexception.go | 233 + .../puntplugin/descriptor/ip_punt_redirect.go | 31 +- .../puntplugin/descriptor/punt_exception.go | 172 + .../vpp/puntplugin/descriptor/punt_to_host.go | 100 +- plugins/vpp/puntplugin/options.go | 1 + plugins/vpp/puntplugin/puntplugin.go | 50 +- .../vpp/puntplugin/vppcalls/punt_vppcalls.go | 30 +- .../vppcalls/vpp1901/dump_vppcalls.go | 39 +- .../vppcalls/vpp1901/punt_vppcalls.go | 21 +- .../vppcalls/vpp1901/vppcalls_handler.go | 4 +- .../vppcalls/vpp1904/dump_vppcalls.go | 37 +- .../vppcalls/vpp1904/punt_vppcalls.go | 21 +- .../vppcalls/vpp1904/vppcalls_handler.go | 4 +- .../vppcalls/vpp1908/dump_vppcalls.go | 245 + .../vppcalls/vpp1908/punt_vppcalls.go | 292 ++ .../vppcalls/vpp1908/punt_vppcalls_test.go | 224 + .../vppcalls/vpp1908/vppcalls_handler.go | 78 + plugins/vpp/srplugin/descriptor/localsid.go | 5 +- plugins/vpp/srplugin/srplugin.go | 1 + plugins/vpp/srplugin/vppcalls/api_vppcalls.go | 4 +- plugins/vpp/srplugin/vppcalls/vpp1901/srv6.go | 30 +- .../srplugin/vppcalls/vpp1901/srv6_test.go | 62 +- .../vppcalls/vpp1901/vppcalls_handlers.go | 4 +- plugins/vpp/srplugin/vppcalls/vpp1904/srv6.go | 30 +- .../srplugin/vppcalls/vpp1904/srv6_test.go | 62 +- .../vppcalls/vpp1904/vppcalls_handlers.go | 4 +- plugins/vpp/srplugin/vppcalls/vpp1908/srv6.go | 644 +++ .../srplugin/vppcalls/vpp1908/srv6_test.go | 1523 +++++++ .../vppcalls/vpp1908/vppcalls_handlers.go | 58 + plugins/vpp/stnplugin/stnplugin.go | 1 + .../vppcalls/vpp1901/vppcalls_handler.go | 2 +- .../vppcalls/vpp1904/vppcalls_handler.go | 2 +- .../vppcalls/vpp1908/dump_stn_vppcalls.go | 76 + .../vppcalls/vpp1908/stn_vppcalls.go | 89 + .../vppcalls/vpp1908/stn_vppcalls_test.go | 151 + .../vppcalls/vpp1908/vppcalls_handler.go | 56 + plugins/vpp/vppcallmock/vpp_ctx_mock.go | 4 +- scripts/genbinapi.sh | 8 + scripts/install_protobuf.sh | 14 + scripts/static_analysis.sh | 1 + tests/integration/README.md | 19 + tests/integration/vpp/000_initial_test.go | 32 + tests/integration/vpp/001_telemetry_test.go | 68 + tests/integration/vpp/010_interfaces_test.go | 182 + tests/integration/vpp/020_routes_test.go | 360 ++ tests/integration/vpp/030_arp_test.go | 138 + tests/integration/vpp/040_acl_test.go | 850 ++++ tests/integration/vpp/integration_test.go | 271 ++ tests/integration/vpp_integration.sh | 46 + tests/perf/.gitignore | 1 + tests/perf/grpc-perf/grpc.conf | 2 +- tests/perf/grpc-perf/kvscheduler.conf | 2 + tests/perf/grpc-perf/main.go | 144 +- tests/perf/grpc-perf/telemetry.conf | 1 + .../perf/{grpc-perf/test.sh => perf_test.sh} | 170 +- tests/perf/run_all.sh | 24 +- tests/robot/examples/example_crud_test.robot | 4 +- tests/robot/libraries/docker.robot | 61 - tests/robot/libraries/etcdctl.robot | 9 +- tests/robot/libraries/pretty_keywords.robot | 3 - tests/robot/libraries/setup-teardown.robot | 12 - .../resources/tap_interface_with_ip.json | 14 - tests/robot/suites/api/BFD/bfd_api.robot | 1 - tests/robot/suites/crud/bd_crud.robot | 2 +- tests/robot/suites/crud/tap_crud.robot | 100 - .../crudIPv6/app_namespaces_crudIPv6.robot | 4 +- .../robot/suites/crudIPv6/arp_crudIPv6.robot | 21 +- tests/robot/suites/crudIPv6/bd_crudIPv6.robot | 2 +- .../suites/crudIPv6/linux_arp_crudIPv6.robot | 12 +- .../crudIPv6/linux_ip_route_crudIPv6.robot | 1 - .../robot/suites/crudIPv6/srv6_crudIPv6.robot | 3 +- .../suites/crudIPv6/stn_rule_crudIPv6.robot | 4 +- .../robot/suites/crudIPv6/tap_crudIPv6.robot | 99 - .../crudIPv6/tap_unnumbered_crudIPv6.robot | 6 +- tests/robot/suites/misc/etcd_clear.robot | 2 - .../vswitch_2x_vnf_vpp.robot | 1 - .../l2xconnect_trafic.robot | 2 + .../physical_int_traffic.robot | 3 +- ...p_int_and_route_config_order_traffic.robot | 9 +- ...2_int_and_route_config_order_traffic.robot | 3 - .../veth_af_packet_traffic.robot | 1 - .../veth_afpacket_memif_vxlan_traffic.robot | 1 - .../l2xconnect_traficIPv6.robot | 2 + .../physical_int_trafficIPv6.robot | 3 +- ...t_and_route_config_order_trafficIPv6.robot | 10 +- ...t_and_route_config_order_trafficIPv6.robot | 5 - tests/robot/variables/common_variables.robot | 3 - .../variables/obsolete_common_variables.py | 1 - .../obsolete_jozo_local_variables.py | 1 - .../variables/obsolete_tricorder_variables.py | 1 - .../govpp.git/adapter/socketclient/doc.go | 33 + .../adapter/socketclient/socketclient.go | 221 +- .../git.fd.io/govpp.git/adapter/stats_api.go | 13 +- .../adapter/statsclient/stat_segment.go | 368 ++ .../adapter/statsclient/statsclient.go | 223 + .../govpp.git/adapter/statsclient/version.go | 33 + vendor/git.fd.io/govpp.git/adapter/vpp_api.go | 11 +- .../adapter/vppapiclient/stat_client.go | 28 +- .../vppapiclient/stat_client_wrapper.h | 20 +- .../adapter/vppapiclient/vppapiclient.go | 24 +- vendor/git.fd.io/govpp.git/api/binapi.go | 3 - vendor/git.fd.io/govpp.git/api/stats.go | 14 + .../govpp.git/cmd/binapi-generator/doc.go | 3 +- .../cmd/binapi-generator/generate.go | 388 +- .../govpp.git/cmd/binapi-generator/main.go | 167 +- .../govpp.git/cmd/binapi-generator/objects.go | 67 +- .../govpp.git/cmd/binapi-generator/parse.go | 205 +- .../govpp.git/cmd/binapi-generator/types.go | 24 +- vendor/git.fd.io/govpp.git/core/channel.go | 14 +- vendor/git.fd.io/govpp.git/core/connection.go | 18 +- vendor/git.fd.io/govpp.git/core/log.go | 1 + .../govpp.git/core/request_handler.go | 6 +- .../{bin_api => binapi}/memclnt/memclnt.ba.go | 295 +- vendor/github.com/ftrvxmtrx/fd/LICENSE.MIT | 18 + vendor/github.com/ftrvxmtrx/fd/README.md | 25 + vendor/github.com/ftrvxmtrx/fd/fd.go | 104 + vendor/github.com/ligato/cn-infra/.gitignore | 2 + vendor/github.com/ligato/cn-infra/Gopkg.lock | 44 +- vendor/github.com/ligato/cn-infra/Gopkg.toml | 18 +- .../datasync/syncbase/msg/datamsg.pb.go | 253 +- .../etcd-lib/model/phonebook/phonebook.pb.go | 18 +- .../advanced-scenario/main.go | 4 +- .../basic-scenario/main.go | 4 +- .../process-manager-plugin/templates/main.go | 4 +- .../redis-lib/airport/model/flight.pb.go | 24 +- .../examples/supervisor-plugin/example.log | 0 .../examples/supervisor-plugin/main.go | 113 + .../tutorials/04_kv-store/model/model.pb.go | 32 +- .../{ => exec}/processmanager/options.go | 0 .../{ => exec}/processmanager/plugin.go | 6 +- .../{ => exec}/processmanager/pm.conf | 0 .../{ => exec}/processmanager/process.go | 2 +- .../{ => exec}/processmanager/process_impl.go | 2 +- .../processmanager/process_options.go | 2 +- .../processmanager/status/status.go | 0 .../processmanager/status/test-state | 0 .../template/model/process/process.pb.go | 34 +- .../template/model/process/process.proto | 0 .../processmanager/template/template.go | 2 +- .../ligato/cn-infra/exec/supervisor/config.go | 90 + .../ligato/cn-infra/exec/supervisor/hooks.go | 54 + .../ligato/cn-infra/exec/supervisor/logger.go | 65 + .../cn-infra/exec/supervisor/options.go | 53 + .../ligato/cn-infra/exec/supervisor/plugin.go | 245 + .../cn-infra/exec/supervisor/supervisor.conf | 19 + .../statuscheck/model/status/status.pb.go | 54 +- .../measure/model/apitrace/apitrace.pb.go | 40 +- .../access-security/accesssecurity.pb.go | 44 +- vendor/github.com/mitchellh/go-ps/.gitignore | 1 + vendor/github.com/mitchellh/go-ps/.travis.yml | 4 + vendor/github.com/mitchellh/go-ps/LICENSE.md | 21 + vendor/github.com/mitchellh/go-ps/README.md | 34 + vendor/github.com/mitchellh/go-ps/Vagrantfile | 43 + vendor/github.com/mitchellh/go-ps/process.go | 40 + .../mitchellh/go-ps/process_darwin.go | 138 + .../mitchellh/go-ps/process_freebsd.go | 260 ++ .../mitchellh/go-ps/process_linux.go | 35 + .../mitchellh/go-ps/process_solaris.go | 96 + .../mitchellh/go-ps/process_unix.go | 101 + .../mitchellh/go-ps/process_windows.go | 119 + vendor/github.com/pkg/profile/.travis.yml | 10 + vendor/github.com/pkg/profile/AUTHORS | 1 + vendor/github.com/pkg/profile/LICENSE | 24 + vendor/github.com/pkg/profile/README.md | 54 + vendor/github.com/pkg/profile/mutex.go | 13 + vendor/github.com/pkg/profile/mutex17.go | 9 + vendor/github.com/pkg/profile/profile.go | 263 ++ vendor/github.com/pkg/profile/trace.go | 8 + vendor/github.com/pkg/profile/trace16.go | 10 + vpp.env | 17 +- 568 files changed, 71381 insertions(+), 9028 deletions(-) create mode 100644 cmd/agentctl/cmd/import.go create mode 100644 cmd/vpp-agent-init/main.go delete mode 100644 cmd/vpp-agent/debug.go delete mode 100755 docker/dev/exec_agent.sh delete mode 100755 docker/dev/exec_vpp.sh create mode 100755 docker/dev/init_hook.sh delete mode 100644 docker/dev/linux-ifplugin.conf create mode 100644 docker/dev/supervisor.conf delete mode 100644 docker/dev/supervisord.conf delete mode 100755 docker/dev/supervisord_kill.py delete mode 100755 docker/prod/exec_agent.sh create mode 100755 docker/prod/init_hook.sh delete mode 100644 docker/prod/linux-ifplugin.conf create mode 100644 docker/prod/supervisor.conf delete mode 100644 docker/prod/supervisord.conf delete mode 100755 docker/prod/supervisord_kill.py delete mode 100644 docker/prod/vpp-ifplugin.conf create mode 100644 examples/kvscheduler/rxplacement/govpp.conf create mode 100644 examples/kvscheduler/rxplacement/kvscheduler.conf create mode 100644 examples/kvscheduler/rxplacement/main.go create mode 100644 pkg/debug/debug.go rename pkg/models/{encoding.go => item.go} (89%) create mode 100644 plugins/govppmux/adapter_puregoclient.go rename plugins/govppmux/{govpp_channel.go => binapi_client.go} (69%) rename plugins/govppmux/{govpp_channel_test.go => binapi_client_test.go} (100%) create mode 100644 plugins/govppmux/config.go create mode 100644 plugins/govppmux/rest.go create mode 100644 plugins/govppmux/stats_client.go create mode 100644 plugins/govppmux/vppcalls/vpp1908/vpe_vppcalls.go create mode 100644 plugins/orchestrator/watcher/aggregator.go create mode 100644 plugins/telemetry/metrics.go delete mode 100644 plugins/telemetry/prometheus.go create mode 100644 plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls.go create mode 100644 plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls_test.go create mode 100644 plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls.go create mode 100644 plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls_test.go create mode 100644 plugins/vpp/abfplugin/vppcalls/vpp1908/dump_abf_vppcalls.go create mode 100644 plugins/vpp/abfplugin/vppcalls/vpp1908/vppcalls_handlers.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls_test.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls_test.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls_test.go create mode 100644 plugins/vpp/aclplugin/vppcalls/vpp1908/vppcalls_handlers.go create mode 100644 plugins/vpp/binapi/vpp1901/abf.patch create mode 100644 plugins/vpp/binapi/vpp1901/gen.go create mode 100644 plugins/vpp/binapi/vpp1901/ip.patch create mode 100644 plugins/vpp/binapi/vpp1901/sr.patch create mode 100644 plugins/vpp/binapi/vpp1908/abf.patch create mode 100644 plugins/vpp/binapi/vpp1908/abf/abf.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/acl/acl.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/af_packet/af_packet.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/bfd/bfd.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/bond/bond.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/dhcp/dhcp.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/gen.go create mode 100644 plugins/vpp/binapi/vpp1908/interfaces/interfaces.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/ip.patch create mode 100644 plugins/vpp/binapi/vpp1908/ip/ip.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/ipsec/ipsec.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/l2/l2.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/memclnt/memclnt.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/memif/memif.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/nat/nat.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/punt/punt.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/session/session.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/sr.patch create mode 100644 plugins/vpp/binapi/vpp1908/sr/sr.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/stn/stn.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/tapv2/tapv2.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/vmxnet3/vmxnet3.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/vpe/vpe.ba.go create mode 100644 plugins/vpp/binapi/vpp1908/vxlan/vxlan.ba.go create mode 100644 plugins/vpp/ifplugin/config.go create mode 100644 plugins/vpp/ifplugin/descriptor/adapter/rxmode.go create mode 100644 plugins/vpp/ifplugin/descriptor/adapter/rxplacement.go create mode 100644 plugins/vpp/ifplugin/descriptor/interface_with_address.go create mode 100644 plugins/vpp/ifplugin/descriptor/link_state.go create mode 100644 plugins/vpp/ifplugin/descriptor/rx_mode.go create mode 100644 plugins/vpp/ifplugin/descriptor/rx_placement.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/bond_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/doc.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/l2_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vppcalls_handler.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls_test.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls.go create mode 100644 plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls_test.go create mode 100644 plugins/vpp/ipsecplugin/vppcalls/vpp1908/dump_vppcalls.go create mode 100644 plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls.go create mode 100644 plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go create mode 100644 plugins/vpp/ipsecplugin/vppcalls/vpp1908/vppcalls_handlers.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls_test.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls_test.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/doc.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls_test.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls_test.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls_test.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/vppcalls_handler.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls.go create mode 100644 plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/descriptor/adapter/dhcpproxy.go create mode 100644 plugins/vpp/l3plugin/descriptor/dhcp_proxy.go create mode 100644 plugins/vpp/l3plugin/l3plugin_api.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/arp_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/doc.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/vppcalls_handlers.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump_test.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go create mode 100644 plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go create mode 100644 plugins/vpp/l3plugin/vrfidx/doc.go create mode 100644 plugins/vpp/l3plugin/vrfidx/vrfidx.go create mode 100644 plugins/vpp/l3plugin/vrfidx/vrfidx_test.go create mode 100644 plugins/vpp/natplugin/vppcalls/vpp1908/dump_nat_vppcalls.go create mode 100644 plugins/vpp/natplugin/vppcalls/vpp1908/dump_nat_vppcalls_test.go create mode 100644 plugins/vpp/natplugin/vppcalls/vpp1908/nat_vppcalls.go create mode 100644 plugins/vpp/natplugin/vppcalls/vpp1908/nat_vppcalls_test.go create mode 100644 plugins/vpp/natplugin/vppcalls/vpp1908/vppcalls_handler.go create mode 100644 plugins/vpp/puntplugin/descriptor/adapter/puntexception.go create mode 100644 plugins/vpp/puntplugin/descriptor/punt_exception.go create mode 100644 plugins/vpp/puntplugin/vppcalls/vpp1908/dump_vppcalls.go create mode 100644 plugins/vpp/puntplugin/vppcalls/vpp1908/punt_vppcalls.go create mode 100644 plugins/vpp/puntplugin/vppcalls/vpp1908/punt_vppcalls_test.go create mode 100644 plugins/vpp/puntplugin/vppcalls/vpp1908/vppcalls_handler.go create mode 100644 plugins/vpp/srplugin/vppcalls/vpp1908/srv6.go create mode 100644 plugins/vpp/srplugin/vppcalls/vpp1908/srv6_test.go create mode 100644 plugins/vpp/srplugin/vppcalls/vpp1908/vppcalls_handlers.go create mode 100644 plugins/vpp/stnplugin/vppcalls/vpp1908/dump_stn_vppcalls.go create mode 100644 plugins/vpp/stnplugin/vppcalls/vpp1908/stn_vppcalls.go create mode 100644 plugins/vpp/stnplugin/vppcalls/vpp1908/stn_vppcalls_test.go create mode 100644 plugins/vpp/stnplugin/vppcalls/vpp1908/vppcalls_handler.go create mode 100755 scripts/genbinapi.sh create mode 100755 scripts/install_protobuf.sh create mode 100644 tests/integration/README.md create mode 100644 tests/integration/vpp/000_initial_test.go create mode 100644 tests/integration/vpp/001_telemetry_test.go create mode 100644 tests/integration/vpp/010_interfaces_test.go create mode 100644 tests/integration/vpp/020_routes_test.go create mode 100644 tests/integration/vpp/030_arp_test.go create mode 100644 tests/integration/vpp/040_acl_test.go create mode 100644 tests/integration/vpp/integration_test.go create mode 100755 tests/integration/vpp_integration.sh create mode 100644 tests/perf/.gitignore create mode 100644 tests/perf/grpc-perf/kvscheduler.conf create mode 100644 tests/perf/grpc-perf/telemetry.conf rename tests/perf/{grpc-perf/test.sh => perf_test.sh} (55%) delete mode 100644 tests/robot/resources/tap_interface_with_ip.json delete mode 100644 tests/robot/suites/crud/tap_crud.robot delete mode 100644 tests/robot/suites/crudIPv6/tap_crudIPv6.robot create mode 100644 vendor/git.fd.io/govpp.git/adapter/socketclient/doc.go create mode 100644 vendor/git.fd.io/govpp.git/adapter/statsclient/stat_segment.go create mode 100644 vendor/git.fd.io/govpp.git/adapter/statsclient/statsclient.go create mode 100644 vendor/git.fd.io/govpp.git/adapter/statsclient/version.go rename vendor/git.fd.io/govpp.git/examples/{bin_api => binapi}/memclnt/memclnt.ba.go (64%) create mode 100644 vendor/github.com/ftrvxmtrx/fd/LICENSE.MIT create mode 100644 vendor/github.com/ftrvxmtrx/fd/README.md create mode 100644 vendor/github.com/ftrvxmtrx/fd/fd.go create mode 100644 vendor/github.com/ligato/cn-infra/examples/supervisor-plugin/example.log create mode 100644 vendor/github.com/ligato/cn-infra/examples/supervisor-plugin/main.go rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/options.go (100%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/plugin.go (98%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/pm.conf (100%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/process.go (99%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/process_impl.go (99%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/process_options.go (97%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/status/status.go (100%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/status/test-state (100%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/template/model/process/process.pb.go (90%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/template/model/process/process.proto (100%) rename vendor/github.com/ligato/cn-infra/{ => exec}/processmanager/template/template.go (97%) create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/config.go create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/hooks.go create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/logger.go create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/options.go create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/plugin.go create mode 100644 vendor/github.com/ligato/cn-infra/exec/supervisor/supervisor.conf create mode 100644 vendor/github.com/mitchellh/go-ps/.gitignore create mode 100644 vendor/github.com/mitchellh/go-ps/.travis.yml create mode 100644 vendor/github.com/mitchellh/go-ps/LICENSE.md create mode 100644 vendor/github.com/mitchellh/go-ps/README.md create mode 100644 vendor/github.com/mitchellh/go-ps/Vagrantfile create mode 100644 vendor/github.com/mitchellh/go-ps/process.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_darwin.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_freebsd.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_linux.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_solaris.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_unix.go create mode 100644 vendor/github.com/mitchellh/go-ps/process_windows.go create mode 100644 vendor/github.com/pkg/profile/.travis.yml create mode 100644 vendor/github.com/pkg/profile/AUTHORS create mode 100644 vendor/github.com/pkg/profile/LICENSE create mode 100644 vendor/github.com/pkg/profile/README.md create mode 100644 vendor/github.com/pkg/profile/mutex.go create mode 100644 vendor/github.com/pkg/profile/mutex17.go create mode 100644 vendor/github.com/pkg/profile/profile.go create mode 100644 vendor/github.com/pkg/profile/trace.go create mode 100644 vendor/github.com/pkg/profile/trace16.go diff --git a/.dockerignore b/.dockerignore index 0fbea72603..ede13b7132 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,4 +10,7 @@ examples/ k8s/ cmd/agentctl/agentctl cmd/vpp-agent/vpp-agent -cmd/vpp-agent-ctl/vpp-agent-ctl \ No newline at end of file +cmd/vpp-agent-ctl/vpp-agent-ctl +docker/dev/build.sh +docker/prod/build.sh +tests/perf/grpc-perf/grpc-perf \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index c72329e2d3..1a9511d380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,47 +4,72 @@ sudo: required language: go go: - - "1.11.x" - -addons: - apt: - packages: - - npm + - "1.12.x" go_import_path: github.com/ligato/vpp-agent +services: + - docker + git: - depth: 10 + depth: 5 submodules: false cache: directories: - - $HOME/.cache/go-build - - $HOME/build-cache - - $HOME/.npm - - $(npm config get prefix)/lib/node_modules - -env: - - GO_BUILD_TAGS=mockvpp - -before_install: - - make travis - - make get-linkcheck - - make get-linters - - make get-dep - - go get github.com/mattn/goveralls - -script: - - make yamllint - - make check-links || true - - make lint - - make dep-check - - make verify-binapi - - make - - make test-cover - -after_success: - - goveralls -coverprofile=/tmp/coverage.out -service=travis-ci + - ${HOME}/.cache + +install: true + +stages: + - Check + - Test + - Build + - Integration + +jobs: + include: + - stage: Check + language: shell + name: "Check formatting" + addons: + apt: + packages: + - npm + script: + - make yamllint + - make check-links || true + - name: "Go dependency check" + script: make dep-check + + - stage: Test + name: "Code linter" + script: make lint + - name: "Unit tests" + before_script: + - go get github.com/mattn/goveralls + script: make test-cover + after_success: + - goveralls -coverprofile=/tmp/coverage.out -service=travis-ci + + - stage: Build + script: + - make cmd + - make examples + + - stage: Integration + env: VPP_VERSION=1904 + script: + - make verify-binapi + - make integration-tests + - env: VPP_VERSION=1908 + script: + - make verify-binapi + - make integration-tests + - env: VPP_VERSION=1901 + script: + - make verify-binapi + - make integration-tests notifications: slack: diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf98be534..e4eb408d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Release Notes +- [v2.2.0-beta](#v2.2.0-beta) - [v2.1.0](#v2.1.0) - [v2.1.1](#v2.1.1) - [v2.0.0](#v2.0.0) @@ -44,6 +45,70 @@ RELEASE CHANGELOG TEMPLATE: --> + +# [2.2.0-beta](https://github.com/ligato/vpp-agent/compare/v2.1.1...v2.2.0-beta) (2019-08-09) + +### Compatibility +- **VPP 19.08** (rc1) +- **VPP 19.04** (default) +- **VPP 19.01** (backward compatible) + +### Bug Fixes +* Fixed SRv6 localsid delete case for non-zero VRF tables. +* Fixed interface IPv6 detection in the descriptor. +* Various bugs fixed in KV scheduler TXN post-processing. +* Interface plugin config names fixed, no stats publishers are now used by default. Instead, datasync is used (by default ETCD, Redis and Consul). +* Rx-placement and rx-mode is now correctly dependent on interface link state. +* Fixed crash for iptables rulechain with default microservice. +* Punt dump fixed in all supported VPP versions. +* Removal of registered punt sockets fixed after a resync. +* Punt socket paths should no longer be unintentionally recreated. +* IP redirect is now correctly dependent on RX interface. +* Fixed IPSec security association configuration for tunnel mode. +* Fixed URL for VPP metrics in telemetry plugin +* Routes are now properly dependent on VRF. + +### New Features +* Defined new environment variable `DISABLE_INTERFACE_STATS` to generally disable interface plugin stats. +* Defined new environment variable `RESYNC_TIMEOU` to override default resync timeout. +* Added [ETCD ansible python plugin][ansible] with example playbook. Consult [readme](ansible/README.md) for more information. + +### Improvements +* [govppmux-plugin][govppmux-plugin] + - GoVPPMux stats can be read with rest under path `/govppmux/stats`. + - Added disabling of interface stats via the environment variable `DISABLE_INTERFACE_STATS`. + - Added disabling of interface status publishing via environment variable `DISABLE_STATUS_PUBLISHING`. +* [kv-scheduler][kv-scheduler] + - Added some more performance improvements. + - The same key can be no more matched by multiple descriptors. +* [abf-plugin][vpp-abf-plugin] + - ABF plugin was added to config data model and is now initialized in configurator. +* [if-plugin][vpp-interface-plugin] + - Interface rx-placement and rx-mode was enhanced and now allows per-queue configuration. + - Added [examples](examples/kvscheduler/rxplacement) for rx-placement and rx-mode. +* [nat-plugin][vpp-nat-plugin] + - NAT example updated for VPP 19.04 +* [l3-plugin][vpp-l3-plugin] + - Route keys were changed to prevent collisions with some types of configuration. Route with outgoing interface now contains the interface name in the key. + - Added support for DHCP proxy. A new descriptor allows calling CRUD operations to VPP DHCP proxy servers. +* [punt-plugin][vpp-punt-plugin] + - Added support for Punt exceptions. + - IP redirect dump was implemented for VPP 19.08. +* [Telemetry][vpp-telemetry] + - Interface metrics added to telemetry plugin. Note that the URL for prometheus export was changed to `/metrics/vpp`. + - Plugin configuration file now has an option to skip certain metrics. +* [rest-plugin][rest-plugin] + - Added support for IPSec plugin + - Added support for punt plugin +* [agentctl][agentctl] + - We continuously update the new CTL tool. Various bugs were fixed some new features added. + - Added new command `import` which can import configuration from file. + +### Docker Images +* The supervisor was replaced with VPP-Agent init plugin. +* Images now use pre-built VPP images from [ligato/vpp-base](https://github.com/ligato/vpp-base) + + # [2.1.1](https://github.com/ligato/vpp-agent/compare/v2.1.0...v2.1.1) (2019-04-05) @@ -829,6 +894,7 @@ Data replication and events: - remote client - for remote configuration of VPP Agent (while integrating for example with control plane) [agentctl]: cmd/agentctl +[ansible]: ansible [configurator-plugin]: plugins/configurator [consul]: https://www.consul.io/ [contiv-vpp1810]: https://github.com/vpp-dev/vpp/tree/stable-1801-contiv diff --git a/Gopkg.lock b/Gopkg.lock index 53c6d44f73..0cec8e7a72 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -3,22 +3,23 @@ [[projects]] branch = "master" - digest = "1:833783cac162a09c16538f5ecf6e03f90d8b09babb4d54497a4102a1444b69ea" + digest = "1:576638fbd32f0237520d280e7df80092293efd6780f639546bb258768f150c83" name = "git.fd.io/govpp.git" packages = [ "adapter", "adapter/mock", "adapter/mock/binapi", "adapter/socketclient", + "adapter/statsclient", "adapter/vppapiclient", "api", "cmd/binapi-generator", "codec", "core", - "examples/bin_api/memclnt", + "examples/binapi/memclnt", ] pruneopts = "UT" - revision = "6acebecfc33da246685c1cc14b2fc8bc6be3191b" + revision = "bde85d422c7949ec32fb067e9c36320ccc47fb9e" [[projects]] branch = "master" @@ -297,6 +298,14 @@ revision = "8842d40dbf5ee062d80f9dc429db31a0fe0cdc73" version = "v1.2.2" +[[projects]] + branch = "master" + digest = "1:ea797b536b154f62d2e1c49b61d5a1088782111563eb59837ff2b83fd2a65184" + name = "github.com/ftrvxmtrx/fd" + packages = ["."] + pruneopts = "UT" + revision = "c6d800382fff6dc1412f34269f71b7f83bd059ad" + [[projects]] digest = "1:2cd7915ab26ede7d95b8749e6b1f933f1c6d5398030684e6505940a10f31cfda" name = "github.com/ghodss/yaml" @@ -491,7 +500,8 @@ version = "v1.0" [[projects]] - digest = "1:5485ade83659041e023daf65c3eba8d5799a26f4b6e8883405bbb3d03fbc3d76" + branch = "dev" + digest = "1:b20db15de753c9aff7d611058a54142ccf122a1065cdf79cf16f1e21108898b7" name = "github.com/ligato/cn-infra" packages = [ "agent", @@ -507,6 +517,11 @@ "db/keyval/etcd", "db/keyval/kvproto", "db/keyval/redis", + "exec/processmanager", + "exec/processmanager/status", + "exec/processmanager/template", + "exec/processmanager/template/model/process", + "exec/supervisor", "health/probe", "health/statuscheck", "health/statuscheck/model/status", @@ -534,8 +549,7 @@ "utils/safeclose", ] pruneopts = "T" - revision = "ceaf6f4fe9f9fa6aa0629edc20156a969928f0e5" - version = "v2.1.0" + revision = "691b90eac5d48e3d589d7057ce03b1dffdee54fe" [[projects]] branch = "master" @@ -569,6 +583,14 @@ pruneopts = "UT" revision = "3864e76763d94a6df2f9960b16a20a33da9f9a66" +[[projects]] + branch = "master" + digest = "1:d0c95a34e79df79eb96ca870d6b6fc43361d34c9c05495f93a5ad0077f7bbb24" + name = "github.com/mitchellh/go-ps" + packages = ["."] + pruneopts = "UT" + revision = "4fdf99ab29366514c69ccccddab5dc58b8d84062" + [[projects]] branch = "master" digest = "1:5ab79470a1d0fb19b041a624415612f8236b3c06070161a910562f2b2d064355" @@ -707,6 +729,14 @@ revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" version = "v0.8.1" +[[projects]] + digest = "1:447ab23604df9681aabfc6e48dbded59cb933b6eb4224e64d9d037318534b1bd" + name = "github.com/pkg/profile" + packages = ["."] + pruneopts = "UT" + revision = "f6fe06335df110bcf1ed6d4e852b760bfc15beee" + version = "v1.3.0" + [[projects]] digest = "1:d14a5f4bfecf017cb780bdde1b6483e5deb87e12c332544d2c430eda58734bcb" name = "github.com/prometheus/client_golang" @@ -988,6 +1018,7 @@ "git.fd.io/govpp.git/adapter", "git.fd.io/govpp.git/adapter/mock", "git.fd.io/govpp.git/adapter/socketclient", + "git.fd.io/govpp.git/adapter/statsclient", "git.fd.io/govpp.git/adapter/vppapiclient", "git.fd.io/govpp.git/api", "git.fd.io/govpp.git/cmd/binapi-generator", @@ -1015,6 +1046,7 @@ "github.com/ligato/cn-infra/db/keyval/etcd", "github.com/ligato/cn-infra/db/keyval/kvproto", "github.com/ligato/cn-infra/db/keyval/redis", + "github.com/ligato/cn-infra/exec/supervisor", "github.com/ligato/cn-infra/health/probe", "github.com/ligato/cn-infra/health/statuscheck", "github.com/ligato/cn-infra/health/statuscheck/model/status", @@ -1025,7 +1057,6 @@ "github.com/ligato/cn-infra/logging/logmanager", "github.com/ligato/cn-infra/logging/logrus", "github.com/ligato/cn-infra/logging/measure", - "github.com/ligato/cn-infra/logging/measure/model/apitrace", "github.com/ligato/cn-infra/messaging/kafka", "github.com/ligato/cn-infra/rpc/grpc", "github.com/ligato/cn-infra/rpc/prometheus", @@ -1036,12 +1067,14 @@ "github.com/ligato/cn-infra/utils/safeclose", "github.com/logrusorgru/aurora.git", "github.com/lunixbochs/struc", + "github.com/mitchellh/go-ps", "github.com/namsral/flag", "github.com/onsi/gomega", "github.com/opencontainers/runc", "github.com/pkg/errors", + "github.com/pkg/profile", "github.com/prometheus/client_golang/prometheus", - "github.com/prometheus/client_golang/prometheus/promhttp", + "github.com/sirupsen/logrus", "github.com/spf13/cobra", "github.com/unrolled/render", "github.com/vishvananda/netlink", diff --git a/Gopkg.toml b/Gopkg.toml index b094b280c1..02405c3862 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -12,8 +12,8 @@ required = [ # Constraints [[constraint]] + branch = "dev" name = "github.com/ligato/cn-infra" - version = "2.1.0" [[constraint]] branch = "master" diff --git a/Makefile b/Makefile index 4d0101edf5..97c671a4e7 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,23 @@ -include vpp.env - VERSION ?= $(shell git describe --always --tags --dirty) COMMIT ?= $(shell git rev-parse HEAD) DATE ?= $(shell git log -1 --format="%ct" | xargs -I{} date -d @{} +'%Y-%m-%dT%H:%M%:z') +ARCH ?= $(shell uname -m) CNINFRA := github.com/ligato/vpp-agent/vendor/github.com/ligato/cn-infra/agent LDFLAGS = -X $(CNINFRA).BuildVersion=$(VERSION) -X $(CNINFRA).CommitHash=$(COMMIT) -X $(CNINFRA).BuildDate=$(DATE) +include vpp.env + +ifeq ($(VPP_VERSION),) +VPP_VERSION = $(VPP_DEFAULT) +endif +VPP_IMG:=$(value VPP_IMG_$(VPP_VERSION)) +ifeq (${ARCH}, aarch64) +VPP_IMG:=$(subst vpp-base,vpp-base-arm64,$(VPP_IMG)) +endif +VPP_BINAPI?=$(value VPP_BINAPI_$(VPP_VERSION)) +SKIP_CHECK?= + ifeq ($(NOSTRIP),) LDFLAGS += -w -s endif @@ -22,39 +33,32 @@ endif COVER_DIR ?= /tmp -# Build all build: cmd examples -# Clean all clean: clean-cmd clean-examples -# Install commands agent: @echo "=> installing agent ${VERSION}" @go install -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} ./cmd/vpp-agent -# Install commands install: - @echo "=> installing commands ${VERSION}" + @echo "=> installing ${VERSION}" go install -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} ./cmd/vpp-agent - go install -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} ./cmd/vpp-agent-ctl + go install -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} ./cmd/vpp-agent-init go install -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} ./cmd/agentctl -# Build commands cmd: - @echo "=> building commands ${VERSION}" - cd cmd/vpp-agent && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} - cd cmd/vpp-agent-ctl && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} - cd cmd/agentctl && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} + @echo "=> building ${VERSION}" + cd cmd/vpp-agent && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} + cd cmd/vpp-agent-init && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} + cd cmd/agentctl && go build -ldflags "${LDFLAGS}" -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} -# Clean commands clean-cmd: @echo "=> cleaning command binaries" rm -f ./cmd/vpp-agent/vpp-agent - rm -f ./cmd/vpp-agent-ctl/vpp-agent-ctl + rm -f ./cmd/vpp-agent/vpp-agent-init rm -f ./cmd/agentctl/agentctl -# Build examples examples: @echo "=> building examples" cd examples/custom_model && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} @@ -66,13 +70,14 @@ examples: cd examples/kvscheduler/l2 && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/kvscheduler/acl && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/kvscheduler/nat && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} + cd examples/kvscheduler/rxplacement && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/kvscheduler/vpp-l3 && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} + cd examples/kvscheduler/vrf && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/localclient_linux/tap && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/localclient_linux/veth && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/localclient_vpp/nat && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} cd examples/localclient_vpp/plugins && go build -tags="${GO_BUILD_TAGS}" ${GO_BUILD_ARGS} -# Clean examples clean-examples: @echo "=> cleaning examples" cd examples/custom_model && go clean @@ -90,12 +95,17 @@ clean-examples: cd examples/localclient_vpp/nat && go clean cd examples/localclient_vpp/plugins && go clean -# Run tests +debug-remote: + cd ./cmd/vpp-agent && dlv debug --headless --listen=:2345 --api-version=2 --accept-multiclient + +# ------------------------------- +# Testing +# ------------------------------- + test: @echo "=> running unit tests" go test -tags="${GO_BUILD_TAGS}" ./... -# Run coverage report test-cover: @echo "=> running unit tests with coverage" go test -tags="${GO_BUILD_TAGS}" -covermode=count -coverprofile=${COVER_DIR}/coverage.out ./... @@ -109,29 +119,44 @@ test-cover-xml: test-cover gocov convert ${COVER_DIR}/coverage.out | gocov-xml > ${COVER_DIR}/coverage.xml @echo "=> coverage report generated into ${COVER_DIR}/coverage.xml" -# Code generation +perf: + @echo "=> running perf test" + ./tests/perf/perf_test.sh grpc-perf 1000 + +perf-all: + @echo "=> running all perf tests" + ./tests/perf/run_all.sh + +integration-tests: + @echo "=> running integration tests" + VPP_IMG=$(VPP_IMG) ./tests/integration/vpp_integration.sh + +# ------------------------------- +# Code generation +# ------------------------------- + generate: generate-proto generate-binapi generate-desc-adapters -# Get generator tools get-proto-generators: @go install ./vendor/github.com/gogo/protobuf/protoc-gen-gogo -# Generate proto models generate-proto: get-proto-generators @echo "=> generating proto" ./scripts/genprotos.sh -# Get generator tools get-binapi-generators: @go install ./vendor/git.fd.io/govpp.git/cmd/binapi-generator -# Generate binary api generate-binapi: get-binapi-generators @echo "=> generating binapi" - cd plugins/vpp/binapi && go generate ./... - @echo "=> applying fix patches" - find plugins/vpp/binapi -maxdepth 2 -type f -name '*.patch' -exec patch --no-backup-if-mismatch -p1 -i {} \; - @echo + VPP_BINAPI=$(VPP_BINAPI) ./scripts/genbinapi.sh + +verify-binapi: + @echo "=> verifying binary api" + docker build -f docker/dev/Dockerfile \ + --build-arg VPP_IMG=${VPP_IMG} \ + --build-arg VPP_BINAPI=${VPP_BINAPI} \ + --target verify-binapi . get-desc-adapter-generator: @go install ./plugins/kvscheduler/descriptor-adapter @@ -153,13 +178,6 @@ generate-desc-adapters: get-desc-adapter-generator cd plugins/vpp/srplugin && go generate @echo -verify-binapi: - @echo "=> verifying binary api" - docker build -f docker/dev/Dockerfile \ - --build-arg VPP_REPO_URL=${VPP_REPO_URL} \ - --build-arg VPP_COMMIT=${VPP_COMMIT} \ - --target verify-stage . - get-bindata: go get -v github.com/jteeuwen/go-bindata/... go get -v github.com/elazarl/go-bindata-assetfs/... @@ -167,29 +185,32 @@ get-bindata: bindata: get-bindata cd plugins/restplugin && go generate -# Get dependency manager tool +# ------------------------------- +# Dependencies +# ------------------------------- + get-dep: - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + curl -sSfL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh dep version -# Install the project's dependencies dep-install: get-dep @echo "=> installing project's dependencies" dep ensure -v -# Update the locked versions of all dependencies dep-update: get-dep @echo "=> updating all dependencies" dep ensure -update -# Check state of dependencies dep-check: get-dep @echo "=> checking dependencies" dep check +# ------------------------------- +# Linters +# ------------------------------- + LINTER := $(shell command -v gometalinter 2> /dev/null) -# Get linter tools get-linters: ifndef LINTER @echo "=> installing linters" @@ -197,67 +218,65 @@ ifndef LINTER gometalinter --install endif -# Run linters lint: get-linters @echo "=> running code analysis" ./scripts/static_analysis.sh golint vet -# Format code format: @echo "=> formatting the code" ./scripts/gofmt.sh MDLINKCHECK := $(shell command -v markdown-link-check 2> /dev/null) -# Get link check tool get-linkcheck: ifndef MDLINKCHECK sudo apt-get update && sudo apt-get install -y npm npm install -g markdown-link-check@3.6.2 endif -# Validate links in markdown files check-links: get-linkcheck ./scripts/check_links.sh -# Travis -travis: - @echo "=> TRAVIS: $$TRAVIS_BUILD_STAGE_NAME" - @echo "Build: #$$TRAVIS_BUILD_NUMBER ($$TRAVIS_BUILD_ID)" - @echo "Job: #$$TRAVIS_JOB_NUMBER ($$TRAVIS_JOB_ID)" - @echo "AllowFailure: $$TRAVIS_ALLOW_FAILURE TestResult: $$TRAVIS_TEST_RESULT" - @echo "Type: $$TRAVIS_EVENT_TYPE PullRequest: $$TRAVIS_PULL_REQUEST" - @echo "Repo: $$TRAVIS_REPO_SLUG Branch: $$TRAVIS_BRANCH" - @echo "Commit: $$TRAVIS_COMMIT" - @echo "$$TRAVIS_COMMIT_MESSAGE" - @echo "Range: $$TRAVIS_COMMIT_RANGE" - @echo "Files:" - @echo "$$(git diff --name-only $$TRAVIS_COMMIT_RANGE)" - -# Install yamllint get-yamllint: pip install --user yamllint -# Lint the yaml files yamllint: get-yamllint @echo "=> linting the yaml files" yamllint -c .yamllint.yml $(shell git ls-files '*.yaml' '*.yml' | grep -v 'vendor/') +# ------------------------------- +# Images +# ------------------------------- + images: dev-image prod-image dev-image: - ./docker/dev/build.sh + @echo "=> building dev image" + IMAGE_TAG=$(IMAGE_TAG) \ + VPP_IMG=$(VPP_IMG) VPP_BINAPI=$(VPP_BINAPI) \ + VERSION=$(VERSION) COMMIT=$(COMMIT) DATE=$(DATE) \ + ./docker/dev/build.sh prod-image: - ./docker/prod/build.sh + @echo "=> building prod image" + IMAGE_TAG=$(IMAGE_TAG) \ + ./docker/prod/build.sh -perf: - @echo "=> running perf test" - ./tests/perf/grpc-perf/test.sh 1000 +# ------------------------------- + +travis: + @echo "=> TRAVIS: $$TRAVIS_BUILD_STAGE_NAME" + @echo "Build: #$$TRAVIS_BUILD_NUMBER ($$TRAVIS_BUILD_ID)" + @echo "Job: #$$TRAVIS_JOB_NUMBER ($$TRAVIS_JOB_ID)" + @echo "AllowFailure: $$TRAVIS_ALLOW_FAILURE TestResult: $$TRAVIS_TEST_RESULT" + @echo "Type: $$TRAVIS_EVENT_TYPE PullRequest: $$TRAVIS_PULL_REQUEST" + @echo "Repo: $$TRAVIS_REPO_SLUG Branch: $$TRAVIS_BRANCH" + @echo "Commit: $$TRAVIS_COMMIT" + @echo "$$TRAVIS_COMMIT_MESSAGE" + @echo "Range: $$TRAVIS_COMMIT_RANGE" + @echo "Files:" + @echo "$$(git diff --name-only $$TRAVIS_COMMIT_RANGE)" -perf-all: - @echo "=> running all perf tests" - ./tests/perf/run_all.sh .PHONY: build clean \ install cmd examples clean-examples test \ @@ -266,7 +285,7 @@ perf-all: get-dep dep-install dep-update dep-check \ get-linters lint format \ get-linkcheck check-links \ - travis \ get-yamllint yamllint \ images dev-image prod-image \ - perf perf-all + perf perf-all \ + travis diff --git a/README.md b/README.md index b9df7ef645..d2646cf8c7 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ If you are interested in contributing, please see the [contribution guidelines][ [kafka]: docs/arm64/kafka.md [ligato-docs]: http://docs.ligato.io/ [protobufs]: https://developers.google.com/protocol-buffers/ -[vnf]: https://github.com/ligato/cn-infra/blob/master/docs/readmes/cn_virtual_function.md +[vnf]: https://docs.ligato.io/en/latest/intro/glossary/#cnf [vpp]: https://fd.io/technology/#vpp [vpp-agent]: https://hub.docker.com/r/ligato/vpp-agent [vpp-agent-arm64]: https://hub.docker.com/r/ligato/vpp-agent-arm64 diff --git a/api/genericmanager/genericmanager.pb.go b/api/genericmanager/genericmanager.pb.go index e4b4ffdd40..7907d1ae73 100644 --- a/api/genericmanager/genericmanager.pb.go +++ b/api/genericmanager/genericmanager.pb.go @@ -463,6 +463,44 @@ func (m *SetConfigRequest) GetOverwriteAll() bool { return false } +type SetConfigResponse struct { + Results []*UpdateResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetConfigResponse) Reset() { *m = SetConfigResponse{} } +func (m *SetConfigResponse) String() string { return proto.CompactTextString(m) } +func (*SetConfigResponse) ProtoMessage() {} +func (*SetConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_436b82698a12e5e3, []int{8} +} +func (m *SetConfigResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetConfigResponse.Unmarshal(m, b) +} +func (m *SetConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetConfigResponse.Marshal(b, m, deterministic) +} +func (m *SetConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetConfigResponse.Merge(m, src) +} +func (m *SetConfigResponse) XXX_Size() int { + return xxx_messageInfo_SetConfigResponse.Size(m) +} +func (m *SetConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SetConfigResponse proto.InternalMessageInfo + +func (m *SetConfigResponse) GetResults() []*UpdateResult { + if m != nil { + return m.Results + } + return nil +} + type UpdateItem struct { // The item describes item to be updated. // For a delete operation set fields item.Data to nil. @@ -478,7 +516,7 @@ func (m *UpdateItem) Reset() { *m = UpdateItem{} } func (m *UpdateItem) String() string { return proto.CompactTextString(m) } func (*UpdateItem) ProtoMessage() {} func (*UpdateItem) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{8} + return fileDescriptor_436b82698a12e5e3, []int{9} } func (m *UpdateItem) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateItem.Unmarshal(m, b) @@ -512,44 +550,6 @@ func (m *UpdateItem) GetLabels() map[string]string { return nil } -type SetConfigResponse struct { - Results []*UpdateResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetConfigResponse) Reset() { *m = SetConfigResponse{} } -func (m *SetConfigResponse) String() string { return proto.CompactTextString(m) } -func (*SetConfigResponse) ProtoMessage() {} -func (*SetConfigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{9} -} -func (m *SetConfigResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetConfigResponse.Unmarshal(m, b) -} -func (m *SetConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetConfigResponse.Marshal(b, m, deterministic) -} -func (m *SetConfigResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetConfigResponse.Merge(m, src) -} -func (m *SetConfigResponse) XXX_Size() int { - return xxx_messageInfo_SetConfigResponse.Size(m) -} -func (m *SetConfigResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SetConfigResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SetConfigResponse proto.InternalMessageInfo - -func (m *SetConfigResponse) GetResults() []*UpdateResult { - if m != nil { - return m.Results - } - return nil -} - type UpdateResult struct { Id *Item_ID `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` @@ -651,10 +651,10 @@ func (m *GetConfigRequest) GetIds() []*Item_ID { } type GetConfigResponse struct { - Items []*GetConfigResponse_ConfigItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Items []*ConfigItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetConfigResponse) Reset() { *m = GetConfigResponse{} } @@ -681,14 +681,14 @@ func (m *GetConfigResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetConfigResponse proto.InternalMessageInfo -func (m *GetConfigResponse) GetItems() []*GetConfigResponse_ConfigItem { +func (m *GetConfigResponse) GetItems() []*ConfigItem { if m != nil { return m.Items } return nil } -type GetConfigResponse_ConfigItem struct { +type ConfigItem struct { Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` Status *ItemStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` Labels map[string]string `protobuf:"bytes,3,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -697,45 +697,45 @@ type GetConfigResponse_ConfigItem struct { XXX_sizecache int32 `json:"-"` } -func (m *GetConfigResponse_ConfigItem) Reset() { *m = GetConfigResponse_ConfigItem{} } -func (m *GetConfigResponse_ConfigItem) String() string { return proto.CompactTextString(m) } -func (*GetConfigResponse_ConfigItem) ProtoMessage() {} -func (*GetConfigResponse_ConfigItem) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{12, 0} +func (m *ConfigItem) Reset() { *m = ConfigItem{} } +func (m *ConfigItem) String() string { return proto.CompactTextString(m) } +func (*ConfigItem) ProtoMessage() {} +func (*ConfigItem) Descriptor() ([]byte, []int) { + return fileDescriptor_436b82698a12e5e3, []int{13} } -func (m *GetConfigResponse_ConfigItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetConfigResponse_ConfigItem.Unmarshal(m, b) +func (m *ConfigItem) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConfigItem.Unmarshal(m, b) } -func (m *GetConfigResponse_ConfigItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetConfigResponse_ConfigItem.Marshal(b, m, deterministic) +func (m *ConfigItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConfigItem.Marshal(b, m, deterministic) } -func (m *GetConfigResponse_ConfigItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetConfigResponse_ConfigItem.Merge(m, src) +func (m *ConfigItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigItem.Merge(m, src) } -func (m *GetConfigResponse_ConfigItem) XXX_Size() int { - return xxx_messageInfo_GetConfigResponse_ConfigItem.Size(m) +func (m *ConfigItem) XXX_Size() int { + return xxx_messageInfo_ConfigItem.Size(m) } -func (m *GetConfigResponse_ConfigItem) XXX_DiscardUnknown() { - xxx_messageInfo_GetConfigResponse_ConfigItem.DiscardUnknown(m) +func (m *ConfigItem) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigItem.DiscardUnknown(m) } -var xxx_messageInfo_GetConfigResponse_ConfigItem proto.InternalMessageInfo +var xxx_messageInfo_ConfigItem proto.InternalMessageInfo -func (m *GetConfigResponse_ConfigItem) GetItem() *Item { +func (m *ConfigItem) GetItem() *Item { if m != nil { return m.Item } return nil } -func (m *GetConfigResponse_ConfigItem) GetStatus() *ItemStatus { +func (m *ConfigItem) GetStatus() *ItemStatus { if m != nil { return m.Status } return nil } -func (m *GetConfigResponse_ConfigItem) GetLabels() map[string]string { +func (m *ConfigItem) GetLabels() map[string]string { if m != nil { return m.Labels } @@ -743,17 +743,17 @@ func (m *GetConfigResponse_ConfigItem) GetLabels() map[string]string { } type DumpStateRequest struct { - Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Ids []*Item_ID `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DumpStateRequest) Reset() { *m = DumpStateRequest{} } func (m *DumpStateRequest) String() string { return proto.CompactTextString(m) } func (*DumpStateRequest) ProtoMessage() {} func (*DumpStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{13} + return fileDescriptor_436b82698a12e5e3, []int{14} } func (m *DumpStateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DumpStateRequest.Unmarshal(m, b) @@ -773,25 +773,25 @@ func (m *DumpStateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DumpStateRequest proto.InternalMessageInfo -func (m *DumpStateRequest) GetKeys() []string { +func (m *DumpStateRequest) GetIds() []*Item_ID { if m != nil { - return m.Keys + return m.Ids } return nil } type DumpStateResponse struct { - States []*DumpStateResponse_StateItem `protobuf:"bytes,1,rep,name=states,proto3" json:"states,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Items []*StateItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DumpStateResponse) Reset() { *m = DumpStateResponse{} } func (m *DumpStateResponse) String() string { return proto.CompactTextString(m) } func (*DumpStateResponse) ProtoMessage() {} func (*DumpStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{14} + return fileDescriptor_436b82698a12e5e3, []int{15} } func (m *DumpStateResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DumpStateResponse.Unmarshal(m, b) @@ -811,14 +811,14 @@ func (m *DumpStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DumpStateResponse proto.InternalMessageInfo -func (m *DumpStateResponse) GetStates() []*DumpStateResponse_StateItem { +func (m *DumpStateResponse) GetItems() []*StateItem { if m != nil { - return m.States + return m.Items } return nil } -type DumpStateResponse_StateItem struct { +type StateItem struct { Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -826,38 +826,38 @@ type DumpStateResponse_StateItem struct { XXX_sizecache int32 `json:"-"` } -func (m *DumpStateResponse_StateItem) Reset() { *m = DumpStateResponse_StateItem{} } -func (m *DumpStateResponse_StateItem) String() string { return proto.CompactTextString(m) } -func (*DumpStateResponse_StateItem) ProtoMessage() {} -func (*DumpStateResponse_StateItem) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{14, 0} +func (m *StateItem) Reset() { *m = StateItem{} } +func (m *StateItem) String() string { return proto.CompactTextString(m) } +func (*StateItem) ProtoMessage() {} +func (*StateItem) Descriptor() ([]byte, []int) { + return fileDescriptor_436b82698a12e5e3, []int{16} } -func (m *DumpStateResponse_StateItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DumpStateResponse_StateItem.Unmarshal(m, b) +func (m *StateItem) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StateItem.Unmarshal(m, b) } -func (m *DumpStateResponse_StateItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DumpStateResponse_StateItem.Marshal(b, m, deterministic) +func (m *StateItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StateItem.Marshal(b, m, deterministic) } -func (m *DumpStateResponse_StateItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpStateResponse_StateItem.Merge(m, src) +func (m *StateItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateItem.Merge(m, src) } -func (m *DumpStateResponse_StateItem) XXX_Size() int { - return xxx_messageInfo_DumpStateResponse_StateItem.Size(m) +func (m *StateItem) XXX_Size() int { + return xxx_messageInfo_StateItem.Size(m) } -func (m *DumpStateResponse_StateItem) XXX_DiscardUnknown() { - xxx_messageInfo_DumpStateResponse_StateItem.DiscardUnknown(m) +func (m *StateItem) XXX_DiscardUnknown() { + xxx_messageInfo_StateItem.DiscardUnknown(m) } -var xxx_messageInfo_DumpStateResponse_StateItem proto.InternalMessageInfo +var xxx_messageInfo_StateItem proto.InternalMessageInfo -func (m *DumpStateResponse_StateItem) GetItem() *Item { +func (m *StateItem) GetItem() *Item { if m != nil { return m.Item } return nil } -func (m *DumpStateResponse_StateItem) GetMetadata() map[string]string { +func (m *StateItem) GetMetadata() map[string]string { if m != nil { return m.Metadata } @@ -875,7 +875,7 @@ func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} } func (m *SubscribeRequest) String() string { return proto.CompactTextString(m) } func (*SubscribeRequest) ProtoMessage() {} func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{15} + return fileDescriptor_436b82698a12e5e3, []int{17} } func (m *SubscribeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SubscribeRequest.Unmarshal(m, b) @@ -913,7 +913,7 @@ func (m *SubscribeResponse) Reset() { *m = SubscribeResponse{} } func (m *SubscribeResponse) String() string { return proto.CompactTextString(m) } func (*SubscribeResponse) ProtoMessage() {} func (*SubscribeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{16} + return fileDescriptor_436b82698a12e5e3, []int{18} } func (m *SubscribeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SubscribeResponse.Unmarshal(m, b) @@ -951,7 +951,7 @@ func (m *Subscription) Reset() { *m = Subscription{} } func (m *Subscription) String() string { return proto.CompactTextString(m) } func (*Subscription) ProtoMessage() {} func (*Subscription) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{17} + return fileDescriptor_436b82698a12e5e3, []int{19} } func (m *Subscription) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Subscription.Unmarshal(m, b) @@ -990,7 +990,7 @@ func (m *Notification) Reset() { *m = Notification{} } func (m *Notification) String() string { return proto.CompactTextString(m) } func (*Notification) ProtoMessage() {} func (*Notification) Descriptor() ([]byte, []int) { - return fileDescriptor_436b82698a12e5e3, []int{18} + return fileDescriptor_436b82698a12e5e3, []int{20} } func (m *Notification) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Notification.Unmarshal(m, b) @@ -1036,18 +1036,18 @@ func init() { proto.RegisterType((*ModelInfo)(nil), "genericmanager.ModelInfo") proto.RegisterMapType((map[string]string)(nil), "genericmanager.ModelInfo.InfoEntry") proto.RegisterType((*SetConfigRequest)(nil), "genericmanager.SetConfigRequest") + proto.RegisterType((*SetConfigResponse)(nil), "genericmanager.SetConfigResponse") proto.RegisterType((*UpdateItem)(nil), "genericmanager.UpdateItem") proto.RegisterMapType((map[string]string)(nil), "genericmanager.UpdateItem.LabelsEntry") - proto.RegisterType((*SetConfigResponse)(nil), "genericmanager.SetConfigResponse") proto.RegisterType((*UpdateResult)(nil), "genericmanager.UpdateResult") proto.RegisterType((*GetConfigRequest)(nil), "genericmanager.GetConfigRequest") proto.RegisterType((*GetConfigResponse)(nil), "genericmanager.GetConfigResponse") - proto.RegisterType((*GetConfigResponse_ConfigItem)(nil), "genericmanager.GetConfigResponse.ConfigItem") - proto.RegisterMapType((map[string]string)(nil), "genericmanager.GetConfigResponse.ConfigItem.LabelsEntry") + proto.RegisterType((*ConfigItem)(nil), "genericmanager.ConfigItem") + proto.RegisterMapType((map[string]string)(nil), "genericmanager.ConfigItem.LabelsEntry") proto.RegisterType((*DumpStateRequest)(nil), "genericmanager.DumpStateRequest") proto.RegisterType((*DumpStateResponse)(nil), "genericmanager.DumpStateResponse") - proto.RegisterType((*DumpStateResponse_StateItem)(nil), "genericmanager.DumpStateResponse.StateItem") - proto.RegisterMapType((map[string]string)(nil), "genericmanager.DumpStateResponse.StateItem.MetadataEntry") + proto.RegisterType((*StateItem)(nil), "genericmanager.StateItem") + proto.RegisterMapType((map[string]string)(nil), "genericmanager.StateItem.MetadataEntry") proto.RegisterType((*SubscribeRequest)(nil), "genericmanager.SubscribeRequest") proto.RegisterType((*SubscribeResponse)(nil), "genericmanager.SubscribeResponse") proto.RegisterType((*Subscription)(nil), "genericmanager.Subscription") @@ -1059,70 +1059,68 @@ func init() { } var fileDescriptor_436b82698a12e5e3 = []byte{ - // 997 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0x76, 0xda, 0x6e, 0x5e, 0xd2, 0x92, 0x0e, 0x5d, 0xe8, 0x5a, 0x1c, 0x8a, 0x0b, 0xa5, - 0x68, 0xc1, 0x59, 0x05, 0xb4, 0xdd, 0xe5, 0xcf, 0x8a, 0xb6, 0x09, 0x51, 0xc4, 0x76, 0xa9, 0x26, - 0x5b, 0x10, 0x5c, 0xaa, 0x49, 0x32, 0x09, 0xa3, 0xfa, 0x1f, 0xf6, 0x38, 0xab, 0x88, 0x2f, 0xc3, - 0x81, 0x13, 0x37, 0x0e, 0x7c, 0x08, 0x8e, 0x7c, 0x9a, 0xbd, 0xa2, 0x99, 0xb1, 0x1d, 0xc7, 0x4e, - 0xba, 0x1b, 0x09, 0x2e, 0xd6, 0xbc, 0x37, 0xbf, 0xf7, 0x7b, 0x6f, 0x7e, 0xf3, 0x9e, 0x6d, 0x38, - 0x9c, 0x50, 0x8f, 0x86, 0x6c, 0xe8, 0x12, 0x8f, 0x4c, 0x68, 0xd8, 0x5c, 0x34, 0xed, 0x20, 0xf4, - 0xb9, 0x8f, 0x76, 0x16, 0xbd, 0xe6, 0xbd, 0x89, 0xef, 0x4f, 0x1c, 0xda, 0x94, 0xbb, 0x83, 0x78, - 0xdc, 0x24, 0xde, 0x4c, 0x41, 0xad, 0x0b, 0xd8, 0xb8, 0xf0, 0x47, 0xd4, 0x41, 0x6f, 0xc3, 0xa6, - 0xeb, 0x8f, 0x62, 0x87, 0xee, 0x6b, 0x07, 0xda, 0x71, 0x15, 0x27, 0x16, 0xda, 0x87, 0xad, 0x29, - 0x0d, 0x23, 0xe6, 0x7b, 0xfb, 0xba, 0xdc, 0x48, 0x4d, 0x84, 0xa0, 0xc2, 0x67, 0x01, 0xdd, 0x37, - 0xa4, 0x5b, 0xae, 0xad, 0xdf, 0x34, 0xa8, 0xf4, 0x38, 0x75, 0xd1, 0x87, 0xa0, 0xb3, 0x91, 0xa4, - 0xaa, 0xb5, 0xde, 0xb1, 0x0b, 0x55, 0x0a, 0x84, 0xdd, 0x6b, 0x63, 0x9d, 0x8d, 0xd0, 0x31, 0x54, - 0x46, 0x84, 0x13, 0x49, 0x5e, 0x6b, 0xed, 0x15, 0xa1, 0x6d, 0xc2, 0x09, 0x96, 0x08, 0xb3, 0x03, - 0x7a, 0xaf, 0x8d, 0xee, 0xc3, 0x86, 0x2b, 0x0a, 0x4e, 0xb8, 0xef, 0x16, 0x03, 0xe4, 0x69, 0xb0, - 0xc2, 0x88, 0x12, 0x3d, 0xe2, 0xd2, 0xa4, 0x72, 0xb9, 0xb6, 0x6c, 0xa8, 0x08, 0x52, 0x74, 0x04, - 0x06, 0xf1, 0x66, 0x09, 0xcd, 0x9e, 0xad, 0x24, 0xb2, 0x53, 0x89, 0xec, 0x53, 0x6f, 0x86, 0x05, - 0xc0, 0x7a, 0x02, 0x20, 0xea, 0xed, 0x73, 0xc2, 0xe3, 0x48, 0xc8, 0x14, 0xc9, 0x55, 0x2a, 0x93, - 0xb2, 0x84, 0x4c, 0x2e, 0x8d, 0x22, 0x32, 0x49, 0x93, 0xa5, 0xa6, 0x75, 0x17, 0xde, 0x3a, 0x27, - 0x01, 0x19, 0x30, 0x87, 0x71, 0x46, 0x23, 0x4c, 0x7f, 0x89, 0x69, 0xc4, 0xad, 0x5f, 0x61, 0x6f, - 0xd1, 0x1d, 0x05, 0xbe, 0x17, 0x51, 0xf4, 0x25, 0xd4, 0x6f, 0x3c, 0xff, 0x85, 0x77, 0x2d, 0x4f, - 0x20, 0xd2, 0x18, 0xc7, 0xb5, 0xd6, 0xbd, 0xa5, 0xc7, 0xec, 0x79, 0x63, 0x1f, 0xd7, 0x24, 0x5c, - 0xda, 0x11, 0xfa, 0x00, 0x76, 0xc8, 0x90, 0xb3, 0x29, 0xbd, 0x56, 0xd7, 0x17, 0xed, 0xeb, 0x07, - 0xc6, 0x71, 0x15, 0x6f, 0x2b, 0xef, 0x85, 0x72, 0x5a, 0x7f, 0x68, 0x50, 0xcd, 0x18, 0xd6, 0x93, - 0xf4, 0x04, 0x2a, 0xcc, 0x1b, 0xfb, 0x92, 0xb7, 0xd6, 0x3a, 0x5c, 0x59, 0x97, 0x2d, 0x1e, 0x1d, - 0x8f, 0x87, 0x33, 0x2c, 0x03, 0xcc, 0x13, 0xa8, 0x66, 0x2e, 0xd4, 0x00, 0xe3, 0x86, 0xce, 0x12, - 0x0d, 0xc5, 0x12, 0xed, 0xc1, 0xc6, 0x94, 0x38, 0x71, 0x2a, 0x9f, 0x32, 0x3e, 0xd7, 0x1f, 0x69, - 0x96, 0x0b, 0x8d, 0x3e, 0xe5, 0xe7, 0xbe, 0x37, 0x66, 0x93, 0x44, 0x3d, 0xf4, 0x19, 0x6c, 0xc5, - 0xc1, 0x88, 0x70, 0x9a, 0x0a, 0x64, 0x16, 0x0b, 0xb9, 0x92, 0xdb, 0xe2, 0xe6, 0x70, 0x0a, 0x45, - 0x87, 0xb0, 0xed, 0x4f, 0x69, 0xf8, 0x22, 0x64, 0x9c, 0x5e, 0x13, 0xc7, 0x91, 0xb9, 0xee, 0xe0, - 0x7a, 0xe6, 0x3c, 0x75, 0x1c, 0xeb, 0x4f, 0x0d, 0x60, 0x1e, 0x2c, 0xfa, 0x93, 0x71, 0xea, 0xce, - 0xfb, 0xa4, 0xdc, 0xca, 0x58, 0x22, 0xd0, 0x13, 0xd8, 0x74, 0xc8, 0x40, 0xdc, 0x99, 0xd2, 0xe6, - 0x68, 0x75, 0x49, 0xf6, 0x53, 0x09, 0x54, 0xf2, 0x24, 0x51, 0xe6, 0x63, 0xa8, 0xe5, 0xdc, 0x6b, - 0x49, 0xf4, 0x2d, 0xec, 0xe6, 0x24, 0x4a, 0x3a, 0xe9, 0x21, 0x6c, 0x85, 0x34, 0x8a, 0x1d, 0x9e, - 0x6a, 0xf4, 0xee, 0xf2, 0x82, 0xb0, 0x04, 0xe1, 0x14, 0x6c, 0xbd, 0xd4, 0xa0, 0x9e, 0xdf, 0x49, - 0x66, 0xb9, 0xf2, 0xea, 0x59, 0x2e, 0x97, 0xfc, 0x10, 0x74, 0x3f, 0x90, 0xf5, 0xee, 0xac, 0xd2, - 0x43, 0x25, 0xb1, 0xbf, 0x0b, 0x68, 0x48, 0x38, 0xf3, 0x3d, 0xac, 0xfb, 0x01, 0x6a, 0x65, 0x63, - 0x66, 0xc8, 0xb4, 0xe6, 0xb2, 0xb4, 0x6a, 0x24, 0xd3, 0x11, 0xb4, 0xbe, 0x86, 0x6a, 0x46, 0x82, - 0xde, 0x84, 0xda, 0xd5, 0xb3, 0xfe, 0x65, 0xe7, 0xbc, 0xf7, 0x4d, 0xaf, 0xd3, 0x6e, 0xbc, 0x81, - 0x00, 0x36, 0xcf, 0x71, 0xe7, 0xf4, 0x79, 0xa7, 0xa1, 0x89, 0xf5, 0xd5, 0x65, 0x5b, 0xac, 0x75, - 0xb1, 0x6e, 0x77, 0x9e, 0x76, 0x9e, 0x77, 0x1a, 0x86, 0xf5, 0x15, 0x34, 0xba, 0xc5, 0x4e, 0xfb, - 0x08, 0x0c, 0x36, 0x4a, 0x15, 0x5c, 0x79, 0x7a, 0x81, 0xb1, 0xfe, 0xd1, 0x61, 0xb7, 0x5b, 0xba, - 0x86, 0x33, 0xd8, 0x10, 0xed, 0x91, 0x52, 0x7c, 0x5c, 0xa4, 0x28, 0x45, 0xd8, 0xca, 0x94, 0x9d, - 0xa5, 0x42, 0xcd, 0x97, 0x1a, 0xc0, 0xdc, 0xbb, 0x46, 0x4f, 0xce, 0x75, 0xd4, 0x5f, 0x57, 0x47, - 0x74, 0x99, 0xf5, 0xb1, 0x21, 0x2b, 0x7e, 0xb4, 0x4e, 0xc5, 0xff, 0x75, 0x67, 0x1f, 0x41, 0xa3, - 0x1d, 0xbb, 0x81, 0x28, 0x91, 0xa6, 0x57, 0x82, 0xa0, 0x72, 0x43, 0x67, 0x4a, 0xd0, 0x2a, 0x96, - 0x6b, 0xeb, 0x77, 0x1d, 0x76, 0x73, 0xc0, 0x44, 0xfb, 0x73, 0x75, 0xfc, 0xec, 0x2d, 0x71, 0xbf, - 0xf4, 0x79, 0x29, 0x86, 0xd8, 0xd2, 0x92, 0x0a, 0x26, 0xa1, 0xe6, 0xdf, 0x1a, 0x54, 0x33, 0xef, - 0x1a, 0xda, 0x5f, 0xc1, 0x1d, 0x97, 0x72, 0x92, 0x7c, 0xdd, 0x44, 0xfa, 0xc7, 0x6b, 0xa4, 0xb7, - 0x2f, 0x92, 0x58, 0x25, 0x65, 0x46, 0x65, 0x7e, 0x01, 0xdb, 0x0b, 0x5b, 0x6b, 0xc9, 0xf9, 0x3d, - 0x34, 0xfa, 0xf1, 0x20, 0x1a, 0x86, 0x6c, 0x90, 0xc9, 0x79, 0x06, 0xdb, 0x91, 0xf2, 0x05, 0x62, - 0x74, 0x56, 0xbe, 0x2d, 0xfa, 0x39, 0x10, 0x5e, 0x0c, 0xb1, 0x7e, 0x80, 0xdd, 0x1c, 0x6f, 0xd6, - 0xf9, 0xdb, 0x9e, 0xcf, 0xd9, 0x98, 0x0d, 0xc9, 0xad, 0xc4, 0xcf, 0x72, 0x20, 0xbc, 0x18, 0x62, - 0x9d, 0x40, 0x3d, 0x9f, 0xf7, 0xb5, 0xff, 0x2b, 0x2c, 0x07, 0xea, 0x79, 0xde, 0xff, 0x77, 0x66, - 0x5a, 0x7f, 0x19, 0xb0, 0xd3, 0x55, 0xa8, 0x0b, 0x85, 0x42, 0x3f, 0x42, 0x3d, 0xff, 0x81, 0x47, - 0xa5, 0x4f, 0xe5, 0x92, 0xbf, 0x02, 0xf3, 0xfd, 0xdb, 0x41, 0x89, 0xb0, 0x97, 0x50, 0xcd, 0x5e, - 0xf7, 0xe8, 0xa0, 0x74, 0x4f, 0x85, 0x57, 0x98, 0xf9, 0xde, 0x2d, 0x88, 0x39, 0x63, 0x77, 0x35, - 0x63, 0xf7, 0x95, 0x8c, 0xdd, 0x65, 0x8c, 0x59, 0x77, 0x97, 0x19, 0x8b, 0x33, 0x5d, 0x66, 0x2c, - 0x0f, 0x33, 0x86, 0x6a, 0xd6, 0x63, 0x4b, 0x4e, 0x5d, 0x68, 0xeb, 0x25, 0xa7, 0x2e, 0x36, 0xe8, - 0x03, 0xed, 0xec, 0xc1, 0x4f, 0xf6, 0x84, 0xf1, 0x9f, 0xe3, 0x81, 0x3d, 0xf4, 0xdd, 0xa6, 0xc3, - 0x26, 0x84, 0xfb, 0xcd, 0x69, 0x10, 0x7c, 0x42, 0x26, 0xd4, 0xe3, 0x4d, 0x12, 0xb0, 0xc2, 0x1f, - 0xf6, 0x60, 0x53, 0xfe, 0x21, 0x7e, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xd0, 0xb5, - 0xd4, 0x89, 0x0b, 0x00, 0x00, + // 968 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5f, 0x6f, 0xe3, 0x44, + 0x10, 0xc7, 0x76, 0xda, 0x5e, 0x26, 0x69, 0x49, 0x97, 0x1e, 0xe4, 0x22, 0x1e, 0x8a, 0x0b, 0x77, + 0x45, 0x08, 0xa7, 0x0a, 0xe8, 0xca, 0xbf, 0x3b, 0xd1, 0x26, 0x26, 0x8a, 0xb8, 0x1c, 0xd5, 0xe6, + 0x0a, 0x82, 0x97, 0x6a, 0x93, 0x6c, 0xc2, 0xea, 0x6c, 0xaf, 0xb1, 0xd7, 0x39, 0x45, 0x7c, 0x19, + 0x9e, 0x79, 0xe3, 0x01, 0xf1, 0x89, 0xf8, 0x0c, 0xbc, 0xa2, 0x5d, 0xff, 0x89, 0xe3, 0x24, 0xbd, + 0x0b, 0xe2, 0x5e, 0xa2, 0xdd, 0xd9, 0xdf, 0xfe, 0x66, 0xe6, 0x37, 0x33, 0x59, 0xc3, 0xc9, 0x94, + 0x7a, 0x34, 0x60, 0x23, 0x97, 0x78, 0x64, 0x4a, 0x83, 0xe6, 0xf2, 0xd6, 0xf2, 0x03, 0x2e, 0x38, + 0x3a, 0x58, 0xb6, 0x36, 0xee, 0x4d, 0x39, 0x9f, 0x3a, 0xb4, 0xa9, 0x4e, 0x87, 0xd1, 0xa4, 0x49, + 0xbc, 0x79, 0x0c, 0x35, 0xfb, 0xb0, 0xd3, 0xe7, 0x63, 0xea, 0xa0, 0xb7, 0x61, 0xd7, 0xe5, 0xe3, + 0xc8, 0xa1, 0x75, 0xed, 0x58, 0x3b, 0x2d, 0xe3, 0x64, 0x87, 0xea, 0xb0, 0x37, 0xa3, 0x41, 0xc8, + 0xb8, 0x57, 0xd7, 0xd5, 0x41, 0xba, 0x45, 0x08, 0x4a, 0x62, 0xee, 0xd3, 0xba, 0xa1, 0xcc, 0x6a, + 0x6d, 0xfe, 0xa6, 0x41, 0xa9, 0x27, 0xa8, 0x8b, 0x1e, 0x80, 0xce, 0xc6, 0x8a, 0xaa, 0xd2, 0x7a, + 0xc7, 0x2a, 0x44, 0x29, 0x11, 0x56, 0xaf, 0x83, 0x75, 0x36, 0x46, 0xa7, 0x50, 0x1a, 0x13, 0x41, + 0x14, 0x79, 0xa5, 0x75, 0x54, 0x84, 0x76, 0x88, 0x20, 0x58, 0x21, 0x1a, 0x36, 0xe8, 0xbd, 0x0e, + 0xfa, 0x08, 0x76, 0x5c, 0x19, 0x70, 0xc2, 0x7d, 0xb7, 0x78, 0x41, 0x65, 0x83, 0x63, 0x8c, 0x0c, + 0xd1, 0x23, 0x2e, 0x4d, 0x22, 0x57, 0x6b, 0xd3, 0x82, 0x92, 0x24, 0x45, 0xf7, 0xc1, 0x20, 0xde, + 0x3c, 0xa1, 0x39, 0xb2, 0x62, 0x89, 0xac, 0x54, 0x22, 0xeb, 0xc2, 0x9b, 0x63, 0x09, 0x30, 0x1f, + 0x03, 0xc8, 0x78, 0x07, 0x82, 0x88, 0x28, 0x94, 0x32, 0x85, 0x6a, 0x95, 0xca, 0x14, 0xef, 0xa4, + 0x4c, 0x2e, 0x0d, 0x43, 0x32, 0x4d, 0x9d, 0xa5, 0x5b, 0xf3, 0x2e, 0xbc, 0xd5, 0x26, 0x3e, 0x19, + 0x32, 0x87, 0x09, 0x46, 0x43, 0x4c, 0x7f, 0x89, 0x68, 0x28, 0xcc, 0x5f, 0xe1, 0x68, 0xd9, 0x1c, + 0xfa, 0xdc, 0x0b, 0x29, 0xfa, 0x0a, 0xaa, 0xcf, 0x3d, 0xfe, 0xc2, 0xbb, 0x51, 0x19, 0x48, 0x37, + 0xc6, 0x69, 0xa5, 0x75, 0x6f, 0x6d, 0x9a, 0x3d, 0x6f, 0xc2, 0x71, 0x45, 0xc1, 0xd5, 0x3e, 0x44, + 0x1f, 0xc0, 0x01, 0x19, 0x09, 0x36, 0xa3, 0x37, 0x71, 0xf9, 0xc2, 0xba, 0x7e, 0x6c, 0x9c, 0x96, + 0xf1, 0x7e, 0x6c, 0xed, 0xc7, 0x46, 0xf3, 0x77, 0x0d, 0xca, 0x19, 0xc3, 0x76, 0x92, 0x9e, 0x43, + 0x89, 0x79, 0x13, 0xae, 0x78, 0x2b, 0xad, 0x93, 0x8d, 0x71, 0x59, 0xf2, 0xc7, 0xf6, 0x44, 0x30, + 0xc7, 0xea, 0x42, 0xe3, 0x1c, 0xca, 0x99, 0x09, 0xd5, 0xc0, 0x78, 0x4e, 0xe7, 0x89, 0x86, 0x72, + 0x89, 0x8e, 0x60, 0x67, 0x46, 0x9c, 0x28, 0x95, 0x2f, 0xde, 0x7c, 0xa1, 0x7f, 0xa6, 0x99, 0x2e, + 0xd4, 0x06, 0x54, 0xb4, 0xb9, 0x37, 0x61, 0xd3, 0x44, 0x3d, 0xf4, 0x29, 0xec, 0x45, 0xfe, 0x98, + 0x08, 0x9a, 0x0a, 0xd4, 0x28, 0x06, 0x72, 0xad, 0x8e, 0x65, 0xe5, 0x70, 0x0a, 0x45, 0x27, 0xb0, + 0xcf, 0x67, 0x34, 0x78, 0x11, 0x30, 0x41, 0x6f, 0x88, 0xe3, 0x28, 0x5f, 0x77, 0x70, 0x35, 0x33, + 0x5e, 0x38, 0x8e, 0xf9, 0x2d, 0x1c, 0xe6, 0xdc, 0x25, 0x55, 0x79, 0x08, 0x7b, 0x01, 0x0d, 0x23, + 0x47, 0xa4, 0xfe, 0xde, 0x5d, 0xef, 0x0f, 0x2b, 0x10, 0x4e, 0xc1, 0xe6, 0x1f, 0x1a, 0xc0, 0x22, + 0x12, 0xd9, 0xec, 0x4c, 0x50, 0x77, 0xd1, 0x74, 0xab, 0x73, 0x81, 0x15, 0x02, 0x3d, 0x86, 0x5d, + 0x87, 0x0c, 0x65, 0x03, 0xc4, 0x42, 0xdf, 0xdf, 0x9c, 0x9f, 0xf5, 0x44, 0x01, 0x63, 0xad, 0x93, + 0x5b, 0x8d, 0xcf, 0xa1, 0x92, 0x33, 0x6f, 0xa5, 0xf7, 0x3f, 0x1a, 0x54, 0xf3, 0xd9, 0x24, 0xb3, + 0x5c, 0x7a, 0xf9, 0x2c, 0xaf, 0x7a, 0x79, 0x08, 0x3a, 0xf7, 0x95, 0x8b, 0x83, 0x4d, 0x29, 0xc4, + 0x4e, 0xac, 0xef, 0x7c, 0x1a, 0x10, 0xc1, 0xb8, 0x87, 0x75, 0xee, 0xa3, 0x56, 0x36, 0x66, 0x86, + 0x72, 0xdb, 0x58, 0xe7, 0x36, 0x1e, 0xc9, 0x74, 0x04, 0xcd, 0xaf, 0xa1, 0x9c, 0x91, 0xa0, 0x37, + 0xa1, 0x72, 0xfd, 0x74, 0x70, 0x65, 0xb7, 0x7b, 0xdf, 0xf4, 0xec, 0x4e, 0xed, 0x0d, 0x04, 0xb0, + 0xdb, 0xc6, 0xf6, 0xc5, 0x33, 0xbb, 0xa6, 0xc9, 0xf5, 0xf5, 0x55, 0x47, 0xae, 0x75, 0xb9, 0xee, + 0xd8, 0x4f, 0xec, 0x67, 0x76, 0xcd, 0x30, 0x1f, 0x41, 0xad, 0x5b, 0xec, 0xb4, 0x0f, 0xc1, 0x60, + 0xe3, 0xb4, 0xea, 0x1b, 0xb3, 0x97, 0x18, 0xd3, 0x86, 0xc3, 0xee, 0x4a, 0xe7, 0x9c, 0xc1, 0x8e, + 0x2c, 0xe8, 0xc6, 0x3e, 0x8d, 0xe1, 0xaa, 0xf2, 0x31, 0xd0, 0xfc, 0x5b, 0x03, 0x58, 0x58, 0xb7, + 0xe8, 0x99, 0x85, 0x68, 0xfa, 0xab, 0x8a, 0x96, 0xeb, 0x33, 0x63, 0x7d, 0x9f, 0x2d, 0x22, 0xf9, + 0xbf, 0xfb, 0xec, 0x11, 0xd4, 0x3a, 0x91, 0xeb, 0xcb, 0x80, 0xe8, 0x7f, 0x50, 0xbb, 0x03, 0x87, + 0xb9, 0xeb, 0x89, 0xda, 0xcd, 0x65, 0xb5, 0x57, 0xfe, 0x36, 0x15, 0x3a, 0x2f, 0xf6, 0x5f, 0x1a, + 0x94, 0x33, 0xe3, 0x16, 0x5a, 0xb7, 0xe1, 0x8e, 0x4b, 0x05, 0x49, 0x9e, 0x2e, 0xe9, 0xeb, 0xc1, + 0x46, 0x5f, 0x56, 0x3f, 0x41, 0xc6, 0xd2, 0x65, 0x17, 0x1b, 0x5f, 0xc2, 0xfe, 0xd2, 0xd1, 0x56, + 0xf2, 0x7d, 0x0f, 0xb5, 0x41, 0x34, 0x0c, 0x47, 0x01, 0x1b, 0x66, 0xf2, 0x5d, 0xc2, 0x7e, 0x18, + 0xdb, 0x7c, 0x39, 0x05, 0x1b, 0xff, 0xac, 0x06, 0x39, 0x10, 0x5e, 0xbe, 0x62, 0xfe, 0x00, 0x87, + 0x39, 0xde, 0x44, 0xd7, 0x4b, 0xd8, 0xf7, 0xb8, 0x60, 0x13, 0x36, 0x22, 0xb7, 0x12, 0x3f, 0xcd, + 0x81, 0xf0, 0xf2, 0x15, 0xf3, 0x1c, 0xaa, 0x79, 0xbf, 0xaf, 0xfc, 0x89, 0x60, 0x3a, 0x50, 0xcd, + 0xf3, 0xbe, 0xde, 0x89, 0x68, 0xfd, 0x69, 0xc0, 0x41, 0x37, 0x46, 0xf5, 0x63, 0x14, 0xfa, 0x11, + 0xaa, 0xf9, 0xb7, 0x1a, 0xad, 0xbc, 0x7a, 0x6b, 0x1e, 0xf8, 0xc6, 0xfb, 0xb7, 0x83, 0x12, 0x61, + 0xaf, 0xa0, 0x9c, 0xbd, 0x36, 0xe8, 0x78, 0xa5, 0x4e, 0x85, 0x7f, 0xa3, 0xc6, 0x7b, 0xb7, 0x20, + 0x16, 0x8c, 0xdd, 0xcd, 0x8c, 0xdd, 0x97, 0x32, 0x76, 0xd7, 0x31, 0x66, 0x93, 0xb6, 0xca, 0x58, + 0x9c, 0xe1, 0x55, 0xc6, 0xd5, 0x31, 0xc5, 0x50, 0xce, 0x7a, 0x6c, 0x4d, 0xd6, 0x85, 0xb6, 0x5e, + 0x93, 0x75, 0xb1, 0x41, 0xcf, 0xb4, 0xcb, 0xb3, 0x9f, 0xac, 0x29, 0x13, 0x3f, 0x47, 0x43, 0x6b, + 0xc4, 0xdd, 0xa6, 0xc3, 0xa6, 0x44, 0xf0, 0xe6, 0xcc, 0xf7, 0x3f, 0x26, 0x53, 0xea, 0x89, 0x26, + 0xf1, 0x59, 0xe1, 0x63, 0x79, 0xb8, 0xab, 0x3e, 0xf6, 0x3e, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, + 0x34, 0xdf, 0x38, 0x23, 0x54, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1142,9 +1140,9 @@ type GenericManagerClient interface { Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesResponse, error) // SetConfig is used to update desired configuration. SetConfig(ctx context.Context, in *SetConfigRequest, opts ...grpc.CallOption) (*SetConfigResponse, error) - // GetConfig is used to readt current configuration. + // GetConfig is used to read the desired configuration. GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) - // DumpState retrieves the current running state. + // DumpState is used to retrieve the actual running state. DumpState(ctx context.Context, in *DumpStateRequest, opts ...grpc.CallOption) (*DumpStateResponse, error) // Subscribe is used for subscribing to events. // Notifications are returned by streaming updates. @@ -1234,9 +1232,9 @@ type GenericManagerServer interface { Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesResponse, error) // SetConfig is used to update desired configuration. SetConfig(context.Context, *SetConfigRequest) (*SetConfigResponse, error) - // GetConfig is used to readt current configuration. + // GetConfig is used to read the desired configuration. GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error) - // DumpState retrieves the current running state. + // DumpState is used to retrieve the actual running state. DumpState(context.Context, *DumpStateRequest) (*DumpStateResponse, error) // Subscribe is used for subscribing to events. // Notifications are returned by streaming updates. diff --git a/api/genericmanager/genericmanager.proto b/api/genericmanager/genericmanager.proto index b898270377..99c2b5d45f 100644 --- a/api/genericmanager/genericmanager.proto +++ b/api/genericmanager/genericmanager.proto @@ -52,10 +52,10 @@ service GenericManager { // SetConfig is used to update desired configuration. rpc SetConfig (SetConfigRequest) returns (SetConfigResponse); - // GetConfig is used to readt current configuration. + // GetConfig is used to read the desired configuration. rpc GetConfig (GetConfigRequest) returns (GetConfigResponse); - // DumpState retrieves the current running state. + // DumpState is used to retrieve the actual running state. rpc DumpState (DumpStateRequest) returns (DumpStateResponse); // Subscribe is used for subscribing to events. @@ -66,7 +66,7 @@ service GenericManager { //------------------------------------------------------------------------------ message CapabilitiesRequest { - // TODO: query filters + // TODO: filters } message CapabilitiesResponse { repeated ModelInfo known_models = 1; @@ -86,6 +86,9 @@ message SetConfigRequest { // (this is also known as Full Resync) bool overwrite_all = 2; } +message SetConfigResponse { + repeated UpdateResult results = 1; +} message UpdateItem { // The item describes item to be updated. @@ -95,10 +98,6 @@ message UpdateItem { map labels = 2; } -message SetConfigResponse { - repeated UpdateResult results = 1; -} - message UpdateResult { enum Operation { UNSPECIFIED = 0; @@ -118,25 +117,27 @@ message GetConfigRequest { repeated Item.ID ids = 1; } message GetConfigResponse { - message ConfigItem { - Item item = 1; - ItemStatus status = 2; - map labels = 3; - } repeated ConfigItem items = 1; } +message ConfigItem { + Item item = 1; + ItemStatus status = 2; + map labels = 3; +} + //------------------------------------------------------------------------------ message DumpStateRequest { - repeated string keys = 1; + repeated Item.ID ids = 1; } message DumpStateResponse { - message StateItem { - Item item = 1; - map metadata = 2; - } - repeated StateItem states = 1; + repeated StateItem items = 1; +} + +message StateItem { + Item item = 1; + map metadata = 2; } //------------------------------------------------------------------------------ diff --git a/api/models/linux/interfaces/interface.pb.go b/api/models/linux/interfaces/interface.pb.go index 83b77abd50..ae08d6ad2a 100644 --- a/api/models/linux/interfaces/interface.pb.go +++ b/api/models/linux/interfaces/interface.pb.go @@ -29,6 +29,7 @@ const ( Interface_VETH Interface_Type = 1 Interface_TAP_TO_VPP Interface_Type = 2 Interface_LOOPBACK Interface_Type = 3 + Interface_EXISTING Interface_Type = 4 ) var Interface_Type_name = map[int32]string{ @@ -36,6 +37,7 @@ var Interface_Type_name = map[int32]string{ 1: "VETH", 2: "TAP_TO_VPP", 3: "LOOPBACK", + 4: "EXISTING", } var Interface_Type_value = map[string]int32{ @@ -43,6 +45,7 @@ var Interface_Type_value = map[string]int32{ "VETH": 1, "TAP_TO_VPP": 2, "LOOPBACK": 3, + "EXISTING": 4, } func (x Interface_Type) String() string { @@ -404,42 +407,42 @@ func init() { } var fileDescriptor_c08db992330d3513 = []byte{ - // 581 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x6e, 0x9b, 0x4c, - 0x14, 0x0d, 0x86, 0x2f, 0xb1, 0x6f, 0x9c, 0x7c, 0x68, 0x94, 0x44, 0xc4, 0x52, 0x2b, 0x6a, 0xa9, - 0xad, 0x37, 0x86, 0x28, 0xed, 0x2e, 0xea, 0xc2, 0x8e, 0x6d, 0xd9, 0x8a, 0x0b, 0x16, 0x21, 0x59, - 0x74, 0x83, 0xc6, 0x78, 0xf8, 0x51, 0x30, 0x8c, 0x60, 0x6c, 0x25, 0x6f, 0xd8, 0x55, 0x1f, 0xa1, - 0x9b, 0xbe, 0x48, 0xc5, 0x18, 0x4c, 0x1b, 0x27, 0x9b, 0xee, 0xee, 0x3d, 0x9c, 0x33, 0xe7, 0xce, - 0xb9, 0x1a, 0xe0, 0xe3, 0x32, 0x59, 0x90, 0x28, 0xd3, 0xa3, 0x30, 0x5e, 0x3d, 0xea, 0x61, 0xcc, - 0x48, 0xea, 0x61, 0x97, 0x64, 0x55, 0xa9, 0xd1, 0x34, 0x61, 0x09, 0x92, 0x39, 0x43, 0xab, 0x18, - 0xad, 0xae, 0x1f, 0xb2, 0x60, 0x35, 0xd7, 0xdc, 0x64, 0xa9, 0xfb, 0x89, 0x9f, 0xe8, 0x9c, 0x38, - 0x5f, 0x79, 0xbc, 0xe3, 0x0d, 0xaf, 0x36, 0x07, 0xb4, 0x3e, 0xfc, 0xe5, 0x14, 0xe3, 0x25, 0xc9, - 0x28, 0x76, 0x49, 0x55, 0x6d, 0x78, 0xed, 0x1f, 0x22, 0x34, 0x26, 0xa5, 0x0b, 0x42, 0x20, 0xe5, - 0x04, 0x45, 0x50, 0x85, 0x4e, 0xc3, 0xe2, 0x35, 0xfa, 0x0c, 0x12, 0x7b, 0xa2, 0x44, 0xa9, 0xa9, - 0x42, 0xe7, 0xf8, 0x52, 0xd5, 0x9e, 0x4f, 0xa6, 0x6d, 0xe5, 0x9a, 0xfd, 0x44, 0x89, 0xc5, 0xd9, - 0xe8, 0x0a, 0x1a, 0x5b, 0x2b, 0x45, 0x54, 0x85, 0xce, 0xe1, 0xe5, 0x9b, 0x42, 0x5a, 0x8d, 0x60, - 0x10, 0x66, 0x94, 0x8d, 0x55, 0xf1, 0x91, 0x0a, 0xcd, 0x20, 0xc9, 0x98, 0x13, 0x7a, 0x0e, 0x1f, - 0x47, 0xe2, 0xe3, 0x40, 0x8e, 0x4d, 0xbc, 0x5c, 0x81, 0x14, 0x38, 0x20, 0x31, 0x9e, 0x47, 0x64, - 0xa1, 0xfc, 0xa7, 0x0a, 0x9d, 0xba, 0x55, 0xb6, 0xe8, 0x1d, 0x34, 0x43, 0xea, 0xe0, 0xc5, 0x22, - 0x25, 0x59, 0x46, 0x32, 0x65, 0x5f, 0x15, 0x3b, 0x0d, 0xeb, 0x30, 0xa4, 0xbd, 0x12, 0xca, 0x29, - 0x34, 0x78, 0xca, 0x4a, 0x92, 0x72, 0xc0, 0x8f, 0x3f, 0xcc, 0xb1, 0x82, 0x84, 0x64, 0x10, 0x97, - 0x6c, 0xa5, 0xd4, 0x55, 0xa1, 0x73, 0x64, 0xe5, 0x25, 0xba, 0x00, 0x69, 0x4d, 0x58, 0xa0, 0x9c, - 0xf0, 0xbb, 0xb4, 0x76, 0x63, 0xb8, 0x27, 0x2c, 0x98, 0x86, 0xf1, 0xc3, 0x78, 0xcf, 0xe2, 0x4c, - 0xd4, 0x05, 0x91, 0x61, 0xaa, 0x9c, 0x72, 0xc1, 0xf9, 0xae, 0xc0, 0xc6, 0xb4, 0xe0, 0xe7, 0xbc, - 0xf6, 0x17, 0x90, 0xf2, 0xfc, 0xd0, 0x11, 0x34, 0xee, 0x8c, 0xc1, 0x70, 0x34, 0x31, 0x86, 0x03, - 0x79, 0x0f, 0xd5, 0x41, 0xba, 0x1f, 0xda, 0x63, 0x59, 0x40, 0xc7, 0x00, 0x76, 0x6f, 0xe6, 0xd8, - 0xa6, 0x73, 0x3f, 0x9b, 0xc9, 0x35, 0xd4, 0x84, 0xfa, 0xd4, 0x34, 0x67, 0xfd, 0xde, 0xf5, 0x8d, - 0x2c, 0xf6, 0xf7, 0x41, 0x8a, 0xc2, 0xf8, 0xa1, 0xfd, 0xb3, 0x06, 0xf5, 0x72, 0x94, 0x3c, 0x48, - 0x4a, 0x48, 0xba, 0x0d, 0x72, 0xb3, 0x57, 0xc8, 0xb1, 0x22, 0x48, 0x17, 0xce, 0xd2, 0x47, 0xc7, - 0x0d, 0x88, 0xfb, 0x90, 0xad, 0x96, 0x4e, 0xe2, 0x79, 0x51, 0x82, 0x17, 0x61, 0xec, 0x17, 0xfb, - 0xee, 0xbe, 0x7e, 0x51, 0xed, 0xba, 0x50, 0x99, 0x5b, 0x91, 0x75, 0x92, 0x3e, 0xee, 0xa2, 0xb9, - 0x09, 0x7b, 0xd9, 0x44, 0xfc, 0x27, 0x13, 0xf6, 0x82, 0x49, 0xdb, 0x03, 0xf4, 0x82, 0xf5, 0x39, - 0x9c, 0x5e, 0x8f, 0x6f, 0x6e, 0xbf, 0x3a, 0xe6, 0x68, 0x34, 0x35, 0x7b, 0x03, 0x67, 0x30, 0x1c, - 0xf5, 0xee, 0xa6, 0xb6, 0xbc, 0xb7, 0xfb, 0x69, 0x68, 0xf4, 0xfa, 0xd3, 0xe1, 0x40, 0x16, 0x50, - 0x0b, 0xce, 0x9e, 0xa9, 0x26, 0xb7, 0x9b, 0x6f, 0xb5, 0xf6, 0x05, 0x1c, 0x14, 0x9b, 0x43, 0xef, - 0xe1, 0xff, 0x35, 0xa5, 0x0e, 0xc3, 0xf4, 0x59, 0xc2, 0xcd, 0x35, 0xa5, 0x36, 0xa6, 0x9b, 0x8c, - 0xfb, 0xc6, 0xf7, 0x5f, 0x6f, 0x85, 0x6f, 0xe3, 0x3f, 0x1e, 0x70, 0x14, 0xfa, 0x98, 0x25, 0xfa, - 0x9a, 0xd2, 0x2e, 0xf6, 0x49, 0xcc, 0x74, 0x4c, 0x43, 0xfd, 0x95, 0x7f, 0xc3, 0x15, 0x07, 0x9c, - 0x0a, 0x98, 0xef, 0xf3, 0xa7, 0xfb, 0xe9, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xc5, 0xaf, - 0xb8, 0x4e, 0x04, 0x00, 0x00, + // 588 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6e, 0xda, 0x40, + 0x10, 0x8d, 0xb1, 0x9b, 0xc0, 0x84, 0xa4, 0xd6, 0x2a, 0x89, 0x1c, 0xa4, 0x56, 0x2e, 0x52, 0x5b, + 0x2e, 0xd8, 0x51, 0xda, 0x5b, 0x4e, 0x10, 0x4c, 0x41, 0xa1, 0x06, 0x39, 0x4e, 0x54, 0xf5, 0x62, + 0x2d, 0xb0, 0x06, 0x2b, 0xc6, 0x5e, 0xd9, 0x0b, 0x4a, 0xfe, 0xb0, 0x1f, 0x51, 0xf5, 0xd2, 0x1f, + 0xa9, 0x76, 0xb1, 0x71, 0x1b, 0xc8, 0xa5, 0xb7, 0x99, 0xe7, 0xf7, 0xf6, 0xcd, 0xbe, 0xd1, 0x1a, + 0x3e, 0x2e, 0xe2, 0x29, 0x09, 0x53, 0x33, 0x0c, 0xa2, 0xe5, 0xa3, 0x19, 0x44, 0x8c, 0x24, 0x3e, + 0x9e, 0x90, 0xb4, 0x28, 0x0d, 0x9a, 0xc4, 0x2c, 0x46, 0xaa, 0x60, 0x18, 0x05, 0xa3, 0xd6, 0x9c, + 0x05, 0x6c, 0xbe, 0x1c, 0x1b, 0x93, 0x78, 0x61, 0xce, 0xe2, 0x59, 0x6c, 0x0a, 0xe2, 0x78, 0xe9, + 0x8b, 0x4e, 0x34, 0xa2, 0x5a, 0x1f, 0x50, 0xfb, 0xf0, 0x8f, 0x53, 0x84, 0x17, 0x24, 0xa5, 0x78, + 0x42, 0x8a, 0x6a, 0xcd, 0xab, 0xff, 0x94, 0xa1, 0xd2, 0xcf, 0x5d, 0x10, 0x02, 0x85, 0x13, 0x34, + 0x49, 0x97, 0x1a, 0x15, 0x47, 0xd4, 0xe8, 0x33, 0x28, 0xec, 0x89, 0x12, 0xad, 0xa4, 0x4b, 0x8d, + 0xe3, 0x4b, 0xdd, 0x78, 0x3e, 0x99, 0xb1, 0x91, 0x1b, 0xee, 0x13, 0x25, 0x8e, 0x60, 0xa3, 0x2b, + 0xa8, 0x6c, 0xac, 0x34, 0x59, 0x97, 0x1a, 0x87, 0x97, 0x6f, 0x32, 0x69, 0x31, 0x82, 0x4d, 0x98, + 0x9d, 0x37, 0x4e, 0xc1, 0x47, 0x3a, 0x54, 0xe7, 0x71, 0xca, 0xbc, 0xc0, 0xf7, 0xc4, 0x38, 0x8a, + 0x18, 0x07, 0x38, 0xd6, 0xf7, 0xb9, 0x02, 0x69, 0x70, 0x40, 0x22, 0x3c, 0x0e, 0xc9, 0x54, 0x7b, + 0xa5, 0x4b, 0x8d, 0xb2, 0x93, 0xb7, 0xe8, 0x1d, 0x54, 0x03, 0xea, 0xe1, 0xe9, 0x34, 0x21, 0x69, + 0x4a, 0x52, 0x6d, 0x5f, 0x97, 0x1b, 0x15, 0xe7, 0x30, 0xa0, 0xad, 0x1c, 0xe2, 0x14, 0x3a, 0x7f, + 0x4a, 0x73, 0x92, 0x76, 0x20, 0x8e, 0x3f, 0xe4, 0x58, 0x46, 0x42, 0x2a, 0xc8, 0x0b, 0xb6, 0xd4, + 0xca, 0xba, 0xd4, 0x38, 0x72, 0x78, 0x89, 0x2e, 0x40, 0x59, 0x11, 0x36, 0xd7, 0x4e, 0xc4, 0x5d, + 0x6a, 0xdb, 0x31, 0xdc, 0x13, 0x36, 0x1f, 0x04, 0xd1, 0x43, 0x6f, 0xcf, 0x11, 0x4c, 0xd4, 0x04, + 0x99, 0x61, 0xaa, 0x9d, 0x0a, 0xc1, 0xf9, 0xb6, 0xc0, 0xc5, 0x34, 0xe3, 0x73, 0x5e, 0xfd, 0x06, + 0x14, 0x9e, 0x1f, 0x3a, 0x82, 0xca, 0x9d, 0xdd, 0xb1, 0xba, 0x7d, 0xdb, 0xea, 0xa8, 0x7b, 0xa8, + 0x0c, 0xca, 0xbd, 0xe5, 0xf6, 0x54, 0x09, 0x1d, 0x03, 0xb8, 0xad, 0x91, 0xe7, 0x0e, 0xbd, 0xfb, + 0xd1, 0x48, 0x2d, 0xa1, 0x2a, 0x94, 0x07, 0xc3, 0xe1, 0xa8, 0xdd, 0xba, 0xbe, 0x51, 0x65, 0xde, + 0x59, 0xdf, 0xfa, 0xb7, 0x6e, 0xdf, 0xfe, 0xa2, 0x2a, 0xed, 0x7d, 0x50, 0xc2, 0x20, 0x7a, 0xa8, + 0xff, 0x2a, 0x41, 0x39, 0x1f, 0x8c, 0xc7, 0x4a, 0x09, 0x49, 0x36, 0xb1, 0xae, 0xb7, 0x0c, 0x1c, + 0xcb, 0x62, 0x9d, 0xc0, 0x59, 0xf2, 0xe8, 0x4d, 0xe6, 0x64, 0xf2, 0x90, 0x2e, 0x17, 0x5e, 0xec, + 0xfb, 0x61, 0x8c, 0xa7, 0x41, 0x34, 0xcb, 0xb6, 0xdf, 0x7c, 0xf9, 0xda, 0xc6, 0x75, 0xa6, 0x1a, + 0x6e, 0x44, 0xce, 0x49, 0xf2, 0xb8, 0x8d, 0x72, 0x13, 0xb6, 0xdb, 0x44, 0xfe, 0x2f, 0x13, 0xb6, + 0xc3, 0xa4, 0xee, 0x03, 0xda, 0x61, 0x7d, 0x0e, 0xa7, 0xd7, 0xbd, 0x9b, 0xdb, 0xaf, 0xde, 0xb0, + 0xdb, 0x1d, 0x0c, 0x5b, 0x1d, 0xaf, 0x63, 0x75, 0x5b, 0x77, 0x03, 0x57, 0xdd, 0xdb, 0xfe, 0x64, + 0xd9, 0xad, 0xf6, 0xc0, 0xea, 0xa8, 0x12, 0xaa, 0xc1, 0xd9, 0x33, 0x55, 0xff, 0x76, 0xfd, 0xad, + 0x54, 0xbf, 0x80, 0x83, 0x6c, 0x8f, 0xe8, 0x3d, 0xbc, 0x5e, 0x51, 0xea, 0x31, 0x4c, 0x9f, 0x25, + 0x5c, 0x5d, 0x51, 0xea, 0x62, 0xba, 0xce, 0xb8, 0x6d, 0xff, 0xf8, 0xfd, 0x56, 0xfa, 0xde, 0xfb, + 0xeb, 0x39, 0x87, 0xc1, 0x0c, 0xb3, 0xd8, 0x5c, 0x51, 0xda, 0xc4, 0x33, 0x12, 0x31, 0x13, 0xd3, + 0xc0, 0x7c, 0xe1, 0x4f, 0x71, 0x25, 0x00, 0xaf, 0x00, 0xc6, 0xfb, 0xe2, 0x21, 0x7f, 0xfa, 0x13, + 0x00, 0x00, 0xff, 0xff, 0x80, 0x0c, 0x9a, 0x56, 0x5c, 0x04, 0x00, 0x00, } diff --git a/api/models/linux/interfaces/interface.proto b/api/models/linux/interfaces/interface.proto index 3a10d13629..d015cb2228 100644 --- a/api/models/linux/interfaces/interface.proto +++ b/api/models/linux/interfaces/interface.proto @@ -15,6 +15,7 @@ message Interface { VETH = 1; TAP_TO_VPP = 2; /* TAP created by VPP to have the Linux-side further configured */ LOOPBACK = 3; + EXISTING = 4; }; string name = 1; /* Logical interface name unique across all configured interfaces (mandatory) */ diff --git a/api/models/vpp/abf/keys_test.go b/api/models/vpp/abf/keys_test.go index b7d6aef3cf..996970f5f1 100644 --- a/api/models/vpp/abf/keys_test.go +++ b/api/models/vpp/abf/keys_test.go @@ -17,9 +17,7 @@ package vpp_abf_test import ( "testing" - "github.com/ligato/vpp-agent/api/models/vpp/abf" - - "github.com/ligato/vpp-agent/pkg/models" + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" ) func TestABFKey(t *testing.T) { @@ -73,7 +71,7 @@ func TestParseNameFromKey(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - abfIndex, isABFKey := models.Model(&vpp_abf.ABF{}).ParseKey(test.key) + abfIndex, isABFKey := vpp_abf.ModelABF.ParseKey(test.key) if isABFKey != test.expectedIsABFKey { t.Errorf("expected isABFKey: %v\tgot: %v", test.expectedIsABFKey, isABFKey) } diff --git a/api/models/vpp/interfaces/interface.pb.go b/api/models/vpp/interfaces/interface.pb.go index 0c5bd6d029..fe6ddd4593 100644 --- a/api/models/vpp/interfaces/interface.pb.go +++ b/api/models/vpp/interfaces/interface.pb.go @@ -75,17 +75,17 @@ func (Interface_Type) EnumDescriptor() ([]byte, []int) { } // from vpp/build-root/install-vpp-native/vpp/include/vnet/interface.h -type Interface_RxModeSettings_RxModeType int32 +type Interface_RxMode_Type int32 const ( - Interface_RxModeSettings_UNKNOWN Interface_RxModeSettings_RxModeType = 0 - Interface_RxModeSettings_POLLING Interface_RxModeSettings_RxModeType = 1 - Interface_RxModeSettings_INTERRUPT Interface_RxModeSettings_RxModeType = 2 - Interface_RxModeSettings_ADAPTIVE Interface_RxModeSettings_RxModeType = 3 - Interface_RxModeSettings_DEFAULT Interface_RxModeSettings_RxModeType = 4 + Interface_RxMode_UNKNOWN Interface_RxMode_Type = 0 + Interface_RxMode_POLLING Interface_RxMode_Type = 1 + Interface_RxMode_INTERRUPT Interface_RxMode_Type = 2 + Interface_RxMode_ADAPTIVE Interface_RxMode_Type = 3 + Interface_RxMode_DEFAULT Interface_RxMode_Type = 4 ) -var Interface_RxModeSettings_RxModeType_name = map[int32]string{ +var Interface_RxMode_Type_name = map[int32]string{ 0: "UNKNOWN", 1: "POLLING", 2: "INTERRUPT", @@ -93,7 +93,7 @@ var Interface_RxModeSettings_RxModeType_name = map[int32]string{ 4: "DEFAULT", } -var Interface_RxModeSettings_RxModeType_value = map[string]int32{ +var Interface_RxMode_Type_value = map[string]int32{ "UNKNOWN": 0, "POLLING": 1, "INTERRUPT": 2, @@ -101,11 +101,11 @@ var Interface_RxModeSettings_RxModeType_value = map[string]int32{ "DEFAULT": 4, } -func (x Interface_RxModeSettings_RxModeType) String() string { - return proto.EnumName(Interface_RxModeSettings_RxModeType_name, int32(x)) +func (x Interface_RxMode_Type) String() string { + return proto.EnumName(Interface_RxMode_Type_name, int32(x)) } -func (Interface_RxModeSettings_RxModeType) EnumDescriptor() ([]byte, []int) { +func (Interface_RxMode_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1ac7cab935c1dc4d, []int{0, 1, 0} } @@ -249,17 +249,17 @@ func (BondLink_LoadBalance) EnumDescriptor() ([]byte, []int) { } type Interface struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Type Interface_Type `protobuf:"varint,2,opt,name=type,proto3,enum=vpp.interfaces.Interface_Type" json:"type,omitempty"` - Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` - PhysAddress string `protobuf:"bytes,4,opt,name=phys_address,json=physAddress,proto3" json:"phys_address,omitempty"` - IpAddresses []string `protobuf:"bytes,5,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"` - Vrf uint32 `protobuf:"varint,6,opt,name=vrf,proto3" json:"vrf,omitempty"` - SetDhcpClient bool `protobuf:"varint,7,opt,name=set_dhcp_client,json=setDhcpClient,proto3" json:"set_dhcp_client,omitempty"` - Mtu uint32 `protobuf:"varint,8,opt,name=mtu,proto3" json:"mtu,omitempty"` - Unnumbered *Interface_Unnumbered `protobuf:"bytes,9,opt,name=unnumbered,proto3" json:"unnumbered,omitempty"` - RxModeSettings *Interface_RxModeSettings `protobuf:"bytes,10,opt,name=rx_mode_settings,json=rxModeSettings,proto3" json:"rx_mode_settings,omitempty"` - RxPlacementSettings *Interface_RxPlacementSettings `protobuf:"bytes,11,opt,name=rx_placement_settings,json=rxPlacementSettings,proto3" json:"rx_placement_settings,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type Interface_Type `protobuf:"varint,2,opt,name=type,proto3,enum=vpp.interfaces.Interface_Type" json:"type,omitempty"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + PhysAddress string `protobuf:"bytes,4,opt,name=phys_address,json=physAddress,proto3" json:"phys_address,omitempty"` + IpAddresses []string `protobuf:"bytes,5,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"` + Vrf uint32 `protobuf:"varint,6,opt,name=vrf,proto3" json:"vrf,omitempty"` + SetDhcpClient bool `protobuf:"varint,7,opt,name=set_dhcp_client,json=setDhcpClient,proto3" json:"set_dhcp_client,omitempty"` + Mtu uint32 `protobuf:"varint,8,opt,name=mtu,proto3" json:"mtu,omitempty"` + Unnumbered *Interface_Unnumbered `protobuf:"bytes,9,opt,name=unnumbered,proto3" json:"unnumbered,omitempty"` + RxModes []*Interface_RxMode `protobuf:"bytes,10,rep,name=rx_modes,json=rxModes,proto3" json:"rx_modes,omitempty"` + RxPlacements []*Interface_RxPlacement `protobuf:"bytes,11,rep,name=rx_placements,json=rxPlacements,proto3" json:"rx_placements,omitempty"` // Types that are valid to be assigned to Link: // *Interface_Sub // *Interface_Memif @@ -407,16 +407,16 @@ func (m *Interface) GetUnnumbered() *Interface_Unnumbered { return nil } -func (m *Interface) GetRxModeSettings() *Interface_RxModeSettings { +func (m *Interface) GetRxModes() []*Interface_RxMode { if m != nil { - return m.RxModeSettings + return m.RxModes } return nil } -func (m *Interface) GetRxPlacementSettings() *Interface_RxPlacementSettings { +func (m *Interface) GetRxPlacements() []*Interface_RxPlacement { if m != nil { - return m.RxPlacementSettings + return m.RxPlacements } return nil } @@ -711,120 +711,120 @@ func (*Interface_Unnumbered) XXX_MessageName() string { return "vpp.interfaces.Interface.Unnumbered" } -type Interface_RxModeSettings struct { - RxMode Interface_RxModeSettings_RxModeType `protobuf:"varint,1,opt,name=rx_mode,json=rxMode,proto3,enum=vpp.interfaces.Interface_RxModeSettings_RxModeType" json:"rx_mode,omitempty"` - QueueId uint32 `protobuf:"varint,2,opt,name=queue_id,json=queueId,proto3" json:"queue_id,omitempty"` - QueueIdValid uint32 `protobuf:"varint,3,opt,name=queue_id_valid,json=queueIdValid,proto3" json:"queue_id_valid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type Interface_RxMode struct { + Queue uint32 `protobuf:"varint,1,opt,name=queue,proto3" json:"queue,omitempty"` + Mode Interface_RxMode_Type `protobuf:"varint,2,opt,name=mode,proto3,enum=vpp.interfaces.Interface_RxMode_Type" json:"mode,omitempty"` + DefaultMode bool `protobuf:"varint,3,opt,name=default_mode,json=defaultMode,proto3" json:"default_mode,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Interface_RxModeSettings) Reset() { *m = Interface_RxModeSettings{} } -func (m *Interface_RxModeSettings) String() string { return proto.CompactTextString(m) } -func (*Interface_RxModeSettings) ProtoMessage() {} -func (*Interface_RxModeSettings) Descriptor() ([]byte, []int) { +func (m *Interface_RxMode) Reset() { *m = Interface_RxMode{} } +func (m *Interface_RxMode) String() string { return proto.CompactTextString(m) } +func (*Interface_RxMode) ProtoMessage() {} +func (*Interface_RxMode) Descriptor() ([]byte, []int) { return fileDescriptor_1ac7cab935c1dc4d, []int{0, 1} } -func (m *Interface_RxModeSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Interface_RxModeSettings.Unmarshal(m, b) +func (m *Interface_RxMode) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Interface_RxMode.Unmarshal(m, b) } -func (m *Interface_RxModeSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Interface_RxModeSettings.Marshal(b, m, deterministic) +func (m *Interface_RxMode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Interface_RxMode.Marshal(b, m, deterministic) } -func (m *Interface_RxModeSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_Interface_RxModeSettings.Merge(m, src) +func (m *Interface_RxMode) XXX_Merge(src proto.Message) { + xxx_messageInfo_Interface_RxMode.Merge(m, src) } -func (m *Interface_RxModeSettings) XXX_Size() int { - return xxx_messageInfo_Interface_RxModeSettings.Size(m) +func (m *Interface_RxMode) XXX_Size() int { + return xxx_messageInfo_Interface_RxMode.Size(m) } -func (m *Interface_RxModeSettings) XXX_DiscardUnknown() { - xxx_messageInfo_Interface_RxModeSettings.DiscardUnknown(m) +func (m *Interface_RxMode) XXX_DiscardUnknown() { + xxx_messageInfo_Interface_RxMode.DiscardUnknown(m) } -var xxx_messageInfo_Interface_RxModeSettings proto.InternalMessageInfo +var xxx_messageInfo_Interface_RxMode proto.InternalMessageInfo -func (m *Interface_RxModeSettings) GetRxMode() Interface_RxModeSettings_RxModeType { +func (m *Interface_RxMode) GetQueue() uint32 { if m != nil { - return m.RxMode + return m.Queue } - return Interface_RxModeSettings_UNKNOWN + return 0 } -func (m *Interface_RxModeSettings) GetQueueId() uint32 { +func (m *Interface_RxMode) GetMode() Interface_RxMode_Type { if m != nil { - return m.QueueId + return m.Mode } - return 0 + return Interface_RxMode_UNKNOWN } -func (m *Interface_RxModeSettings) GetQueueIdValid() uint32 { +func (m *Interface_RxMode) GetDefaultMode() bool { if m != nil { - return m.QueueIdValid + return m.DefaultMode } - return 0 + return false } -func (*Interface_RxModeSettings) XXX_MessageName() string { - return "vpp.interfaces.Interface.RxModeSettings" +func (*Interface_RxMode) XXX_MessageName() string { + return "vpp.interfaces.Interface.RxMode" } -type Interface_RxPlacementSettings struct { +type Interface_RxPlacement struct { Queue uint32 `protobuf:"varint,1,opt,name=queue,proto3" json:"queue,omitempty"` Worker uint32 `protobuf:"varint,2,opt,name=worker,proto3" json:"worker,omitempty"` - IsMain bool `protobuf:"varint,3,opt,name=is_main,json=isMain,proto3" json:"is_main,omitempty"` + MainThread bool `protobuf:"varint,3,opt,name=main_thread,json=mainThread,proto3" json:"main_thread,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *Interface_RxPlacementSettings) Reset() { *m = Interface_RxPlacementSettings{} } -func (m *Interface_RxPlacementSettings) String() string { return proto.CompactTextString(m) } -func (*Interface_RxPlacementSettings) ProtoMessage() {} -func (*Interface_RxPlacementSettings) Descriptor() ([]byte, []int) { +func (m *Interface_RxPlacement) Reset() { *m = Interface_RxPlacement{} } +func (m *Interface_RxPlacement) String() string { return proto.CompactTextString(m) } +func (*Interface_RxPlacement) ProtoMessage() {} +func (*Interface_RxPlacement) Descriptor() ([]byte, []int) { return fileDescriptor_1ac7cab935c1dc4d, []int{0, 2} } -func (m *Interface_RxPlacementSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Interface_RxPlacementSettings.Unmarshal(m, b) +func (m *Interface_RxPlacement) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Interface_RxPlacement.Unmarshal(m, b) } -func (m *Interface_RxPlacementSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Interface_RxPlacementSettings.Marshal(b, m, deterministic) +func (m *Interface_RxPlacement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Interface_RxPlacement.Marshal(b, m, deterministic) } -func (m *Interface_RxPlacementSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_Interface_RxPlacementSettings.Merge(m, src) +func (m *Interface_RxPlacement) XXX_Merge(src proto.Message) { + xxx_messageInfo_Interface_RxPlacement.Merge(m, src) } -func (m *Interface_RxPlacementSettings) XXX_Size() int { - return xxx_messageInfo_Interface_RxPlacementSettings.Size(m) +func (m *Interface_RxPlacement) XXX_Size() int { + return xxx_messageInfo_Interface_RxPlacement.Size(m) } -func (m *Interface_RxPlacementSettings) XXX_DiscardUnknown() { - xxx_messageInfo_Interface_RxPlacementSettings.DiscardUnknown(m) +func (m *Interface_RxPlacement) XXX_DiscardUnknown() { + xxx_messageInfo_Interface_RxPlacement.DiscardUnknown(m) } -var xxx_messageInfo_Interface_RxPlacementSettings proto.InternalMessageInfo +var xxx_messageInfo_Interface_RxPlacement proto.InternalMessageInfo -func (m *Interface_RxPlacementSettings) GetQueue() uint32 { +func (m *Interface_RxPlacement) GetQueue() uint32 { if m != nil { return m.Queue } return 0 } -func (m *Interface_RxPlacementSettings) GetWorker() uint32 { +func (m *Interface_RxPlacement) GetWorker() uint32 { if m != nil { return m.Worker } return 0 } -func (m *Interface_RxPlacementSettings) GetIsMain() bool { +func (m *Interface_RxPlacement) GetMainThread() bool { if m != nil { - return m.IsMain + return m.MainThread } return false } -func (*Interface_RxPlacementSettings) XXX_MessageName() string { - return "vpp.interfaces.Interface.RxPlacementSettings" +func (*Interface_RxPlacement) XXX_MessageName() string { + return "vpp.interfaces.Interface.RxPlacement" } type SubInterface struct { @@ -1529,15 +1529,15 @@ func (*BondLink_BondedInterface) XXX_MessageName() string { } func init() { proto.RegisterEnum("vpp.interfaces.Interface_Type", Interface_Type_name, Interface_Type_value) - proto.RegisterEnum("vpp.interfaces.Interface_RxModeSettings_RxModeType", Interface_RxModeSettings_RxModeType_name, Interface_RxModeSettings_RxModeType_value) + proto.RegisterEnum("vpp.interfaces.Interface_RxMode_Type", Interface_RxMode_Type_name, Interface_RxMode_Type_value) proto.RegisterEnum("vpp.interfaces.SubInterface_TagRewriteOptions", SubInterface_TagRewriteOptions_name, SubInterface_TagRewriteOptions_value) proto.RegisterEnum("vpp.interfaces.MemifLink_MemifMode", MemifLink_MemifMode_name, MemifLink_MemifMode_value) proto.RegisterEnum("vpp.interfaces.BondLink_Mode", BondLink_Mode_name, BondLink_Mode_value) proto.RegisterEnum("vpp.interfaces.BondLink_LoadBalance", BondLink_LoadBalance_name, BondLink_LoadBalance_value) proto.RegisterType((*Interface)(nil), "vpp.interfaces.Interface") proto.RegisterType((*Interface_Unnumbered)(nil), "vpp.interfaces.Interface.Unnumbered") - proto.RegisterType((*Interface_RxModeSettings)(nil), "vpp.interfaces.Interface.RxModeSettings") - proto.RegisterType((*Interface_RxPlacementSettings)(nil), "vpp.interfaces.Interface.RxPlacementSettings") + proto.RegisterType((*Interface_RxMode)(nil), "vpp.interfaces.Interface.RxMode") + proto.RegisterType((*Interface_RxPlacement)(nil), "vpp.interfaces.Interface.RxPlacement") proto.RegisterType((*SubInterface)(nil), "vpp.interfaces.SubInterface") proto.RegisterType((*MemifLink)(nil), "vpp.interfaces.MemifLink") proto.RegisterType((*VxlanLink)(nil), "vpp.interfaces.VxlanLink") @@ -1554,124 +1554,123 @@ func init() { } var fileDescriptor_1ac7cab935c1dc4d = []byte{ - // 1898 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4b, 0x73, 0xdb, 0xc8, - 0x11, 0x16, 0x1f, 0x12, 0xc9, 0xe6, 0x43, 0xf0, 0x78, 0x9d, 0x85, 0xb5, 0xf6, 0xae, 0xc2, 0x6c, - 0xb2, 0xaa, 0xa4, 0x2c, 0x59, 0xd4, 0x56, 0x65, 0x2b, 0x39, 0x81, 0x22, 0xb4, 0xe6, 0x9a, 0x02, - 0x11, 0x10, 0xb4, 0xbd, 0xa9, 0x54, 0xa1, 0x40, 0x60, 0x08, 0x4d, 0x04, 0x02, 0x30, 0x66, 0x48, - 0x53, 0x5b, 0x95, 0xdf, 0x90, 0xbf, 0x94, 0x63, 0x0e, 0xb9, 0xe4, 0x98, 0x73, 0x8e, 0x39, 0x6d, - 0xe5, 0x0f, 0xa4, 0xe6, 0xc1, 0x87, 0x1e, 0xde, 0xca, 0x85, 0x35, 0xf3, 0x75, 0x7f, 0x3d, 0xcd, - 0x9e, 0x9e, 0xee, 0x06, 0xfc, 0x72, 0x96, 0x86, 0x38, 0xa6, 0x27, 0x8b, 0x2c, 0x3b, 0x21, 0x09, - 0xc3, 0xf9, 0xd4, 0x0f, 0x30, 0xdd, 0x2c, 0x8f, 0xb3, 0x3c, 0x65, 0x29, 0x6a, 0x2d, 0xb2, 0xec, - 0x78, 0x23, 0x3f, 0x78, 0x11, 0x11, 0x76, 0x35, 0x9f, 0x1c, 0x07, 0xe9, 0xec, 0x24, 0x4a, 0xa3, - 0xf4, 0x44, 0xa8, 0x4d, 0xe6, 0x53, 0xb1, 0x13, 0x1b, 0xb1, 0x92, 0xf4, 0x83, 0x67, 0xdb, 0xa7, - 0x64, 0x14, 0x07, 0xf2, 0x57, 0x4a, 0xdb, 0x3f, 0xd6, 0xa1, 0xd6, 0x5f, 0xd9, 0x46, 0x08, 0xca, - 0x89, 0x3f, 0xc3, 0x7a, 0xe1, 0xb0, 0x70, 0x54, 0x73, 0xc4, 0x1a, 0x75, 0xa0, 0xcc, 0x6e, 0x32, - 0xac, 0x17, 0x0f, 0x0b, 0x47, 0xad, 0xce, 0xe7, 0xc7, 0xb7, 0xbd, 0x39, 0x5e, 0x93, 0x8f, 0xdd, - 0x9b, 0x0c, 0x3b, 0x42, 0x17, 0xe9, 0x50, 0xc1, 0x89, 0x3f, 0x89, 0x71, 0xa8, 0x97, 0x0e, 0x0b, - 0x47, 0x55, 0x67, 0xb5, 0x45, 0x3f, 0x87, 0x46, 0x76, 0x75, 0x43, 0x3d, 0x3f, 0x0c, 0x73, 0x4c, - 0xa9, 0x5e, 0x16, 0x27, 0xd5, 0x39, 0x66, 0x48, 0x88, 0xab, 0x90, 0x6c, 0xa5, 0x80, 0xa9, 0xbe, - 0x7b, 0x58, 0xe2, 0x2a, 0x24, 0x33, 0x56, 0x10, 0xd2, 0xa0, 0xb4, 0xc8, 0xa7, 0xfa, 0xde, 0x61, - 0xe1, 0xa8, 0xe9, 0xf0, 0x25, 0xfa, 0x15, 0xec, 0x53, 0xcc, 0xbc, 0xf0, 0x2a, 0xc8, 0xbc, 0x20, - 0x26, 0x38, 0x61, 0x7a, 0x45, 0x9c, 0xdc, 0xa4, 0x98, 0xf5, 0xae, 0x82, 0xec, 0x5c, 0x80, 0x9c, - 0x39, 0x63, 0x73, 0xbd, 0x2a, 0x99, 0x33, 0x36, 0x47, 0x3d, 0x80, 0x79, 0x92, 0xcc, 0x67, 0x13, - 0x9c, 0xe3, 0x50, 0xaf, 0x1d, 0x16, 0x8e, 0xea, 0x9d, 0x2f, 0x3f, 0xfe, 0x2f, 0xc7, 0x6b, 0x5d, - 0x67, 0x8b, 0x87, 0x1c, 0xd0, 0xf2, 0xa5, 0xc7, 0x43, 0xed, 0x51, 0xcc, 0x18, 0x49, 0x22, 0xaa, - 0x83, 0xb0, 0x75, 0xf4, 0x71, 0x5b, 0xce, 0xf2, 0x32, 0x0d, 0xf1, 0x48, 0xe9, 0x3b, 0xad, 0xfc, - 0xd6, 0x1e, 0xf9, 0xf0, 0x24, 0x5f, 0x7a, 0x59, 0xec, 0x07, 0x78, 0x86, 0x13, 0xb6, 0x31, 0x5c, - 0x17, 0x86, 0x5f, 0xfc, 0x94, 0x61, 0x7b, 0xc5, 0x5a, 0x5b, 0x7f, 0x9c, 0xdf, 0x07, 0xd1, 0x4b, - 0x28, 0xd1, 0xf9, 0x44, 0x0f, 0x85, 0xc1, 0x67, 0x77, 0x0d, 0x8e, 0xe6, 0x93, 0xb5, 0xcd, 0x57, - 0x3b, 0x0e, 0x57, 0x45, 0xa7, 0xb0, 0x3b, 0xc3, 0x33, 0x32, 0xd5, 0xb1, 0xe0, 0x3c, 0xbd, 0xcb, - 0xb9, 0xe4, 0xc2, 0x01, 0x49, 0xae, 0x5f, 0xed, 0x38, 0x52, 0x13, 0xfd, 0x0e, 0xaa, 0xfe, 0x34, - 0xf3, 0x83, 0x6b, 0xcc, 0xf4, 0xe9, 0xc3, 0x27, 0x19, 0x4a, 0xae, 0x88, 0x6b, 0x7d, 0xf4, 0x1b, - 0x28, 0x31, 0x3f, 0xd3, 0x23, 0x41, 0xfb, 0xf4, 0x2e, 0xcd, 0xf5, 0x33, 0xc5, 0xe0, 0x5a, 0xdc, - 0xb7, 0xc5, 0x32, 0xf6, 0x13, 0xfd, 0xea, 0x61, 0xdf, 0xde, 0x70, 0xe1, 0xca, 0x37, 0xa1, 0xc9, - 0x29, 0xe2, 0x39, 0xe8, 0xe4, 0x61, 0x4a, 0xdf, 0x1e, 0xe1, 0x60, 0x45, 0x11, 0x9a, 0xe8, 0x1b, - 0xa8, 0x2e, 0x66, 0x4b, 0x2f, 0xc1, 0xec, 0x4c, 0xff, 0xb3, 0x60, 0x7d, 0x76, 0xef, 0xa0, 0xd9, - 0xd2, 0xc2, 0xec, 0x4c, 0xf1, 0x2a, 0x0b, 0xb9, 0x45, 0xc7, 0x50, 0x9e, 0xa4, 0x49, 0xa8, 0x5f, - 0x0b, 0x96, 0x7e, 0x97, 0xd5, 0x4d, 0x93, 0x50, 0x51, 0x84, 0xde, 0xc1, 0x37, 0x00, 0x9b, 0x74, - 0x43, 0xbf, 0x86, 0x47, 0x6b, 0x65, 0xef, 0x03, 0x61, 0x57, 0x1e, 0xc9, 0xd4, 0x4b, 0xdd, 0x5f, - 0x0b, 0xde, 0x12, 0x76, 0xd5, 0xcf, 0x0e, 0x7e, 0x2c, 0x40, 0xeb, 0x76, 0x76, 0xa1, 0x01, 0x54, - 0x54, 0x86, 0x0a, 0x52, 0xab, 0x73, 0xf6, 0xff, 0x26, 0xa6, 0xda, 0x8a, 0xf7, 0xbd, 0x27, 0x73, - 0x14, 0x3d, 0x85, 0xea, 0xfb, 0x39, 0x9e, 0x63, 0x8f, 0x84, 0xa2, 0x32, 0x34, 0x9d, 0x8a, 0xd8, - 0xf7, 0x43, 0xf4, 0x25, 0xb4, 0x56, 0x22, 0x6f, 0xe1, 0xc7, 0x44, 0xd6, 0x80, 0xa6, 0xd3, 0x50, - 0x0a, 0x6f, 0x38, 0xd6, 0xb6, 0x01, 0x36, 0x66, 0x51, 0x1d, 0x2a, 0x63, 0xeb, 0xb5, 0x35, 0x7c, - 0x6b, 0x69, 0x3b, 0x7c, 0x63, 0x0f, 0x07, 0x83, 0xbe, 0xf5, 0xad, 0x56, 0x40, 0x4d, 0xa8, 0xf5, - 0x2d, 0xd7, 0x74, 0x9c, 0xb1, 0xed, 0x6a, 0x45, 0xd4, 0x80, 0xaa, 0xd1, 0x33, 0x6c, 0xb7, 0xff, - 0xc6, 0xd4, 0x4a, 0x5c, 0xb3, 0x67, 0x5e, 0x18, 0xe3, 0x81, 0xab, 0x95, 0x0f, 0xfe, 0x04, 0x8f, - 0x1f, 0xc8, 0x7b, 0xf4, 0x09, 0xec, 0x8a, 0x83, 0xc5, 0xbf, 0x6e, 0x3a, 0x72, 0x83, 0x7e, 0x06, - 0x7b, 0x1f, 0xd2, 0xfc, 0x1a, 0xe7, 0xca, 0x7b, 0xb5, 0x43, 0x9f, 0x42, 0x85, 0x50, 0x6f, 0xe6, - 0x93, 0x44, 0x55, 0xae, 0x3d, 0x42, 0x2f, 0x7d, 0x92, 0xb4, 0xff, 0x56, 0x80, 0xb2, 0x70, 0x15, - 0x41, 0x6b, 0x6c, 0xf5, 0xcc, 0x8b, 0xbe, 0x65, 0xf6, 0x3c, 0xf7, 0x7b, 0xdb, 0xd4, 0x76, 0xd0, - 0x23, 0x68, 0x8e, 0xc6, 0x5d, 0x4f, 0x38, 0x7a, 0x61, 0x9c, 0x9b, 0x5a, 0x01, 0x3d, 0x81, 0x47, - 0xa3, 0xe1, 0x85, 0xfb, 0xd6, 0x70, 0x4c, 0x6f, 0x30, 0x1c, 0xda, 0x5d, 0xe3, 0xfc, 0xb5, 0x56, - 0x44, 0x55, 0x28, 0xf7, 0xec, 0xde, 0x6b, 0xad, 0x84, 0x6a, 0xb0, 0x7b, 0x69, 0x5e, 0xf6, 0x2f, - 0xb4, 0x32, 0xaa, 0x40, 0xc9, 0x35, 0x6c, 0x6d, 0x97, 0xff, 0x59, 0xe3, 0xc2, 0xb3, 0x8d, 0xf3, - 0xd7, 0xa6, 0xab, 0xed, 0x21, 0x0d, 0x1a, 0x6f, 0xde, 0x0d, 0x0c, 0xcb, 0x73, 0xc7, 0x96, 0x65, - 0x0e, 0xb4, 0x0a, 0x47, 0xfa, 0xf6, 0xc8, 0x3c, 0x5f, 0x21, 0x55, 0x7e, 0xce, 0x9b, 0xcb, 0x77, - 0x96, 0xe9, 0x9e, 0x6d, 0x1d, 0x5f, 0xe3, 0x5e, 0x76, 0x87, 0x56, 0x6f, 0x0b, 0x83, 0xee, 0x1e, - 0x94, 0x63, 0x92, 0x5c, 0xb7, 0xff, 0x5b, 0x84, 0xc6, 0xf6, 0xd3, 0x46, 0x5f, 0x40, 0x3d, 0xf3, - 0x73, 0x5e, 0x62, 0xb6, 0xaa, 0x3f, 0x48, 0xc8, 0xe2, 0x3d, 0xe0, 0x09, 0xec, 0xd1, 0xf9, 0x64, - 0x73, 0xd7, 0xbb, 0x74, 0x3e, 0xe9, 0xf3, 0xa2, 0xd7, 0x64, 0x7e, 0xe4, 0xe5, 0x1f, 0xbc, 0x34, - 0x63, 0x24, 0x95, 0x21, 0x6b, 0x75, 0x8e, 0x7f, 0xaa, 0x8e, 0x1c, 0xbb, 0x7e, 0xe4, 0xe0, 0x0f, - 0x39, 0x61, 0x78, 0x28, 0x48, 0xd4, 0xa9, 0x33, 0x3f, 0x72, 0x3e, 0xc8, 0x1d, 0x7a, 0x0e, 0x90, - 0xcd, 0xe9, 0x95, 0x17, 0xa6, 0xec, 0xf4, 0xbd, 0x68, 0x0f, 0x55, 0xa7, 0xc6, 0x91, 0x1e, 0x07, - 0x78, 0x87, 0x62, 0x7e, 0x74, 0xaa, 0xef, 0x0a, 0x3f, 0xc4, 0x5a, 0x61, 0x1d, 0xd5, 0x0e, 0xc4, - 0xba, 0xfd, 0xd7, 0x02, 0x3c, 0xba, 0x77, 0x12, 0xcf, 0x9e, 0x5e, 0x7f, 0x64, 0x74, 0x07, 0x66, - 0x4f, 0xdb, 0xe1, 0x37, 0x60, 0x8f, 0x47, 0xaf, 0x4e, 0xb5, 0xc2, 0x6a, 0xd9, 0x91, 0x37, 0x64, - 0x0f, 0xed, 0x53, 0xad, 0xa4, 0x56, 0x1d, 0xad, 0x8c, 0xf6, 0xa1, 0xee, 0x3a, 0x86, 0x35, 0x1a, - 0x18, 0xae, 0x79, 0x7a, 0xaa, 0xed, 0xde, 0x06, 0x3a, 0xda, 0xde, 0x2d, 0xa0, 0x73, 0xaa, 0x55, - 0x6e, 0x03, 0x1d, 0xad, 0xda, 0xfe, 0x57, 0x11, 0x6a, 0xeb, 0xe2, 0x88, 0x7e, 0x0b, 0xe5, 0xad, - 0xa7, 0xf8, 0x8b, 0x8f, 0x56, 0x51, 0xb9, 0xe2, 0xef, 0xc4, 0x11, 0x04, 0x9e, 0xb8, 0x33, 0x9f, - 0x32, 0x95, 0xb8, 0x55, 0x47, 0xed, 0x50, 0x0b, 0x8a, 0xeb, 0x97, 0x56, 0x24, 0x21, 0xfa, 0x0a, - 0xf6, 0x69, 0xca, 0x4b, 0xa8, 0x37, 0x25, 0x31, 0x16, 0xf7, 0x2a, 0x7b, 0x6d, 0x4b, 0xc2, 0x17, - 0x0a, 0xe5, 0x06, 0x29, 0x0e, 0x72, 0xcc, 0x44, 0x4c, 0x6b, 0x8e, 0xda, 0xa1, 0xcf, 0xa0, 0x96, - 0x93, 0x24, 0xf2, 0x28, 0xf9, 0x01, 0xab, 0xd0, 0x56, 0x39, 0x30, 0x22, 0x3f, 0x88, 0x8c, 0x99, - 0xcc, 0xa7, 0x53, 0x9c, 0x4b, 0x71, 0x45, 0x88, 0x41, 0x42, 0x42, 0x81, 0xb3, 0x97, 0x9e, 0x78, - 0x6b, 0x54, 0x75, 0xdb, 0x6a, 0xbe, 0xfc, 0x83, 0xd8, 0x73, 0x21, 0x5b, 0x0b, 0x6b, 0x52, 0xc8, - 0x94, 0xb0, 0xdd, 0x51, 0x61, 0x12, 0x65, 0xa6, 0x01, 0x55, 0xd3, 0x7d, 0x65, 0x3a, 0x96, 0xe9, - 0x6a, 0x3b, 0x68, 0x0f, 0x8a, 0x7d, 0x5b, 0x2b, 0xf0, 0xd8, 0xda, 0x63, 0xcb, 0xf5, 0xfa, 0xd6, - 0x77, 0xe6, 0xb9, 0xab, 0x15, 0xdb, 0x7f, 0x81, 0xda, 0xba, 0xb6, 0x73, 0xdf, 0x68, 0x1e, 0xac, - 0x27, 0x0c, 0x95, 0xcd, 0x34, 0x0f, 0x56, 0x03, 0xc6, 0x17, 0x50, 0x0f, 0x29, 0x5b, 0x2b, 0x14, - 0xa5, 0x42, 0x48, 0xd9, 0x4a, 0x81, 0x8f, 0x17, 0x09, 0x51, 0xc1, 0xe4, 0x4b, 0xf4, 0x0c, 0x6a, - 0xb3, 0x79, 0xcc, 0x48, 0xe0, 0x53, 0xa6, 0xe2, 0xb8, 0x01, 0xda, 0x2f, 0xa1, 0xb1, 0xdd, 0xc0, - 0xd0, 0x21, 0x34, 0xae, 0x52, 0xca, 0x3c, 0x32, 0xbd, 0xf5, 0xa0, 0x38, 0xd6, 0x9f, 0xf2, 0x07, - 0xd5, 0xfe, 0x67, 0x01, 0x2a, 0xaa, 0x79, 0xf1, 0x61, 0x69, 0x81, 0x73, 0xca, 0xdf, 0x8f, 0x2c, - 0x51, 0xab, 0xed, 0x3d, 0x3b, 0xc5, 0xbb, 0x76, 0xf8, 0x2d, 0xb3, 0xd4, 0x9b, 0x91, 0x20, 0x4f, - 0x29, 0xce, 0x17, 0x24, 0xc0, 0xc2, 0xeb, 0x9a, 0xd3, 0x62, 0xe9, 0xe5, 0x16, 0xca, 0x4d, 0xe5, - 0x4b, 0x6f, 0x73, 0xa1, 0x65, 0x79, 0x63, 0xf9, 0xd2, 0x59, 0x5d, 0xe9, 0x21, 0x34, 0xd8, 0xb6, - 0x86, 0x7c, 0x61, 0xc0, 0x36, 0x1a, 0xcf, 0x01, 0xe4, 0x18, 0xe7, 0x45, 0x34, 0x15, 0x29, 0x51, - 0x75, 0x6a, 0x12, 0xf9, 0x96, 0xa6, 0xed, 0xff, 0x94, 0xa0, 0xb6, 0x6e, 0x97, 0x3c, 0x86, 0x98, - 0x26, 0x2a, 0x49, 0xf9, 0x92, 0x87, 0xdd, 0x4f, 0x18, 0xf1, 0x72, 0x9c, 0xc5, 0xfe, 0x8d, 0x2a, - 0xaf, 0xc0, 0x21, 0x47, 0x20, 0xbc, 0xa7, 0xc4, 0x69, 0xe0, 0xc7, 0xbc, 0xaf, 0xc9, 0x18, 0x57, - 0xc4, 0xbe, 0x9f, 0x89, 0x74, 0xc2, 0xb3, 0x94, 0x61, 0x2e, 0x93, 0x79, 0x5a, 0x95, 0x80, 0x14, - 0x4a, 0x1e, 0xcd, 0xc8, 0x2a, 0x53, 0x05, 0x30, 0xca, 0x08, 0x77, 0x5a, 0x31, 0xb9, 0x54, 0x26, - 0xaa, 0xb2, 0xc5, 0xc5, 0x67, 0x00, 0x41, 0x7e, 0x93, 0xb1, 0xd4, 0xf3, 0xe3, 0x48, 0x24, 0x6a, - 0xab, 0xf3, 0x89, 0x7c, 0x8d, 0x62, 0x4a, 0x3e, 0x17, 0x42, 0x23, 0x8e, 0x9c, 0x5a, 0xb0, 0x5a, - 0xa2, 0x23, 0xd0, 0xe4, 0x81, 0x8a, 0x7a, 0x8d, 0x6f, 0x44, 0x1a, 0xd7, 0x9c, 0x96, 0xc0, 0x25, - 0xe9, 0x35, 0xbe, 0xe1, 0x3d, 0x5b, 0x9d, 0xbe, 0xa5, 0x0a, 0xb2, 0x67, 0x4b, 0xc1, 0x46, 0xf7, - 0x25, 0xd4, 0x78, 0x05, 0x88, 0x84, 0x27, 0x75, 0xe1, 0xc9, 0xe3, 0x2d, 0x4f, 0x78, 0x05, 0x8d, - 0xb8, 0x23, 0x55, 0xa2, 0x56, 0x7c, 0xe8, 0x55, 0x01, 0x13, 0x3c, 0x6e, 0xbb, 0x21, 0x6c, 0x37, - 0x65, 0xdc, 0x38, 0xca, 0x2d, 0x1f, 0x81, 0xb6, 0x8a, 0xde, 0x5a, 0xb1, 0x29, 0xfd, 0x55, 0x41, - 0xdc, 0xd2, 0x54, 0x57, 0x3c, 0x0f, 0x33, 0x0f, 0x27, 0x81, 0x9f, 0xe9, 0x2d, 0x71, 0x51, 0x2d, - 0x89, 0x8f, 0xc3, 0xcc, 0xe4, 0x68, 0x3b, 0x84, 0xfa, 0xd6, 0x94, 0xc3, 0x2f, 0x57, 0x11, 0x71, - 0x9c, 0x46, 0xea, 0xda, 0x55, 0xba, 0x98, 0x71, 0x1a, 0xf1, 0xcb, 0xcd, 0x97, 0xef, 0x65, 0x6a, - 0xc9, 0x87, 0x55, 0xc9, 0x97, 0xef, 0x45, 0x5e, 0x3d, 0x85, 0x2a, 0x5b, 0x89, 0x64, 0x5e, 0x56, - 0x98, 0x14, 0xb5, 0xff, 0x51, 0x82, 0xea, 0x6a, 0x2c, 0x52, 0x25, 0xae, 0xb0, 0x2e, 0x71, 0xa7, - 0xaa, 0x86, 0xca, 0xae, 0xf3, 0xfc, 0x63, 0xe3, 0xd4, 0xf1, 0x56, 0xf5, 0xfc, 0x1a, 0x8a, 0xf1, - 0x44, 0x1c, 0xd2, 0xba, 0x3f, 0xe4, 0xaf, 0x09, 0x83, 0xd4, 0x0f, 0xbb, 0x7e, 0xec, 0x27, 0x01, - 0x76, 0x8a, 0xf1, 0x04, 0x8d, 0xe1, 0x11, 0x9f, 0xc7, 0x70, 0xe8, 0x6d, 0xb4, 0xf5, 0xc6, 0x61, - 0xe9, 0xa1, 0xe9, 0x7e, 0x6d, 0xa4, 0x2b, 0x18, 0xeb, 0xbe, 0xe7, 0x68, 0x93, 0xdb, 0x00, 0x3d, - 0x88, 0x61, 0xff, 0x8e, 0xd2, 0x83, 0x1f, 0x60, 0xcf, 0x01, 0x08, 0xf5, 0x32, 0x9f, 0x52, 0xb2, - 0xc0, 0x2a, 0xb2, 0x35, 0x42, 0x6d, 0x09, 0xf0, 0x24, 0x20, 0xd4, 0x8b, 0xd3, 0x24, 0xf2, 0x18, - 0x99, 0xe1, 0x74, 0xce, 0xd4, 0xd3, 0x6a, 0x12, 0x3a, 0x48, 0x93, 0xc8, 0x95, 0x60, 0xfb, 0x7b, - 0x28, 0x8b, 0x92, 0x7a, 0x6b, 0xd4, 0xda, 0x87, 0xba, 0x33, 0x1c, 0x5b, 0x3d, 0xcf, 0x19, 0x76, - 0xfb, 0x96, 0x56, 0xe0, 0x93, 0x8c, 0x71, 0xce, 0xa7, 0x2b, 0x8f, 0x0f, 0x2c, 0x63, 0x5b, 0x2b, - 0xf2, 0xe9, 0xe4, 0xdd, 0xd0, 0xd1, 0x4a, 0x7c, 0x3a, 0xe9, 0x3a, 0x43, 0xa3, 0x77, 0x6e, 0x8c, - 0x5c, 0xad, 0xcc, 0xdb, 0xe3, 0xc0, 0x38, 0xb7, 0xb5, 0xdd, 0xf6, 0x57, 0x50, 0xdf, 0x0a, 0x19, - 0x2f, 0xd3, 0x83, 0x8e, 0xb6, 0xc3, 0x89, 0x83, 0xb3, 0xaf, 0xb5, 0x82, 0x58, 0x74, 0xce, 0xb4, - 0x62, 0xf7, 0xbb, 0xbf, 0xff, 0xfb, 0xf3, 0xc2, 0x1f, 0x7b, 0x5b, 0x1f, 0xb0, 0x31, 0x89, 0x7c, - 0x96, 0xf2, 0x8f, 0xd3, 0x17, 0x7e, 0x84, 0x13, 0x76, 0xe2, 0x67, 0xe4, 0xe4, 0xc1, 0xef, 0xe2, - 0xdf, 0x2f, 0xb2, 0x6c, 0x2b, 0xfe, 0x93, 0x3d, 0xf1, 0x01, 0x7b, 0xf6, 0xbf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x43, 0xf7, 0x1a, 0x56, 0x46, 0x0f, 0x00, 0x00, + // 1880 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x57, 0xcd, 0x72, 0xe3, 0xc6, + 0x11, 0x16, 0x7f, 0x24, 0x02, 0xcd, 0x1f, 0x61, 0x27, 0xb6, 0x83, 0x95, 0x77, 0x6d, 0x85, 0xc9, + 0xc6, 0xaa, 0xa4, 0x2c, 0xad, 0x28, 0x57, 0xc5, 0x89, 0x4f, 0xa0, 0x08, 0x79, 0xb9, 0x4b, 0x81, + 0x0c, 0x08, 0xee, 0xae, 0x53, 0xa9, 0x42, 0x81, 0xc0, 0x10, 0x44, 0x04, 0x02, 0x58, 0xcc, 0x90, + 0x4b, 0xb9, 0x2a, 0xcf, 0x90, 0x7b, 0x9e, 0x26, 0x47, 0x1f, 0x72, 0xc9, 0x31, 0xe7, 0x1c, 0x73, + 0xcc, 0x0b, 0xa4, 0xe6, 0x07, 0x14, 0xa5, 0x95, 0xec, 0x8b, 0x34, 0xf3, 0x75, 0x7f, 0x3d, 0x8d, + 0x9e, 0xee, 0x9e, 0x26, 0x3c, 0x5b, 0xa4, 0x01, 0x8e, 0xc9, 0xc9, 0x2a, 0xcb, 0x4e, 0xa2, 0x84, + 0xe2, 0x7c, 0xe6, 0xf9, 0x98, 0xdc, 0x2c, 0x8f, 0xb3, 0x3c, 0xa5, 0x29, 0x6a, 0xad, 0xb2, 0xec, + 0xf8, 0x46, 0x7e, 0xf0, 0x65, 0x18, 0xd1, 0xf9, 0x72, 0x7a, 0xec, 0xa7, 0x8b, 0x93, 0x30, 0x0d, + 0xd3, 0x13, 0xae, 0x36, 0x5d, 0xce, 0xf8, 0x8e, 0x6f, 0xf8, 0x4a, 0xd0, 0x0f, 0x9e, 0x6c, 0x9f, + 0x92, 0x11, 0xec, 0x8b, 0xbf, 0x42, 0xda, 0xfe, 0x7b, 0x1d, 0xd4, 0x7e, 0x61, 0x1b, 0x21, 0xa8, + 0x26, 0xde, 0x02, 0xeb, 0xa5, 0xc3, 0xd2, 0x91, 0x6a, 0xf3, 0x35, 0xea, 0x40, 0x95, 0x5e, 0x67, + 0x58, 0x2f, 0x1f, 0x96, 0x8e, 0x5a, 0x9d, 0xcf, 0x8e, 0x6f, 0x7b, 0x73, 0xbc, 0x21, 0x1f, 0x3b, + 0xd7, 0x19, 0xb6, 0xb9, 0x2e, 0xd2, 0xa1, 0x86, 0x13, 0x6f, 0x1a, 0xe3, 0x40, 0xaf, 0x1c, 0x96, + 0x8e, 0x14, 0xbb, 0xd8, 0xa2, 0x5f, 0x40, 0x23, 0x9b, 0x5f, 0x13, 0xd7, 0x0b, 0x82, 0x1c, 0x13, + 0xa2, 0x57, 0xf9, 0x49, 0x75, 0x86, 0x19, 0x02, 0x62, 0x2a, 0x51, 0x56, 0x28, 0x60, 0xa2, 0xef, + 0x1e, 0x56, 0x98, 0x4a, 0x94, 0x19, 0x05, 0x84, 0x34, 0xa8, 0xac, 0xf2, 0x99, 0xbe, 0x77, 0x58, + 0x3a, 0x6a, 0xda, 0x6c, 0x89, 0x7e, 0x0d, 0xfb, 0x04, 0x53, 0x37, 0x98, 0xfb, 0x99, 0xeb, 0xc7, + 0x11, 0x4e, 0xa8, 0x5e, 0xe3, 0x27, 0x37, 0x09, 0xa6, 0xbd, 0xb9, 0x9f, 0x9d, 0x73, 0x90, 0x31, + 0x17, 0x74, 0xa9, 0x2b, 0x82, 0xb9, 0xa0, 0x4b, 0xd4, 0x03, 0x58, 0x26, 0xc9, 0x72, 0x31, 0xc5, + 0x39, 0x0e, 0x74, 0xf5, 0xb0, 0x74, 0x54, 0xef, 0xfc, 0xea, 0xe1, 0xaf, 0x9c, 0x6c, 0x74, 0xed, + 0x2d, 0x1e, 0xfa, 0x06, 0x94, 0x7c, 0xed, 0xb2, 0x50, 0x13, 0x1d, 0x0e, 0x2b, 0x47, 0xf5, 0xce, + 0xe1, 0xc3, 0x36, 0xec, 0xf5, 0x65, 0x1a, 0x60, 0xbb, 0x96, 0xf3, 0xff, 0x04, 0xbd, 0x84, 0x66, + 0xbe, 0x76, 0xb3, 0xd8, 0xf3, 0xf1, 0x02, 0x27, 0x94, 0xe8, 0x75, 0x6e, 0xe1, 0xd9, 0x8f, 0x59, + 0x18, 0x15, 0xda, 0x76, 0x23, 0xbf, 0xd9, 0x10, 0xf4, 0x1c, 0x2a, 0x64, 0x39, 0xd5, 0x03, 0xfe, + 0x1d, 0x4f, 0xee, 0x5a, 0x18, 0x2f, 0xa7, 0x1b, 0x23, 0x2f, 0x76, 0x6c, 0xa6, 0x8a, 0x4e, 0x61, + 0x77, 0x81, 0x17, 0xd1, 0x4c, 0xc7, 0x9c, 0xf3, 0xf8, 0x2e, 0xe7, 0x92, 0x09, 0x07, 0x51, 0x72, + 0xf5, 0x62, 0xc7, 0x16, 0x9a, 0xe8, 0x0f, 0xa0, 0x78, 0xb3, 0xcc, 0xf3, 0xaf, 0x30, 0xd5, 0x67, + 0xf7, 0x9f, 0x64, 0x48, 0xb9, 0x24, 0x6e, 0xf4, 0xd1, 0x6f, 0xa1, 0x42, 0xbd, 0x4c, 0x0f, 0x39, + 0xed, 0xe7, 0x77, 0x69, 0x8e, 0x97, 0x49, 0x06, 0xd3, 0x62, 0xbe, 0xad, 0xd6, 0xb1, 0x97, 0xe8, + 0xf3, 0xfb, 0x7d, 0x7b, 0xcd, 0x84, 0x85, 0x6f, 0x5c, 0x93, 0x51, 0x78, 0x82, 0xeb, 0xd1, 0xfd, + 0x94, 0xfe, 0x68, 0x8c, 0xfd, 0x82, 0xc2, 0x35, 0xd1, 0xd7, 0xa0, 0xac, 0x16, 0x6b, 0x37, 0xc1, + 0xf4, 0x4c, 0xff, 0x0b, 0x67, 0x7d, 0xfa, 0xc1, 0x41, 0x8b, 0xb5, 0x85, 0xe9, 0x99, 0xe4, 0xd5, + 0x56, 0x62, 0x8b, 0x8e, 0xa1, 0x3a, 0x4d, 0x93, 0x40, 0xbf, 0xe2, 0x2c, 0xfd, 0x2e, 0xab, 0x9b, + 0x26, 0x81, 0xa4, 0x70, 0xbd, 0x83, 0xaf, 0x01, 0x6e, 0x12, 0x08, 0xfd, 0x06, 0x1e, 0x6d, 0x94, + 0xdd, 0xf7, 0x11, 0x9d, 0xbb, 0x51, 0x26, 0x6b, 0x6f, 0x7f, 0x23, 0x78, 0x13, 0xd1, 0x79, 0x3f, + 0x3b, 0xf8, 0xa1, 0x04, 0x7b, 0x22, 0x6f, 0xd0, 0x47, 0xb0, 0xfb, 0x6e, 0x89, 0x97, 0xa2, 0x4c, + 0x9b, 0xb6, 0xd8, 0xa0, 0xdf, 0x43, 0x95, 0xa5, 0x9f, 0xac, 0xd3, 0x67, 0x3f, 0x95, 0x7d, 0xb2, + 0x5c, 0x19, 0x85, 0x55, 0x5c, 0x80, 0x67, 0xde, 0x32, 0xa6, 0x3c, 0x83, 0x65, 0xcd, 0xd6, 0x25, + 0xc6, 0xb4, 0xdb, 0x2f, 0xa1, 0xca, 0x08, 0xa8, 0x0e, 0xb5, 0x89, 0xf5, 0xca, 0x1a, 0xbe, 0xb1, + 0xb4, 0x1d, 0xb6, 0x19, 0x0d, 0x07, 0x83, 0xbe, 0xf5, 0xad, 0x56, 0x42, 0x4d, 0x50, 0xfb, 0x96, + 0x63, 0xda, 0xf6, 0x64, 0xe4, 0x68, 0x65, 0xd4, 0x00, 0xc5, 0xe8, 0x19, 0x23, 0xa7, 0xff, 0xda, + 0xd4, 0x2a, 0x4c, 0xb3, 0x67, 0x5e, 0x18, 0x93, 0x81, 0xa3, 0x55, 0x0f, 0xfe, 0x0c, 0xf5, 0xad, + 0xfc, 0x7d, 0xe0, 0x73, 0x3e, 0x81, 0xbd, 0xf7, 0x69, 0x7e, 0x85, 0x73, 0xfe, 0x41, 0x4d, 0x5b, + 0xee, 0xd0, 0xe7, 0x50, 0x5f, 0x78, 0x51, 0xe2, 0xd2, 0x79, 0x8e, 0xbd, 0xa2, 0xbd, 0x00, 0x83, + 0x1c, 0x8e, 0xb4, 0xff, 0x51, 0x92, 0xae, 0x22, 0x68, 0x4d, 0xac, 0x9e, 0x79, 0xd1, 0xb7, 0xcc, + 0x9e, 0xeb, 0x7c, 0x37, 0x32, 0xb5, 0x1d, 0xf4, 0x08, 0x9a, 0xe3, 0x49, 0xd7, 0xe5, 0x8e, 0x5e, + 0x18, 0xe7, 0xa6, 0x56, 0x42, 0x1f, 0xc3, 0xa3, 0xf1, 0xf0, 0xc2, 0x79, 0x63, 0xd8, 0xa6, 0x3b, + 0x18, 0x0e, 0x47, 0x5d, 0xe3, 0xfc, 0x95, 0x56, 0x46, 0x0a, 0x54, 0x7b, 0xa3, 0xde, 0x2b, 0xad, + 0x82, 0x54, 0xd8, 0xbd, 0x34, 0x2f, 0xfb, 0x17, 0x5a, 0x15, 0xd5, 0xa0, 0xe2, 0x18, 0x23, 0x6d, + 0x97, 0x7d, 0xac, 0x71, 0xe1, 0x8e, 0x8c, 0xf3, 0x57, 0xa6, 0xa3, 0xed, 0x21, 0x0d, 0x1a, 0xaf, + 0xdf, 0x0e, 0x0c, 0xcb, 0x75, 0x26, 0x96, 0x65, 0x0e, 0xb4, 0x1a, 0x43, 0xfa, 0xa3, 0xb1, 0x79, + 0x5e, 0x20, 0x0a, 0x3b, 0xe7, 0xf5, 0xe5, 0x5b, 0xcb, 0x74, 0xce, 0xb6, 0x8e, 0x57, 0x99, 0x97, + 0xdd, 0xa1, 0xd5, 0xdb, 0xc2, 0xa0, 0xbb, 0x07, 0xd5, 0x38, 0x4a, 0xae, 0xda, 0xff, 0x2b, 0x43, + 0x63, 0xbb, 0x62, 0xd9, 0xc7, 0x67, 0x5e, 0x8e, 0x13, 0xea, 0x6e, 0xb5, 0x69, 0x10, 0x90, 0xc5, + 0x9a, 0xf5, 0xc7, 0xb0, 0x47, 0x96, 0x53, 0x37, 0x0a, 0x64, 0xd4, 0x76, 0xc9, 0x72, 0xda, 0x0f, + 0x90, 0x0d, 0x4d, 0xea, 0x85, 0x6e, 0xfe, 0xde, 0x4d, 0x33, 0x1a, 0xa5, 0x09, 0x0f, 0x5b, 0xab, + 0x73, 0xfc, 0x63, 0xed, 0xe1, 0xd8, 0xf1, 0x42, 0x1b, 0xbf, 0xcf, 0x23, 0x8a, 0x87, 0x9c, 0x44, + 0xec, 0x3a, 0xf5, 0x42, 0xfb, 0xbd, 0xd8, 0xa1, 0xa7, 0x00, 0xd9, 0x92, 0xcc, 0xdd, 0x20, 0xa5, + 0xa7, 0xef, 0x78, 0x1f, 0x57, 0x6c, 0x95, 0x21, 0x3d, 0x06, 0xb0, 0xa7, 0x84, 0x7a, 0xe1, 0xa9, + 0xbe, 0xcb, 0xfd, 0xe0, 0x6b, 0x89, 0x75, 0x64, 0xdf, 0xe6, 0xeb, 0xf6, 0xdf, 0x4a, 0xf0, 0xe8, + 0x83, 0x93, 0x58, 0xf6, 0xf4, 0xfa, 0x63, 0xa3, 0x3b, 0x30, 0x7b, 0xda, 0x0e, 0xbb, 0x81, 0xd1, + 0x64, 0xfc, 0xe2, 0x54, 0x2b, 0x15, 0xcb, 0x8e, 0xb8, 0xa1, 0xd1, 0x70, 0x74, 0xaa, 0x55, 0xe4, + 0xaa, 0xa3, 0x55, 0xd1, 0x3e, 0xd4, 0x1d, 0xdb, 0xb0, 0xc6, 0x03, 0xc3, 0x31, 0x4f, 0x4f, 0xb5, + 0xdd, 0xdb, 0x40, 0x47, 0xdb, 0xbb, 0x05, 0x74, 0x4e, 0xb5, 0xda, 0x6d, 0xa0, 0xa3, 0x29, 0xed, + 0x7f, 0x97, 0x41, 0xdd, 0xf4, 0x3c, 0xf4, 0x3b, 0x59, 0x56, 0x25, 0x1e, 0xb1, 0x5f, 0x3e, 0xd8, + 0x1c, 0xc5, 0x8a, 0xf7, 0x75, 0x51, 0x54, 0x9f, 0xc0, 0xde, 0xc2, 0x23, 0x54, 0x26, 0xb0, 0x62, + 0xcb, 0x1d, 0x6a, 0x41, 0x39, 0x12, 0x79, 0xdb, 0xb4, 0xcb, 0x51, 0x80, 0xbe, 0x80, 0x7d, 0x92, + 0xb2, 0xce, 0xe8, 0xce, 0xa2, 0x18, 0xf3, 0x7b, 0x15, 0x8f, 0x62, 0x4b, 0xc0, 0x17, 0x12, 0x65, + 0x06, 0x09, 0xf6, 0x73, 0x4c, 0x79, 0x4c, 0x55, 0x5b, 0xee, 0xd0, 0xa7, 0xa0, 0xe6, 0x51, 0x12, + 0xba, 0x24, 0xfa, 0x1e, 0xcb, 0xd0, 0x2a, 0x0c, 0x18, 0x47, 0xdf, 0xf3, 0x8c, 0x99, 0x2e, 0x67, + 0x33, 0x9c, 0x0b, 0x71, 0x8d, 0x8b, 0x41, 0x40, 0x5c, 0x81, 0xb1, 0xd7, 0x2e, 0xaf, 0x39, 0x22, + 0x9f, 0x45, 0x25, 0x5f, 0xff, 0x91, 0xef, 0x99, 0x90, 0x6e, 0x84, 0xaa, 0x10, 0x52, 0x29, 0x6c, + 0x77, 0x64, 0x98, 0x78, 0x4f, 0x6a, 0x80, 0x62, 0x3a, 0x2f, 0x4c, 0xdb, 0x32, 0x1d, 0x6d, 0x07, + 0xed, 0x41, 0xb9, 0x3f, 0xd2, 0x4a, 0x2c, 0xb6, 0xa3, 0x89, 0xe5, 0xb8, 0x7d, 0xeb, 0xa5, 0x79, + 0xee, 0x68, 0xe5, 0xf6, 0x5f, 0x41, 0xdd, 0xb4, 0x6c, 0xe6, 0x1b, 0xc9, 0xfd, 0xcd, 0x28, 0x20, + 0xb3, 0x99, 0xe4, 0x7e, 0x31, 0x09, 0x7c, 0x0e, 0xf5, 0x80, 0xd0, 0x8d, 0x42, 0x59, 0x28, 0x04, + 0x84, 0x16, 0x0a, 0x6c, 0x0e, 0x48, 0x22, 0x19, 0x4c, 0xb6, 0x44, 0x4f, 0x40, 0x5d, 0x2c, 0x63, + 0x1a, 0xf9, 0x1e, 0xa1, 0x32, 0x8e, 0x37, 0x40, 0xfb, 0x39, 0x34, 0xb6, 0xdf, 0x25, 0x74, 0x08, + 0x8d, 0x79, 0x4a, 0xa8, 0x1b, 0xcd, 0x6e, 0x15, 0x14, 0xc3, 0xfa, 0x33, 0x56, 0x50, 0xed, 0x7f, + 0x95, 0xa0, 0x26, 0xdf, 0x24, 0x36, 0xd5, 0xac, 0x70, 0x4e, 0x58, 0xfd, 0x88, 0x56, 0x55, 0x6c, + 0x3f, 0xb0, 0x53, 0xbe, 0x6b, 0x87, 0xdd, 0x32, 0x4d, 0xdd, 0x45, 0xe4, 0xe7, 0x29, 0xc1, 0xf9, + 0x2a, 0xf2, 0x45, 0x97, 0x55, 0xed, 0x16, 0x4d, 0x2f, 0xb7, 0x50, 0x66, 0x2a, 0x5f, 0xbb, 0x37, + 0x17, 0x5a, 0x15, 0x37, 0x96, 0xaf, 0xed, 0xe2, 0x4a, 0x0f, 0xa1, 0x41, 0xb7, 0x35, 0x44, 0x85, + 0x01, 0xbd, 0xd1, 0x78, 0x0a, 0x20, 0xe6, 0x2d, 0x37, 0x24, 0x29, 0x4f, 0x09, 0xc5, 0x56, 0x05, + 0xf2, 0x2d, 0x49, 0xdb, 0xff, 0xad, 0x80, 0xba, 0x79, 0x05, 0x59, 0x0c, 0x31, 0x49, 0x64, 0x92, + 0xb2, 0x25, 0x0b, 0xbb, 0x97, 0xd0, 0xc8, 0xcd, 0x71, 0x16, 0x7b, 0xd7, 0x45, 0x8b, 0x65, 0x90, + 0xcd, 0x11, 0xf4, 0x18, 0x94, 0x38, 0xf5, 0xbd, 0x98, 0x3d, 0x57, 0x22, 0xc6, 0x35, 0xbe, 0xef, + 0x67, 0x3c, 0x9d, 0xf0, 0x22, 0xa5, 0x98, 0xc9, 0x44, 0x9e, 0x2a, 0x02, 0x10, 0x42, 0xc1, 0x23, + 0x59, 0x54, 0x64, 0x2a, 0x07, 0xc6, 0x59, 0xc4, 0x9c, 0x96, 0x4c, 0x26, 0x15, 0x89, 0x2a, 0x6d, + 0x31, 0xf1, 0x19, 0x80, 0x9f, 0x5f, 0x67, 0x34, 0x75, 0xbd, 0x38, 0xe4, 0x89, 0xda, 0xea, 0x7c, + 0x24, 0xaa, 0x91, 0x8f, 0xb3, 0xe7, 0x5c, 0x68, 0xc4, 0xa1, 0xad, 0xfa, 0xc5, 0x12, 0x1d, 0x81, + 0x26, 0x0e, 0x94, 0xd4, 0x2b, 0x7c, 0xcd, 0xd3, 0x58, 0xb5, 0x5b, 0x1c, 0x17, 0xa4, 0x57, 0xf8, + 0x9a, 0x3d, 0xc5, 0xf2, 0xf4, 0x2d, 0x55, 0x10, 0x4f, 0xb1, 0x10, 0xdc, 0xe8, 0x3e, 0x07, 0x95, + 0x75, 0x80, 0x90, 0x7b, 0x52, 0xe7, 0x9e, 0xfc, 0x6c, 0xcb, 0x13, 0xd6, 0x41, 0x43, 0xe6, 0x88, + 0x12, 0xc9, 0x15, 0x9b, 0x4e, 0x65, 0xc0, 0x38, 0x8f, 0xd9, 0x6e, 0x70, 0xdb, 0x4d, 0x11, 0x37, + 0x86, 0x32, 0xcb, 0x47, 0xa0, 0x15, 0xd1, 0xdb, 0x28, 0x36, 0x85, 0xbf, 0x32, 0x88, 0x5b, 0x9a, + 0xf2, 0x8a, 0x97, 0x41, 0xe6, 0xe2, 0xc4, 0xf7, 0x32, 0xbd, 0xc5, 0x2f, 0xaa, 0x25, 0xf0, 0x49, + 0x90, 0x99, 0x0c, 0x6d, 0x07, 0x50, 0xdf, 0x1a, 0x5e, 0xd8, 0xe5, 0x4a, 0x22, 0x8e, 0xd3, 0x50, + 0x5e, 0xbb, 0x4c, 0x17, 0x33, 0x4e, 0x43, 0x76, 0xb9, 0xf9, 0xfa, 0x9d, 0x48, 0x2d, 0x51, 0x58, + 0xb5, 0x7c, 0xfd, 0x8e, 0xe7, 0xd5, 0x63, 0x50, 0x68, 0x21, 0x12, 0x79, 0x59, 0xa3, 0x42, 0xd4, + 0xfe, 0x67, 0x05, 0x94, 0x62, 0xda, 0x91, 0x2d, 0xae, 0xb4, 0x69, 0x71, 0xa7, 0xb2, 0x87, 0x8a, + 0x57, 0xe7, 0xe9, 0x43, 0x53, 0xd2, 0xf1, 0x56, 0xf7, 0xfc, 0x0a, 0xca, 0xf1, 0x94, 0x1f, 0xd2, + 0xfa, 0x70, 0x1a, 0xdf, 0x10, 0x06, 0xa9, 0x17, 0x74, 0xbd, 0xd8, 0x4b, 0x7c, 0x6c, 0x97, 0xe3, + 0x29, 0x9a, 0xc0, 0x23, 0x36, 0x66, 0xe1, 0xc0, 0xbd, 0xd1, 0xd6, 0x1b, 0x7c, 0x98, 0x3e, 0x7a, + 0xd0, 0x48, 0x97, 0x33, 0x36, 0xef, 0x9e, 0xad, 0x4d, 0x6f, 0x03, 0xe4, 0x20, 0x86, 0xfd, 0x3b, + 0x4a, 0xf7, 0xfe, 0x52, 0x7a, 0x0a, 0x10, 0x11, 0x37, 0xf3, 0x08, 0x89, 0x56, 0x58, 0x46, 0x56, + 0x8d, 0xc8, 0x48, 0x00, 0x2c, 0x09, 0x22, 0xe2, 0xc6, 0x69, 0x12, 0xba, 0x34, 0x5a, 0xe0, 0x74, + 0x49, 0x65, 0x69, 0x35, 0x23, 0x32, 0x48, 0x93, 0xd0, 0x11, 0x60, 0xfb, 0x3b, 0xa8, 0xf2, 0x96, + 0x7a, 0x6b, 0xd4, 0xda, 0x87, 0xba, 0x3d, 0x9c, 0x58, 0x3d, 0xd7, 0x1e, 0x76, 0xfb, 0x96, 0x56, + 0x62, 0x93, 0x8c, 0x71, 0xce, 0xa6, 0x2b, 0x97, 0x0d, 0x2c, 0x93, 0x91, 0x56, 0x66, 0xd3, 0xc9, + 0xdb, 0xa1, 0xad, 0x55, 0xd8, 0x74, 0xd2, 0xb5, 0x87, 0x46, 0xef, 0xdc, 0x18, 0x3b, 0x5a, 0x95, + 0x3d, 0x8f, 0x03, 0xe3, 0x7c, 0xa4, 0xed, 0xb6, 0xbf, 0x80, 0xfa, 0x56, 0xc8, 0x58, 0x9b, 0x1e, + 0x74, 0xb4, 0x1d, 0x46, 0x1c, 0x9c, 0x7d, 0xa5, 0x95, 0xf8, 0xa2, 0x73, 0xa6, 0x95, 0xbb, 0x2f, + 0x7f, 0xf8, 0xcf, 0x67, 0xa5, 0x3f, 0xf5, 0xb6, 0x7e, 0x69, 0xc6, 0x51, 0xe8, 0xd1, 0x94, 0xfd, + 0x8a, 0xfc, 0xd2, 0x0b, 0x71, 0x42, 0x4f, 0xbc, 0x2c, 0x3a, 0xb9, 0xf7, 0x07, 0xec, 0x37, 0xab, + 0x2c, 0xdb, 0x8a, 0xff, 0x74, 0x8f, 0xff, 0xd2, 0x3c, 0xfb, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x6f, 0x77, 0x95, 0x46, 0xef, 0x0e, 0x00, 0x00, } diff --git a/api/models/vpp/interfaces/interface.proto b/api/models/vpp/interfaces/interface.proto index 677a96e16d..0b1a73cf8d 100644 --- a/api/models/vpp/interfaces/interface.proto +++ b/api/models/vpp/interfaces/interface.proto @@ -40,27 +40,30 @@ message Interface { } Unnumbered unnumbered = 9; - message RxModeSettings { + message RxMode { // from vpp/build-root/install-vpp-native/vpp/include/vnet/interface.h - enum RxModeType { + enum Type { UNKNOWN = 0; POLLING = 1; INTERRUPT = 2; ADAPTIVE = 3; DEFAULT = 4; }; - RxModeType rx_mode = 1; - uint32 queue_id = 2; - uint32 queue_id_valid = 3; + uint32 queue = 1; + Type mode = 2; + bool default_mode = 3; // if enabled, will be ignored and the given + // will be used for all queues without explicitly + // selected Rx mode } - RxModeSettings rx_mode_settings = 10; + repeated RxMode rx_modes = 10; - message RxPlacementSettings { - uint32 queue = 1; - uint32 worker = 2; - bool is_main = 3; + message RxPlacement { + uint32 queue = 1; // select from interval <0, number-of-queues) + uint32 worker = 2; // select from interval <0, number-of-workers) + bool main_thread = 3; // let the main thread to process the given queue + // - if enabled, value of is ignored } - RxPlacementSettings rx_placement_settings = 11; + repeated RxPlacement rx_placements = 11; oneof link { SubInterface sub = 100; /* sub-interface configuration */ @@ -70,7 +73,7 @@ message Interface { VxlanLink vxlan = 104; /* VXLAN-specific configuration */ IPSecLink ipsec = 105; /* IPSec tunnel-specific configuration */ VmxNet3Link vmx_net3 = 106; /* VmxNet3-specific configuration */ - BondLink bond = 107; /* Bond interface-specific configuration */ + BondLink bond = 107; /* Bond interface-specific configuration */ }; }; diff --git a/api/models/vpp/interfaces/keys.go b/api/models/vpp/interfaces/keys.go index 87fa0755e4..6365fbb829 100644 --- a/api/models/vpp/interfaces/keys.go +++ b/api/models/vpp/interfaces/keys.go @@ -109,6 +109,39 @@ const ( DHCPLeaseKeyPrefix = "vpp/interface/dhcp-lease/" ) +/* Interface Link State */ + +const ( + // interface link states as described in the keys + linkUpState = "UP" + linkDownState = "DOWN" + + // linkStateKeyTemplate is a template for keys representing + // the link state of VPP interfaces (up/down). + linkStateKeyTemplate = "vpp/interface/{ifName}/link-state/{linkState}" +) + +/* Interface Rx-placement (derived) */ +const ( + // rxPlacementKeyTemplate is a template for (derived) key representing + // rx-placement configured for a given interface queue. + rxPlacementKeyTemplate = "vpp/interface/{iface}/rx-placement/queue/{queue}" +) + +/* Interface Rx-modes (derived) */ +const ( + // rxModeKeyTemplate is a template for (derived) key representing + // rx-mode configuration for all queues of a given interface. + rxModesKeyTemplate = "vpp/interface/{iface}/rx-modes" +) + +/* Interface with IP address (derived, property) */ +const ( + // interfaceWithIPKeyTemplate is a template for keys derived from all interfaces + // but created only after at least one IP address is assigned. + interfaceWithIPKeyTemplate = "vpp/interface/{iface}/has-IP-address" +) + const ( // InvalidKeyPart is used in key for parts which are invalid InvalidKeyPart = "" @@ -401,6 +434,163 @@ func ParseNameFromDHCPLeaseKey(key string) (iface string, isDHCPLeaseKey bool) { return } +/* Link State (notification) */ + +// LinkStateKey returns key representing link state of a VPP interface. +func LinkStateKey(ifaceName string, linkIsUp bool) string { + if ifaceName == "" { + ifaceName = InvalidKeyPart + } + linkState := linkDownState + if linkIsUp { + linkState = linkUpState + } + key := strings.Replace(linkStateKeyTemplate, "{ifName}", ifaceName, 1) + key = strings.Replace(key, "{linkState}", linkState, 1) + return key +} + +// ParseLinkStateKey parses key representing link state of a VPP interface. +func ParseLinkStateKey(key string) (ifaceName string, isLinkUp bool, isLinkStateKey bool) { + if suffix := strings.TrimPrefix(key, "vpp/interface/"); suffix != key { + parts := strings.Split(suffix, "/") + linkState := -1 + for i, part := range parts { + if part == "link-state" { + linkState = i + } + } + if linkState != len(parts)-2 { + return + } + + switch parts[len(parts)-1] { + case linkDownState: + case linkUpState: + isLinkUp = true + default: + return + } + + // beware: interface name may contain forward slashes + ifaceName = strings.Join(parts[:linkState], "/") + if ifaceName == InvalidKeyPart { + isLinkUp = false + ifaceName = "" + return + } + isLinkStateKey = true + } + return +} + +/* Interface with IP address (derived property) */ + +// InterfaceWithIPKey returns key derived from every VPP interface but created only +// after at least one IP address was assigned to it. +func InterfaceWithIPKey(ifaceName string) string { + if ifaceName == "" { + ifaceName = InvalidKeyPart + } + return strings.Replace(interfaceWithIPKeyTemplate, "{iface}", ifaceName, 1) +} + +// ParseInterfaceWithIPKey parses key derived from every VPP interface but created only +// after at least one IP address was assigned to it +func ParseInterfaceWithIPKey(key string) (ifaceName string, isInterfaceWithIPKey bool) { + if suffix := strings.TrimPrefix(key, "vpp/interface/"); suffix != key { + if prefix := strings.TrimSuffix(suffix, "/has-IP-address"); prefix != suffix { + if prefix != InvalidKeyPart { + ifaceName = prefix + isInterfaceWithIPKey = true + } + } + } + return +} + +/* Rx placement (derived) */ + +// RxPlacementKey returns a key representing rx-placement configured for a given +// interface queue. +func RxPlacementKey(ifaceName string, queue uint32) string { + if ifaceName == "" { + ifaceName = InvalidKeyPart + } + key := strings.Replace(rxPlacementKeyTemplate, "{iface}", ifaceName, 1) + key = strings.Replace(key, "{queue}", strconv.Itoa(int(queue)), 1) + return key +} + +// ParseRxPlacementKey parses key representing rx-placement configured for a given +// interface queue. +func ParseRxPlacementKey(key string) (ifaceName string, queue uint32, isRxPlacementKey bool) { + if suffix := strings.TrimPrefix(key, "vpp/interface/"); suffix != key { + parts := strings.Split(suffix, "/") + rxPlacement := -1 + for i, part := range parts { + if part == "rx-placement" { + rxPlacement = i + } + } + if rxPlacement != len(parts)-3 { + return + } + + if parts[len(parts)-2] != "queue" { + return + } + + queueID, err := strconv.Atoi(parts[len(parts)-1]) + if err != nil || queueID < 0 { + return + } + + // beware: interface name may contain forward slashes + ifaceName = strings.Join(parts[:rxPlacement], "/") + if ifaceName == InvalidKeyPart { + ifaceName = "" + return + } + + queue = uint32(queueID) + isRxPlacementKey = true + } + return +} + +/* Rx modes (derived) */ + +// RxModesKey returns a key representing rx-mode configuration for all queues +// of a given interface. +func RxModesKey(ifaceName string) string { + if ifaceName == "" { + ifaceName = InvalidKeyPart + } + return strings.Replace(rxModesKeyTemplate, "{iface}", ifaceName, 1) +} + +// ParseRxModesKey parses key representing rx-mode configuration for all queues +// of a given interface. +func ParseRxModesKey(key string) (ifaceName string, isRxModesKey bool) { + if suffix := strings.TrimPrefix(key, "vpp/interface/"); suffix != key { + parts := strings.Split(suffix, "/") + if len(parts) == 0 || parts[len(parts)-1] != "rx-modes" { + return + } + + // beware: interface name may contain forward slashes + ifaceName = strings.Join(parts[:len(parts)-1], "/") + if ifaceName == InvalidKeyPart { + ifaceName = "" + return + } + + isRxModesKey = true + } + return +} + // MarshalJSON ensures that field of type 'oneOf' is correctly marshaled // by using gogo lib marshaller func (m *Interface) MarshalJSON() ([]byte, error) { diff --git a/api/models/vpp/interfaces/keys_test.go b/api/models/vpp/interfaces/keys_test.go index 6020a2f5f9..172205552c 100644 --- a/api/models/vpp/interfaces/keys_test.go +++ b/api/models/vpp/interfaces/keys_test.go @@ -842,3 +842,396 @@ func TestDHCPLeaseKey(t *testing.T) { }) } } + +func TestLinkStateKey(t *testing.T) { + tests := []struct { + name string + iface string + linkIsUp bool + expectedKey string + }{ + { + name: "link is UP", + iface: "memif0", + linkIsUp: true, + expectedKey: "vpp/interface/memif0/link-state/UP", + }, + { + name: "link is DOWN", + iface: "memif0", + linkIsUp: false, + expectedKey: "vpp/interface/memif0/link-state/DOWN", + }, + { + name: "invalid interface name", + iface: "", + linkIsUp: true, + expectedKey: "vpp/interface//link-state/UP", + }, + { + name: "Gbe interface", + iface: "GigabitEthernet0/8/0", + linkIsUp: false, + expectedKey: "vpp/interface/GigabitEthernet0/8/0/link-state/DOWN", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + key := LinkStateKey(test.iface, test.linkIsUp) + if key != test.expectedKey { + t.Errorf("failed for: iface=%s linkIsUp=%v\n"+ + "expected key:\n\t%q\ngot key:\n\t%q", + test.iface, test.linkIsUp, test.expectedKey, key) + } + }) + } +} + +func TestParseLinkStateKey(t *testing.T) { + tests := []struct { + name string + key string + expectedIface string + expectedIsLinkUp bool + expectedIsLinkStateKey bool + }{ + { + name: "link is UP", + key: "vpp/interface/memif0/link-state/UP", + expectedIface: "memif0", + expectedIsLinkUp: true, + expectedIsLinkStateKey: true, + }, + { + name: "link is DOWN", + key: "vpp/interface/memif0/link-state/DOWN", + expectedIface: "memif0", + expectedIsLinkUp: false, + expectedIsLinkStateKey: true, + }, + { + name: "invalid interface name", + key: "vpp/interface//link-state/DOWN", + expectedIsLinkStateKey: false, + }, + { + name: "Gbe interface", + key: "vpp/interface/GigabitEthernet0/8/0/link-state/UP", + expectedIface: "GigabitEthernet0/8/0", + expectedIsLinkUp: true, + expectedIsLinkStateKey: true, + }, + { + name: "invalid link state", + key: "vpp/interface/GigabitEthernet0/8/0/link-state/", + expectedIsLinkStateKey: false, + }, + { + name: "missing link state", + key: "vpp/interface/GigabitEthernet0/8/0/link-state", + expectedIsLinkStateKey: false, + }, + { + name: "not link state key", + key: "vpp/interface/unnumbered/GigabitEthernet0/8/0", + expectedIsLinkStateKey: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + iface, isLinkUp, isLinkStateKey := ParseLinkStateKey(test.key) + if isLinkStateKey != test.expectedIsLinkStateKey { + t.Errorf("expected isLinkStateKey: %v\tgot: %v", + test.expectedIsLinkStateKey, isLinkStateKey) + } + if iface != test.expectedIface { + t.Errorf("expected iface: %s\tgot: %s", test.expectedIface, iface) + } + if isLinkUp != test.expectedIsLinkUp { + t.Errorf("expected isLinkUp: %t\tgot: %t", test.expectedIsLinkUp, isLinkUp) + } + }) + } +} + +func TestRxPlacementKey(t *testing.T) { + tests := []struct { + name string + iface string + queue uint32 + expectedKey string + }{ + { + name: "queue 0", + iface: "memif0", + queue: 0, + expectedKey: "vpp/interface/memif0/rx-placement/queue/0", + }, + { + name: "queue 1", + iface: "memif0", + queue: 1, + expectedKey: "vpp/interface/memif0/rx-placement/queue/1", + }, + { + name: "invalid interface name", + iface: "", + queue: 1, + expectedKey: "vpp/interface//rx-placement/queue/1", + }, + { + name: "Gbe interface", + iface: "GigabitEthernet0/8/0", + queue: 2, + expectedKey: "vpp/interface/GigabitEthernet0/8/0/rx-placement/queue/2", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + key := RxPlacementKey(test.iface, test.queue) + if key != test.expectedKey { + t.Errorf("failed for: iface=%s queue=%d\n"+ + "expected key:\n\t%q\ngot key:\n\t%q", + test.iface, test.queue, test.expectedKey, key) + } + }) + } +} + +func TestParseRxPlacementKey(t *testing.T) { + tests := []struct { + name string + key string + expectedIface string + expectedQueue uint32 + expectedIsRxPlacementKey bool + }{ + { + name: "queue 0", + key: "vpp/interface/memif0/rx-placement/queue/0", + expectedIface: "memif0", + expectedQueue: 0, + expectedIsRxPlacementKey: true, + }, + { + name: "queue 1", + key: "vpp/interface/memif0/rx-placement/queue/1", + expectedIface: "memif0", + expectedQueue: 1, + expectedIsRxPlacementKey: true, + }, + { + name: "invalid interface name", + key: "vpp/interface//rx-placement/queue/1", + expectedIsRxPlacementKey: false, + }, + { + name: "invalid queue", + key: "vpp/interface/memif0/rx-placement/queue/", + expectedIsRxPlacementKey: false, + }, + { + name: "missing queue", + key: "vpp/interface/memif0/rx-placement/", + expectedIsRxPlacementKey: false, + }, + { + name: "missing queue ID", + key: "vpp/interface/memif0/rx-placement/queue", + expectedIsRxPlacementKey: false, + }, + { + name: "Gbe interface", + key: "vpp/interface/GigabitEthernet0/8/0/rx-placement/queue/3", + expectedIface: "GigabitEthernet0/8/0", + expectedQueue: 3, + expectedIsRxPlacementKey: true, + }, + { + name: "not rx placement key", + key: "vpp/interface/memif0/link-state/DOWN", + expectedIsRxPlacementKey: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + iface, queue, isRxPlacementKey := ParseRxPlacementKey(test.key) + if isRxPlacementKey != test.expectedIsRxPlacementKey { + t.Errorf("expected isRxPlacementKey: %v\tgot: %v", + test.expectedIsRxPlacementKey, isRxPlacementKey) + } + if queue != test.expectedQueue { + t.Errorf("expected queue: %d\tgot: %d", test.expectedQueue, queue) + } + if iface != test.expectedIface { + t.Errorf("expected iface: %s\tgot: %s", test.expectedIface, iface) + } + }) + } +} + +func TestRxModesKey(t *testing.T) { + tests := []struct { + name string + iface string + expectedKey string + }{ + { + name: "memif", + iface: "memif0", + expectedKey: "vpp/interface/memif0/rx-modes", + }, + { + name: "Gbe", + iface: "GigabitEthernet0/8/0", + expectedKey: "vpp/interface/GigabitEthernet0/8/0/rx-modes", + }, + { + name: "invalid interface name", + iface: "", + expectedKey: "vpp/interface//rx-modes", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + key := RxModesKey(test.iface) + if key != test.expectedKey { + t.Errorf("failed for: iface=%s\n"+ + "expected key:\n\t%q\ngot key:\n\t%q", + test.iface, test.expectedKey, key) + } + }) + } +} + +func TestParseRxModesKey(t *testing.T) { + tests := []struct { + name string + key string + expectedIface string + expectedIsRxModesKey bool + }{ + { + name: "memif", + key: "vpp/interface/memif0/rx-modes", + expectedIface: "memif0", + expectedIsRxModesKey: true, + }, + { + name: "Gbe", + key: "vpp/interface/GigabitEthernet0/8/0/rx-modes", + expectedIface: "GigabitEthernet0/8/0", + expectedIsRxModesKey: true, + }, + { + name: "invalid interface name", + key: "vpp/interface//rx-modes", + expectedIsRxModesKey: false, + }, + { + name: "missing rx-mode suffix", + key: "vpp/interface/", + expectedIsRxModesKey: false, + }, + { + name: "not rx-mode key", + key: "vpp/interface/memif0/address/192.168.1.12/24", + expectedIsRxModesKey: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + iface, isRxModesKey := ParseRxModesKey(test.key) + if isRxModesKey != test.expectedIsRxModesKey { + t.Errorf("expected isRxModesKey: %v\tgot: %v", + test.expectedIsRxModesKey, isRxModesKey) + } + if iface != test.expectedIface { + t.Errorf("expected iface: %s\tgot: %s", test.expectedIface, iface) + } + }) + } +} + +func TestInterfaceWithIPKey(t *testing.T) { + tests := []struct { + name string + iface string + expectedKey string + }{ + { + name: "memif", + iface: "memif0", + expectedKey: "vpp/interface/memif0/has-IP-address", + }, + { + name: "invalid interface name", + iface: "", + expectedKey: "vpp/interface//has-IP-address", + }, + { + name: "Gbe interface", + iface: "GigabitEthernet0/8/0", + expectedKey: "vpp/interface/GigabitEthernet0/8/0/has-IP-address", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + key := InterfaceWithIPKey(test.iface) + if key != test.expectedKey { + t.Errorf("failed for: iface=%s\n"+ + "expected key:\n\t%q\ngot key:\n\t%q", + test.iface, test.expectedKey, key) + } + }) + } +} + +func TestParseInterfaceWithIPKey(t *testing.T) { + tests := []struct { + name string + key string + expectedIface string + expectedIsIfaceWithIPKey bool + }{ + { + name: "memif", + key: "vpp/interface/memif0/has-IP-address", + expectedIface: "memif0", + expectedIsIfaceWithIPKey: true, + }, + { + name: "Gbe", + key: "vpp/interface/GigabitEthernet0/8/0/has-IP-address", + expectedIface: "GigabitEthernet0/8/0", + expectedIsIfaceWithIPKey: true, + }, + { + name: "invalid interface name", + key: "vpp/interface//has-IP-address", + expectedIsIfaceWithIPKey: false, + }, + { + name: "missing has-IP-address suffix", + key: "vpp/interface/", + expectedIsIfaceWithIPKey: false, + }, + { + name: "not has-IP-address key", + key: "vpp/interface/memif0/address/192.168.1.12/24", + expectedIsIfaceWithIPKey: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + iface, isInterfaceWithIPKey := ParseInterfaceWithIPKey(test.key) + if isInterfaceWithIPKey != test.expectedIsIfaceWithIPKey { + t.Errorf("expected isInterfaceWithIPKey: %v\tgot: %v", + test.expectedIsIfaceWithIPKey, isInterfaceWithIPKey) + } + if iface != test.expectedIface { + t.Errorf("expected iface: %s\tgot: %s", test.expectedIface, iface) + } + }) + } +} diff --git a/api/models/vpp/l3/keys.go b/api/models/vpp/l3/keys.go index 7a38e6981e..dde4662154 100644 --- a/api/models/vpp/l3/keys.go +++ b/api/models/vpp/l3/keys.go @@ -39,7 +39,10 @@ var ( Type: "route", Version: "v2", }, models.WithNameTemplate( - `vrf/{{.VrfId}}/dst/{{with ipnet .DstNetwork}}{{printf "%s/%d" .IP .MaskSize}}{{end}}/gw/{{.NextHopAddr}}`, + `{{if .OutgoingInterface}}{{printf "if/%s/" .OutgoingInterface}}{{end}}`+ + `vrf/{{.VrfId}}/`+ + `{{with ipnet .DstNetwork}}{{printf "dst/%s/%d/" .IP .MaskSize}}{{end}}`+ + `{{if .NextHopAddr}}gw/{{.NextHopAddr}}{{end}}`, )) ModelProxyARP = models.Register(&ProxyARP{}, models.Spec{ @@ -61,6 +64,14 @@ var ( }, models.WithNameTemplate( `id/{{.Id}}/protocol/{{.Protocol}}`, )) + + ModelDHCPProxy = models.Register(&DHCPProxy{}, models.Spec{ + Module: ModuleName, + Type: "dhcp-proxy", + Version: "v2", + }, models.WithNameTemplate( + `{{ protoip .SourceIpAddress}}`, + )) ) // ProxyARPKey is key for global proxy arp @@ -74,11 +85,12 @@ func IPScanNeighborKey() string { } // RouteKey returns the key used in ETCD to store vpp route for vpp instance. -func RouteKey(vrf uint32, dstNet string, nextHopAddr string) string { +func RouteKey(iface string, vrf uint32, dstNet string, nextHopAddr string) string { return models.Key(&Route{ - VrfId: vrf, - DstNetwork: dstNet, - NextHopAddr: nextHopAddr, + OutgoingInterface: iface, + VrfId: vrf, + DstNetwork: dstNet, + NextHopAddr: nextHopAddr, }) } @@ -98,6 +110,13 @@ func VrfTableKey(id uint32, protocol VrfTable_Protocol) string { }) } +// DHCPProxyKey is key for DHCP proxy +func DHCPProxyKey(srcIP string) string { + return models.Key(&DHCPProxy{ + SourceIpAddress: srcIP, + }) +} + const ( proxyARPInterfacePrefix = "vpp/proxyarp/interface/" proxyARPInterfaceTemplate = proxyARPInterfacePrefix + "{iface}" diff --git a/api/models/vpp/l3/keys_test.go b/api/models/vpp/l3/keys_test.go index f9db781643..3309bbd34e 100644 --- a/api/models/vpp/l3/keys_test.go +++ b/api/models/vpp/l3/keys_test.go @@ -18,80 +18,118 @@ import ( "testing" . "github.com/onsi/gomega" + + "github.com/ligato/vpp-agent/pkg/models" ) -/*func TestRouteKey(t *testing.T) { +func TestRouteKey(t *testing.T) { tests := []struct { name string - vrf uint32 - dstNet string - nextHopAddr string + route Route expectedKey string }{ { - name: "route-ipv4", - vrf: 0, - dstNet: "10.10.0.0/24", - nextHopAddr: "", - expectedKey: "vpp/config/v2/route/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", + "route-ipv4", + Route{ + VrfId: 0, + DstNetwork: "10.10.0.0/24", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", + }, + { + "route-ipv6", + Route{ + VrfId: 0, + DstNetwork: "2001:DB8::0001/32", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst/2001:db8::/32/gw/0.0.0.0", }, { - name: "dst-network-address", - vrf: 0, - dstNet: "10.10.0.255/24", - nextHopAddr: "", - expectedKey: "vpp/config/v2/route/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", + "route-ipv4-interface", + Route{ + VrfId: 0, + DstNetwork: "10.10.0.0/24", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "iface1", + }, + "config/vpp/v2/route/if/iface1/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", }, { - name: "zero-next-hop", - vrf: 0, - dstNet: "10.10.0.1/24", - nextHopAddr: "0.0.0.0", - expectedKey: "vpp/config/v2/route/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", + "route-ipv6-interface", + Route{ + VrfId: 0, + DstNetwork: "2001:DB8::0001/32", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "iface1", + }, + "config/vpp/v2/route/if/iface1/vrf/0/dst/2001:db8::/32/gw/0.0.0.0", }, { - name: "non-zero-vrf", - vrf: 1, - dstNet: "10.10.0.1/24", - nextHopAddr: "0.0.0.0", - expectedKey: "vpp/config/v2/route/vrf/1/dst/10.10.0.0/24/gw/0.0.0.0", + "route-invalid-ip", + Route{ + VrfId: 0, + DstNetwork: "INVALID", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst//0/gw/0.0.0.0", }, { - name: "invalid-dst-net-empty-gw", - dstNet: "INVALID", - expectedKey: "vpp/config/v2/route/vrf/0/dst///gw/", + "route-invalid-gw", + Route{ + VrfId: 0, + DstNetwork: "10.10.10.0/32", + NextHopAddr: "INVALID", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst/10.10.10.0/32/gw/INVALID", }, { - name: "invalid-next-hop", - dstNet: "10.10.0.1/24", - nextHopAddr: "INVALID", - expectedKey: "vpp/config/v2/route/vrf/0/dst/10.10.0.0/24/gw/", + "route-dstnetwork", + Route{ + VrfId: 0, + DstNetwork: "10.10.0.5/24", + NextHopAddr: "0.0.0.0", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst/10.10.0.0/24/gw/0.0.0.0", }, { - name: "invalid-dst-net-valid-gw", - dstNet: "INVALID", - nextHopAddr: "1.2.3.4", - expectedKey: "vpp/config/v2/route/vrf/0/dst///gw/1.2.3.4", + "route-gw-empty", + Route{ + VrfId: 0, + DstNetwork: "10.0.0.0/8", + NextHopAddr: "", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/0/dst/10.0.0.0/8", }, { - name: "route-ipv6", - dstNet: "2001:DB8::0001/32", - nextHopAddr: "", - expectedKey: "vpp/config/v2/route/vrf/0/dst/2001:db8::/32/gw/::", + "route-vrf", + Route{ + VrfId: 3, + DstNetwork: "10.0.0.0/8", + NextHopAddr: "", + OutgoingInterface: "", + }, + "config/vpp/v2/route/vrf/3/dst/10.0.0.0/8", }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - key := RouteKey(test.vrf, test.dstNet, test.nextHopAddr) + key := models.Key(&test.route) if key != test.expectedKey { - t.Errorf("failed for: vrf=%d dstNet=%q nextHop=%q\n"+ + t.Errorf("failed key for route: %+v\n"+ "expected key:\n\t%q\ngot key:\n\t%q", - test.vrf, test.dstNet, test.nextHopAddr, test.expectedKey, key) + test.route, test.expectedKey, key) } }) } } -*/ // TestParseRouteKey test different cases for ParseRouteKey(...) func TestParseRouteKey(t *testing.T) { diff --git a/api/models/vpp/l3/l3.pb.go b/api/models/vpp/l3/l3.pb.go index 703d068cd5..fe454430b4 100644 --- a/api/models/vpp/l3/l3.pb.go +++ b/api/models/vpp/l3/l3.pb.go @@ -275,45 +275,161 @@ func (m *IPScanNeighbor) GetStaleThreshold() uint32 { func (*IPScanNeighbor) XXX_MessageName() string { return "vpp.l3.IPScanNeighbor" } + +type DHCPProxy struct { + SourceIpAddress string `protobuf:"bytes,1,opt,name=source_ip_address,json=sourceIpAddress,proto3" json:"source_ip_address,omitempty"` + RxVrfId uint32 `protobuf:"varint,2,opt,name=rx_vrf_id,json=rxVrfId,proto3" json:"rx_vrf_id,omitempty"` + Servers []*DHCPProxy_DHCPServer `protobuf:"bytes,4,rep,name=servers,proto3" json:"servers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DHCPProxy) Reset() { *m = DHCPProxy{} } +func (m *DHCPProxy) String() string { return proto.CompactTextString(m) } +func (*DHCPProxy) ProtoMessage() {} +func (*DHCPProxy) Descriptor() ([]byte, []int) { + return fileDescriptor_81bc8b784b5befd5, []int{2} +} +func (m *DHCPProxy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DHCPProxy.Unmarshal(m, b) +} +func (m *DHCPProxy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DHCPProxy.Marshal(b, m, deterministic) +} +func (m *DHCPProxy) XXX_Merge(src proto.Message) { + xxx_messageInfo_DHCPProxy.Merge(m, src) +} +func (m *DHCPProxy) XXX_Size() int { + return xxx_messageInfo_DHCPProxy.Size(m) +} +func (m *DHCPProxy) XXX_DiscardUnknown() { + xxx_messageInfo_DHCPProxy.DiscardUnknown(m) +} + +var xxx_messageInfo_DHCPProxy proto.InternalMessageInfo + +func (m *DHCPProxy) GetSourceIpAddress() string { + if m != nil { + return m.SourceIpAddress + } + return "" +} + +func (m *DHCPProxy) GetRxVrfId() uint32 { + if m != nil { + return m.RxVrfId + } + return 0 +} + +func (m *DHCPProxy) GetServers() []*DHCPProxy_DHCPServer { + if m != nil { + return m.Servers + } + return nil +} + +func (*DHCPProxy) XXX_MessageName() string { + return "vpp.l3.DHCPProxy" +} + +type DHCPProxy_DHCPServer struct { + VrfId uint32 `protobuf:"varint,1,opt,name=vrf_id,json=vrfId,proto3" json:"vrf_id,omitempty"` + IpAddress string `protobuf:"bytes,2,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DHCPProxy_DHCPServer) Reset() { *m = DHCPProxy_DHCPServer{} } +func (m *DHCPProxy_DHCPServer) String() string { return proto.CompactTextString(m) } +func (*DHCPProxy_DHCPServer) ProtoMessage() {} +func (*DHCPProxy_DHCPServer) Descriptor() ([]byte, []int) { + return fileDescriptor_81bc8b784b5befd5, []int{2, 0} +} +func (m *DHCPProxy_DHCPServer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DHCPProxy_DHCPServer.Unmarshal(m, b) +} +func (m *DHCPProxy_DHCPServer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DHCPProxy_DHCPServer.Marshal(b, m, deterministic) +} +func (m *DHCPProxy_DHCPServer) XXX_Merge(src proto.Message) { + xxx_messageInfo_DHCPProxy_DHCPServer.Merge(m, src) +} +func (m *DHCPProxy_DHCPServer) XXX_Size() int { + return xxx_messageInfo_DHCPProxy_DHCPServer.Size(m) +} +func (m *DHCPProxy_DHCPServer) XXX_DiscardUnknown() { + xxx_messageInfo_DHCPProxy_DHCPServer.DiscardUnknown(m) +} + +var xxx_messageInfo_DHCPProxy_DHCPServer proto.InternalMessageInfo + +func (m *DHCPProxy_DHCPServer) GetVrfId() uint32 { + if m != nil { + return m.VrfId + } + return 0 +} + +func (m *DHCPProxy_DHCPServer) GetIpAddress() string { + if m != nil { + return m.IpAddress + } + return "" +} + +func (*DHCPProxy_DHCPServer) XXX_MessageName() string { + return "vpp.l3.DHCPProxy.DHCPServer" +} func init() { proto.RegisterEnum("vpp.l3.IPScanNeighbor_Mode", IPScanNeighbor_Mode_name, IPScanNeighbor_Mode_value) proto.RegisterType((*ProxyARP)(nil), "vpp.l3.ProxyARP") proto.RegisterType((*ProxyARP_Interface)(nil), "vpp.l3.ProxyARP.Interface") proto.RegisterType((*ProxyARP_Range)(nil), "vpp.l3.ProxyARP.Range") proto.RegisterType((*IPScanNeighbor)(nil), "vpp.l3.IPScanNeighbor") + proto.RegisterType((*DHCPProxy)(nil), "vpp.l3.DHCPProxy") + proto.RegisterType((*DHCPProxy_DHCPServer)(nil), "vpp.l3.DHCPProxy.DHCPServer") } func init() { proto.RegisterFile("models/vpp/l3/l3.proto", fileDescriptor_81bc8b784b5befd5) } var fileDescriptor_81bc8b784b5befd5 = []byte{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xcd, 0x8a, 0xdb, 0x30, - 0x10, 0x80, 0xeb, 0xc4, 0x1b, 0x92, 0xc9, 0x4f, 0x83, 0x0e, 0x8b, 0x49, 0x69, 0x1b, 0xd2, 0x42, - 0xf7, 0xb2, 0x36, 0xc4, 0x4b, 0x0f, 0xdb, 0x53, 0x42, 0x0a, 0x35, 0x74, 0x5b, 0xe3, 0x4d, 0x2f, - 0xbd, 0x18, 0xc5, 0x56, 0x1c, 0x83, 0x6c, 0x09, 0x59, 0x31, 0xd9, 0x77, 0xea, 0x83, 0xf4, 0x3d, - 0x0a, 0x7d, 0x8e, 0xa2, 0x49, 0x5c, 0x12, 0xf6, 0x36, 0xfa, 0xf4, 0xcd, 0x8c, 0x46, 0x0c, 0x5c, - 0x17, 0x22, 0x65, 0xbc, 0xf2, 0x6a, 0x29, 0x3d, 0xee, 0x7b, 0xdc, 0x77, 0xa5, 0x12, 0x5a, 0x90, - 0x4e, 0x2d, 0xa5, 0xcb, 0xfd, 0xc9, 0x6d, 0x96, 0xeb, 0xdd, 0x7e, 0xe3, 0x26, 0xa2, 0xf0, 0x32, - 0x91, 0x09, 0x0f, 0xaf, 0x37, 0xfb, 0x2d, 0x9e, 0xf0, 0x80, 0xd1, 0x31, 0x6d, 0xf6, 0xd7, 0x82, - 0x6e, 0xa8, 0xc4, 0xe1, 0x69, 0x11, 0x85, 0xe4, 0x1e, 0x20, 0x2f, 0x35, 0x53, 0x5b, 0x9a, 0xb0, - 0xca, 0xb1, 0xa6, 0xed, 0x9b, 0xfe, 0x7c, 0xe2, 0x1e, 0x0b, 0xbb, 0x8d, 0xe5, 0x06, 0x8d, 0x12, - 0x9d, 0xd9, 0xc4, 0x85, 0x8e, 0xa2, 0x65, 0xc6, 0x2a, 0xa7, 0x85, 0x79, 0xd7, 0xcf, 0xf2, 0x22, - 0x73, 0x1d, 0x9d, 0xac, 0xc9, 0x5b, 0xe8, 0xfd, 0x2f, 0x44, 0x08, 0xd8, 0x25, 0x2d, 0x98, 0x63, - 0x4d, 0xad, 0x9b, 0x5e, 0x84, 0xf1, 0xe4, 0x01, 0xae, 0x30, 0x83, 0xcc, 0x60, 0xb8, 0xcd, 0x55, - 0xa5, 0xe3, 0x5c, 0xc6, 0x34, 0x4d, 0xd5, 0xc9, 0xea, 0x23, 0x0c, 0xe4, 0x22, 0x4d, 0x15, 0x99, - 0xc2, 0x80, 0xd3, 0x33, 0xa5, 0x85, 0x0a, 0x18, 0x76, 0x34, 0x66, 0xbf, 0x5a, 0x30, 0x0a, 0xc2, - 0xc7, 0x84, 0x96, 0xdf, 0x58, 0x9e, 0xed, 0x36, 0x42, 0x11, 0x0f, 0x6c, 0xf3, 0x99, 0x58, 0x6f, - 0x34, 0x7f, 0xd5, 0x3c, 0xf8, 0xd2, 0x72, 0x1f, 0x44, 0xca, 0x22, 0x14, 0xc9, 0x3b, 0x18, 0x56, - 0x09, 0x2d, 0x63, 0x1c, 0xbb, 0xa6, 0x1c, 0xdb, 0x0c, 0xa3, 0x81, 0x81, 0xc1, 0x89, 0x99, 0xe7, - 0x16, 0xf4, 0x10, 0x4b, 0x25, 0x92, 0x58, 0xe7, 0x05, 0x73, 0xda, 0x28, 0xf5, 0x0b, 0x7a, 0x08, - 0x95, 0x48, 0xd6, 0x79, 0xc1, 0xc8, 0x6b, 0x00, 0xe3, 0xec, 0x65, 0x4a, 0x35, 0x73, 0x6c, 0x14, - 0x7a, 0x05, 0x3d, 0xfc, 0x40, 0x40, 0xde, 0xc3, 0xa8, 0xe9, 0x13, 0xa7, 0x8c, 0xd3, 0x27, 0xe7, - 0xea, 0xa2, 0xd1, 0xca, 0x30, 0xf2, 0x01, 0x5e, 0x56, 0x9a, 0x72, 0x16, 0xeb, 0x9d, 0x62, 0xd5, - 0x4e, 0xf0, 0xd4, 0xe9, 0xa0, 0x36, 0x42, 0xbc, 0x6e, 0xe8, 0x6c, 0x0e, 0xb6, 0x19, 0x82, 0x0c, - 0xa0, 0xbb, 0x0a, 0x1e, 0x17, 0xcb, 0xaf, 0x9f, 0x57, 0xe3, 0x17, 0xa4, 0x0b, 0x76, 0x10, 0xd6, - 0x77, 0x63, 0xeb, 0x14, 0x7d, 0x1c, 0xb7, 0x4c, 0xb4, 0xfc, 0xbe, 0xfe, 0x32, 0x6e, 0x2f, 0xef, - 0x7f, 0xff, 0x79, 0x63, 0xfd, 0xbc, 0x3b, 0x5b, 0x26, 0x9e, 0x67, 0x54, 0x0b, 0xb3, 0x77, 0xb7, - 0x34, 0x63, 0xa5, 0xf6, 0xa8, 0xcc, 0xbd, 0x8b, 0x65, 0xfc, 0x54, 0x4b, 0x19, 0x73, 0x7f, 0xd3, - 0xc1, 0xd5, 0xf2, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x5c, 0x0c, 0x36, 0xab, 0x02, 0x00, - 0x00, + // 552 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x93, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0x71, 0xea, 0xa6, 0xf5, 0xb4, 0x4d, 0xc3, 0x4a, 0x54, 0x96, 0xa1, 0x50, 0x05, 0x24, + 0x2a, 0xa4, 0xda, 0x52, 0x53, 0xf5, 0x50, 0x4e, 0x0d, 0x41, 0xaa, 0x25, 0x0a, 0x96, 0x13, 0x38, + 0x70, 0xb1, 0x36, 0xf6, 0xc6, 0xb1, 0x64, 0x7b, 0x57, 0xbb, 0x8e, 0xe5, 0xbe, 0x13, 0x0f, 0xc2, + 0x8d, 0x87, 0x40, 0xe2, 0x39, 0x90, 0xc7, 0x76, 0x49, 0xc4, 0x6d, 0xf6, 0x3f, 0xbf, 0xf9, 0xd8, + 0xd9, 0x1d, 0x38, 0xc9, 0x78, 0xc4, 0x52, 0xe5, 0x94, 0x42, 0x38, 0xe9, 0xd8, 0x49, 0xc7, 0xb6, + 0x90, 0xbc, 0xe0, 0xa4, 0x5f, 0x0a, 0x61, 0xa7, 0x63, 0xeb, 0x22, 0x4e, 0x8a, 0xd5, 0x7a, 0x61, + 0x87, 0x3c, 0x73, 0x62, 0x1e, 0x73, 0x07, 0xdd, 0x8b, 0xf5, 0x12, 0x4f, 0x78, 0x40, 0xab, 0x09, + 0x1b, 0xfd, 0xd1, 0x60, 0xdf, 0x93, 0xbc, 0x7a, 0xb8, 0xf5, 0x3d, 0x72, 0x03, 0x90, 0xe4, 0x05, + 0x93, 0x4b, 0x1a, 0x32, 0x65, 0x6a, 0x67, 0x3b, 0xe7, 0x07, 0x97, 0x96, 0xdd, 0x24, 0xb6, 0x3b, + 0xca, 0x76, 0x3b, 0xc4, 0xdf, 0xa0, 0x89, 0x0d, 0x7d, 0x49, 0xf3, 0x98, 0x29, 0xb3, 0x87, 0x71, + 0x27, 0xff, 0xc5, 0xf9, 0xb5, 0xdb, 0x6f, 0x29, 0xeb, 0x15, 0x18, 0x8f, 0x89, 0x08, 0x01, 0x3d, + 0xa7, 0x19, 0x33, 0xb5, 0x33, 0xed, 0xdc, 0xf0, 0xd1, 0xb6, 0xee, 0x61, 0x17, 0x23, 0xc8, 0x08, + 0x8e, 0x96, 0x89, 0x54, 0x45, 0x90, 0x88, 0x80, 0x46, 0x91, 0x6c, 0xa9, 0x03, 0x14, 0x5d, 0x71, + 0x1b, 0x45, 0x92, 0x9c, 0xc1, 0x61, 0x4a, 0x37, 0x90, 0x1e, 0x22, 0x50, 0x6b, 0x0d, 0x31, 0xfa, + 0xd1, 0x83, 0x81, 0xeb, 0xcd, 0x42, 0x9a, 0x7f, 0x66, 0x49, 0xbc, 0x5a, 0x70, 0x49, 0x1c, 0xd0, + 0xeb, 0x61, 0x62, 0xbe, 0xc1, 0xe5, 0xf3, 0xae, 0xe1, 0x6d, 0xca, 0xbe, 0xe7, 0x11, 0xf3, 0x11, + 0x24, 0xaf, 0xe1, 0x48, 0x85, 0x34, 0x0f, 0xf0, 0xda, 0x25, 0x4d, 0xb1, 0xcc, 0x91, 0x7f, 0x58, + 0x8b, 0x6e, 0xab, 0xd5, 0xed, 0x66, 0xb4, 0x0a, 0x84, 0xe4, 0x61, 0x50, 0x24, 0x19, 0x33, 0x77, + 0x10, 0x3a, 0xc8, 0x68, 0xe5, 0x49, 0x1e, 0xce, 0x93, 0x8c, 0x91, 0x53, 0x80, 0x9a, 0x59, 0x8b, + 0x88, 0x16, 0xcc, 0xd4, 0x11, 0x30, 0x32, 0x5a, 0x7d, 0x45, 0x81, 0xbc, 0x81, 0x41, 0x57, 0x27, + 0x88, 0x58, 0x4a, 0x1f, 0xcc, 0xdd, 0xad, 0x42, 0xd3, 0x5a, 0x23, 0x6f, 0xe1, 0x58, 0x15, 0x34, + 0x65, 0x41, 0xb1, 0x92, 0x4c, 0xad, 0x78, 0x1a, 0x99, 0x7d, 0xc4, 0x06, 0x28, 0xcf, 0x3b, 0x75, + 0x74, 0x09, 0x7a, 0x7d, 0x09, 0x72, 0x08, 0xfb, 0x53, 0x77, 0x76, 0x3b, 0xf9, 0xf4, 0x71, 0x3a, + 0x7c, 0x42, 0xf6, 0x41, 0x77, 0xbd, 0xf2, 0x6a, 0xa8, 0xb5, 0xd6, 0xf5, 0xb0, 0x57, 0x5b, 0x93, + 0x2f, 0xf3, 0xbb, 0xe1, 0xce, 0xe8, 0x97, 0x06, 0xc6, 0xf4, 0xee, 0x83, 0x87, 0xaf, 0x47, 0xde, + 0xc1, 0x53, 0xc5, 0xd7, 0x32, 0x64, 0xdd, 0x80, 0x99, 0x52, 0xed, 0x33, 0x1c, 0x37, 0x8e, 0x66, + 0xca, 0x4c, 0x29, 0x62, 0x81, 0x21, 0xab, 0xa0, 0x94, 0xcb, 0x20, 0x89, 0xda, 0x01, 0xed, 0xc9, + 0xea, 0x9b, 0x5c, 0xba, 0x11, 0xb9, 0x86, 0x3d, 0xc5, 0x64, 0xc9, 0xa4, 0x32, 0x75, 0xfc, 0x25, + 0x2f, 0xba, 0xa1, 0x3f, 0xd6, 0x42, 0x6b, 0x86, 0x90, 0xdf, 0xc1, 0xd6, 0x04, 0xe0, 0x9f, 0x4c, + 0x9e, 0x41, 0xbf, 0x4d, 0xaf, 0x61, 0xfa, 0xdd, 0x12, 0x93, 0x9f, 0x02, 0x6c, 0x74, 0xd7, 0xfc, + 0x00, 0x23, 0xe9, 0xfa, 0x9a, 0xdc, 0xfc, 0xfc, 0xfd, 0x52, 0xfb, 0x7e, 0xb5, 0xb1, 0x1e, 0x69, + 0x12, 0xd3, 0x82, 0xd7, 0x9b, 0x74, 0x41, 0x63, 0x96, 0x17, 0x0e, 0x15, 0x89, 0xb3, 0xb5, 0x5e, + 0xef, 0x4b, 0x21, 0x82, 0x74, 0xbc, 0xe8, 0xe3, 0xb2, 0x8c, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, + 0x62, 0xd6, 0xee, 0x67, 0x7d, 0x03, 0x00, 0x00, } diff --git a/api/models/vpp/l3/l3.proto b/api/models/vpp/l3/l3.proto index 4d52ab9c78..0624d10c71 100644 --- a/api/models/vpp/l3/l3.proto +++ b/api/models/vpp/l3/l3.proto @@ -35,3 +35,15 @@ message IPScanNeighbor { uint32 scan_int_delay = 5; uint32 stale_threshold = 6; } + +message DHCPProxy { + + message DHCPServer { + uint32 vrf_id = 1; + string ip_address = 2; + } + + string source_ip_address = 1; + uint32 rx_vrf_id = 2; + repeated DHCPServer servers = 4; +} diff --git a/api/models/vpp/punt/keys.go b/api/models/vpp/punt/keys.go index 4adb0ee71b..a242525776 100644 --- a/api/models/vpp/punt/keys.go +++ b/api/models/vpp/punt/keys.go @@ -22,6 +22,13 @@ import ( const ModuleName = "vpp" var ( + ModelIPRedirect = models.Register(&IPRedirect{}, models.Spec{ + Module: ModuleName, + Type: "ipredirect", + Version: "v2", + }, models.WithNameTemplate( + "l3/{{.L3Protocol}}/tx/{{.TxInterface}}", + )) ModelToHost = models.Register(&ToHost{}, models.Spec{ Module: ModuleName, Type: "tohost", @@ -29,15 +36,23 @@ var ( }, models.WithNameTemplate( "l3/{{.L3Protocol}}/l4/{{.L4Protocol}}/port/{{.Port}}", )) - ModelIPRedirect = models.Register(&IPRedirect{}, models.Spec{ + ModelException = models.Register(&Exception{}, models.Spec{ Module: ModuleName, - Type: "ipredirect", + Type: "exception", Version: "v2", }, models.WithNameTemplate( - "l3/{{.L3Protocol}}/tx/{{.TxInterface}}", + "reason/{{.Reason}}", )) ) +// IPRedirectKey returns key representing IP punt redirect configuration. +func IPRedirectKey(l3Proto L3Protocol, txIf string) string { + return models.Key(&IPRedirect{ + L3Protocol: l3Proto, + TxInterface: txIf, + }) +} + // ToHostKey returns key representing punt to host/socket configuration. func ToHostKey(l3Proto L3Protocol, l4Proto L4Protocol, port uint32) string { return models.Key(&ToHost{ @@ -47,10 +62,8 @@ func ToHostKey(l3Proto L3Protocol, l4Proto L4Protocol, port uint32) string { }) } -// IPRedirectKey returns key representing IP punt redirect configuration. -func IPRedirectKey(l3Proto L3Protocol, txIf string) string { - return models.Key(&IPRedirect{ - L3Protocol: l3Proto, - TxInterface: txIf, +func ExceptionKey(reason string) string { + return models.Key(&Exception{ + Reason: reason, }) } diff --git a/api/models/vpp/punt/punt.pb.go b/api/models/vpp/punt/punt.pb.go index 8322099ffb..f19d0aeffd 100644 --- a/api/models/vpp/punt/punt.pb.go +++ b/api/models/vpp/punt/punt.pb.go @@ -21,6 +21,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +// L3Protocol defines Layer 3 protocols. type L3Protocol int32 const ( @@ -52,6 +53,7 @@ func (L3Protocol) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c6553556423e0b80, []int{0} } +// L4Protocol defines Layer 4 protocols. type L4Protocol int32 const ( @@ -80,16 +82,21 @@ func (L4Protocol) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c6553556423e0b80, []int{1} } -// IPRedirect allows otherwise dropped packet which destination IP address matching some of the VPP addresses -//to redirect to the defined next hop address via the TX interface +// IPRedirect allows otherwise dropped packet which destination IP address +// matching some of the VPP addresses to redirect to the defined next hop address +// via the TX interface. type IPRedirect struct { - L3Protocol L3Protocol `protobuf:"varint,1,opt,name=l3_protocol,json=l3Protocol,proto3,enum=vpp.punt.L3Protocol" json:"l3_protocol,omitempty"` - RxInterface string `protobuf:"bytes,2,opt,name=rx_interface,json=rxInterface,proto3" json:"rx_interface,omitempty"` - TxInterface string `protobuf:"bytes,3,opt,name=tx_interface,json=txInterface,proto3" json:"tx_interface,omitempty"` - NextHop string `protobuf:"bytes,4,opt,name=next_hop,json=nextHop,proto3" json:"next_hop,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // L3 protocol to be redirected + L3Protocol L3Protocol `protobuf:"varint,1,opt,name=l3_protocol,json=l3Protocol,proto3,enum=vpp.punt.L3Protocol" json:"l3_protocol,omitempty"` + // Receive interface name. Optional, only redirect traffic incoming from this interface + RxInterface string `protobuf:"bytes,2,opt,name=rx_interface,json=rxInterface,proto3" json:"rx_interface,omitempty"` + // Transmit interface name + TxInterface string `protobuf:"bytes,3,opt,name=tx_interface,json=txInterface,proto3" json:"tx_interface,omitempty"` + // Next hop IP where the traffic is redirected + NextHop string `protobuf:"bytes,4,opt,name=next_hop,json=nextHop,proto3" json:"next_hop,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *IPRedirect) Reset() { *m = IPRedirect{} } @@ -148,16 +155,25 @@ func (*IPRedirect) XXX_MessageName() string { return "vpp.punt.IPRedirect" } -// allows otherwise dropped packet which destination IP address matching some of the VPP interface IP addresses to be -//punted to the host. L3 and L4 protocols can be used for filtering +// ToHost allows otherwise dropped packet which destination IP address matching +// some of the VPP interface IP addresses to be punted to the host. +// L3 and L4 protocols can be used for filtering */ type ToHost struct { - L3Protocol L3Protocol `protobuf:"varint,2,opt,name=l3_protocol,json=l3Protocol,proto3,enum=vpp.punt.L3Protocol" json:"l3_protocol,omitempty"` - L4Protocol L4Protocol `protobuf:"varint,3,opt,name=l4_protocol,json=l4Protocol,proto3,enum=vpp.punt.L4Protocol" json:"l4_protocol,omitempty"` - Port uint32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` - SocketPath string `protobuf:"bytes,5,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // L3 destination protocol a packet has to match in order to be punted. + L3Protocol L3Protocol `protobuf:"varint,2,opt,name=l3_protocol,json=l3Protocol,proto3,enum=vpp.punt.L3Protocol" json:"l3_protocol,omitempty"` + // L4 destination protocol a packet has to match. + // Currently VPP only supports UDP. + L4Protocol L4Protocol `protobuf:"varint,3,opt,name=l4_protocol,json=l4Protocol,proto3,enum=vpp.punt.L4Protocol" json:"l4_protocol,omitempty"` + // Destination port + Port uint32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + // SocketPath defines path to unix domain socket + // used for punt packets to the host. + // In dumps, it will actually contain the socket + // defined in VPP config under punt section. + SocketPath string `protobuf:"bytes,5,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ToHost) Reset() { *m = ToHost{} } @@ -215,39 +231,156 @@ func (m *ToHost) GetSocketPath() string { func (*ToHost) XXX_MessageName() string { return "vpp.punt.ToHost" } + +// Exception allows specifying punt exceptions used for punting packets. +// The type of exception is defined by reason name. +type Exception struct { + // Name should contain reason name, e.g. `ipsec4-spi-0`. + Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"` + // SocketPath defines path to unix domain socket + // used for punt packets to the host. + // In dumps, it will actually contain the socket + // defined in VPP config under punt section. + SocketPath string `protobuf:"bytes,2,opt,name=socket_path,json=socketPath,proto3" json:"socket_path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Exception) Reset() { *m = Exception{} } +func (m *Exception) String() string { return proto.CompactTextString(m) } +func (*Exception) ProtoMessage() {} +func (*Exception) Descriptor() ([]byte, []int) { + return fileDescriptor_c6553556423e0b80, []int{2} +} +func (m *Exception) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Exception.Unmarshal(m, b) +} +func (m *Exception) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Exception.Marshal(b, m, deterministic) +} +func (m *Exception) XXX_Merge(src proto.Message) { + xxx_messageInfo_Exception.Merge(m, src) +} +func (m *Exception) XXX_Size() int { + return xxx_messageInfo_Exception.Size(m) +} +func (m *Exception) XXX_DiscardUnknown() { + xxx_messageInfo_Exception.DiscardUnknown(m) +} + +var xxx_messageInfo_Exception proto.InternalMessageInfo + +func (m *Exception) GetReason() string { + if m != nil { + return m.Reason + } + return "" +} + +func (m *Exception) GetSocketPath() string { + if m != nil { + return m.SocketPath + } + return "" +} + +func (*Exception) XXX_MessageName() string { + return "vpp.punt.Exception" +} + +// Reason represents punt reason used in exceptions. +// List of known exceptions can be retrieved in VPP CLI +// with following command: +// +// vpp# show punt reasons +// [0] ipsec4-spi-0 from:[ipsec ] +// [1] ipsec6-spi-0 from:[ipsec ] +// [2] ipsec4-spi-o-udp-0 from:[ipsec ] +// [3] ipsec4-no-such-tunnel from:[ipsec ] +// [4] ipsec6-no-such-tunnel from:[ipsec ] +// [5] VXLAN-GBP-no-such-v4-tunnel from:[vxlan-gbp ] +// [6] VXLAN-GBP-no-such-v6-tunnel from:[vxlan-gbp ] +// +type Reason struct { + // Name contains reason name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Reason) Reset() { *m = Reason{} } +func (m *Reason) String() string { return proto.CompactTextString(m) } +func (*Reason) ProtoMessage() {} +func (*Reason) Descriptor() ([]byte, []int) { + return fileDescriptor_c6553556423e0b80, []int{3} +} +func (m *Reason) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Reason.Unmarshal(m, b) +} +func (m *Reason) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Reason.Marshal(b, m, deterministic) +} +func (m *Reason) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reason.Merge(m, src) +} +func (m *Reason) XXX_Size() int { + return xxx_messageInfo_Reason.Size(m) +} +func (m *Reason) XXX_DiscardUnknown() { + xxx_messageInfo_Reason.DiscardUnknown(m) +} + +var xxx_messageInfo_Reason proto.InternalMessageInfo + +func (m *Reason) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (*Reason) XXX_MessageName() string { + return "vpp.punt.Reason" +} func init() { proto.RegisterEnum("vpp.punt.L3Protocol", L3Protocol_name, L3Protocol_value) proto.RegisterEnum("vpp.punt.L4Protocol", L4Protocol_name, L4Protocol_value) proto.RegisterType((*IPRedirect)(nil), "vpp.punt.IPRedirect") proto.RegisterType((*ToHost)(nil), "vpp.punt.ToHost") + proto.RegisterType((*Exception)(nil), "vpp.punt.Exception") + proto.RegisterType((*Reason)(nil), "vpp.punt.Reason") } func init() { proto.RegisterFile("models/vpp/punt/punt.proto", fileDescriptor_c6553556423e0b80) } var fileDescriptor_c6553556423e0b80 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0xa2, 0x50, - 0x14, 0xc6, 0x45, 0x19, 0x75, 0x8e, 0xce, 0x84, 0xb9, 0x99, 0x05, 0xe3, 0x62, 0x6a, 0x5d, 0x19, - 0x13, 0xa1, 0x29, 0xb4, 0x69, 0x62, 0xd2, 0xa4, 0xad, 0x36, 0x92, 0x10, 0x43, 0x88, 0x6e, 0xba, - 0x21, 0x88, 0x57, 0x20, 0x45, 0xee, 0x0d, 0x5e, 0x89, 0x0f, 0xd4, 0x5d, 0x5f, 0xa4, 0xef, 0xd1, - 0x17, 0x69, 0xb8, 0xf8, 0x87, 0xe8, 0xa6, 0x1b, 0xf2, 0x7d, 0xe7, 0x7c, 0x3f, 0xf2, 0x05, 0x0e, - 0xb4, 0x56, 0x64, 0x81, 0xa3, 0xb5, 0x9a, 0x52, 0xaa, 0xd2, 0x4d, 0xcc, 0xf8, 0x43, 0xa1, 0x09, - 0x61, 0x04, 0xd5, 0x53, 0x4a, 0x95, 0xcc, 0xb7, 0xfa, 0x7e, 0xc8, 0x82, 0xcd, 0x5c, 0xf1, 0xc8, - 0x4a, 0xf5, 0x89, 0x4f, 0x54, 0x1e, 0x98, 0x6f, 0x96, 0xdc, 0x71, 0xc3, 0x55, 0x0e, 0x76, 0xde, - 0x04, 0x00, 0xc3, 0xb2, 0xf1, 0x22, 0x4c, 0xb0, 0xc7, 0xd0, 0x0d, 0x34, 0x22, 0xcd, 0xe1, 0x2b, - 0x8f, 0x44, 0xb2, 0xd0, 0x16, 0xba, 0xbf, 0xaf, 0xff, 0x2a, 0xfb, 0xb7, 0x2b, 0xa6, 0x66, 0xed, - 0x76, 0x36, 0x44, 0x07, 0x8d, 0x2e, 0xa1, 0x99, 0x6c, 0x9d, 0x30, 0x66, 0x38, 0x59, 0xba, 0x1e, - 0x96, 0xcb, 0x6d, 0xa1, 0xfb, 0xd3, 0x6e, 0x24, 0x5b, 0x63, 0x3f, 0xca, 0x22, 0xac, 0x18, 0xa9, - 0xe4, 0x11, 0x56, 0x88, 0xfc, 0x83, 0x7a, 0x8c, 0xb7, 0xcc, 0x09, 0x08, 0x95, 0x45, 0xbe, 0xae, - 0x65, 0x7e, 0x4c, 0x68, 0xe7, 0x5d, 0x80, 0xea, 0x94, 0x8c, 0xc9, 0xfa, 0xac, 0x62, 0xf9, 0x9b, - 0x15, 0x33, 0x4c, 0x3f, 0x62, 0x95, 0x33, 0x4c, 0x2f, 0x60, 0x07, 0x8d, 0x10, 0x88, 0x94, 0x24, - 0x8c, 0xf7, 0xf9, 0x65, 0x73, 0x8d, 0x2e, 0xa0, 0xb1, 0x26, 0xde, 0x2b, 0x66, 0x0e, 0x75, 0x59, - 0x20, 0xff, 0xe0, 0x55, 0x21, 0x1f, 0x59, 0x2e, 0x0b, 0x7a, 0x03, 0x80, 0x63, 0x0b, 0x24, 0x41, - 0x73, 0x36, 0x19, 0x8e, 0x9e, 0x8d, 0xc9, 0x68, 0xe8, 0x98, 0x9a, 0x54, 0x42, 0x75, 0x10, 0x0d, - 0x2b, 0xd5, 0x25, 0x71, 0xa7, 0x6e, 0xa5, 0x2a, 0xaa, 0x41, 0xe5, 0xc1, 0x34, 0x25, 0xe8, 0x5d, - 0x01, 0x1c, 0xbb, 0x9c, 0xc0, 0xba, 0x54, 0xca, 0x82, 0xd3, 0x27, 0x2b, 0x27, 0x66, 0x43, 0x4b, - 0xfa, 0xf3, 0x78, 0xff, 0xf1, 0xf9, 0x5f, 0x78, 0xb9, 0x2b, 0xfc, 0xf8, 0x28, 0xf4, 0x5d, 0x46, - 0xb2, 0x4b, 0xe9, 0xbb, 0x3e, 0x8e, 0x99, 0xea, 0xd2, 0x50, 0x3d, 0x39, 0x9f, 0x41, 0x4a, 0xa9, - 0x93, 0x89, 0x79, 0x95, 0x7f, 0x15, 0xed, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x11, 0xab, 0x16, 0x1e, - 0x61, 0x02, 0x00, 0x00, + // 414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xd1, 0x6a, 0x9c, 0x40, + 0x14, 0x8d, 0xbb, 0xd6, 0xec, 0xde, 0x4d, 0x8b, 0x1d, 0x4a, 0xb1, 0xa1, 0xb4, 0xe9, 0x3e, 0x85, + 0x40, 0xb4, 0x54, 0x5b, 0x0a, 0x81, 0x42, 0x5b, 0xb7, 0x44, 0x90, 0x20, 0x92, 0xbc, 0xf4, 0x45, + 0x66, 0xcd, 0x44, 0xa5, 0xae, 0x77, 0xd0, 0x59, 0xf1, 0x83, 0xfa, 0xd6, 0x1f, 0xe9, 0x7f, 0xf4, + 0x47, 0x8a, 0xa3, 0xbb, 0x2b, 0xbb, 0x2f, 0x79, 0x19, 0xce, 0x99, 0x7b, 0xce, 0xe1, 0xcc, 0x70, + 0xe1, 0x74, 0x85, 0xf7, 0x2c, 0xaf, 0xac, 0x9a, 0x73, 0x8b, 0xaf, 0x0b, 0x21, 0x0f, 0x93, 0x97, + 0x28, 0x90, 0x4c, 0x6a, 0xce, 0xcd, 0x96, 0x9f, 0x5e, 0x26, 0x99, 0x48, 0xd7, 0x4b, 0x33, 0xc6, + 0x95, 0x95, 0x60, 0x82, 0x96, 0x14, 0x2c, 0xd7, 0x0f, 0x92, 0x49, 0x22, 0x51, 0x67, 0x9c, 0xff, + 0x56, 0x00, 0xbc, 0x20, 0x64, 0xf7, 0x59, 0xc9, 0x62, 0x41, 0x3e, 0xc2, 0x2c, 0xb7, 0x23, 0x39, + 0x8a, 0x31, 0x37, 0x94, 0x33, 0xe5, 0xfc, 0xd9, 0x87, 0x17, 0xe6, 0x26, 0xdd, 0xf4, 0xed, 0xa0, + 0x9f, 0x85, 0x90, 0x6f, 0x31, 0x79, 0x07, 0x27, 0x65, 0x13, 0x65, 0x85, 0x60, 0xe5, 0x03, 0x8d, + 0x99, 0x31, 0x3a, 0x53, 0xce, 0xa7, 0xe1, 0xac, 0x6c, 0xbc, 0xcd, 0x55, 0x2b, 0x11, 0x43, 0xc9, + 0xb8, 0x93, 0x88, 0x81, 0xe4, 0x15, 0x4c, 0x0a, 0xd6, 0x88, 0x28, 0x45, 0x6e, 0xa8, 0x72, 0x7c, + 0xdc, 0xf2, 0x6b, 0xe4, 0xf3, 0x3f, 0x0a, 0x68, 0xb7, 0x78, 0x8d, 0xd5, 0x41, 0xc5, 0xd1, 0x23, + 0x2b, 0xb6, 0x36, 0x67, 0x67, 0x1b, 0x1f, 0xd8, 0x9c, 0x81, 0x6d, 0x8b, 0x09, 0x01, 0x95, 0x63, + 0x29, 0x64, 0x9f, 0xa7, 0xa1, 0xc4, 0xe4, 0x2d, 0xcc, 0x2a, 0x8c, 0x7f, 0x31, 0x11, 0x71, 0x2a, + 0x52, 0xe3, 0x89, 0xac, 0x0a, 0xdd, 0x55, 0x40, 0x45, 0x3a, 0x77, 0x61, 0xba, 0x68, 0x62, 0xc6, + 0x45, 0x86, 0x05, 0x79, 0x09, 0x5a, 0xc9, 0x68, 0x85, 0x85, 0xfc, 0xcd, 0x69, 0xd8, 0xb3, 0xfd, + 0x94, 0xd1, 0x41, 0xca, 0x6b, 0xd0, 0xc2, 0x4e, 0x4a, 0x40, 0x2d, 0xe8, 0x8a, 0xf5, 0x01, 0x12, + 0x5f, 0x5c, 0x01, 0xec, 0x5e, 0x4a, 0x74, 0x38, 0xb9, 0xbb, 0x71, 0x17, 0x3f, 0xbc, 0x9b, 0x85, + 0x1b, 0xf9, 0xb6, 0x7e, 0x44, 0x26, 0xa0, 0x7a, 0x41, 0xed, 0xe8, 0x6a, 0x8f, 0x3e, 0xe9, 0x1a, + 0x39, 0x86, 0xf1, 0x57, 0xdf, 0xd7, 0xe1, 0xe2, 0x3d, 0xc0, 0xee, 0xbd, 0x7b, 0x66, 0x47, 0x3f, + 0x6a, 0x85, 0xb7, 0xdf, 0x83, 0xce, 0x71, 0xe7, 0x06, 0xfa, 0xf3, 0x6f, 0x5f, 0xfe, 0xfe, 0x7b, + 0xa3, 0xfc, 0xfc, 0x3c, 0x58, 0xae, 0x3c, 0x4b, 0xa8, 0xc0, 0x76, 0x1b, 0x2f, 0x69, 0xc2, 0x0a, + 0x61, 0x51, 0x9e, 0x59, 0x7b, 0x2b, 0x7a, 0x55, 0x73, 0x1e, 0xb5, 0x60, 0xa9, 0xc9, 0x9f, 0xb7, + 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x58, 0x77, 0x1c, 0x31, 0xc5, 0x02, 0x00, 0x00, } diff --git a/api/models/vpp/punt/punt.proto b/api/models/vpp/punt/punt.proto index 44f47c7ee6..ae11cc41dc 100644 --- a/api/models/vpp/punt/punt.proto +++ b/api/models/vpp/punt/punt.proto @@ -7,6 +7,7 @@ option go_package = "github.com/ligato/vpp-agent/api/models/vpp/punt;vpp_punt"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.messagename_all) = true; +// L3Protocol defines Layer 3 protocols. enum L3Protocol { UNDEFINED_L3 = 0; IPv4 = 4; @@ -14,27 +15,73 @@ enum L3Protocol { ALL = 10; } +// L4Protocol defines Layer 4 protocols. enum L4Protocol { UNDEFINED_L4 = 0; TCP = 6; UDP = 17; } -/* IPRedirect allows otherwise dropped packet which destination IP address matching some of the VPP addresses -to redirect to the defined next hop address via the TX interface */ +// IPRedirect allows otherwise dropped packet which destination IP address +// matching some of the VPP addresses to redirect to the defined next hop address +// via the TX interface. message IPRedirect { - L3Protocol l3_protocol = 1; /* L3 protocol */ - string rx_interface = 2; /* Receive interface name. Optional, only redirect traffic incoming from this interface */ - string tx_interface = 3; /* Transmit interface name */ - string next_hop = 4; /* Next hop IP where the traffic is redirected */ + // L3 protocol to be redirected + L3Protocol l3_protocol = 1; + // Receive interface name. Optional, only redirect traffic incoming from this interface + string rx_interface = 2; + // Transmit interface name + string tx_interface = 3; + // Next hop IP where the traffic is redirected + string next_hop = 4; } -/* allows otherwise dropped packet which destination IP address matching some of the VPP interface IP addresses to be -punted to the host. L3 and L4 protocols can be used for filtering */ +// ToHost allows otherwise dropped packet which destination IP address matching +// some of the VPP interface IP addresses to be punted to the host. +// L3 and L4 protocols can be used for filtering */ message ToHost { - L3Protocol l3_protocol = 2; /* L3 destination protocol a packet has to match in order to be punted */ - L4Protocol l4_protocol = 3; /* L4 destination protocol a packet has to match. Currently VPP only supports UDP */ - uint32 port = 4; /* Destination port */ + // L3 destination protocol a packet has to match in order to be punted. + L3Protocol l3_protocol = 2; + // L4 destination protocol a packet has to match. + // Currently VPP only supports UDP. + L4Protocol l4_protocol = 3; + // Destination port + uint32 port = 4; - string socket_path = 5; /* Optional, use unix domain socket to punt packets to the host. */ + // SocketPath defines path to unix domain socket + // used for punt packets to the host. + // In dumps, it will actually contain the socket + // defined in VPP config under punt section. + string socket_path = 5; +} + +// Exception allows specifying punt exceptions used for punting packets. +// The type of exception is defined by reason name. +message Exception { + // Name should contain reason name, e.g. `ipsec4-spi-0`. + string reason = 1; + + // SocketPath defines path to unix domain socket + // used for punt packets to the host. + // In dumps, it will actually contain the socket + // defined in VPP config under punt section. + string socket_path = 2; +} + +// Reason represents punt reason used in exceptions. +// List of known exceptions can be retrieved in VPP CLI +// with following command: +// +// vpp# show punt reasons +// [0] ipsec4-spi-0 from:[ipsec ] +// [1] ipsec6-spi-0 from:[ipsec ] +// [2] ipsec4-spi-o-udp-0 from:[ipsec ] +// [3] ipsec4-no-such-tunnel from:[ipsec ] +// [4] ipsec6-no-such-tunnel from:[ipsec ] +// [5] VXLAN-GBP-no-such-v4-tunnel from:[vxlan-gbp ] +// [6] VXLAN-GBP-no-such-v6-tunnel from:[vxlan-gbp ] +// +message Reason { + // Name contains reason name. + string name = 1; } diff --git a/api/models/vpp/vpp.pb.go b/api/models/vpp/vpp.pb.go index 4a6649fe02..b6c9f9ed72 100644 --- a/api/models/vpp/vpp.pb.go +++ b/api/models/vpp/vpp.pb.go @@ -45,6 +45,7 @@ type ConfigData struct { IpsecSas []*ipsec.SecurityAssociation `protobuf:"bytes,61,rep,name=ipsec_sas,json=ipsecSas,proto3" json:"ipsec_sas,omitempty"` PuntIpredirects []*punt.IPRedirect `protobuf:"bytes,70,rep,name=punt_ipredirects,json=puntIpredirects,proto3" json:"punt_ipredirects,omitempty"` PuntTohosts []*punt.ToHost `protobuf:"bytes,71,rep,name=punt_tohosts,json=puntTohosts,proto3" json:"punt_tohosts,omitempty"` + PuntExceptions []*punt.Exception `protobuf:"bytes,72,rep,name=punt_exceptions,json=puntExceptions,proto3" json:"punt_exceptions,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -186,6 +187,13 @@ func (m *ConfigData) GetPuntTohosts() []*punt.ToHost { return nil } +func (m *ConfigData) GetPuntExceptions() []*punt.Exception { + if m != nil { + return m.PuntExceptions + } + return nil +} + type Notification struct { Interface *interfaces.InterfaceNotification `protobuf:"bytes,1,opt,name=interface,proto3" json:"interface,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -232,47 +240,49 @@ func init() { func init() { proto.RegisterFile("models/vpp/vpp.proto", fileDescriptor_60d3c66428a08eaa) } var fileDescriptor_60d3c66428a08eaa = []byte{ - // 666 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x6d, 0x4b, 0x1c, 0x3b, - 0x14, 0xc7, 0x11, 0xc5, 0xeb, 0xc6, 0xf5, 0x81, 0xe0, 0xf5, 0x46, 0xb9, 0xd8, 0x55, 0x2a, 0x68, - 0x8b, 0xb3, 0x65, 0x57, 0x28, 0xc5, 0x16, 0xbb, 0xbb, 0x56, 0xbb, 0x50, 0x64, 0xc9, 0xfa, 0xa2, - 0xf4, 0xcd, 0x90, 0xc9, 0x3c, 0x18, 0x18, 0x93, 0x90, 0x64, 0xc5, 0xfd, 0x78, 0xfd, 0x66, 0x25, - 0x67, 0x66, 0x9c, 0x59, 0xd8, 0xbe, 0xc8, 0x30, 0x27, 0xbf, 0xff, 0xff, 0x4c, 0xe6, 0x9c, 0x1c, - 0xb4, 0xf7, 0xa4, 0xe2, 0x24, 0xb7, 0xdd, 0x67, 0xad, 0xfd, 0x0a, 0xb4, 0x51, 0x4e, 0xe1, 0xd5, - 0x67, 0xad, 0x0f, 0x49, 0x03, 0xb1, 0x28, 0xf5, 0xab, 0xc0, 0x8b, 0x84, 0xe7, 0x7e, 0x95, 0xe4, - 0xb4, 0x41, 0x84, 0x74, 0x89, 0x49, 0x19, 0x4f, 0x6c, 0xfd, 0x5a, 0xca, 0x8e, 0x97, 0xcb, 0xac, - 0x63, 0xae, 0x92, 0xfc, 0xdf, 0x94, 0x68, 0x9b, 0xf0, 0xe2, 0xb9, 0x24, 0x41, 0xde, 0xeb, 0x46, - 0x46, 0xc4, 0x59, 0x72, 0x11, 0xab, 0x27, 0x26, 0x64, 0x29, 0xf9, 0x6f, 0x51, 0x92, 0x8a, 0x68, - 0x49, 0xe6, 0xbc, 0xd7, 0x7d, 0xe1, 0x4a, 0xca, 0x84, 0xbb, 0x65, 0xb6, 0x7e, 0x97, 0x99, 0xb2, - 0x26, 0x87, 0xfb, 0x8b, 0x20, 0xef, 0x97, 0xfb, 0x07, 0x8b, 0xfb, 0x46, 0xcd, 0x5e, 0xff, 0xa1, - 0x59, 0x27, 0xc9, 0x9c, 0x5f, 0x25, 0x39, 0x6c, 0x10, 0x3d, 0x93, 0x0e, 0x1e, 0x05, 0x3b, 0xf9, - 0xbd, 0x8e, 0xd0, 0x48, 0xc9, 0x54, 0x64, 0x37, 0xcc, 0x31, 0xfc, 0x09, 0xa1, 0xba, 0x44, 0x04, - 0x75, 0x56, 0xcf, 0x36, 0x7b, 0x07, 0x81, 0xef, 0x55, 0xbd, 0x1d, 0x8c, 0xab, 0x57, 0xda, 0x10, - 0xe3, 0x0e, 0x5a, 0x63, 0x3c, 0xb7, 0x64, 0x0f, 0x4c, 0x6d, 0x30, 0xf9, 0x5e, 0x0d, 0x46, 0x3f, - 0x28, 0x10, 0x50, 0x44, 0xa9, 0x25, 0xff, 0x36, 0x15, 0x51, 0x1a, 0x0c, 0x86, 0xb7, 0x14, 0x08, - 0xbe, 0x42, 0xdb, 0x45, 0x75, 0xc3, 0xa2, 0xba, 0x96, 0x1c, 0x81, 0x76, 0x0f, 0xb4, 0x79, 0x2f, - 0x18, 0x02, 0xbd, 0x01, 0x48, 0xb7, 0xa2, 0x46, 0x64, 0xf1, 0x5b, 0xb4, 0x96, 0x8a, 0xc8, 0x92, - 0x37, 0x60, 0xd9, 0xad, 0x2c, 0xb7, 0xe3, 0xe1, 0x37, 0xe9, 0xcc, 0x9c, 0x02, 0xf5, 0x9f, 0xa8, - 0x9a, 0x10, 0x6a, 0x26, 0x8c, 0x25, 0x9d, 0xc5, 0x4f, 0xfc, 0x1c, 0x15, 0x74, 0xc2, 0x84, 0xa1, - 0x5b, 0x95, 0xd6, 0x47, 0x16, 0x9f, 0xa2, 0x75, 0x28, 0xb9, 0x25, 0x67, 0x60, 0xda, 0x2a, 0x4c, - 0xfd, 0x80, 0xfa, 0x5d, 0x5a, 0x42, 0x7f, 0x12, 0x66, 0xb4, 0x25, 0xe7, 0xcd, 0x93, 0xf4, 0x83, - 0x01, 0x9d, 0x94, 0x27, 0xf1, 0x14, 0x5f, 0xa0, 0x96, 0x36, 0xea, 0x65, 0x1e, 0x32, 0xa3, 0xc9, - 0xbb, 0xce, 0x4a, 0x53, 0x3a, 0xf1, 0x60, 0x40, 0x27, 0x74, 0x03, 0x24, 0x03, 0xa3, 0xf1, 0x35, - 0xda, 0x11, 0xda, 0x72, 0x26, 0x43, 0x99, 0x88, 0xec, 0x31, 0x52, 0x86, 0xbc, 0x07, 0xd3, 0x7e, - 0x65, 0x1a, 0x4f, 0xa6, 0x9c, 0xc9, 0xfb, 0x92, 0xd2, 0xed, 0x42, 0x5e, 0xc5, 0xf8, 0x23, 0x6a, - 0x4b, 0xe6, 0x2e, 0x2f, 0xc3, 0x2c, 0x57, 0x11, 0xcb, 0x49, 0x0f, 0xdc, 0xc5, 0x7f, 0xfb, 0xcb, - 0x72, 0xef, 0xe1, 0x1d, 0x30, 0xba, 0x29, 0xeb, 0x00, 0x9f, 0xa3, 0x7f, 0x62, 0x88, 0x2d, 0xe9, - 0xc3, 0x1f, 0xed, 0xbc, 0x7a, 0x6e, 0xc0, 0x44, 0x2b, 0x8e, 0xbf, 0x22, 0x04, 0x93, 0x13, 0x5a, - 0x1d, 0x5b, 0xf2, 0x19, 0xd4, 0xc7, 0xc5, 0xfd, 0x81, 0x81, 0x9a, 0x26, 0x7c, 0x66, 0x84, 0x9b, - 0x4f, 0x54, 0x2e, 0xf8, 0xdc, 0x5f, 0xb9, 0x88, 0xd9, 0x84, 0xb6, 0x80, 0x4e, 0x75, 0xec, 0xfb, - 0xd3, 0x2a, 0x33, 0x30, 0x4b, 0xbe, 0x40, 0x82, 0xa3, 0x25, 0x09, 0x06, 0xd6, 0x2a, 0x2e, 0x98, - 0x13, 0x4a, 0xd2, 0x8d, 0xc2, 0xcd, 0x2c, 0xbe, 0x46, 0xbb, 0xfe, 0x6e, 0x87, 0x42, 0x9b, 0x24, - 0x16, 0x26, 0xe1, 0xce, 0x92, 0xdb, 0x46, 0x7b, 0xe1, 0xe2, 0x8f, 0x27, 0xb4, 0x84, 0x74, 0xc7, - 0x6f, 0x8c, 0x6b, 0x31, 0xee, 0xa3, 0x36, 0x24, 0x70, 0xea, 0x51, 0x59, 0x67, 0xc9, 0x5d, 0xa3, - 0x83, 0x60, 0x7e, 0x50, 0xdf, 0x95, 0x75, 0x74, 0xd3, 0x07, 0x0f, 0x85, 0xe8, 0x64, 0x8a, 0xda, - 0xf7, 0xca, 0x89, 0x54, 0x70, 0x38, 0x0f, 0x1e, 0xa1, 0xd6, 0xeb, 0x5c, 0x90, 0x15, 0xa8, 0xf2, - 0xe9, 0x5f, 0x67, 0xa8, 0xe9, 0xa4, 0xb5, 0x6f, 0xf8, 0xe1, 0x57, 0x90, 0x09, 0xf7, 0x38, 0x8b, - 0x02, 0xae, 0x9e, 0xba, 0xb9, 0xc8, 0x98, 0x53, 0x7e, 0x82, 0x2f, 0x58, 0x96, 0x48, 0xd7, 0x65, - 0x5a, 0x74, 0xeb, 0xb1, 0xbe, 0x7a, 0xd6, 0x3a, 0x5a, 0x87, 0x89, 0xee, 0xff, 0x09, 0x00, 0x00, - 0xff, 0xff, 0xe2, 0x4d, 0x26, 0xe0, 0x66, 0x05, 0x00, 0x00, + // 689 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xef, 0x4b, 0x1b, 0x31, + 0x18, 0xc7, 0x11, 0xc5, 0xd9, 0x58, 0x7f, 0x90, 0x39, 0x17, 0x65, 0xb8, 0x2a, 0x13, 0x74, 0xc3, + 0xeb, 0x68, 0x85, 0x31, 0x74, 0xb8, 0xb6, 0xfe, 0x2a, 0x0c, 0x29, 0xa9, 0x2f, 0xc6, 0xde, 0x1c, + 0xb9, 0xf4, 0xae, 0x06, 0xce, 0x24, 0x24, 0xa9, 0xd8, 0xbf, 0x7e, 0x23, 0xcf, 0xdd, 0xf5, 0xae, + 0xd0, 0xbd, 0xc8, 0x71, 0x4f, 0x3e, 0xdf, 0xef, 0x73, 0xc9, 0xf3, 0x24, 0x87, 0x76, 0x9e, 0xd5, + 0x28, 0x4e, 0x6d, 0xf3, 0x45, 0x6b, 0x3f, 0x02, 0x6d, 0x94, 0x53, 0x78, 0xf9, 0x45, 0xeb, 0x7d, + 0x52, 0x41, 0x2c, 0x4a, 0xfc, 0xc8, 0xf0, 0x3c, 0xe1, 0xa9, 0x1f, 0x39, 0x39, 0xae, 0x10, 0x21, + 0x5d, 0x6c, 0x12, 0xc6, 0x63, 0x5b, 0xbe, 0xe6, 0xb2, 0xc3, 0xc5, 0x32, 0xeb, 0x98, 0x2b, 0x24, + 0x1f, 0xaa, 0x12, 0x6d, 0x63, 0x9e, 0x3d, 0x17, 0x24, 0x48, 0x5b, 0xcd, 0xc8, 0x88, 0xd1, 0x38, + 0x3e, 0x1b, 0xa9, 0x67, 0x26, 0x64, 0x2e, 0x79, 0x3f, 0x2f, 0x49, 0x44, 0xb4, 0x20, 0x73, 0xda, + 0x6a, 0xbe, 0x72, 0x25, 0x65, 0xcc, 0xdd, 0x22, 0x5b, 0xbb, 0xc9, 0x4c, 0x5e, 0x93, 0xfd, 0xdd, + 0x79, 0x90, 0xb6, 0xf3, 0xf9, 0xbd, 0xf9, 0x79, 0xa3, 0x26, 0xb3, 0x3d, 0x54, 0xeb, 0x24, 0x99, + 0xf3, 0x23, 0x27, 0xfb, 0x15, 0xa2, 0x27, 0xd2, 0xc1, 0x23, 0x63, 0x47, 0x7f, 0x57, 0x11, 0xea, + 0x29, 0x99, 0x88, 0xf1, 0x35, 0x73, 0x0c, 0x7f, 0x47, 0xa8, 0x2c, 0x11, 0x41, 0x8d, 0xe5, 0x93, + 0xf5, 0xd6, 0x5e, 0xe0, 0x7b, 0x55, 0x4e, 0x07, 0xfd, 0xe2, 0x95, 0x56, 0xc4, 0xb8, 0x81, 0x56, + 0x18, 0x4f, 0x2d, 0xd9, 0x01, 0x53, 0x1d, 0x4c, 0xbe, 0x57, 0x9d, 0xde, 0x2f, 0x0a, 0x04, 0x14, + 0x51, 0x62, 0xc9, 0xbb, 0xaa, 0x22, 0x4a, 0x82, 0x4e, 0xf7, 0x96, 0x02, 0xc1, 0x17, 0x68, 0x33, + 0xab, 0x6e, 0x98, 0x55, 0xd7, 0x92, 0x03, 0xd0, 0xee, 0x80, 0x36, 0x6d, 0x05, 0x5d, 0xa0, 0xd7, + 0x00, 0xe9, 0x46, 0x54, 0x89, 0x2c, 0xfe, 0x84, 0x56, 0x12, 0x11, 0x59, 0xf2, 0x11, 0x2c, 0xdb, + 0x85, 0xe5, 0xb6, 0xdf, 0xbd, 0x91, 0xce, 0x4c, 0x29, 0x50, 0xff, 0x89, 0xa2, 0x09, 0xa1, 0x66, + 0xc2, 0x58, 0xd2, 0x98, 0xff, 0xc4, 0xef, 0x5e, 0x46, 0x07, 0x4c, 0x18, 0xba, 0x51, 0x68, 0x7d, + 0x64, 0xf1, 0x31, 0x5a, 0x85, 0x92, 0x5b, 0x72, 0x02, 0xa6, 0x8d, 0xcc, 0xd4, 0x0e, 0xa8, 0x9f, + 0xa5, 0x39, 0xf4, 0x2b, 0x61, 0x46, 0x5b, 0x72, 0x5a, 0x5d, 0x49, 0x3b, 0xe8, 0xd0, 0x41, 0xbe, + 0x12, 0x4f, 0xf1, 0x19, 0xaa, 0x69, 0xa3, 0x5e, 0xa7, 0x21, 0x33, 0x9a, 0x7c, 0x6e, 0x2c, 0x55, + 0xa5, 0x03, 0x0f, 0x3a, 0x74, 0x40, 0xd7, 0x40, 0xd2, 0x31, 0x1a, 0x5f, 0xa1, 0x2d, 0xa1, 0x2d, + 0x67, 0x32, 0x94, 0xb1, 0x18, 0x3f, 0x45, 0xca, 0x90, 0x2f, 0x60, 0xda, 0x2d, 0x4c, 0xfd, 0xc1, + 0x90, 0x33, 0xf9, 0x90, 0x53, 0xba, 0x99, 0xc9, 0x8b, 0x18, 0x7f, 0x43, 0x75, 0xc9, 0xdc, 0xf9, + 0x79, 0x38, 0x4e, 0x55, 0xc4, 0x52, 0xd2, 0x02, 0x77, 0xb6, 0x6f, 0x7f, 0x58, 0x1e, 0x3c, 0xbc, + 0x03, 0x46, 0xd7, 0x65, 0x19, 0xe0, 0x53, 0xf4, 0x66, 0x04, 0xb1, 0x25, 0x6d, 0xd8, 0xd1, 0xd6, + 0xcc, 0x73, 0x0d, 0x26, 0x5a, 0x70, 0xfc, 0x13, 0x21, 0xb8, 0x39, 0xa1, 0xd5, 0x23, 0x4b, 0x2e, + 0x41, 0x7d, 0x98, 0x9d, 0x1f, 0xb8, 0x50, 0xc3, 0x98, 0x4f, 0x8c, 0x70, 0xd3, 0x81, 0x4a, 0x05, + 0x9f, 0xfa, 0x23, 0x17, 0x31, 0x1b, 0xd3, 0x1a, 0xd0, 0xa1, 0x1e, 0xf9, 0xfe, 0xd4, 0xf2, 0x0c, + 0xcc, 0x92, 0x1f, 0x90, 0xe0, 0x60, 0x41, 0x82, 0x8e, 0xb5, 0x8a, 0x0b, 0xe6, 0x84, 0x92, 0x74, + 0x2d, 0x73, 0x33, 0x8b, 0xaf, 0xd0, 0xb6, 0x3f, 0xdb, 0xa1, 0xd0, 0x26, 0x1e, 0x09, 0x13, 0x73, + 0x67, 0xc9, 0x6d, 0xa5, 0xbd, 0x70, 0xf0, 0xfb, 0x03, 0x9a, 0x43, 0xba, 0xe5, 0x27, 0xfa, 0xa5, + 0x18, 0xb7, 0x51, 0x1d, 0x12, 0x38, 0xf5, 0xa4, 0xac, 0xb3, 0xe4, 0xae, 0xd2, 0x41, 0x30, 0x3f, + 0xaa, 0x7b, 0x65, 0x1d, 0x5d, 0xf7, 0xc1, 0x63, 0x26, 0xc2, 0x97, 0x08, 0xf2, 0x84, 0xf1, 0x2b, + 0x8f, 0xb5, 0x5f, 0x91, 0x25, 0xf7, 0xe0, 0x7b, 0x5b, 0xfa, 0x6e, 0x0a, 0x46, 0x37, 0x7d, 0x3c, + 0x0b, 0xed, 0xd1, 0x10, 0xd5, 0x1f, 0x94, 0x13, 0x89, 0xe0, 0xb0, 0x1b, 0xdc, 0x43, 0xb5, 0xd9, + 0xad, 0x22, 0x4b, 0xd0, 0xa3, 0xe3, 0xff, 0xde, 0xc0, 0xaa, 0x93, 0x96, 0xbe, 0xee, 0xd7, 0x3f, + 0xc1, 0x58, 0xb8, 0xa7, 0x49, 0x14, 0x70, 0xf5, 0xdc, 0x4c, 0xc5, 0x98, 0x39, 0xe5, 0xef, 0xff, + 0x19, 0x1b, 0xc7, 0xd2, 0x35, 0x99, 0x16, 0xcd, 0xf2, 0xa7, 0x70, 0xf1, 0xa2, 0x75, 0xb4, 0x0a, + 0xff, 0x83, 0xf6, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x3e, 0x69, 0x57, 0xa4, 0x05, 0x00, + 0x00, } diff --git a/api/models/vpp/vpp.proto b/api/models/vpp/vpp.proto index 7976ba5bba..ae4c6e99ce 100644 --- a/api/models/vpp/vpp.proto +++ b/api/models/vpp/vpp.proto @@ -41,6 +41,7 @@ message ConfigData { repeated punt.IPRedirect punt_ipredirects = 70; repeated punt.ToHost punt_tohosts = 71; + repeated punt.Exception punt_exceptions = 72; } message Notification { diff --git a/client/client_api.go b/client/client_api.go index 30ad1a7b0f..8320cd7bae 100644 --- a/client/client_api.go +++ b/client/client_api.go @@ -1,16 +1,35 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package client import ( "context" "github.com/gogo/protobuf/proto" + api "github.com/ligato/vpp-agent/api/genericmanager" ) +type ModelInfo = api.ModelInfo + +type StateItem = api.StateItem + // ConfigClient defines the client-side interface for config. type ConfigClient interface { // KnownModels retrieves list of known modules. - KnownModels() ([]api.ModelInfo, error) + KnownModels() ([]ModelInfo, error) // ChangeRequest returns transaction for changing config. ChangeRequest() ChangeRequest @@ -19,7 +38,11 @@ type ConfigClient interface { ResyncConfig(items ...proto.Message) error // GetConfig retrieves current config into dsts. + // TODO: return as list of config items GetConfig(dsts ...interface{}) error + + // DumpState dumps actual running state. + DumpState() ([]*StateItem, error) } // ChangeRequest is interface for config change request. diff --git a/client/local_client.go b/client/local_client.go index f06ec43988..b07a432577 100644 --- a/client/local_client.go +++ b/client/local_client.go @@ -61,10 +61,15 @@ func (c *client) ResyncConfig(items ...proto.Message) error { } func (c *client) GetConfig(dsts ...interface{}) error { - + // TODO: use dispatcher to get config return nil } +func (c *client) DumpState() ([]*api.StateItem, error) { + // TODO: use dispatcher to dump state + return nil, nil +} + func (c *client) ChangeRequest() ChangeRequest { return &changeRequest{txn: c.txnFactory.NewTxn(false)} } diff --git a/client/remoteclient/grpc_client.go b/client/remoteclient/grpc_client.go index 786e4c441e..6e1c4f13d4 100644 --- a/client/remoteclient/grpc_client.go +++ b/client/remoteclient/grpc_client.go @@ -71,7 +71,14 @@ func (c *grpcClient) GetConfig(dsts ...interface{}) error { return err } - fmt.Printf("GetConfig: %+v\n", resp) + fmt.Printf("grpcClient.GetConfig: received %d items\n", len(resp.Items)) + tm := proto.TextMarshaler{ + Compact: true, + ExpandAny: true, + } + for _, item := range resp.Items { + fmt.Printf(" - %v\n", tm.Text(item)) + } protos := map[string]proto.Message{} for _, item := range resp.Items { @@ -97,6 +104,26 @@ func (c *grpcClient) GetConfig(dsts ...interface{}) error { return nil } +func (c *grpcClient) DumpState() ([]*client.StateItem, error) { + ctx := context.Background() + + resp, err := c.remote.DumpState(ctx, &api.DumpStateRequest{}) + if err != nil { + return nil, err + } + + /*lfmt.Printf("grpcClient.DumpState: received %d items\n", len(resp.States)) + tm := proto.TextMarshaler{ + Compact: true, + ExpandAny: true, + } + for _, item := range resp.States { + fmt.Printf(" - %v\n", tm.Text(item)) + }*/ + + return resp.GetItems(), nil +} + type setConfigRequest struct { client api.GenericManagerClient req *api.SetConfigRequest @@ -127,15 +154,10 @@ func (r *setConfigRequest) Delete(items ...proto.Message) client.ChangeRequest { for _, protoModel := range items { item, err := models.MarshalItem(protoModel) if err != nil { - if err != nil { - r.err = err - return r - } + r.err = err + return r } r.req.Updates = append(r.req.Updates, &api.UpdateItem{ - /*Item: &api.Item{ - Key: item.Key, - },*/ Item: item, }) } diff --git a/clientv2/linux/data_change_api.go b/clientv2/linux/data_change_api.go index c119fb532f..43e8e50e44 100644 --- a/clientv2/linux/data_change_api.go +++ b/clientv2/linux/data_change_api.go @@ -15,8 +15,8 @@ package linuxclient import ( - "github.com/ligato/vpp-agent/api/models/linux/interfaces" - "github.com/ligato/vpp-agent/api/models/linux/l3" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" vpp_acl "github.com/ligato/vpp-agent/api/models/vpp/acl" vpp_interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" @@ -112,6 +112,8 @@ type PutDSL interface { PuntIPRedirect(val *punt.IPRedirect) PutDSL // PuntToHost adds request to create or update rule to punt L4 traffic to a host. PuntToHost(val *punt.ToHost) PutDSL + // PuntException adds request to create or update exception to punt specific packets. + PuntException(val *punt.Exception) PutDSL // Delete changes the DSL mode to allow removing an existing configuration. // See documentation for DataChangeDSL.Delete(). @@ -157,7 +159,7 @@ type DeleteDSL interface { // XConnect adds a request to delete an existing VPP Cross Connect. XConnect(rxIfaceName string) DeleteDSL // StaticRoute adds a request to delete an existing VPP L3 Static Route. - StaticRoute(vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL + StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL /*// L4Features adds a request to enable or disable L4 features L4Features() DeleteDSL // AppNamespace adds a request to delete VPP Application namespace @@ -183,6 +185,8 @@ type DeleteDSL interface { PuntIPRedirect(l3Proto punt.L3Protocol, txInterface string) DeleteDSL // PuntToHost adds request to delete a rule used to punt L4 traffic to a host. PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protocol, port uint32) DeleteDSL + // PuntException adds request to delete exception to punt specific packets. + PuntException(reason string) DeleteDSL // Put changes the DSL mode to allow configuration editing. // See documentation for DataChangeDSL.Put(). diff --git a/clientv2/linux/data_resync_api.go b/clientv2/linux/data_resync_api.go index b2fb035563..620a8a44a5 100644 --- a/clientv2/linux/data_resync_api.go +++ b/clientv2/linux/data_resync_api.go @@ -15,8 +15,8 @@ package linuxclient import ( - "github.com/ligato/vpp-agent/api/models/linux/interfaces" - "github.com/ligato/vpp-agent/api/models/linux/l3" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" vpp_acl "github.com/ligato/vpp-agent/api/models/vpp/acl" vpp_interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" @@ -92,6 +92,8 @@ type DataResyncDSL interface { PuntIPRedirect(val *punt.IPRedirect) DataResyncDSL // PuntToHost adds request to RESYNC a rule used to punt L4 traffic to a host. PuntToHost(val *punt.ToHost) DataResyncDSL + // PuntException adds request to create or update exception to punt specific packets. + PuntException(val *punt.Exception) DataResyncDSL // Send propagates the RESYNC request to the plugins. Send() vpp_clientv2.Reply diff --git a/clientv2/linux/dbadapter/data_change_db.go b/clientv2/linux/dbadapter/data_change_db.go index 3c3d5f40c4..a2d9e7f329 100644 --- a/clientv2/linux/dbadapter/data_change_db.go +++ b/clientv2/linux/dbadapter/data_change_db.go @@ -17,8 +17,8 @@ package dbadapter import ( "github.com/ligato/cn-infra/db/keyval" - "github.com/ligato/vpp-agent/api/models/linux/interfaces" - "github.com/ligato/vpp-agent/api/models/linux/l3" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" abf "github.com/ligato/vpp-agent/api/models/vpp/abf" acl "github.com/ligato/vpp-agent/api/models/vpp/acl" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" @@ -28,9 +28,10 @@ import ( nat "github.com/ligato/vpp-agent/api/models/vpp/nat" punt "github.com/ligato/vpp-agent/api/models/vpp/punt" stn "github.com/ligato/vpp-agent/api/models/vpp/stn" - "github.com/ligato/vpp-agent/clientv2/linux" - "github.com/ligato/vpp-agent/clientv2/vpp" + linuxclient "github.com/ligato/vpp-agent/clientv2/linux" + vppclient "github.com/ligato/vpp-agent/clientv2/vpp" "github.com/ligato/vpp-agent/clientv2/vpp/dbadapter" + "github.com/ligato/vpp-agent/pkg/models" ) // NewDataChangeDSL returns a new instance of DataChangeDSL which implements @@ -237,6 +238,12 @@ func (dsl *PutDSL) PuntToHost(val *punt.ToHost) linuxclient.PutDSL { return dsl } +// PuntException adds request to create or update exception to punt specific packets. +func (dsl *PutDSL) PuntException(val *punt.Exception) linuxclient.PutDSL { + dsl.parent.txn.Put(models.Key(val), val) + return dsl +} + // Delete changes the DSL mode to allow removal of an existing configuration. func (dsl *PutDSL) Delete() linuxclient.DeleteDSL { return &DeleteDSL{dsl.parent, dsl.vppPut.Delete()} @@ -330,8 +337,8 @@ func (dsl *DeleteDSL) VrfTable(id uint32, proto l3.VrfTable_Protocol) linuxclien } // StaticRoute adds a request to delete an existing VPP L3 Static Route. -func (dsl *DeleteDSL) StaticRoute(vrf uint32, dstAddr string, nextHopAddr string) linuxclient.DeleteDSL { - dsl.vppDelete.StaticRoute(vrf, dstAddr, nextHopAddr) +func (dsl *DeleteDSL) StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) linuxclient.DeleteDSL { + dsl.vppDelete.StaticRoute(iface, vrf, dstAddr, nextHopAddr) return dsl } @@ -408,6 +415,12 @@ func (dsl *DeleteDSL) PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protoco return dsl } +// PuntException adds request to delete exception to punt specific packets. +func (dsl *DeleteDSL) PuntException(reason string) linuxclient.DeleteDSL { + dsl.parent.txn.Delete(punt.ExceptionKey(reason)) + return dsl +} + // Put changes the DSL mode to allow configuration editing. func (dsl *DeleteDSL) Put() linuxclient.PutDSL { return &PutDSL{dsl.parent, dsl.vppDelete.Put()} diff --git a/clientv2/linux/dbadapter/data_resync_db.go b/clientv2/linux/dbadapter/data_resync_db.go index e4055ce8df..8d9fbf0371 100644 --- a/clientv2/linux/dbadapter/data_resync_db.go +++ b/clientv2/linux/dbadapter/data_resync_db.go @@ -17,8 +17,8 @@ package dbadapter import ( "github.com/ligato/cn-infra/db/keyval" - "github.com/ligato/vpp-agent/api/models/linux/interfaces" - "github.com/ligato/vpp-agent/api/models/linux/l3" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" abf "github.com/ligato/vpp-agent/api/models/vpp/abf" acl "github.com/ligato/vpp-agent/api/models/vpp/acl" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" @@ -28,9 +28,10 @@ import ( nat "github.com/ligato/vpp-agent/api/models/vpp/nat" punt "github.com/ligato/vpp-agent/api/models/vpp/punt" stn "github.com/ligato/vpp-agent/api/models/vpp/stn" - "github.com/ligato/vpp-agent/clientv2/linux" - "github.com/ligato/vpp-agent/clientv2/vpp" + linuxclient "github.com/ligato/vpp-agent/clientv2/linux" + vppclient "github.com/ligato/vpp-agent/clientv2/vpp" "github.com/ligato/vpp-agent/clientv2/vpp/dbadapter" + "github.com/ligato/vpp-agent/pkg/models" ) // NewDataResyncDSL returns a new instance of DataResyncDSL which implements @@ -222,6 +223,15 @@ func (dsl *DataResyncDSL) PuntToHost(val *punt.ToHost) linuxclient.DataResyncDSL return dsl } +// PuntException adds request to create or update exception to punt specific packets. +func (dsl *DataResyncDSL) PuntException(val *punt.Exception) linuxclient.DataResyncDSL { + key := models.Key(val) + dsl.txn.Put(key, val) + dsl.txnKeys = append(dsl.txnKeys, key) + + return dsl +} + // AppendKeys is a helper function that fills the keySet with values // pointed to by the iterator . func appendKeys(keys *keySet, it keyval.ProtoKeyIterator) { diff --git a/clientv2/linux/localclient/localclient_api.go b/clientv2/linux/localclient/localclient_api.go index c404034249..c1337c9b68 100644 --- a/clientv2/linux/localclient/localclient_api.go +++ b/clientv2/linux/localclient/localclient_api.go @@ -16,7 +16,7 @@ package localclient import ( "github.com/ligato/cn-infra/datasync/kvdbsync/local" - "github.com/ligato/vpp-agent/clientv2/linux" + linuxclient "github.com/ligato/vpp-agent/clientv2/linux" "github.com/ligato/vpp-agent/clientv2/linux/dbadapter" ) @@ -26,8 +26,7 @@ import ( // DataResyncRequest allows creating a RESYNC request using convenient RESYNC // DSL and sending it locally through go channels (i.e. without using Data Store). func DataResyncRequest(caller string) linuxclient.DataResyncDSL { - return dbadapter.NewDataResyncDSL(local.NewProtoTxn(local.Get().PropagateResync), - nil /*no need to list anything*/) + return dbadapter.NewDataResyncDSL(local.NewProtoTxn(local.Get().PropagateResync), nil /*no need to list anything*/) } // DataChangeRequest allows creating Data Change request(s) using convenient diff --git a/clientv2/vpp/data_change_api.go b/clientv2/vpp/data_change_api.go index a05a8d29b4..6901f0cbc7 100644 --- a/clientv2/vpp/data_change_api.go +++ b/clientv2/vpp/data_change_api.go @@ -89,6 +89,8 @@ type PutDSL interface { PuntIPRedirect(val *punt.IPRedirect) PutDSL // PuntToHost adds request to create or update rule to punt L4 traffic to a host. PuntToHost(val *punt.ToHost) PutDSL + // PuntException adds request to create or update exception to punt specific packets. + PuntException(val *punt.Exception) PutDSL // Delete changes the DSL mode to allow removal of an existing configuration. // See documentation for DataChangeDSL.Delete(). @@ -117,7 +119,7 @@ type DeleteDSL interface { // VrfTable adds a request to delete existing VPP VRF table. VrfTable(id uint32, proto l3.VrfTable_Protocol) DeleteDSL // StaticRoute adds a request to delete an existing VPP L3 Static Route. - StaticRoute(vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL + StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) DeleteDSL // Arp adds a request to delete an existing VPP L3 ARP. Arp(ifaceName string, ipAddr string) DeleteDSL // ProxyArpInterfaces adds a request to delete an existing VPP L3 proxy ARP interfaces @@ -138,6 +140,8 @@ type DeleteDSL interface { PuntIPRedirect(l3Proto punt.L3Protocol, txInterface string) DeleteDSL // PuntToHost adds request to delete a rule used to punt L4 traffic to a host. PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protocol, port uint32) DeleteDSL + // PuntException adds request to delete exception to punt specific packets. + PuntException(reason string) DeleteDSL // Put changes the DSL mode to allow configuration editing. // See documentation for DataChangeDSL.Put(). diff --git a/clientv2/vpp/data_resync_api.go b/clientv2/vpp/data_resync_api.go index b8780f6acd..3f9225e9f0 100644 --- a/clientv2/vpp/data_resync_api.go +++ b/clientv2/vpp/data_resync_api.go @@ -69,6 +69,8 @@ type DataResyncDSL interface { PuntIPRedirect(val *punt.IPRedirect) DataResyncDSL // PuntToHost adds request to RESYNC a rule used to punt L4 traffic to a host. PuntToHost(val *punt.ToHost) DataResyncDSL + // PuntException adds request to create or update exception to punt specific packets. + PuntException(val *punt.Exception) DataResyncDSL // Send propagates the RESYNC request to the plugins. Send() Reply diff --git a/clientv2/vpp/dbadapter/data_change_db.go b/clientv2/vpp/dbadapter/data_change_db.go index 52e5a728ec..51fc377226 100644 --- a/clientv2/vpp/dbadapter/data_change_db.go +++ b/clientv2/vpp/dbadapter/data_change_db.go @@ -29,7 +29,7 @@ import ( nat "github.com/ligato/vpp-agent/api/models/vpp/nat" punt "github.com/ligato/vpp-agent/api/models/vpp/punt" stn "github.com/ligato/vpp-agent/api/models/vpp/stn" - "github.com/ligato/vpp-agent/clientv2/vpp" + vppclient "github.com/ligato/vpp-agent/clientv2/vpp" ) // NewDataChangeDSL returns a new instance of DataChangeDSL which implements @@ -117,7 +117,7 @@ func (dsl *PutDSL) VrfTable(val *l3.VrfTable) vppclient.PutDSL { // StaticRoute adds a request to create or update VPP L3 Static Route. func (dsl *PutDSL) StaticRoute(val *l3.Route) vppclient.PutDSL { - dsl.parent.txn.Put(l3.RouteKey(val.VrfId, val.DstNetwork, val.NextHopAddr), val) + dsl.parent.txn.Put(models.Key(val), val) return dsl } @@ -181,6 +181,12 @@ func (dsl *PutDSL) PuntToHost(val *punt.ToHost) vppclient.PutDSL { return dsl } +// PuntException adds request to create or update exception to punt specific packets. +func (dsl *PutDSL) PuntException(val *punt.Exception) vppclient.PutDSL { + dsl.parent.txn.Put(models.Key(val), val) + return dsl +} + // Delete changes the DSL mode to allow removal of an existing configuration. func (dsl *PutDSL) Delete() vppclient.DeleteDSL { return &DeleteDSL{dsl.parent} @@ -235,8 +241,8 @@ func (dsl *DeleteDSL) VrfTable(id uint32, proto l3.VrfTable_Protocol) vppclient. } // StaticRoute adds a request to delete an existing VPP L3 Static Route. -func (dsl *DeleteDSL) StaticRoute(vrf uint32, dstAddr string, nextHopAddr string) vppclient.DeleteDSL { - dsl.parent.txn.Delete(l3.RouteKey(vrf, dstAddr, nextHopAddr)) +func (dsl *DeleteDSL) StaticRoute(iface string, vrf uint32, dstAddr string, nextHopAddr string) vppclient.DeleteDSL { + dsl.parent.txn.Delete(l3.RouteKey(iface, vrf, dstAddr, nextHopAddr)) return dsl } @@ -300,6 +306,12 @@ func (dsl *DeleteDSL) PuntToHost(l3Proto punt.L3Protocol, l4Proto punt.L4Protoco return dsl } +// PuntException adds request to delete exception to punt specific packets. +func (dsl *DeleteDSL) PuntException(reason string) vppclient.DeleteDSL { + dsl.parent.txn.Delete(punt.ExceptionKey(reason)) + return dsl +} + // Put changes the DSL mode to allow configuration editing. func (dsl *DeleteDSL) Put() vppclient.PutDSL { return &PutDSL{dsl.parent} diff --git a/clientv2/vpp/dbadapter/data_resync_db.go b/clientv2/vpp/dbadapter/data_resync_db.go index f8d07f3acc..d429504509 100644 --- a/clientv2/vpp/dbadapter/data_resync_db.go +++ b/clientv2/vpp/dbadapter/data_resync_db.go @@ -29,7 +29,7 @@ import ( nat "github.com/ligato/vpp-agent/api/models/vpp/nat" punt "github.com/ligato/vpp-agent/api/models/vpp/punt" stn "github.com/ligato/vpp-agent/api/models/vpp/stn" - "github.com/ligato/vpp-agent/clientv2/vpp" + vppclient "github.com/ligato/vpp-agent/clientv2/vpp" ) // NewDataResyncDSL returns a new instance of DataResyncDSL which implements @@ -113,7 +113,7 @@ func (dsl *DataResyncDSL) XConnect(val *l2.XConnectPair) vppclient.DataResyncDSL // StaticRoute adds L3 Static Route to the RESYNC request. func (dsl *DataResyncDSL) StaticRoute(val *l3.Route) vppclient.DataResyncDSL { - key := l3.RouteKey(val.VrfId, val.DstNetwork, val.NextHopAddr) + key := models.Key(val) dsl.txn.Put(key, val) dsl.txnKeys = append(dsl.txnKeys, key) @@ -210,6 +210,15 @@ func (dsl *DataResyncDSL) PuntToHost(val *punt.ToHost) vppclient.DataResyncDSL { return dsl } +// PuntException adds request to create or update exception to punt specific packets. +func (dsl *DataResyncDSL) PuntException(val *punt.Exception) vppclient.DataResyncDSL { + key := models.Key(val) + dsl.txn.Put(key, val) + dsl.txnKeys = append(dsl.txnKeys, key) + + return dsl +} + // AppendKeys is a helper function that fills the keySet with values // pointed to by the iterator . func appendKeys(keys *keySet, it keyval.ProtoKeyIterator) { diff --git a/clientv2/vpp/localclient/localclient_api.go b/clientv2/vpp/localclient/localclient_api.go index e8a57a06e0..f3502b89f8 100644 --- a/clientv2/vpp/localclient/localclient_api.go +++ b/clientv2/vpp/localclient/localclient_api.go @@ -16,7 +16,8 @@ package localclient import ( "github.com/ligato/cn-infra/datasync/kvdbsync/local" - "github.com/ligato/vpp-agent/clientv2/vpp" + + vppclient "github.com/ligato/vpp-agent/clientv2/vpp" "github.com/ligato/vpp-agent/clientv2/vpp/dbadapter" ) @@ -26,8 +27,7 @@ import ( // DataResyncRequest allows creating a RESYNC request using convenient RESYNC // DSL and sending it locally through go channels (i.e. without using Data Store). func DataResyncRequest(caller string) vppclient.DataResyncDSL { - return dbadapter.NewDataResyncDSL(local.NewProtoTxn(local.Get().PropagateResync), - nil /*no need to list anything*/) + return dbadapter.NewDataResyncDSL(local.NewProtoTxn(local.Get().PropagateResync), nil /*no need to list anything*/) } // DataChangeRequest allows creating Data Change request(s) using convenient diff --git a/cmd/agentctl/cmd/generate.go b/cmd/agentctl/cmd/generate.go index 57ff653bfd..405e09b29a 100644 --- a/cmd/agentctl/cmd/generate.go +++ b/cmd/agentctl/cmd/generate.go @@ -7,21 +7,17 @@ import ( "os" "strings" + "github.com/ghodss/yaml" + "github.com/gogo/protobuf/proto" + "github.com/spf13/cobra" + "github.com/ligato/cn-infra/servicelabel" "github.com/ligato/vpp-agent/api/models/linux" - "github.com/ligato/vpp-agent/api/models/vpp" - - yaml "github.com/ghodss/yaml" - - "github.com/ligato/vpp-agent/pkg/models" - - "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/cmd/agentctl/cmd_generator" "github.com/ligato/vpp-agent/cmd/agentctl/utils" - "github.com/spf13/cobra" + "github.com/ligato/vpp-agent/pkg/models" ) // RootCmd represents the base command when called without any subcommands. @@ -206,8 +202,8 @@ func init() { generateConfig.AddCommand(generateLinuxInterface) generateConfig.AddCommand(generateLinuxARP) generateConfig.AddCommand(generateLinuxRoutes) - formatType = generateConfig.PersistentFlags().String("format", "yaml", - "Format:\n\tjson\n\tyaml\n\tproto\n") + formatType = generateConfig.PersistentFlags().String("format", "json", + "Output formats:\n\tjson\n\tyaml\n\tproto\n") generateConfig.PersistentFlags().BoolVar(&short, "short", false, "Print command to one line. Work only with json format") } diff --git a/cmd/agentctl/cmd/import.go b/cmd/agentctl/cmd/import.go new file mode 100644 index 0000000000..6612f39925 --- /dev/null +++ b/cmd/agentctl/cmd/import.go @@ -0,0 +1,258 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "path" + "reflect" + "strings" + "time" + + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "github.com/spf13/cobra" + "google.golang.org/grpc" + + "github.com/ligato/cn-infra/servicelabel" + + "github.com/ligato/vpp-agent/api/genericmanager" + "github.com/ligato/vpp-agent/client/remoteclient" + "github.com/ligato/vpp-agent/cmd/agentctl/utils" + "github.com/ligato/vpp-agent/pkg/models" +) + +var ( + txops uint + grpcAddr string + timeout uint +) + +func init() { + RootCmd.AddCommand(importConfig) + importConfig.PersistentFlags().UintVar(&txops, "txops", 128, + "Number of OPs per transaction") + importConfig.PersistentFlags().StringVar(&grpcAddr, "grpc", "", + "Address of gRPC server.") + importConfig.PersistentFlags().UintVarP(&timeout, "time", "t", 60, + "Client timeout in seconds (how long to wait for response from server)") +} + +var importConfig = &cobra.Command{ + Use: "import", + Aliases: []string{"i"}, + Args: cobra.RangeArgs(1, 1), + Short: "Import configuration from file", + Long: ` +Import configuration from file. + +File format: + + + # ... + + + Empty lines and lines starting with # are ignored. + +Supported key formats: + - /vnf-agent/vpp1/config/vpp/v2/interfaces/iface1 + - config/vpp/v2/interfaces/iface1 + + For short keys, the import command uses microservice label defined with --label. +`, + Example: ` Import configuration from file: + + $ cat input.txt + config/vpp/v2/interfaces/loop1 {"name":"loop1","type":"SOFTWARE_LOOPBACK"} + config/vpp/l2/v2/bridge-domain/bd1 {"name":"bd1"} + $ agentctl import input.txt + + Or import via gRPC server: + + $ agentctl import --grpc=localhost:9111 input.txt +`, + Run: importFunction, +} + +func getTimeout() time.Duration { + return time.Second * time.Duration(timeout) +} + +type keyVal struct { + Key string + Val proto.Message +} + +func importFunction(cmd *cobra.Command, args []string) { + filename := args[0] + + // read file + b, err := ioutil.ReadFile(filename) + if err != nil { + utils.ExitWithError(utils.ExitError, fmt.Errorf("reading input file failed: %v", err)) + return + } + + var keyVals []keyVal + + // parse lines + lines := bytes.Split(b, []byte("\n")) + for _, l := range lines { + line := bytes.TrimSpace(l) + if bytes.HasPrefix(line, []byte("#")) { + continue + } + + parts := bytes.SplitN(line, []byte(" "), 2) + if len(parts) < 2 { + continue + } + key := string(parts[0]) + data := string(parts[1]) + if key == "" || data == "" { + continue + } + + key, err = parseKey(key) + if err != nil { + utils.ExitWithError(utils.ExitError, fmt.Errorf("parsing key failed: %v", err)) + return + } + + val, err := unmarshalKeyVal(key, data) + if err != nil { + utils.ExitWithError(utils.ExitError, fmt.Errorf("decoding value failed: %v", err)) + return + } + + fmt.Printf("KEY: %s - %v\n", key, val) + keyVals = append(keyVals, keyVal{key, val}) + } + + if grpcAddr != "" { + if err := grpcImport(keyVals); err != nil { + utils.ExitWithError(utils.ExitError, fmt.Errorf("import via gRPC failed: %v", err)) + } + } else { + if err := etcdImport(keyVals); err != nil { + utils.ExitWithError(utils.ExitError, fmt.Errorf("import to Etcd failed: %v", err)) + } + } + + fmt.Println("OK") +} + +func grpcImport(keyVals []keyVal) error { + // Set up a connection to the server. + conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure()) + if err != nil { + return fmt.Errorf("connecting to gRPC failed: %v", err) + } + defer conn.Close() + + c := remoteclient.NewClientGRPC(genericmanager.NewGenericManagerClient(conn)) + + fmt.Printf("importing %d key vals\n", len(keyVals)) + + req := c.ChangeRequest() + for _, keyVal := range keyVals { + fmt.Printf(" - %s\n", keyVal.Key) + req.Update(keyVal.Val) + } + + t := getTimeout() + fmt.Printf("sending via gRPC (timeout: %v)\n", t) + + ctx, cancel := context.WithTimeout(context.Background(), t) + defer cancel() + + if err := req.Send(ctx); err != nil { + return fmt.Errorf("send failed: %v", err) + } + + return nil +} + +func etcdImport(keyVals []keyVal) error { + // Connect to etcd + db, err := utils.GetDbForAllAgents(globalFlags.Endpoints) + if err != nil { + return fmt.Errorf("connecting to Etcd failed: %v", err) + } + + fmt.Printf("importing %d key vals\n", len(keyVals)) + + var txn = db.NewTxn() + ops := 0 + for i := 0; i < len(keyVals); i++ { + keyVal := keyVals[i] + + fmt.Printf(" - %s\n", keyVal.Key) + txn.Put(keyVal.Key, keyVal.Val) + ops++ + + if ops == int(txops) || i+1 == len(keyVals) { + fmt.Printf("commiting tx with %d ops\n", ops) + + ctx, cancel := context.WithTimeout(context.Background(), getTimeout()) + err = txn.Commit(ctx) + cancel() + if err != nil { + return fmt.Errorf("commit failed: %v", err) + } + + ops = 0 + txn = db.NewTxn() + } + } + + return nil +} + +func parseKey(key string) (string, error) { + if strings.HasPrefix(key, servicelabel.GetAllAgentsPrefix()) { + return key, nil + } + if !strings.HasPrefix(key, "config/") { + return "", fmt.Errorf("invalid format for key: %q", key) + } + return path.Join(servicelabel.GetAllAgentsPrefix(), globalFlags.Label, key), nil +} + +func unmarshalKeyVal(fullKey string, data string) (proto.Message, error) { + keyParts := strings.Split(fullKey, "/") + if len(keyParts) < 4 || keyParts[0] != "" { + return nil, fmt.Errorf("invalid key: %q", fullKey) + } + key := path.Join(keyParts[3:]...) + + model, err := models.GetModelForKey(key) + if err != nil { + return nil, err + } + valueType := proto.MessageType(model.ProtoName()) + if valueType == nil { + return nil, fmt.Errorf("unknown proto message defined for key %s", key) + } + value := reflect.New(valueType.Elem()).Interface().(proto.Message) + + if err := jsonpb.UnmarshalString(data, value); err != nil { + return nil, err + } + return value, nil +} diff --git a/cmd/agentctl/cmd/put.go b/cmd/agentctl/cmd/put.go index df69ec10b8..a7c85677b6 100644 --- a/cmd/agentctl/cmd/put.go +++ b/cmd/agentctl/cmd/put.go @@ -5,12 +5,12 @@ import ( "fmt" "strings" - "github.com/ligato/cn-infra/db/keyval" + "github.com/spf13/cobra" + "github.com/ligato/cn-infra/db/keyval" "github.com/ligato/cn-infra/servicelabel" "github.com/ligato/vpp-agent/cmd/agentctl/utils" - "github.com/spf13/cobra" ) // RootCmd represents the base command when called without any subcommands. @@ -21,16 +21,16 @@ var putConfig = &cobra.Command{ Long: ` Put configuration file to Etcd. -Supported key: -/vnf-agent/vpp1/config/vpp/v2/route/vrf/1/dst/10.1.1.3/32/gw/192.168.1.13 -vpp1/config/vpp/v2/route/vrf/1/dst/10.1.1.3/32/gw/192.168.1.13 -config/vpp/v2/route/vrf/1/dst/10.1.1.3/32/gw/192.168.1.13 +Supported key formats: + /vnf-agent/vpp1/config/vpp/v2/interfaces/iface1 + vpp1/config/vpp/v2/interfaces/iface1 + config/vpp/v2/interfaces/iface1 For short key, put command use default microservice label and 'vpp1' as default agent label. `, - Args: cobra.RangeArgs(2, 2), + Args: cobra.RangeArgs(1, 2), Example: ` Set route configuration for "vpp1": - $ ./agentctl -e 172.17.0.3:2379 put /vnf-agent/vpp1/config/vpp/v2/route/vrf/1/dst/10.1.1.3/32/gw/192.168.1.13 '{ + $ agentctl -e 172.17.0.3:2379 put /vnf-agent/vpp1/config/vpp/v2/route/vrf/1/dst/10.1.1.3/32/gw/192.168.1.13 '{ "type": 1, "vrf_id": 1, "dst_network": "10.1.1.3/32", @@ -38,9 +38,8 @@ For short key, put command use default microservice label and 'vpp1' as default }' Alternative: - $ ./agentctl put './agentctl generate Route --format json --short' + $ agentctl put $(agentctl generate Route --short) `, - Run: putFunction, } diff --git a/cmd/agentctl/cmd/root.go b/cmd/agentctl/cmd/root.go index c67ba60705..a5f193d468 100644 --- a/cmd/agentctl/cmd/root.go +++ b/cmd/agentctl/cmd/root.go @@ -15,39 +15,39 @@ package cmd import ( + "os" + "github.com/spf13/cobra" ) // GlobalFlags defines a single type to hold all cobra global flags. -type GlobalFlags struct { +var globalFlags struct { Endpoints []string Label string } -var globalFlags GlobalFlags - // RootCmd represents the base command when called without any subcommands. var RootCmd = &cobra.Command{ Use: "agentctl", - Short: "A CLI tool for the vnf-agent", - Long: ` -A CLI tool to show the state of and to configure agents connected to -Etcd. Use the 'ETCD_ENDPOINTS'' environment variable or the 'endpoints' -flag in the command line to specify one or more Etcd instances to -connect to.`, + Short: "A CLI tool for managing agents.", Example: `Specify the etcd to connect to and list all agents that it knows about: $ export ETCD_ENDPOINTS=172.17.0.1:2379 - $ ./agentctl show + $ agentctl show -Do as above, but with a command line flag: - $ ./agentctl --endpoints 172.17.0.1:2379 show +or with a command line flag: + $ agentctl --endpoints 172.17.0.1:2379 show `, } func init() { - // Root command flags + label := "vpp1" + if l := os.Getenv("MICROSERVICE_LABEL"); l != "" { + label = l + } RootCmd.PersistentFlags().StringSliceVarP(&globalFlags.Endpoints, - "endpoints", "e", nil, "One or more comma-separated Etcd endpoints.") - RootCmd.PersistentFlags().StringVarP(&globalFlags.Label, "label", "l", "vpp1", - "Agent microservice label (identifies the agent)") + "endpoints", "e", nil, + "One or more comma-separated Etcd endpoints.") + RootCmd.PersistentFlags().StringVarP(&globalFlags.Label, + "label", "l", label, + "Microservice label which identifies the agent.") } diff --git a/cmd/agentctl/cmd/show.go b/cmd/agentctl/cmd/show.go index 751057b723..5a6169332b 100644 --- a/cmd/agentctl/cmd/show.go +++ b/cmd/agentctl/cmd/show.go @@ -1,31 +1,25 @@ package cmd import ( + "errors" "fmt" "os" "strings" - "github.com/ligato/vpp-agent/api/models/vpp/acl" - - linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" - linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" - - "github.com/ligato/vpp-agent/api/models/vpp/ipsec" - "github.com/ligato/vpp-agent/api/models/vpp/nat" - - "github.com/ligato/vpp-agent/api/models/vpp/l2" - - "github.com/ligato/vpp-agent/api/models/vpp/interfaces" - "github.com/ligato/vpp-agent/api/models/vpp/l3" - - "github.com/ligato/cn-infra/health/statuscheck/model/status" - "github.com/ligato/cn-infra/db/keyval" + "github.com/ligato/cn-infra/health/statuscheck/model/status" "github.com/ligato/cn-infra/servicelabel" - "github.com/ligato/vpp-agent/cmd/agentctl/utils" "github.com/spf13/cobra" - "errors" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" + vpp_acl "github.com/ligato/vpp-agent/api/models/vpp/acl" + vpp_interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + vpp_l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + vpp_nat "github.com/ligato/vpp-agent/api/models/vpp/nat" + "github.com/ligato/vpp-agent/cmd/agentctl/utils" ) // RootCmd represents the base command when called without any subcommands. diff --git a/cmd/agentctl/utils/common_utils.go b/cmd/agentctl/utils/common_utils.go index 88ef769f13..8b7b9a3352 100644 --- a/cmd/agentctl/utils/common_utils.go +++ b/cmd/agentctl/utils/common_utils.go @@ -27,7 +27,6 @@ import ( "github.com/ligato/cn-infra/db/keyval" "github.com/ligato/cn-infra/db/keyval/etcd" "github.com/ligato/cn-infra/db/keyval/kvproto" - "github.com/ligato/cn-infra/logging" "github.com/ligato/cn-infra/logging/logrus" "github.com/ligato/cn-infra/servicelabel" ) @@ -65,10 +64,14 @@ func GetDbForAllAgents(endpoints []string) (*kvproto.ProtoWrapper, error) { cfg := &etcd.Config{} etcdConfig, err := etcd.ConfigToClient(cfg) + if err != nil { + return nil, err + } // Log warnings and errors only. - log := logrus.DefaultLogger() - log.SetLevel(logging.WarnLevel) + log := logrus.NewLogger("etcd") + //log.SetLevel(logging.WarnLevel) + etcdBroker, err := etcd.NewEtcdConnectionWithBytes(*etcdConfig, log) if err != nil { return nil, err @@ -87,10 +90,14 @@ func GetDbForOneAgent(endpoints []string, agentLabel string) (keyval.ProtoBroker cfg := &etcd.Config{} etcdConfig, err := etcd.ConfigToClient(cfg) + if err != nil { + return nil, err + } // Log warnings and errors only. - log := logrus.DefaultLogger() - log.SetLevel(logging.WarnLevel) + log := logrus.NewLogger("etcd") + //log.SetLevel(logging.WarnLevel) + etcdBroker, err := etcd.NewEtcdConnectionWithBytes(*etcdConfig, log) if err != nil { return nil, err diff --git a/cmd/agentctl/utils/db_write_utils.go b/cmd/agentctl/utils/db_write_utils.go index 0f5efaf1d4..8e2324cd51 100644 --- a/cmd/agentctl/utils/db_write_utils.go +++ b/cmd/agentctl/utils/db_write_utils.go @@ -23,7 +23,6 @@ import ( ) func WriteData(db keyval.ProtoTxn, key string, json string) { - switch { case strings.Contains(key, acl.ModelACL.KeyPrefix()): writeACLConfigToDb(db, key, json) diff --git a/cmd/vpp-agent-ctl/data/ifplugin.go b/cmd/vpp-agent-ctl/data/ifplugin.go index 27a4a00cf7..d61ec5f90c 100644 --- a/cmd/vpp-agent-ctl/data/ifplugin.go +++ b/cmd/vpp-agent-ctl/data/ifplugin.go @@ -110,6 +110,7 @@ func (ctl *VppAgentCtlImpl) PutTap() error { Link: &interfaces.Interface_Tap{ Tap: &interfaces.TapLink{ HostIfName: "tap-host", + Version: 2, }, }, } diff --git a/cmd/vpp-agent-ctl/data/ipsecplugin.go b/cmd/vpp-agent-ctl/data/ipsecplugin.go index bfd6c6e2b1..a34091077d 100644 --- a/cmd/vpp-agent-ctl/data/ipsecplugin.go +++ b/cmd/vpp-agent-ctl/data/ipsecplugin.go @@ -88,6 +88,8 @@ func (ctl *VppAgentCtlImpl) PutIPSecSA() error { IntegAlg: 2, IntegKey: "4339314b55523947594d6d3547666b45764e6a58", EnableUdpEncap: true, + //TunnelSrcAddr: "10.0.0.1", + //TunnelDstAddr: "20.0.0.1", } sa2 := ipsec.SecurityAssociation{ Index: "2", @@ -98,6 +100,8 @@ func (ctl *VppAgentCtlImpl) PutIPSecSA() error { IntegAlg: 2, IntegKey: "4339314b55523947594d6d3547666b45764e6a58", EnableUdpEncap: false, + //TunnelSrcAddr: "20.0.0.1", + //TunnelDstAddr: "10.0.0.1", } ctl.Log.Infof("IPSec SA put: %v", sa1.Index) diff --git a/cmd/vpp-agent-ctl/data/l3plugins.go b/cmd/vpp-agent-ctl/data/l3plugins.go index 0d9cf1e572..44c4c2e35b 100644 --- a/cmd/vpp-agent-ctl/data/l3plugins.go +++ b/cmd/vpp-agent-ctl/data/l3plugins.go @@ -17,6 +17,7 @@ package data import ( linuxL3 "github.com/ligato/vpp-agent/api/models/linux/l3" l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/pkg/models" ) // L3Ctl L3 plugin related methods for vpp-agent-ctl (including linux) @@ -53,6 +54,10 @@ type L3Ctl interface { SetIPScanNeigh() error // UnsetIPScanNeigh removes VPP IP scan neighbor configuration from the ETCD UnsetIPScanNeigh() error + // PutVrf puts VPP VRF to the ETCD + PutVrf() error + // UnsetVrf removes VPP VRF configuration from the ETCD + DeleteVrf() error // CreateLinuxArp puts linux ARP entry configuration to the ETCD PutLinuxArp() error // DeleteLinuxArp removes Linux ARP entry configuration from the ETCD @@ -70,12 +75,12 @@ func (ctl *VppAgentCtlImpl) PutRoute() error { } ctl.Log.Infof("Route put: %v", route) - return ctl.broker.Put(l3.RouteKey(route.VrfId, route.DstNetwork, route.NextHopAddr), route) + return ctl.broker.Put(models.Key(route), route) } // DeleteRoute removes VPP route configuration from the ETCD func (ctl *VppAgentCtlImpl) DeleteRoute() error { - routeKey := l3.RouteKey(0, "10.1.1.3/32", "192.168.1.13") + routeKey := l3.RouteKey("tap1",0, "10.1.1.3/32", "192.168.1.13") ctl.Log.Infof("Route delete: %v", routeKey) _, err := ctl.broker.Delete(routeKey) @@ -92,12 +97,12 @@ func (ctl *VppAgentCtlImpl) PutInterVrfRoute() error { } ctl.Log.Infof("Route put: %v", route) - return ctl.broker.Put(l3.RouteKey(route.VrfId, route.DstNetwork, route.NextHopAddr), route) + return ctl.broker.Put(models.Key(route), route) } // DeleteInterVrfRoute removes VPP route configuration from the ETCD func (ctl *VppAgentCtlImpl) DeleteInterVrfRoute() error { - routeKey := l3.RouteKey(0, "1.2.3.4/32", "") + routeKey := l3.RouteKey("",0, "1.2.3.4/32", "") ctl.Log.Infof("Route delete: %v", routeKey) _, err := ctl.broker.Delete(routeKey) @@ -115,12 +120,12 @@ func (ctl *VppAgentCtlImpl) PutNextHopRoute() error { } ctl.Log.Infof("Route put: %v", route) - return ctl.broker.Put(l3.RouteKey(route.VrfId, route.DstNetwork, route.NextHopAddr), route) + return ctl.broker.Put(models.Key(route), route) } // DeleteNextHopRoute removes VPP route configuration from the ETCD func (ctl *VppAgentCtlImpl) DeleteNextHopRoute() error { - routeKey := l3.RouteKey(1, "10.1.1.3/32", "192.168.1.13") + routeKey := l3.RouteKey("", 1, "10.1.1.3/32", "192.168.1.13") ctl.Log.Infof("Route delete: %v", routeKey) _, err := ctl.broker.Delete(routeKey) @@ -243,6 +248,27 @@ func (ctl *VppAgentCtlImpl) UnsetIPScanNeigh() error { return err } +// PutVrf puts VPP VRF to the ETCD +func (ctl *VppAgentCtlImpl) PutVrf() error { + vrf := &l3.VrfTable{ + Label: "vrf1", + Id: 1, + Protocol: l3.VrfTable_IPV4, + } + + ctl.Log.Info("VRF set") + return ctl.broker.Put(l3.VrfTableKey(vrf.Id, vrf.Protocol), vrf) +} + +// DeleteVrf removes VPP VRF configuration from the ETCD +func (ctl *VppAgentCtlImpl) DeleteVrf() error { + vrf := l3.VrfTableKey(1, l3.VrfTable_IPV4) + + ctl.Log.Info("VRF unset") + _, err := ctl.broker.Delete(vrf) + return err +} + // PutLinuxArp puts linux ARP entry configuration to the ETCD func (ctl *VppAgentCtlImpl) PutLinuxArp() error { linuxArp := &linuxL3.ARPEntry{ diff --git a/cmd/vpp-agent-ctl/main.go b/cmd/vpp-agent-ctl/main.go index d008c77059..d2bf41cdc4 100644 --- a/cmd/vpp-agent-ctl/main.go +++ b/cmd/vpp-agent-ctl/main.go @@ -207,6 +207,10 @@ func do(ctl data.VppAgentCtl) { err = ctl.SetIPScanNeigh() case "-ipscand": err = ctl.UnsetIPScanNeigh() + case "-vrf": + err = ctl.PutVrf() + case "-vrfd": + err = ctl.DeleteVrf() // Linux L3 plugin case "-lroute": err = ctl.PutLinuxRoute() diff --git a/cmd/vpp-agent-init/main.go b/cmd/vpp-agent-init/main.go new file mode 100644 index 0000000000..ff69afa2f3 --- /dev/null +++ b/cmd/vpp-agent-init/main.go @@ -0,0 +1,30 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package vpp-agent-init starts supervisor plugin managing other processes +// (VPP-Agent, VPP, ...) + +package main + +import ( + "github.com/ligato/cn-infra/agent" + sv "github.com/ligato/cn-infra/exec/supervisor" +) + +func main() { + a := agent.NewAgent(agent.AllPlugins(&sv.DefaultPlugin)) + if err := a.Run(); err != nil { + panic(err) + } +} diff --git a/cmd/vpp-agent/app/vpp_agent.go b/cmd/vpp-agent/app/vpp_agent.go index af931c4bb0..1e847cdf63 100644 --- a/cmd/vpp-agent/app/vpp_agent.go +++ b/cmd/vpp-agent/app/vpp_agent.go @@ -27,7 +27,6 @@ import ( "github.com/ligato/cn-infra/health/statuscheck" "github.com/ligato/cn-infra/logging/logmanager" "github.com/ligato/cn-infra/messaging/kafka" - "github.com/ligato/vpp-agent/plugins/vpp/srplugin" "github.com/ligato/vpp-agent/plugins/configurator" linux_ifplugin "github.com/ligato/vpp-agent/plugins/linux/ifplugin" @@ -45,6 +44,7 @@ import ( "github.com/ligato/vpp-agent/plugins/vpp/l3plugin" "github.com/ligato/vpp-agent/plugins/vpp/natplugin" "github.com/ligato/vpp-agent/plugins/vpp/puntplugin" + "github.com/ligato/vpp-agent/plugins/vpp/srplugin" "github.com/ligato/vpp-agent/plugins/vpp/stnplugin" ) @@ -100,6 +100,7 @@ func New() *VPPAgent { redisDataSync, } orchestrator.DefaultPlugin.Watcher = watchers + orchestrator.DefaultPlugin.StatusPublisher = writers ifplugin.DefaultPlugin.Watcher = watchers ifplugin.DefaultPlugin.NotifyStates = ifStatePub diff --git a/cmd/vpp-agent/debug.go b/cmd/vpp-agent/debug.go deleted file mode 100644 index 66cc4b5bbb..0000000000 --- a/cmd/vpp-agent/debug.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2019 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !nodebug - -package main - -import ( - _ "expvar" - "log" - "net/http" - _ "net/http/pprof" - "os" - "runtime" - "runtime/pprof" - "runtime/trace" -) - -var ( - debugEnabled = os.Getenv("DEBUG_ENABLED") != "" - debugServerAddr = os.Getenv("DEBUG_SERVERADDR") - cpuprofile = os.Getenv("DEBUG_CPUPROFILE") - memprofile = os.Getenv("DEBUG_MEMPROFILE") - traceprofile = os.Getenv("DEBUG_TRACEPROFILE") -) - -func init() { - if debugEnabled { - go debugServer() - debugging = debug - } -} - -func debugServer() { - addr := debugServerAddr - if addr == "" { - addr = ":1234" - } - if err := http.ListenAndServe(addr, nil); err != nil { - log.Printf("debug server error: %v", err) - } -} - -func debug() func() { - /*trace.AuthRequest = func(req *http.Request) (any, sensitive bool) { - return true, true - }*/ - var err error - - var cpuFile *os.File - if cpuprofile != "" { - cpuFile, err = os.Create(cpuprofile) - if err != nil { - log.Fatal("could not create CPU profile: ", err) - } - if err := pprof.StartCPUProfile(cpuFile); err != nil { - log.Fatal("could not start CPU profile: ", err) - } - } - - var traceFile *os.File - if traceprofile != "" { - traceFile, err = os.Create(traceprofile) - if err != nil { - log.Fatalf("failed to create trace output file: %v", err) - } - if err := trace.Start(traceFile); err != nil { - log.Fatalf("failed to start trace: %v", err) - } - } - - return func() { - if traceFile != nil { - trace.Stop() - log.Printf("closing trace profile file: %s", traceFile.Name()) - if err := traceFile.Close(); err != nil { - log.Fatalf("failed to close trace file: %v", err) - } - } - if cpuFile != nil { - pprof.StopCPUProfile() - log.Printf("closing CPU profile file: %s", cpuFile.Name()) - if err := cpuFile.Close(); err != nil { - log.Printf("closing failed: %v", err) - } - } - if memprofile != "" { - f, err := os.Create(memprofile) - if err != nil { - log.Fatal("could not create memory profile: ", err) - } - defer func() { - log.Printf("closing memory profile: %s", memprofile) - if err := f.Close(); err != nil { - log.Printf("closing failed: %v", err) - } - }() - runtime.GC() // get up-to-date statistics - if err := pprof.WriteHeapProfile(f); err != nil { - log.Fatal("could not write memory profile: ", err) - } - } - } -} diff --git a/cmd/vpp-agent/main.go b/cmd/vpp-agent/main.go index 99d7c32da3..564cb51106 100644 --- a/cmd/vpp-agent/main.go +++ b/cmd/vpp-agent/main.go @@ -23,9 +23,12 @@ import ( "time" "github.com/ligato/cn-infra/agent" + "github.com/ligato/cn-infra/datasync/kvdbsync" + "github.com/ligato/cn-infra/datasync/resync" "github.com/ligato/cn-infra/logging" "github.com/ligato/vpp-agent/cmd/vpp-agent/app" + "github.com/ligato/vpp-agent/pkg/debug" ) const logo = ` __ @@ -37,20 +40,21 @@ const logo = ` __ ` var ( + debugEnabled = os.Getenv("DEBUG_ENABLED") != "" + startTimeout = agent.DefaultStartTimeout stopTimeout = agent.DefaultStopTimeout - // FIXME: global flags are not currently compatible with config package (flags are parsed in NewAgent) - //startTimeout = flag.Duration("start-timeout", agent.DefaultStartTimeout, "Timeout duration for starting agent.") - //stopTimeout = flag.Duration("stop-timeout", agent.DefaultStopTimeout, "Timeout duration for stopping agent.") -) -var debugging func() func() + resyncTimeout = time.Second * 10 +) func main() { fmt.Fprintf(os.Stdout, logo, agent.BuildVersion) - if debugging != nil { - defer debugging()() + if debugEnabled { + logging.DefaultLogger.SetLevel(logging.DebugLevel) + logging.DefaultLogger.Debug("DEBUG ENABLED") + defer debug.Start().Stop() } vppAgent := app.New() @@ -66,14 +70,13 @@ func main() { } func init() { - logging.DefaultLogger.SetOutput(os.Stdout) - logging.DefaultLogger.SetLevel(logging.DebugLevel) - // Setup start/stop timeouts for agent + // Overrides for start/stop timeouts of agent if t := os.Getenv("START_TIMEOUT"); t != "" { dur, err := time.ParseDuration(t) if err != nil { log.Fatalf("Invalid duration (%s) for start timeout!", t) } else { + log.Printf("setting agent start timeout to: %v (via START_TIMEOUT)", dur) startTimeout = dur } } @@ -82,7 +85,21 @@ func init() { if err != nil { log.Fatalf("Invalid duration (%s) for stop timeout!", t) } else { + log.Printf("setting agent stop timeout to: %v (via STOP_TIMEOUT)", dur) stopTimeout = dur } } + + // Override resync timeouts + if t := os.Getenv("RESYNC_TIMEOUT"); t != "" { + dur, err := time.ParseDuration(t) + if err != nil { + log.Fatalf("Invalid duration (%s) for resync timeout!", t) + } else { + log.Printf("setting resync timeout to: %v (via RESYNC_TIMEOUT)", dur) + resyncTimeout = dur + } + } + kvdbsync.ResyncDoneTimeout = resyncTimeout + resync.SingleResyncAckTimeout = resyncTimeout } diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 9951d52e0f..d31d126a8d 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,131 +1,103 @@ -ARG BASE_IMG +ARG VPP_IMG +FROM ${VPP_IMG} AS vppimg -FROM golang as verify-stage +RUN dpkg-query -f '${Version}' -W vpp > /vpp/version -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - patch python3-pip python3 \ - && rm -rf /var/lib/apt/lists/* \ - && pip3 install ply +FROM golang:1.12 AS verify-binapi -ARG VPP_REPO_URL -ARG VPP_COMMIT - -RUN git clone ${VPP_REPO_URL} /opt/vpp \ - && cd /opt/vpp \ - && git checkout ${VPP_COMMIT} - -COPY scripts/genjsonapi.sh /opt/genjsonapi.sh -RUN /opt/genjsonapi.sh +RUN apt-get update && apt-get install -y --no-install-recommends \ + patch \ + && rm -rf /var/lib/apt/lists/* WORKDIR /go/src/github.com/ligato/vpp-agent +ARG VPP_BINAPI +ARG SKIP_CHECK + COPY plugins/vpp/binapi plugins/vpp/binapi COPY vendor vendor +COPY scripts/genbinapi.sh scripts/genbinapi.sh COPY Makefile vpp.env ./ -RUN cp -r plugins/vpp/binapi /tmp/orig_binapi \ - && make generate-binapi \ - && diff -r plugins/vpp/binapi /tmp/orig_binapi - -FROM ${BASE_IMG} as dev-stage - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - autoconf automake build-essential ca-certificates curl gdb git \ - graphviz inetutils-traceroute iproute2 ipsec-tools iputils-ping \ - libapr1 libmbedcrypto1 libmbedtls10 libmbedx509-0 libtool \ - make mc nano netcat python software-properties-common sudo supervisor \ - telnet unzip wget python-cffi python3-cffi \ - gcc-8 g++-8 \ - && rm -rf /var/lib/apt/lists/* \ - && rm /usr/bin/gcc \ - && rm /usr/bin/g++ \ - && ln -s /usr/bin/gcc-8 /usr/bin/gcc \ - && ln -s /usr/bin/g++-8 /usr/bin/g++ - -# install Protobuf -ARG PROTOC_VERSION=3.6.1 -ARG PROTOC_OS_ARCH=linux_x86_64 -RUN wget -q https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_OS_ARCH}.zip \ - && unzip protoc-${PROTOC_VERSION}-${PROTOC_OS_ARCH}.zip -d protoc3 \ - && mv protoc3/bin/protoc /usr/local/bin \ - && mv protoc3/include/google /usr/local/include \ - && rm -rf protoc-${PROTOC_VERSION}-${PROTOC_OS_ARCH}.zip protoc3 - -RUN mkdir -p /opt/vpp-agent/dev /opt/vpp-agent/plugin - -WORKDIR /opt/vpp-agent/dev - -ARG VPP_REPO_URL -ARG VPP_COMMIT - -ARG VPP_DEBUG_DEB - +COPY --from=vppimg /usr/share/vpp /usr/share/vpp +COPY --from=vppimg /vpp/version /vpp-version + +RUN cp -r plugins/vpp/binapi /tmp/orig_binapi && \ + make generate-binapi && \ + diff -r plugins/vpp/binapi /tmp/orig_binapi || \ + { \ + vpp_version="$(cat /vpp-version)"; \ + echo >&2 "---------------------------------------------------------------"; \ + echo >&2 " Generated binapi does not match with used version!"; \ + echo >&2 " VPP version: ${vpp_version}"; \ + echo >&2 "---------------------------------------------------------------"; \ + [ -n "$SKIP_CHECK" ] && exit 0; \ + } + +FROM vppimg AS devimg + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + git \ + graphviz \ + iproute2 \ + iputils-ping \ + make \ + nano \ + patch \ + sudo \ + unzip \ + wget \ + && rm -rf /var/lib/apt/lists/* + +# Install Go +ENV GOLANG_VERSION 1.12.7 RUN set -eux; \ - git clone "${VPP_REPO_URL}" vpp; \ - cd vpp; \ - git checkout "${VPP_COMMIT}"; \ - sed -i -e 's/vpp vom/vpp/g' build-data/platforms/vpp.mk; \ - export UNATTENDED=y; \ - make install-dep dpdk-install-dev; \ - if [ -n "${VPP_DEBUG_DEB}" ]; then \ - make build; \ - make -C build-root PLATFORM=vpp TAG=vpp_debug install-deb; \ - else \ - make build-release pkg-deb; \ - fi; \ - cd build-root; \ - dpkg -i *.deb; \ - rm -rf .ccache /var/lib/apt/lists/*; \ - find . -type f -name '*.o' -exec rm -rf '{}' \; - -# install Go -ENV GOLANG_VERSION 1.11.8 -ARG GOLANG_OS_ARCH=linux-amd64 -RUN wget -O go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.${GOLANG_OS_ARCH}.tar.gz" \ - && tar -C /usr/local -xzf go.tgz \ - && rm go.tgz + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) goRelArch='linux-amd64'; ;; \ + armhf) goRelArch='linux-armv6l'; ;; \ + arm64) goRelArch='linux-arm64'; ;; \ + esac; \ + wget -nv -O go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \ + tar -C /usr/local -xzf go.tgz; \ + rm go.tgz; ENV GOPATH /go ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \ - && chmod -R 777 "$GOPATH" +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" -# install debugger +# Install debugger RUN \ go get -u github.com/go-delve/delve/cmd/dlv && dlv version; \ go get -u github.com/golang/dep/cmd/dep && dep version; -# copy configs + +# Copy configs COPY \ - docker/dev/etcd.conf \ - docker/dev/vpp-ifplugin.conf \ - docker/dev/linux-ifplugin.conf \ - docker/dev/logs.conf \ - ./ + ./docker/dev/etcd.conf \ + ./docker/dev/logs.conf \ + ./docker/dev/vpp-ifplugin.conf \ + ./docker/dev/supervisor.conf \ + /opt/vpp-agent/dev/ -COPY docker/dev/vpp.conf /etc/vpp/vpp.conf -COPY docker/dev/supervisord.conf /etc/supervisord/supervisord.conf +COPY ./docker/dev/vpp.conf /etc/vpp/vpp.conf +COPY ./docker/dev/init_hook.sh /usr/bin/ -# copy scripts -COPY \ - docker/dev/exec_vpp.sh \ - docker/dev/exec_agent.sh \ - docker/dev/supervisord_kill.py \ - /usr/bin/ +# Build agent +WORKDIR $GOPATH/src/github.com/ligato/vpp-agent ARG VERSION ARG COMMIT ARG DATE -# copy & build agent -COPY . $GOPATH/src/github.com/ligato/vpp-agent +COPY . ./ -RUN cd $GOPATH/src/github.com/ligato/vpp-agent \ - && VERSION=$VERSION COMMIT=$COMMIT DATE=$DATE make install +RUN VERSION=$VERSION COMMIT=$COMMIT DATE=$DATE make install -WORKDIR / +ENV SUPERVISOR_CONFIG=/opt/vpp-agent/dev/supervisor.conf # run supervisor as the default executable CMD rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api && \ - exec /usr/bin/supervisord -c /etc/supervisord/supervisord.conf + exec vpp-agent-init diff --git a/docker/dev/build.sh b/docker/dev/build.sh index 3154a0e761..56fee47a5f 100755 --- a/docker/dev/build.sh +++ b/docker/dev/build.sh @@ -2,74 +2,39 @@ cd "$(dirname "$0")" -set -e - -# Before run of this script you can set environmental variables -# IMAGE_TAG, DOCKERFILE, BASE_IMG, GOLANG_OS_ARCH, then export them -# and to use defined values instead of default ones - -IMAGE_TAG=${IMAGE_TAG:-'dev_vpp_agent'} -DOCKERFILE=${DOCKERFILE:-'Dockerfile'} - -BASE_IMG=${BASE_IMG:-'ubuntu:18.04'} - -BUILDARCH=`uname -m` -case "$BUILDARCH" in - "aarch64" ) - GOLANG_OS_ARCH=${GOLANG_OS_ARCH:-'linux-arm64'} - PROTOC_OS_ARCH=${PROTOC_OS_ARCH:-'linux-aarch_64'} - ;; - - "x86_64" ) - # for AMD64 platform is used the default image (without suffix -amd64) - GOLANG_OS_ARCH=${GOLANG_OS_ARCH:-'linux-amd64'} - PROTOC_OS_ARCH=${PROTOC_OS_ARCH:-'linux-x86_64'} - ;; - * ) - echo "Architecture ${BUILDARCH} is not supported." - exit - ;; -esac - - -source ../../vpp.env -VPP_DEBUG_DEB=${VPP_DEBUG_DEB:-} - -VERSION=$(git describe --always --tags --dirty) -COMMIT=$(git rev-parse HEAD) -DATE=$(git log -1 --format="%ct" | xargs -I{} date -d @{} +'%Y-%m-%dT%H:%M%:z') - -echo "==============================" -echo "Building dev image" -echo "==============================" -echo " base image: ${BASE_IMG}" -echo " image tag: ${IMAGE_TAG}" -echo " architecture: ${BUILDARCH}" -echo -echo "-----------------------------" -echo "VPP" -echo "-----------------------------" -echo " repo URL: ${VPP_REPO_URL}" -echo " commit: ${VPP_COMMIT}" -echo -echo "-----------------------------" -echo "Agent" -echo "-----------------------------" -echo " version: ${VERSION}" -echo " commit: ${COMMIT}" -echo " date: ${DATE}" -echo -echo "-----------------------------" - -docker build -f ${DOCKERFILE} \ - --tag ${IMAGE_TAG} \ - --build-arg BASE_IMG=${BASE_IMG} \ - --build-arg VPP_COMMIT=${VPP_COMMIT} \ - --build-arg VPP_REPO_URL=${VPP_REPO_URL} \ - --build-arg VPP_DEBUG_DEB=${VPP_DEBUG_DEB} \ - --build-arg GOLANG_OS_ARCH=${GOLANG_OS_ARCH} \ - --build-arg PROTOC_OS_ARCH=${PROTOC_OS_ARCH} \ +set -euo pipefail + +[ -n "${VPP_IMG-}" ] || { + echo "VPP_IMG not set, use 'make images' to build docker images" + exit 1 +} + +echo "===============================================" +echo " Image: ${IMAGE_TAG:=dev_vpp_agent}" +echo "===============================================" +echo " VPP" +echo "-----------------------------------------------" +echo " - base image: ${VPP_IMG}" +echo " - binapi dir: ${VPP_BINAPI}" +echo "-----------------------------------------------" +echo " Agent" +echo "-----------------------------------------------" +echo " - version: ${VERSION}" +echo " - commit: ${COMMIT}" +echo " - date: ${DATE}" +echo "===============================================" + +set -x + +docker build -f Dockerfile \ + --build-arg VPP_IMG=${VPP_IMG} \ + --build-arg VPP_BINAPI=${VPP_BINAPI} \ --build-arg VERSION=${VERSION} \ --build-arg COMMIT=${COMMIT} \ --build-arg DATE=${DATE} \ - ${DOCKER_BUILD_ARGS} ../.. + --build-arg SKIP_CHECK=${SKIP_CHECK:-} \ + --tag ${IMAGE_TAG} \ + --pull \ + ${DOCKER_BUILD_ARGS-} ../.. + +docker run --rm "${IMAGE_TAG}" vpp-agent -h || true diff --git a/docker/dev/exec_agent.sh b/docker/dev/exec_agent.sh deleted file mode 100755 index f6a74b028c..0000000000 --- a/docker/dev/exec_agent.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ -n "$OMIT_AGENT" ]; then - echo "Start of vpp-agent disabled (unset OMIT_AGENT to enable it)" -else - echo "Starting vpp-agent.." - exec vpp-agent --config-dir=/opt/vpp-agent/dev -fi diff --git a/docker/dev/exec_vpp.sh b/docker/dev/exec_vpp.sh deleted file mode 100755 index 6a524eb67f..0000000000 --- a/docker/dev/exec_vpp.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -e - -VPP_DIR=${VPP_DIR:-/opt/vpp-agent/dev/vpp} - -if [ -n "$RUN_VPP_DEBUG" ]; then - echo "Running VPP in DEBUG mode" - exec ${VPP_DIR}/build-root/install-vpp_debug-native/vpp/bin/vpp -c /etc/vpp/vpp.conf -else - echo "Running VPP in RELEASE mode" - exec ${VPP_DIR}/build-root/install-vpp-native/vpp/bin/vpp -c /etc/vpp/vpp.conf -fi diff --git a/docker/dev/init_hook.sh b/docker/dev/init_hook.sh new file mode 100755 index 0000000000..e3b8ede3a8 --- /dev/null +++ b/docker/dev/init_hook.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +terminate_process () { + PID=$(pidof $1) + if [[ ${PID} != "" ]]; then + kill ${PID} + echo "process $1 terminated" + fi +} + +if [[ "${SUPERVISOR_PROCESS_NAME}" = "agent" && "${SUPERVISOR_PROCESS_STATE}" = "terminated" ]]; then + terminate_process vpp-agent-init +fi + +if [[ "${SUPERVISOR_PROCESS_NAME}" = "vpp" && "${SUPERVISOR_PROCESS_STATE}" = "terminated" ]]; then + terminate_process vpp-agent-init +fi \ No newline at end of file diff --git a/docker/dev/linux-ifplugin.conf b/docker/dev/linux-ifplugin.conf deleted file mode 100644 index 9031308d55..0000000000 --- a/docker/dev/linux-ifplugin.conf +++ /dev/null @@ -1 +0,0 @@ -stopwatch: true \ No newline at end of file diff --git a/docker/dev/supervisor.conf b/docker/dev/supervisor.conf new file mode 100644 index 0000000000..5a894d9340 --- /dev/null +++ b/docker/dev/supervisor.conf @@ -0,0 +1,9 @@ +programs: + - name: "vpp" + executable-path: "/usr/bin/vpp" + executable-args: ["-c", "/etc/vpp/vpp.conf"] + - name: "agent" + executable-path: "/go/bin/vpp-agent" + executable-args: ["--config-dir=/opt/vpp-agent/dev"] +hooks: + - cmd: "/usr/bin/init_hook.sh" diff --git a/docker/dev/supervisord.conf b/docker/dev/supervisord.conf deleted file mode 100644 index a8880f034b..0000000000 --- a/docker/dev/supervisord.conf +++ /dev/null @@ -1,26 +0,0 @@ -[supervisord] -logfile=/var/log/supervisord.log -loglevel=debug -nodaemon=true -pidfile=/run/supervisord.pid - -[program:vpp] -command=/usr/bin/exec_vpp.sh -autorestart=false -redirect_stderr=true -priority=1 - -[program:agent] -command=/usr/bin/exec_agent.sh -startsecs=0 -autorestart=false -redirect_stderr=true -priority=2 - -; This event listener waits for event of vpp or agent exitting. -; Once received, it kills supervisord process and this makes -; subsequently the exit of docker container. -; You should also set agent's autorestart=false. -[eventlistener:vpp_or_agent_not_running] -command=/usr/bin/supervisord_kill.py -events=PROCESS_STATE_EXITED diff --git a/docker/dev/supervisord_kill.py b/docker/dev/supervisord_kill.py deleted file mode 100755 index debf647cb0..0000000000 --- a/docker/dev/supervisord_kill.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -import sys -import os -import signal - - -def write_stdout(msg): - # only eventlistener protocol messages may be sent to stdout - sys.stdout.write(msg) - sys.stdout.flush() - - -def write_stderr(msg): - sys.stderr.write(msg) - sys.stderr.flush() - - -def main(): - while 1: - # transition from ACKNOWLEDGED to READY - write_stdout('READY\n') - - # read header line and print it to stderr - line = sys.stdin.readline() - write_stderr('EVENT: ' + line) - - # read event payload and print it to stderr - headers = dict([x.split(':') for x in line.split()]) - data = sys.stdin.read(int(headers['len'])) - write_stderr('DATA: ' + data + '\n') - - # ignore non vpp events, skipping - parsed_data = dict([x.split(':') for x in data.split()]) - if parsed_data["processname"] not in ["vpp", "agent"]: - write_stderr('Ignoring event from ' + parsed_data["processname"] + '\n') - write_stdout('RESULT 2\nOK') - continue - - # ignore exits with expected exit codes - if parsed_data["expected"] == "1": - write_stderr('Exit state from ' + parsed_data["processname"] + ' was expected\n') - write_stdout('RESULT 2\nOK') - continue - - # do not kill supervisor if retained and exit - if 'RETAIN_SUPERVISOR' in os.environ and os.environ['RETAIN_SUPERVISOR'] != '': - write_stderr('Supervisord is configured to retain after unexpected exits (unset RETAIN_SUPERVISOR to disable it)\n') - write_stdout('RESULT 2\nOK') - continue - - try: - with open('/run/supervisord.pid', 'r') as pidfile: - pid = int(pidfile.readline()) - write_stderr('Killing supervisord with pid: ' + str(pid) + '\n') - os.kill(pid, signal.SIGQUIT) - except Exception as e: - write_stderr('Could not kill supervisor: ' + str(e) + '\n') - - # transition from READY to ACKNOWLEDGED - write_stdout('RESULT 2\nOK') - return - - -if __name__ == '__main__': - main() diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index 0f4649beaf..7fa1b96692 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -1,68 +1,53 @@ -FROM dev_vpp_agent as devimg +ARG DEV_IMG=dev_vpp_agent +FROM ${DEV_IMG} as devimg FROM ubuntu:18.04 as base -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - # general tools - inetutils-traceroute \ - iproute2 \ - iputils-ping \ - # vpp requirements - ca-certificates \ - libapr1 \ - libc6 \ - libmbedcrypto1 \ - libmbedtls10 \ - libmbedx509-0 \ - libnuma1 \ - openssl \ - # other - ipsec-tools \ - python \ - supervisor \ - netcat \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends \ + # general tools + inetutils-traceroute \ + iproute2 \ + iputils-ping \ + # vpp requirements + ca-certificates \ + libapr1 \ + libc6 \ + libmbedcrypto1 \ + libmbedtls10 \ + libmbedx509-0 \ + libnuma1 \ + openssl \ + && rm -rf /var/lib/apt/lists/* # install vpp -COPY --from=devimg \ - /opt/vpp-agent/dev/vpp/build-root/libvppinfra_*.deb \ - /opt/vpp-agent/dev/vpp/build-root/vpp-plugin-core_*.deb \ - /opt/vpp-agent/dev/vpp/build-root/vpp-plugin-dpdk_*.deb \ - /opt/vpp-agent/dev/vpp/build-root/vpp_*.deb \ - /opt/vpp/ +COPY --from=devimg /vpp/*.deb /opt/vpp/ RUN cd /opt/vpp/ \ - && dpkg -i *.deb \ - && rm *.deb + && apt-get update \ + && apt-get install -y ./*.deb \ + && rm *.deb \ + && rm -rf /var/lib/apt/lists/* +# Final image FROM scratch COPY --from=base / / -# install agent +# Install agent COPY --from=devimg \ + /go/bin/agentctl \ /go/bin/vpp-agent \ - /go/bin/vpp-agent-ctl \ + /go/bin/vpp-agent-init \ /bin/ -# copy configs -COPY \ - etcd.conf \ - vpp-ifplugin.conf \ - linux-ifplugin.conf \ - /opt/vpp-agent/dev/ - +# Copy configs +COPY etcd.conf /opt/vpp-agent/dev/ +COPY supervisor.conf /opt/vpp-agent/dev/ COPY vpp.conf /etc/vpp/vpp.conf -COPY supervisord.conf /etc/supervisord/supervisord.conf - -# copy scripts -COPY \ - exec_agent.sh \ - supervisord_kill.py \ - /usr/bin/ +COPY init_hook.sh /usr/bin/ WORKDIR /root/ -# run supervisor as the default executable +ENV SUPERVISOR_CONFIG=/opt/vpp-agent/dev/supervisor.conf + CMD rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api && \ - exec /usr/bin/supervisord -c /etc/supervisord/supervisord.conf + exec vpp-agent-init diff --git a/docker/prod/build.sh b/docker/prod/build.sh index 4867a88398..bda0db4cba 100755 --- a/docker/prod/build.sh +++ b/docker/prod/build.sh @@ -1,25 +1,27 @@ #!/bin/bash -# Before run of this script you can set environmental variables -# IMAGE_TAG ... then export them -# and to use defined values instead of default ones cd "$(dirname "$0")" -set -e +set -euo pipefail -IMAGE_TAG=${IMAGE_TAG:-'prod_vpp_agent'} +buildArch=`uname -m` +case "${buildArch##*-}" in + aarch64) ;; + x86_64) ;; + *) echo "Current architecture (${buildArch}) is not supported."; exit 2; ;; +esac -BUILDARCH=`uname -m` -case "$BUILDARCH" in - "aarch64" ) - ;; +echo "===============================================" +echo " Image: ${IMAGE_TAG:=prod_vpp_agent}" +echo "===============================================" +echo " - dev image: ${DEV_IMG:=dev_vpp_agent}" +echo "===============================================" - "x86_64" ) - ;; - * ) - echo "Architecture ${BUILDARCH} is not supported." - exit - ;; -esac +set -x + +docker build -f Dockerfile \ + --build-arg DEV_IMG=${DEV_IMG} \ + --tag ${IMAGE_TAG} \ + ${DOCKER_BUILD_ARGS-} . -docker build ${DOCKER_BUILD_ARGS} --tag ${IMAGE_TAG} . +docker run --rm "${IMAGE_TAG}" vpp-agent -h || true diff --git a/docker/prod/exec_agent.sh b/docker/prod/exec_agent.sh deleted file mode 100755 index f6a74b028c..0000000000 --- a/docker/prod/exec_agent.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ -n "$OMIT_AGENT" ]; then - echo "Start of vpp-agent disabled (unset OMIT_AGENT to enable it)" -else - echo "Starting vpp-agent.." - exec vpp-agent --config-dir=/opt/vpp-agent/dev -fi diff --git a/docker/prod/init_hook.sh b/docker/prod/init_hook.sh new file mode 100755 index 0000000000..e3b8ede3a8 --- /dev/null +++ b/docker/prod/init_hook.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +terminate_process () { + PID=$(pidof $1) + if [[ ${PID} != "" ]]; then + kill ${PID} + echo "process $1 terminated" + fi +} + +if [[ "${SUPERVISOR_PROCESS_NAME}" = "agent" && "${SUPERVISOR_PROCESS_STATE}" = "terminated" ]]; then + terminate_process vpp-agent-init +fi + +if [[ "${SUPERVISOR_PROCESS_NAME}" = "vpp" && "${SUPERVISOR_PROCESS_STATE}" = "terminated" ]]; then + terminate_process vpp-agent-init +fi \ No newline at end of file diff --git a/docker/prod/linux-ifplugin.conf b/docker/prod/linux-ifplugin.conf deleted file mode 100644 index 9031308d55..0000000000 --- a/docker/prod/linux-ifplugin.conf +++ /dev/null @@ -1 +0,0 @@ -stopwatch: true \ No newline at end of file diff --git a/docker/prod/supervisor.conf b/docker/prod/supervisor.conf new file mode 100644 index 0000000000..3c3519e8a1 --- /dev/null +++ b/docker/prod/supervisor.conf @@ -0,0 +1,9 @@ +programs: + - name: "vpp" + executable-path: "/usr/bin/vpp" + executable-args: ["-c", "/etc/vpp/vpp.conf"] + - name: "agent" + executable-path: "/bin/vpp-agent" + executable-args: ["--config-dir=/opt/vpp-agent/dev"] +hooks: + - cmd: "/usr/bin/init_hook.sh" diff --git a/docker/prod/supervisord.conf b/docker/prod/supervisord.conf deleted file mode 100644 index 0be10c28b7..0000000000 --- a/docker/prod/supervisord.conf +++ /dev/null @@ -1,26 +0,0 @@ -[supervisord] -logfile=/var/log/supervisord.log -loglevel=debug -nodaemon=true -pidfile=/run/supervisord.pid - -[program:vpp] -command=/usr/bin/vpp -c /etc/vpp/vpp.conf -autorestart=false -redirect_stderr=true -priority=1 - -[program:agent] -command=/usr/bin/exec_agent.sh -startsecs=0 -autorestart=false -redirect_stderr=true -priority=2 - -; This event listener waits for event of vpp or agent exitting. -; Once received, it kills supervisord process and this makes -; subsequently the exit of docker container. -; You should also set agent's autorestart=false. -[eventlistener:vpp_or_agent_not_running] -command=/usr/bin/supervisord_kill.py -events=PROCESS_STATE_EXITED diff --git a/docker/prod/supervisord_kill.py b/docker/prod/supervisord_kill.py deleted file mode 100755 index debf647cb0..0000000000 --- a/docker/prod/supervisord_kill.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -import sys -import os -import signal - - -def write_stdout(msg): - # only eventlistener protocol messages may be sent to stdout - sys.stdout.write(msg) - sys.stdout.flush() - - -def write_stderr(msg): - sys.stderr.write(msg) - sys.stderr.flush() - - -def main(): - while 1: - # transition from ACKNOWLEDGED to READY - write_stdout('READY\n') - - # read header line and print it to stderr - line = sys.stdin.readline() - write_stderr('EVENT: ' + line) - - # read event payload and print it to stderr - headers = dict([x.split(':') for x in line.split()]) - data = sys.stdin.read(int(headers['len'])) - write_stderr('DATA: ' + data + '\n') - - # ignore non vpp events, skipping - parsed_data = dict([x.split(':') for x in data.split()]) - if parsed_data["processname"] not in ["vpp", "agent"]: - write_stderr('Ignoring event from ' + parsed_data["processname"] + '\n') - write_stdout('RESULT 2\nOK') - continue - - # ignore exits with expected exit codes - if parsed_data["expected"] == "1": - write_stderr('Exit state from ' + parsed_data["processname"] + ' was expected\n') - write_stdout('RESULT 2\nOK') - continue - - # do not kill supervisor if retained and exit - if 'RETAIN_SUPERVISOR' in os.environ and os.environ['RETAIN_SUPERVISOR'] != '': - write_stderr('Supervisord is configured to retain after unexpected exits (unset RETAIN_SUPERVISOR to disable it)\n') - write_stdout('RESULT 2\nOK') - continue - - try: - with open('/run/supervisord.pid', 'r') as pidfile: - pid = int(pidfile.readline()) - write_stderr('Killing supervisord with pid: ' + str(pid) + '\n') - os.kill(pid, signal.SIGQUIT) - except Exception as e: - write_stderr('Could not kill supervisor: ' + str(e) + '\n') - - # transition from READY to ACKNOWLEDGED - write_stdout('RESULT 2\nOK') - return - - -if __name__ == '__main__': - main() diff --git a/docker/prod/vpp-ifplugin.conf b/docker/prod/vpp-ifplugin.conf deleted file mode 100644 index 9031308d55..0000000000 --- a/docker/prod/vpp-ifplugin.conf +++ /dev/null @@ -1 +0,0 @@ -stopwatch: true \ No newline at end of file diff --git a/docs/kvscheduler/cfd/af_packet_interface.md b/docs/kvscheduler/cfd/af_packet_interface.md index 145b59ce5b..085a763862 100644 --- a/docs/kvscheduler/cfd/af_packet_interface.md +++ b/docs/kvscheduler/cfd/af_packet_interface.md @@ -13,7 +13,7 @@ a pre-existing physical device or interface created by an external process or an administrator during the agent run-time. In such cases, however, there would be no key-value pair to reference from within `AF-Packet` dependencies. Therefore, KVScheduler allows to notify about external objects through -`PushSBNotification(key, value, metadata)` method. Values received through +`PushSBNotification(notification...)` method. Values received through notifications are denoted as `OBTAINED` and will not be removed by resync even though they are not requested to be configured by NB. Obtained values are allowed to have their own descriptors, but from the CRUD operations only diff --git a/examples/custom_model/main.go b/examples/custom_model/main.go index 1c230307ec..579ab08883 100644 --- a/examples/custom_model/main.go +++ b/examples/custom_model/main.go @@ -26,27 +26,28 @@ import ( "github.com/ligato/cn-infra/agent" "github.com/ligato/cn-infra/infra" "github.com/ligato/cn-infra/logging/logrus" - "github.com/ligato/vpp-agent/api/configurator" - "github.com/ligato/vpp-agent/client" - "github.com/ligato/vpp-agent/cmd/vpp-agent/app" - "github.com/ligato/vpp-agent/examples/custom_model/pb" - "github.com/ligato/vpp-agent/plugins/orchestrator" "github.com/namsral/flag" "google.golang.org/grpc" + "github.com/ligato/vpp-agent/api/genericmanager" "github.com/ligato/vpp-agent/api/models/linux" - "github.com/ligato/vpp-agent/api/models/linux/interfaces" - "github.com/ligato/vpp-agent/api/models/linux/l3" + linux_interfaces "github.com/ligato/vpp-agent/api/models/linux/interfaces" + linux_l3 "github.com/ligato/vpp-agent/api/models/linux/l3" "github.com/ligato/vpp-agent/api/models/vpp" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" - "github.com/ligato/vpp-agent/api/models/vpp/l2" + vpp_l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + "github.com/ligato/vpp-agent/client" + "github.com/ligato/vpp-agent/client/remoteclient" + "github.com/ligato/vpp-agent/cmd/vpp-agent/app" + mymodel "github.com/ligato/vpp-agent/examples/custom_model/pb" + "github.com/ligato/vpp-agent/plugins/orchestrator" ) var ( - address = flag.String("address", "172.17.0.2:9111", "address of GRPC server") + address = flag.String("address", "127.0.0.1:9111", "address of GRPC server") socketType = flag.String("socket-type", "tcp", "socket type [tcp, tcp4, tcp6, unix, unixpacket]") - dialTimeout = time.Second * 2 + dialTimeout = time.Second * 3 ) var exampleFinished = make(chan struct{}) @@ -66,7 +67,7 @@ func main() { agent.QuitOnClose(exampleFinished), ) if err := a.Run(); err != nil { - log.Fatal() + log.Fatal(err) } } @@ -109,12 +110,14 @@ func (p *ExamplePlugin) AfterInit() (err error) { go func() { time.Sleep(time.Second) - //c := remoteclient.NewClientGRPC(api.NewGenericManagerClient(conn)) - c := client.LocalClient - + // remoteclient + c := remoteclient.NewClientGRPC(genericmanager.NewGenericManagerClient(p.conn)) demonstrateClient(c) - time.Sleep(time.Second * 3) + //time.Sleep(time.Second * 3) + + // localclient + //demonstrateClient(client.LocalClient) logrus.DefaultLogger().Info("Closing example") close(exampleFinished) @@ -137,40 +140,50 @@ func (p *ExamplePlugin) Close() error { } func demonstrateClient(c client.ConfigClient) { - // ========================================== + tm := proto.TextMarshaler{ + Compact: true, + ExpandAny: true, + } + log.SetFlags(log.Lshortfile | log.Lmicroseconds) + // List known models - // ========================================== + fmt.Println("# ==========================================") + fmt.Println("# List known models..") + fmt.Println("# ==========================================") knownModels, err := c.KnownModels() if err != nil { - log.Fatalln(err) + log.Println("KnownModels failed:", err) } - fmt.Printf("Listing %d known models..\n", len(knownModels)) + fmt.Printf("listing %d models\n", len(knownModels)) for _, model := range knownModels { fmt.Printf(" - %v\n", model.String()) } - time.Sleep(time.Second * 3) + time.Sleep(time.Second * 1) - // ========================================== // Resync config - // ========================================== - fmt.Printf("Requesting config resync..\n") + fmt.Println("# ==========================================") + fmt.Println("# Requesting config resync..") + fmt.Println("# ==========================================") + customModel := &mymodel.MyModel{ + Name: "TheModel", + } err = c.ResyncConfig( memif1, memif2, veth1, veth2, - routeX, + routeX, routeCache, + customModel, ) if err != nil { - log.Fatalln(err) + log.Println("ResyncConfig failed:", err) } - time.Sleep(time.Second * 5) + time.Sleep(time.Second * 2) - // ========================================== // Change config - // ========================================== - fmt.Printf("Requesting config change..\n") + fmt.Println("# ==========================================") + fmt.Println("# Requesting config change..") + fmt.Println("# ==========================================") memif1.Enabled = false memif1.Mtu = 666 - custom := &mymodel.MyModel{ Name: "my1", Mynum: 33, @@ -182,20 +195,35 @@ func demonstrateClient(c client.ConfigClient) { if err := req.Send(context.Background()); err != nil { log.Fatalln(err) } - time.Sleep(time.Second * 5) + time.Sleep(time.Second * 2) - // ========================================== // Get config - // ========================================== - fmt.Printf("Retrieving config..\n") - data := &configurator.Config{ - VppConfig: &vpp.ConfigData{}, - LinuxConfig: &linux.ConfigData{}, + fmt.Println("# ==========================================") + fmt.Println("# Retrieving config..") + fmt.Println("# ==========================================") + type config struct { + VPP vpp.ConfigData + Linux linux.ConfigData + MyModels []*mymodel.MyModel } - if err := c.GetConfig(data.VppConfig, data.LinuxConfig); err != nil { - log.Fatalln(err) + var cfg config + if err := c.GetConfig(&cfg.VPP, &cfg.Linux, &cfg); err != nil { + log.Println("GetConfig failed:", err) + } + fmt.Printf("Retrieved config:\n%+v\n", cfg) + + // Dump state + fmt.Println("# ==========================================") + fmt.Println("# Dumping state..") + fmt.Println("# ==========================================") + states, err := c.DumpState() + if err != nil { + log.Println("DumpState failed:", err) + } + fmt.Printf("Dumping %d states\n", len(states)) + for _, state := range states { + fmt.Printf(" - %v\n", tm.Text(state)) } - fmt.Printf("Retrieved config:\n%+v\n", proto.MarshalTextString(data)) } // Dialer for unix domain socket @@ -286,4 +314,16 @@ var ( GwAddr: "10.10.3.254", Scope: linux_l3.Route_GLOBAL, } + routeCache = &linux.Route{ + DstNetwork: "10.10.5.0/24", + OutgoingInterface: "if10", + GwAddr: "10.10.5.254", + Scope: linux_l3.Route_GLOBAL, + } + routeBad = &linux.Route{ + DstNetwork: "192.168.6.0/24", + OutgoingInterface: "myVETH1", + GwAddr: "10.10.3.2545", + Scope: linux_l3.Route_GLOBAL, + } ) diff --git a/examples/kvscheduler/rxplacement/govpp.conf b/examples/kvscheduler/rxplacement/govpp.conf new file mode 100644 index 0000000000..35870c51bc --- /dev/null +++ b/examples/kvscheduler/rxplacement/govpp.conf @@ -0,0 +1,4 @@ +# Path to a Unix-domain socket through which configuration requests are sent to VPP. +# Used if connect-via-shm is set to false and env. variable GOVPPMUX_NOSOCK is not defined. +# Default is "/run/vpp-api.sock". +binapi-socket-path: /tmp/vpp1.sock diff --git a/examples/kvscheduler/rxplacement/kvscheduler.conf b/examples/kvscheduler/rxplacement/kvscheduler.conf new file mode 100644 index 0000000000..557749f3f4 --- /dev/null +++ b/examples/kvscheduler/rxplacement/kvscheduler.conf @@ -0,0 +1,3 @@ +enable-txn-simulation: true +record-transaction-history: true +print-txn-summary: true diff --git a/examples/kvscheduler/rxplacement/main.go b/examples/kvscheduler/rxplacement/main.go new file mode 100644 index 0000000000..74660b0d76 --- /dev/null +++ b/examples/kvscheduler/rxplacement/main.go @@ -0,0 +1,264 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "fmt" + "log" + "time" + + "github.com/ligato/cn-infra/agent" + + "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/clientv2/linux/localclient" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler" + kvs_api "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/orchestrator" + vpp_ifplugin "github.com/ligato/vpp-agent/plugins/vpp/ifplugin" +) + +/* + * VPP1 (configured by this example): + - startup config: + unix { + interactive + cli-listen 0.0.0.0:5002 + cli-no-pager + coredump-size unlimited + full-coredump + poll-sleep-usec 50 + } + api-trace { + on + } + socksvr { + socket-name "/tmp/vpp1.sock" + } + statseg { + default + per-node-counters on + } + cpu { + workers 2 + } + + * VPP2 (configured manually to connect with myMemif): + - startup config: + unix { + interactive + cli-listen 0.0.0.0:5003 + cli-no-pager + coredump-size unlimited + full-coredump + poll-sleep-usec 50 + } + api-trace { + on + } + socksvr { + socket-name "/tmp/vpp2.sock" + } + statseg { + default + per-node-counters on + } + cpu { + workers 2 + } + + - configuration to be applied via CLI: + $ create interface memif id 0 slave rx-queues 5 tx-queues 5 + $ set int state memif0/0 up + $ set int ip address memif0/0 192.168.1.2/24 +*/ +func main() { + //vpp_ifplugin.DefaultPlugin.PublishStatistics = &Publisher{} + ep := &ExamplePlugin{ + KVScheduler: &kvs.DefaultPlugin, + VPPIfPlugin: &vpp_ifplugin.DefaultPlugin, + Orchestrator: &orchestrator.DefaultPlugin, + } + + a := agent.NewAgent( + agent.AllPlugins(ep), + ) + if err := a.Run(); err != nil { + log.Fatal(err) + } +} + +// ExamplePlugin is the main plugin which +// handles resync and changes in this example. +type ExamplePlugin struct { + KVScheduler *kvs.Scheduler + VPPIfPlugin *vpp_ifplugin.IfPlugin + Orchestrator *orchestrator.Plugin +} + +/* +type Publisher struct { +} + +func (p *Publisher) Put(key string, data proto.Message, opts ...datasync.PutOption) error { + fmt.Printf("Publishing key=%s, data=%+v\n", key, data) + return nil +} +*/ + +// String returns plugin name +func (p *ExamplePlugin) String() string { + return "rx-placement-example" +} + +// Init handles initialization phase. +func (p *ExamplePlugin) Init() error { + return nil +} + +// AfterInit handles phase after initialization. +func (p *ExamplePlugin) AfterInit() error { + ch := make(chan *kvs_api.BaseValueStatus, 100) + p.KVScheduler.WatchValueStatus(ch, nil) + go watchValueStatus(ch) + go testLocalClientWithScheduler(p.KVScheduler) + return nil +} + +// Close cleans up the resources. +func (p *ExamplePlugin) Close() error { + return nil +} + +func watchValueStatus(ch <-chan *kvs_api.BaseValueStatus) { + for { + select { + case status := <-ch: + fmt.Printf("Value status change: %v\n", status.String()) + } + } +} + +func testLocalClientWithScheduler(kvscheduler kvs_api.KVScheduler) { + // initial resync + time.Sleep(time.Second * 2) + fmt.Println("=== RESYNC WITH MEMIF ===") + + txn := localclient.DataResyncRequest("example") + err := txn. + VppInterface(myMemif). + Send().ReceiveReply() + if err != nil { + fmt.Println(err) + return + } + + // data change #1 + time.Sleep(time.Second * 10) + fmt.Println("=== CHANGE ===") + + myMemif.RxModes[0].Mode = vpp_interfaces.Interface_RxMode_INTERRUPT // change default + myMemif.RxModes = append(myMemif.RxModes, &vpp_interfaces.Interface_RxMode{ + Queue: 3, + Mode: vpp_interfaces.Interface_RxMode_POLLING, + }) + myMemif.RxPlacements = append(myMemif.RxPlacements, &vpp_interfaces.Interface_RxPlacement{ + Queue: 3, + MainThread: true, + Worker: 100, // ignored + }) + + txn2 := localclient.DataChangeRequest("example") + err = txn2.Put(). + VppInterface(myMemif). + Send().ReceiveReply() + if err != nil { + fmt.Println(err) + return + } + + // data change #2 + time.Sleep(time.Second * 20) + fmt.Println("=== CHANGE ===") + + myMemif.GetMemif().RxQueues = 5 + myMemif.GetMemif().TxQueues = 5 + myMemif.RxPlacements = append(myMemif.RxPlacements, &vpp_interfaces.Interface_RxPlacement{ + Queue: 4, + MainThread: true, + }) + + /* Re-create will fail - that is expected and it is due to the link-state key + being updated AFTER the transaction, not during. The subsequent retry/notification + should fix all the errors. + */ + + txn3 := localclient.DataChangeRequest("example") + err = txn3.Put(). + VppInterface(myMemif). // re-create + Send().ReceiveReply() + if err != nil { + fmt.Println(err) + return + } +} + +var ( + myMemif = &vpp_interfaces.Interface{ + Name: "my-memif", + Type: vpp_interfaces.Interface_MEMIF, + Enabled: true, + IpAddresses: []string{"192.168.1.1/24"}, + + RxPlacements: []*vpp_interfaces.Interface_RxPlacement{ + { + Queue: 0, + Worker: 0, + }, + { + Queue: 1, + MainThread: true, + }, + { + Queue: 2, + Worker: 1, + }, + }, + + RxModes: []*vpp_interfaces.Interface_RxMode{ + { + DefaultMode: true, + Mode: vpp_interfaces.Interface_RxMode_POLLING, + }, + { + Queue: 1, + Mode: vpp_interfaces.Interface_RxMode_INTERRUPT, + }, + { + Queue: 2, + Mode: vpp_interfaces.Interface_RxMode_INTERRUPT, + }, + }, + + Link: &vpp_interfaces.Interface_Memif{ + Memif: &vpp_interfaces.MemifLink{ + Mode: vpp_interfaces.MemifLink_ETHERNET, + Master: true, + Id: 0, + RxQueues: 4, + TxQueues: 4, + }, + }, + } +) diff --git a/examples/kvscheduler/vpp-l3/main.go b/examples/kvscheduler/vpp-l3/main.go index 88344d672c..949b67dcd7 100644 --- a/examples/kvscheduler/vpp-l3/main.go +++ b/examples/kvscheduler/vpp-l3/main.go @@ -115,7 +115,7 @@ func testLocalClientWithScheduler() { StaticRoute(route0). Delete(). VppInterface(memif0.Name). - StaticRoute(route1.VrfId, route1.DstNetwork, route1.NextHopAddr). + StaticRoute(route1.OutgoingInterface, route1.VrfId, route1.DstNetwork, route1.NextHopAddr). Put(). Arp(arp0). ProxyArp(proxyArp). diff --git a/examples/localclient_vpp/plugins/main.go b/examples/localclient_vpp/plugins/main.go index 8f15125a58..8baf3f3449 100644 --- a/examples/localclient_vpp/plugins/main.go +++ b/examples/localclient_vpp/plugins/main.go @@ -161,7 +161,7 @@ func (p *ExamplePlugin) reconfigureVPP(ctx context.Context) { XConnect(&XConMemif1ToMemif2). /* xconnect memif interfaces */ BD(&BDLoopback1ToTap1). /* put loopback and tap1 into the same bridge domain */ Delete(). - StaticRoute(0, "192.168.2.1/32", "192.168.1.1"). /* remove the route going through memif1 */ + StaticRoute("", 0, "192.168.2.1/32", "192.168.1.1"). /* remove the route going through memif1 */ Send().ReceiveReply() if err != nil { logrus.DefaultLogger().Errorf("Failed to reconfigure VPP: %v", err) @@ -355,10 +355,10 @@ var ( MacAge: 0, /* means disable aging */ Interfaces: []*l2.BridgeDomain_Interface{ { - Name: "loopback1", + Name: "loopback1", BridgedVirtualInterface: true, }, { - Name: "tap1", + Name: "tap1", BridgedVirtualInterface: false, }, }, diff --git a/pkg/debug/debug.go b/pkg/debug/debug.go new file mode 100644 index 0000000000..464082126f --- /dev/null +++ b/pkg/debug/debug.go @@ -0,0 +1,99 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package debug + +import ( + _ "expvar" + "log" + "net/http" + _ "net/http/pprof" + "os" + "strings" + + "github.com/pkg/profile" +) + +const defaultServerAddr = ":1234" + +var ( + profileMode = os.Getenv("DEBUG_PROFILE_MODE") + profilePath = os.Getenv("DEBUG_PROFILE_PATH") + debugServerAddr = os.Getenv("DEBUG_SERVER_ADDR") +) + +type Debug struct { + closer func() +} + +func Start() interface { + Stop() +} { + var d Debug + + d.runProfiling() + + d.runServer() + + return &d +} + +func (d *Debug) Stop() { + if d.closer != nil { + d.closer() + } +} + +func (d *Debug) runProfiling() { + var profiling func(*profile.Profile) + + switch strings.ToLower(profileMode) { + case "cpu": + profiling = profile.CPUProfile + case "mem": + profiling = profile.MemProfile + case "mutex": + profiling = profile.MutexProfile + case "block": + profiling = profile.BlockProfile + case "trace": + profiling = profile.TraceProfile + default: + // do nothing + return + } + + opts := []func(*profile.Profile){ + profiling, + profile.ProfilePath(profilePath), + profile.NoShutdownHook, + } + + d.closer = profile.Start(opts...).Stop +} + +func (d *Debug) runServer() { + addr := debugServerAddr + if addr == "" { + addr = defaultServerAddr + } + + log.Printf("debug server listening on: %s", addr) + + go func() { + if err := http.ListenAndServe(addr, nil); err != nil { + log.Printf("debug server error: %v", err) + } + }() +} diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index e5e41e1d42..bb400f7fb5 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -16,12 +16,13 @@ package metrics import ( "encoding/json" + "math" "sort" "time" ) // RoundDuration is the default value used for rounding durations. -var RoundDuration = time.Microsecond * 10 +var RoundDuration = time.Millisecond * 1 type Calls map[string]*CallStats @@ -32,27 +33,39 @@ func (m Calls) MarshalJSON() ([]byte, error) { calls = append(calls, s) } sort.Slice(calls, func(i, j int) bool { - return calls[i].Total > calls[j].Total + return calls[i].Count > calls[j].Count }) + + /*var buf bytes.Buffer + buf.WriteByte('{') + for i, c := range calls { + if i > 0 { + buf.WriteByte(',') + } + buf.WriteString(fmt.Sprintf(`"%s":{"count":%d}`, c.Name, c.Count)) + } + buf.WriteByte('}') + return buf.Bytes(), nil*/ + return json.Marshal(calls) } // CallStats represents generic stats for call metrics. type CallStats struct { - Name string `json:",omitempty"` - Count uint64 - Total Duration - Avg Duration - Min Duration - Max Duration + Name string `json:"name,omitempty"` + Count uint64 `json:"count"` + Total float64 `json:"total,omitempty"` + Avg float64 `json:"avg,omitempty"` + Min float64 `json:"min,omitempty"` + Max float64 `json:"max,omitempty"` } // Increment increments call count and recalculates durations func (m *CallStats) Increment(d time.Duration) { - took := Duration(d) + took := d.Round(RoundDuration).Seconds() m.Count++ - m.Total += took - m.Avg = m.Total / Duration(m.Count) + m.Total = round(m.Total + took) + m.Avg = round(m.Total / float64(m.Count)) if took > m.Max { m.Max = took } @@ -61,23 +74,17 @@ func (m *CallStats) Increment(d time.Duration) { } } -/* +func round(n float64) float64 { + return math.Round(n*1000) / 1000 +} + // MarshalJSON implements json.Marshaler interface -func (m *CallStats) MarshalJSON() ([]byte, error) { +/*func (m *CallStats) MarshalJSON() ([]byte, error) { var d string d = fmt.Sprintf( - "count: %d, total: %s (avg/min/max: %s/%s/%s)", - m.Count, durStr(m.TotalDur), - durStr(m.AvgDur), durStr(m.MinDur), durStr(m.MaxDur), + "%s - count: %d, total: %s (avg/min/max: %s/%s/%s)", + m.Name, m.Count, durStr(m.Total), + durStr(m.Avg), durStr(m.Min), durStr(m.Max), ) return json.Marshal(d) -} -*/ - -type Duration time.Duration - -// MarshalJSON implements json.Marshaler interface -func (m *Duration) MarshalJSON() ([]byte, error) { - s := time.Duration(*m).Round(RoundDuration).String() - return json.Marshal(s) -} +}*/ diff --git a/pkg/models/encoding.go b/pkg/models/item.go similarity index 89% rename from pkg/models/encoding.go rename to pkg/models/item.go index 5cc30a684e..cec4c26e1c 100644 --- a/pkg/models/encoding.go +++ b/pkg/models/item.go @@ -21,13 +21,14 @@ import ( "github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/types" - api "github.com/ligato/vpp-agent/api/genericmanager" "github.com/ligato/cn-infra/datasync" + api "github.com/ligato/vpp-agent/api/genericmanager" ) // This constant is used as prefix for TypeUrl when marshalling to Any. const ligatoModels = "models.ligato.io/" +// UnmarshalLazyValue is helper function for unmarshalling from datasync.LazyValue. func UnmarshalLazyValue(key string, lazy datasync.LazyValue) (proto.Message, error) { for _, model := range registeredModels { if !model.IsKeyValid(key) { @@ -113,7 +114,7 @@ func getItemID(pb proto.Message) (*api.Item_ID, error) { return nil, fmt.Errorf("message %s is not registered as model", protoName) } - name, err := model.nameFunc(pb) + name, err := model.name(pb) if err != nil { return nil, err } @@ -171,23 +172,3 @@ func ItemKey(item *api.Item) (string, error) { return "", fmt.Errorf("invalid item: %v", item) } - -// RegisteredModels returns all registered modules. -func RegisteredModels() (models []*api.ModelInfo) { - for _, s := range registeredModels { - models = append(models, &api.ModelInfo{ - Model: &api.Model{ - Module: s.Module, - Type: s.Type, - Version: s.Version, - }, - Info: map[string]string{ - "nameTemplate": s.nameTemplate, - "protoName": s.protoName, - "modelPath": s.modelPath, - "keyPrefix": s.keyPrefix, - }, - }) - } - return -} diff --git a/pkg/models/models.go b/pkg/models/models.go index 844ee0935d..436949bf4c 100644 --- a/pkg/models/models.go +++ b/pkg/models/models.go @@ -105,3 +105,14 @@ func GetModel(x proto.Message) (registeredModel, error) { } return *model, nil } + +// GetModelForKey returns registered model for the given key or error. +func GetModelForKey(key string) (registeredModel, error) { + for _, model := range registeredModels { + if !model.IsKeyValid(key) { + continue + } + return *model, nil + } + return registeredModel{}, fmt.Errorf("no model registered for key %s", key) +} diff --git a/pkg/models/spec.go b/pkg/models/spec.go index 51add7fa89..8dde544da1 100644 --- a/pkg/models/spec.go +++ b/pkg/models/spec.go @@ -23,6 +23,7 @@ import ( "text/template" "github.com/gogo/protobuf/proto" + api "github.com/ligato/vpp-agent/api/genericmanager" ) @@ -86,6 +87,8 @@ func (m registeredModel) ParseKey(key string) (name string, valid bool) { if name == key || (name == "" && m.nameFunc != nil) { name = strings.TrimPrefix(key, m.modelPath) } + // key had the prefix and also either + // non-empty name or no name template if name != key && (name != "" || m.nameFunc == nil) { // TODO: validate name? return name, true @@ -121,6 +124,26 @@ var ( debugRegister = strings.Contains(os.Getenv("DEBUG_MODELS"), "register") ) +// RegisteredModels returns all registered modules. +func RegisteredModels() (models []*api.ModelInfo) { + for _, s := range registeredModels { + models = append(models, &api.ModelInfo{ + Model: &api.Model{ + Module: s.Module, + Type: s.Type, + Version: s.Version, + }, + Info: map[string]string{ + "nameTemplate": s.nameTemplate, + "protoName": s.protoName, + "modelPath": s.modelPath, + "keyPrefix": s.keyPrefix, + }, + }) + } + return +} + // Register registers the protobuf message with given model specification. func Register(pb proto.Message, spec Spec, opts ...ModelOption) *registeredModel { model := ®isteredModel{ @@ -205,8 +228,32 @@ func NameTemplate(t string) NameFunc { } var funcMap = template.FuncMap{ + "ip": func(s string) string { + ip := net.ParseIP(s) + if ip == nil { + return "" + } + return ip.String() + }, + "protoip": func(s string) string { + ip := net.ParseIP(s) + if ip == nil { + return "" + } + + if ip.To4() == nil { + return "IPv6" + } + return "IPv4" + }, "ipnet": func(s string) map[string]interface{} { - _, ipNet, _ := net.ParseCIDR(s) + _, ipNet, err := net.ParseCIDR(s) + if err != nil { + return map[string]interface{}{ + "IP": "", + "MaskSize": 0, + } + } maskSize, _ := ipNet.Mask.Size() return map[string]interface{}{ "IP": ipNet.IP.String(), diff --git a/plugins/configurator/configurator.go b/plugins/configurator/configurator.go index 6eca6d6c85..70224f2a5a 100644 --- a/plugins/configurator/configurator.go +++ b/plugins/configurator/configurator.go @@ -1,3 +1,17 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package configurator import ( diff --git a/plugins/configurator/dump.go b/plugins/configurator/dump.go index 15ce77faf6..ee678bf2ad 100644 --- a/plugins/configurator/dump.go +++ b/plugins/configurator/dump.go @@ -1,7 +1,8 @@ package configurator import ( - "github.com/go-errors/errors" + "errors" + "github.com/ligato/cn-infra/logging" "golang.org/x/net/context" @@ -12,6 +13,7 @@ import ( vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" vpp_l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + vpp_nat "github.com/ligato/vpp-agent/api/models/vpp/nat" vpp_punt "github.com/ligato/vpp-agent/api/models/vpp/punt" iflinuxcalls "github.com/ligato/vpp-agent/plugins/linux/ifplugin/linuxcalls" l3linuxcalls "github.com/ligato/vpp-agent/plugins/linux/l3plugin/linuxcalls" @@ -29,19 +31,24 @@ type dumpService struct { log logging.Logger // VPP Handlers - aclHandler aclvppcalls.ACLVppRead - abfHandler abfvppcalls.ABFVppRead + + // core ifHandler ifvppcalls.InterfaceVppRead - natHandler natvppcalls.NatVppRead l2Handler l2vppcalls.L2VppAPI l3Handler l3vppcalls.L3VppAPI ipsecHandler ipsecvppcalls.IPSecVPPRead - puntHandler vppcalls.PuntVPPRead + // plugins + aclHandler aclvppcalls.ACLVppRead + abfHandler abfvppcalls.ABFVppRead + natHandler natvppcalls.NatVppRead + puntHandler vppcalls.PuntVPPRead + // Linux handlers linuxIfHandler iflinuxcalls.NetlinkAPIRead linuxL3Handler l3linuxcalls.NetlinkAPIRead } +// Dump implements Dump method for Configurator func (svc *dumpService) Dump(context.Context, *rpc.DumpRequest) (*rpc.DumpResponse, error) { defer trackOperation("Dump")() @@ -51,34 +58,25 @@ func (svc *dumpService) Dump(context.Context, *rpc.DumpRequest) (*rpc.DumpRespon var err error + // core dump.VppConfig.Interfaces, err = svc.DumpInterfaces() if err != nil { svc.log.Errorf("DumpInterfaces failed: %v", err) return nil, err } - dump.VppConfig.Acls, err = svc.DumpAcls() - if err != nil { - svc.log.Errorf("DumpAcls failed: %v", err) - return nil, err - } - dump.VppConfig.Abfs, err = svc.DumpAbfs() - if err != nil { - svc.log.Errorf("DumpAbfs failed: %v", err) - return nil, err - } - dump.VppConfig.IpsecSpds, err = svc.DumpIPSecSPDs() + dump.VppConfig.BridgeDomains, err = svc.DumpBDs() if err != nil { - svc.log.Errorf("DumpIPSecSPDs failed: %v", err) + svc.log.Errorf("DumpBDs failed: %v", err) return nil, err } - dump.VppConfig.IpsecSas, err = svc.DumpIPSecSAs() + dump.VppConfig.Fibs, err = svc.DumpFIBs() if err != nil { - svc.log.Errorf("DumpIPSecSAs failed: %v", err) + svc.log.Errorf("DumpFIBs failed: %v", err) return nil, err } - dump.VppConfig.BridgeDomains, err = svc.DumpBDs() + dump.VppConfig.XconnectPairs, err = svc.DumpXConnects() if err != nil { - svc.log.Errorf("DumpBDs failed: %v", err) + svc.log.Errorf("DumpXConnects failed: %v", err) return nil, err } dump.VppConfig.Routes, err = svc.DumpRoutes() @@ -91,75 +89,63 @@ func (svc *dumpService) Dump(context.Context, *rpc.DumpRequest) (*rpc.DumpRespon svc.log.Errorf("DumpARPs failed: %v", err) return nil, err } - dump.VppConfig.Fibs, err = svc.DumpFIBs() + dump.VppConfig.IpsecSpds, err = svc.DumpIPSecSPDs() if err != nil { - svc.log.Errorf("DumpFIBs failed: %v", err) + svc.log.Errorf("DumpIPSecSPDs failed: %v", err) return nil, err } - dump.VppConfig.XconnectPairs, err = svc.DumpXConnects() + dump.VppConfig.IpsecSas, err = svc.DumpIPSecSAs() if err != nil { - svc.log.Errorf("DumpXConnects failed: %v", err) + svc.log.Errorf("DumpIPSecSAs failed: %v", err) return nil, err } - dump.VppConfig.PuntTohosts, err = svc.DumpPunt() + + // plugins + dump.VppConfig.Acls, err = svc.DumpACLs() if err != nil { - svc.log.Errorf("DumpPunt failed: %v", err) + svc.log.Errorf("DumpACLs failed: %v", err) return nil, err } - - // FIXME: linux interface handler should return known proto instead of netlink - // state.LinuxData.Interfaces, _ = svc.DumpLinuxInterfaces() - - return &rpc.DumpResponse{Dump: dump}, nil -} - -// DumpAcls reads IP/MACIP access lists and returns them as an *AclResponse. If reading ends up with error, -// only error is send back in response -func (svc *dumpService) DumpAcls() ([]*vpp_acl.ACL, error) { - var acls []*vpp_acl.ACL - if svc.aclHandler == nil { - return nil, errors.New("aclHandler is not available") - } - ipACLs, err := svc.aclHandler.DumpACL() + dump.VppConfig.Abfs, err = svc.DumpABFs() if err != nil { + svc.log.Errorf("DumpABFs failed: %v", err) return nil, err } - macIPACLs, err := svc.aclHandler.DumpMACIPACL() + dump.VppConfig.Nat44Global, err = svc.DumpNAT44Global() if err != nil { + svc.log.Errorf("DumpNAT44Global failed: %v", err) return nil, err } - for _, aclDetails := range ipACLs { - acls = append(acls, aclDetails.ACL) - } - for _, aclDetails := range macIPACLs { - acls = append(acls, aclDetails.ACL) - } - - return acls, nil -} - -// DumpAbfs reads the ACL-based forwarding and returns data read as an *AbfResponse. If the reading ends up with -// an error, only the error is send back in the response -func (svc *dumpService) DumpAbfs() ([]*vpp_abf.ABF, error) { - var abfs []*vpp_abf.ABF - if svc.abfHandler == nil { - return nil, errors.New("abfHandler is not available") + dump.VppConfig.Dnat44S, err = svc.DumpDNAT44s() + if err != nil { + svc.log.Errorf("DumpDNAT44s failed: %v", err) + return nil, err } - abfPolicy, err := svc.abfHandler.DumpABFPolicy() + dump.VppConfig.PuntTohosts, err = svc.DumpPunt() if err != nil { + svc.log.Errorf("DumpPunt failed: %v", err) return nil, err } - for _, abfDetails := range abfPolicy { - abfs = append(abfs, abfDetails.ABF) + dump.VppConfig.PuntExceptions, err = svc.DumpPuntExceptions() + if err != nil { + svc.log.Errorf("DumpPuntExceptions failed: %v", err) + return nil, err } - return abfs, nil + // FIXME: linux interfaces should return known proto instead of netlink + // state.LinuxData.Interfaces, _ = svc.DumpLinuxInterfaces() + + return &rpc.DumpResponse{Dump: dump}, nil } // DumpInterfaces reads interfaces and returns them as an *InterfaceResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpInterfaces() ([]*vpp_interfaces.Interface, error) { - var ifs []*vpp_interfaces.Interface +func (svc *dumpService) DumpInterfaces() (ifs []*vpp_interfaces.Interface, err error) { + if svc.ifHandler == nil { + // handler is not available + return nil, nil + } + ifDetails, err := svc.ifHandler.DumpInterfaces() if err != nil { return nil, err @@ -167,17 +153,17 @@ func (svc *dumpService) DumpInterfaces() ([]*vpp_interfaces.Interface, error) { for _, iface := range ifDetails { ifs = append(ifs, iface.Interface) } - return ifs, nil } // DumpIPSecSPDs reads IPSec SPD and returns them as an *IPSecSPDResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpIPSecSPDs() ([]*vpp_ipsec.SecurityPolicyDatabase, error) { - var spds []*vpp_ipsec.SecurityPolicyDatabase +func (svc *dumpService) DumpIPSecSPDs() (spds []*vpp_ipsec.SecurityPolicyDatabase, err error) { if svc.ipsecHandler == nil { - return nil, errors.New("ipsecHandler is not available") + // handler is not available + return nil, nil } + spdDetails, err := svc.ipsecHandler.DumpIPSecSPD() if err != nil { return nil, err @@ -185,17 +171,17 @@ func (svc *dumpService) DumpIPSecSPDs() ([]*vpp_ipsec.SecurityPolicyDatabase, er for _, spd := range spdDetails { spds = append(spds, spd.Spd) } - return spds, nil } // DumpIPSecSAs reads IPSec SA and returns them as an *IPSecSAResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpIPSecSAs() ([]*vpp_ipsec.SecurityAssociation, error) { - var sas []*vpp_ipsec.SecurityAssociation +func (svc *dumpService) DumpIPSecSAs() (sas []*vpp_ipsec.SecurityAssociation, err error) { if svc.ipsecHandler == nil { - return nil, errors.New("ipsecHandler is not available") + // handler is not available + return nil, nil } + saDetails, err := svc.ipsecHandler.DumpIPSecSA() if err != nil { return nil, err @@ -203,29 +189,17 @@ func (svc *dumpService) DumpIPSecSAs() ([]*vpp_ipsec.SecurityAssociation, error) for _, sa := range saDetails { sas = append(sas, sa.Sa) } - return sas, nil } -// DumpIPSecTunnels reads IPSec tunnels and returns them as an *IPSecTunnelResponse. If reading ends up with error, +// DumpBDs reads bridge domains and returns them as an *BDResponse. If reading ends up with error, // only error is send back in response -/*func (svc *dumpService) DumpIPSecTunnels() (*rpc.IPSecTunnelResponse, error) { - var tuns []*vpp_ipsec. - tunDetails, err := svc.ipSecHandler.DumpIPSecTunnelInterfaces() - if err != nil { - return nil, err - } - for _, tun := range tunDetails { - tuns = append(tuns, tun.Tunnel) +func (svc *dumpService) DumpBDs() (bds []*vpp_l2.BridgeDomain, err error) { + if svc.l2Handler == nil { + // handler is not available + return nil, nil } - return &rpc.IPSecTunnelResponse{Tunnels: tuns}, nil -}*/ - -// DumpBDs reads bridge domains and returns them as an *BDResponse. If reading ends up with error, -// only error is send back in response -func (svc *dumpService) DumpBDs() ([]*vpp_l2.BridgeDomain, error) { - var bds []*vpp_l2.BridgeDomain bdDetails, err := svc.l2Handler.DumpBridgeDomains() if err != nil { return nil, err @@ -233,14 +207,17 @@ func (svc *dumpService) DumpBDs() ([]*vpp_l2.BridgeDomain, error) { for _, bd := range bdDetails { bds = append(bds, bd.Bd) } - return bds, nil } // DumpFIBs reads FIBs and returns them as an *FibResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpFIBs() ([]*vpp_l2.FIBEntry, error) { - var fibs []*vpp_l2.FIBEntry +func (svc *dumpService) DumpFIBs() (fibs []*vpp_l2.FIBEntry, err error) { + if svc.l2Handler == nil { + // handler is not available + return nil, nil + } + fibDetails, err := svc.l2Handler.DumpL2FIBs() if err != nil { return nil, err @@ -248,14 +225,17 @@ func (svc *dumpService) DumpFIBs() ([]*vpp_l2.FIBEntry, error) { for _, fib := range fibDetails { fibs = append(fibs, fib.Fib) } - return fibs, nil } // DumpXConnects reads cross connects and returns them as an *XcResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpXConnects() ([]*vpp_l2.XConnectPair, error) { - var xcs []*vpp_l2.XConnectPair +func (svc *dumpService) DumpXConnects() (xcs []*vpp_l2.XConnectPair, err error) { + if svc.l2Handler == nil { + // handler is not available + return nil, nil + } + xcDetails, err := svc.l2Handler.DumpXConnectPairs() if err != nil { return nil, err @@ -263,14 +243,17 @@ func (svc *dumpService) DumpXConnects() ([]*vpp_l2.XConnectPair, error) { for _, xc := range xcDetails { xcs = append(xcs, xc.Xc) } - return xcs, nil } // DumpRoutes reads VPP routes and returns them as an *RoutesResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpRoutes() ([]*vpp_l3.Route, error) { - var routes []*vpp_l3.Route +func (svc *dumpService) DumpRoutes() (routes []*vpp_l3.Route, err error) { + if svc.l3Handler == nil { + // handler is not available + return nil, nil + } + rtDetails, err := svc.l3Handler.DumpRoutes() if err != nil { return nil, err @@ -278,14 +261,17 @@ func (svc *dumpService) DumpRoutes() ([]*vpp_l3.Route, error) { for _, rt := range rtDetails { routes = append(routes, rt.Route) } - return routes, nil } // DumpARPs reads VPP ARPs and returns them as an *ARPsResponse. If reading ends up with error, // only error is send back in response -func (svc *dumpService) DumpARPs() ([]*vpp_l3.ARPEntry, error) { - var arps []*vpp_l3.ARPEntry +func (svc *dumpService) DumpARPs() (arps []*vpp_l3.ARPEntry, err error) { + if svc.l3Handler == nil { + // handler is not available + return nil, nil + } + arpDetails, err := svc.l3Handler.DumpArpEntries() if err != nil { return nil, err @@ -293,14 +279,85 @@ func (svc *dumpService) DumpARPs() ([]*vpp_l3.ARPEntry, error) { for _, arp := range arpDetails { arps = append(arps, arp.Arp) } - return arps, nil } +// DumpACLs reads IP/MACIP access lists and returns them as an *AclResponse. If reading ends up with error, +// only error is send back in response +func (svc *dumpService) DumpACLs() (acls []*vpp_acl.ACL, err error) { + if svc.aclHandler == nil { + // handler is not available + return nil, nil + } + + ipACLs, err := svc.aclHandler.DumpACL() + if err != nil { + return nil, err + } + macIPACLs, err := svc.aclHandler.DumpMACIPACL() + if err != nil { + return nil, err + } + for _, aclDetails := range ipACLs { + acls = append(acls, aclDetails.ACL) + } + for _, aclDetails := range macIPACLs { + acls = append(acls, aclDetails.ACL) + } + return acls, nil +} + +// DumpABFs reads the ACL-based forwarding and returns data read as an *AbfResponse. If the reading ends up with +// an error, only the error is send back in the response +func (svc *dumpService) DumpABFs() (abfs []*vpp_abf.ABF, err error) { + if svc.abfHandler == nil { + // handler is not available + return nil, nil + } + + abfPolicy, err := svc.abfHandler.DumpABFPolicy() + if err != nil { + return nil, err + } + for _, abfDetails := range abfPolicy { + abfs = append(abfs, abfDetails.ABF) + } + return abfs, nil +} + +// DumpNAT44GLobal dumps NAT44Global +func (svc *dumpService) DumpNAT44Global() (glob *vpp_nat.Nat44Global, err error) { + if svc.natHandler == nil { + // handler is not available + return nil, nil + } + + glob, err = svc.natHandler.Nat44GlobalConfigDump() + if err != nil { + return nil, err + } + return glob, nil +} + +// DumpDNAT44s dumps DNat44 +func (svc *dumpService) DumpDNAT44s() (dnats []*vpp_nat.DNat44, err error) { + if svc.natHandler == nil { + // handler is not available + return nil, nil + } + + dnats, err = svc.natHandler.DNat44Dump() + if err != nil { + return nil, err + } + return dnats, nil +} + // DumpPunt reads VPP Punt socket registrations and returns them as an *PuntResponse. func (svc *dumpService) DumpPunt() (punts []*vpp_punt.ToHost, err error) { if svc.puntHandler == nil { - return nil, errors.New("puntHandler is not available") + // handler is not available + return nil, nil } dump, err := svc.puntHandler.DumpRegisteredPuntSockets() if err != nil { @@ -313,6 +370,22 @@ func (svc *dumpService) DumpPunt() (punts []*vpp_punt.ToHost, err error) { return punts, nil } +// DumpPuntExceptions reads VPP Punt exceptions and returns them as an *PuntResponse. +func (svc *dumpService) DumpPuntExceptions() (punts []*vpp_punt.Exception, err error) { + if svc.puntHandler == nil { + return nil, errors.New("puntHandler is not available") + } + dump, err := svc.puntHandler.DumpExceptions() + if err != nil { + return nil, err + } + for _, puntDetails := range dump { + punts = append(punts, puntDetails.Exception) + } + + return punts, nil +} + // DumpLinuxInterfaces reads linux interfaces and returns them as an *LinuxInterfaceResponse. If reading ends up with error, // only error is send back in response /*func (svc *dumpService) DumpLinuxInterfaces() ([]*linux_interfaces.Interface, error) { diff --git a/plugins/configurator/options.go b/plugins/configurator/options.go index 4b2ed3d451..329f71257c 100644 --- a/plugins/configurator/options.go +++ b/plugins/configurator/options.go @@ -18,8 +18,10 @@ import ( "github.com/ligato/cn-infra/rpc/grpc" "github.com/ligato/vpp-agent/plugins/govppmux" "github.com/ligato/vpp-agent/plugins/orchestrator" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin" "github.com/ligato/vpp-agent/plugins/vpp/l2plugin" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin" ) // DefaultPlugin is default instance of Plugin @@ -33,8 +35,10 @@ func NewPlugin(opts ...Option) *Plugin { p.GRPCServer = &grpc.DefaultPlugin p.Dispatch = &orchestrator.DefaultPlugin p.GoVppmux = &govppmux.DefaultPlugin + p.VPPACLPlugin = &aclplugin.DefaultPlugin p.VPPIfPlugin = &ifplugin.DefaultPlugin p.VPPL2Plugin = &l2plugin.DefaultPlugin + p.VPPL3Plugin = &l3plugin.DefaultPlugin for _, o := range opts { o(p) diff --git a/plugins/configurator/plugin.go b/plugins/configurator/plugin.go index ec5e41d090..7e41704968 100644 --- a/plugins/configurator/plugin.go +++ b/plugins/configurator/plugin.go @@ -16,25 +16,29 @@ package configurator import ( "git.fd.io/govpp.git/api" - "github.com/ligato/vpp-agent/api/models/vpp" - "github.com/ligato/vpp-agent/plugins/orchestrator" - ipsecvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" - puntvppcalls "github.com/ligato/vpp-agent/plugins/vpp/puntplugin/vppcalls" "github.com/ligato/cn-infra/infra" "github.com/ligato/cn-infra/rpc/grpc" + "github.com/ligato/cn-infra/utils/safeclose" rpc "github.com/ligato/vpp-agent/api/configurator" + "github.com/ligato/vpp-agent/api/models/vpp" "github.com/ligato/vpp-agent/plugins/govppmux" iflinuxcalls "github.com/ligato/vpp-agent/plugins/linux/ifplugin/linuxcalls" l3linuxcalls "github.com/ligato/vpp-agent/plugins/linux/l3plugin/linuxcalls" + "github.com/ligato/vpp-agent/plugins/orchestrator" + abfvppcalls "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin" aclvppcalls "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin" ifvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" + ipsecvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/l2plugin" l2vppcalls "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin" l3vppcalls "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" natvppcalls "github.com/ligato/vpp-agent/plugins/vpp/natplugin/vppcalls" + puntvppcalls "github.com/ligato/vpp-agent/plugins/vpp/puntplugin/vppcalls" ) // Plugin registers VPP GRPC services in *grpc.Server. @@ -44,18 +48,19 @@ type Plugin struct { configurator configuratorServer // Channels - vppChan api.Channel - dumpChan api.Channel + vppChan api.Channel } // Deps - dependencies of Plugin type Deps struct { infra.PluginDeps - GRPCServer grpc.Server - Dispatch orchestrator.Dispatcher - GoVppmux govppmux.StatsAPI - VPPIfPlugin ifplugin.API - VPPL2Plugin *l2plugin.L2Plugin + GRPCServer grpc.Server + Dispatch orchestrator.Dispatcher + GoVppmux govppmux.StatsAPI + VPPACLPlugin aclplugin.API + VPPIfPlugin ifplugin.API + VPPL2Plugin *l2plugin.L2Plugin + VPPL3Plugin l3plugin.API } // Init sets plugin child loggers @@ -89,7 +94,7 @@ func (p *Plugin) Init() error { // Close does nothing. func (p *Plugin) Close() error { - return nil + return safeclose.Close(p.vppChan) } // helper method initializes all VPP/Linux plugin handlers @@ -98,23 +103,51 @@ func (p *Plugin) initHandlers() (err error) { if p.vppChan, err = p.GoVppmux.NewAPIChannel(); err != nil { return err } - if p.dumpChan, err = p.GoVppmux.NewAPIChannel(); err != nil { - return err - } // VPP Indexes ifIndexes := p.VPPIfPlugin.GetInterfaceIndex() - bdIndexes := p.VPPL2Plugin.GetBDIndex() dhcpIndexes := p.VPPIfPlugin.GetDHCPIndex() + bdIndexes := p.VPPL2Plugin.GetBDIndex() + aclIndexes := p.VPPACLPlugin.GetACLIndex() // TODO: make ACL optional + vrfIndexes := p.VPPL3Plugin.GetVRFIndex() - // Initialize VPP handlers - p.configurator.aclHandler = aclvppcalls.CompatibleACLVppHandler(p.vppChan, p.dumpChan, ifIndexes, p.Log) + // VPP handlers + + // core p.configurator.ifHandler = ifvppcalls.CompatibleInterfaceVppHandler(p.vppChan, p.Log) - p.configurator.natHandler = natvppcalls.CompatibleNatVppHandler(p.vppChan, ifIndexes, dhcpIndexes, p.Log) + if p.configurator.ifHandler == nil { + p.Log.Info("VPP Interface handler is not available, it will be skipped") + } p.configurator.l2Handler = l2vppcalls.CompatibleL2VppHandler(p.vppChan, ifIndexes, bdIndexes, p.Log) - p.configurator.l3Handler = l3vppcalls.CompatibleL3VppHandler(p.vppChan, ifIndexes, p.Log) + if p.configurator.l2Handler == nil { + p.Log.Info("VPP L2 handler is not available, it will be skipped") + } + p.configurator.l3Handler = l3vppcalls.CompatibleL3VppHandler(p.vppChan, ifIndexes, vrfIndexes, p.Log) + if p.configurator.l3Handler == nil { + p.Log.Info("VPP L3 handler is not available, it will be skipped") + } p.configurator.ipsecHandler = ipsecvppcalls.CompatibleIPSecVppHandler(p.vppChan, ifIndexes, p.Log) + if p.configurator.ipsecHandler == nil { + p.Log.Info("VPP IPSec handler is not available, it will be skipped") + } + + // plugins + p.configurator.abfHandler = abfvppcalls.CompatibleABFVppHandler(p.vppChan, aclIndexes, ifIndexes, p.Log) + if p.configurator.abfHandler == nil { + p.Log.Info("VPP ABF handler is not available, it will be skipped") + } + p.configurator.aclHandler = aclvppcalls.CompatibleACLVppHandler(p.vppChan, ifIndexes, p.Log) + if p.configurator.aclHandler == nil { + p.Log.Info("VPP ACL handler is not available, it will be skipped") + } + p.configurator.natHandler = natvppcalls.CompatibleNatVppHandler(p.vppChan, ifIndexes, dhcpIndexes, p.Log) + if p.configurator.natHandler == nil { + p.Log.Info("VPP NAT handler is not available, it will be skipped") + } p.configurator.puntHandler = puntvppcalls.CompatiblePuntVppHandler(p.vppChan, ifIndexes, p.Log) + if p.configurator.puntHandler == nil { + p.Log.Info("VPP Punt handler is not available, it will be skipped") + } // Linux indexes and handlers p.configurator.linuxIfHandler = iflinuxcalls.NewNetLinkHandler() diff --git a/plugins/govppmux/adapter_puregoclient.go b/plugins/govppmux/adapter_puregoclient.go new file mode 100644 index 0000000000..0f542641f8 --- /dev/null +++ b/plugins/govppmux/adapter_puregoclient.go @@ -0,0 +1,52 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !mockvpp,!vppapiclient + +package govppmux + +import ( + "fmt" + "os" + + "git.fd.io/govpp.git/adapter" + "git.fd.io/govpp.git/adapter/socketclient" + "git.fd.io/govpp.git/adapter/statsclient" +) + +const noShmWarning = `Using shared memory for VPP binary API is not currently supported in pure Go client! + + To use socket client for VPP binary API (recommended): + - unset GOVPPMUX_NOSOCK environment variable + - remove these settings from govpp.conf config: shm-prefix, connect-via-shm + + If you still want to use shared memory for VPP binary API: + - compile your agent with this build tag: vppapiclient + - vppapiclient requires CGo and needs VPP to be installed +` + +// NewVppAdapter returns VPP binary API adapter, implemented as pure Go client. +func NewVppAdapter(addr string, useShm bool) adapter.VppAPI { + if useShm { + fmt.Fprintf(os.Stderr, noShmWarning) + panic("No implementation for shared memory in pure Go client!") + } + // addr is used as socket path + return socketclient.NewVppClient(addr) +} + +// NewStatsAdapter returns VPP stats API adapter, implemented as pure Go client. +func NewStatsAdapter(socketName string) adapter.StatsAPI { + return statsclient.NewStatsClient(socketName) +} diff --git a/plugins/govppmux/adapter_stubs.go b/plugins/govppmux/adapter_stubs.go index 975771e3d5..ca32791106 100644 --- a/plugins/govppmux/adapter_stubs.go +++ b/plugins/govppmux/adapter_stubs.go @@ -21,12 +21,12 @@ import ( govppmock "git.fd.io/govpp.git/adapter/mock" ) -// NewVppAdapter returns mock adapter, used for building without vppapiclient library. +// NewVppAdapter returns mock adapter for VPP binary API. func NewVppAdapter(shmPrefix string, useShm bool) adapter.VppAPI { return govppmock.NewVppAdapter() } -// NewStatsAdapter returns stats vpp api adapter, used for reading statistics with vppapiclient library. +// NewStatsAdapter returns mock adapter for VPP stats API. func NewStatsAdapter(socketName string) adapter.StatsAPI { return govppmock.NewStatsAdapter() } diff --git a/plugins/govppmux/adapter_vppapiclient.go b/plugins/govppmux/adapter_vppapiclient.go index 1acf3d9673..2110ba4b05 100644 --- a/plugins/govppmux/adapter_vppapiclient.go +++ b/plugins/govppmux/adapter_vppapiclient.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build !mockvpp +// +build !mockvpp,vppapiclient package govppmux @@ -22,7 +22,7 @@ import ( "git.fd.io/govpp.git/adapter/vppapiclient" ) -// NewVppAdapter returns real vpp api adapter, used for building with vppapiclient library. +// NewVppAdapter returns VPP binary API adapter, implemented as wrapper for vppapiclient library. func NewVppAdapter(addr string, useShm bool) adapter.VppAPI { if useShm { // addr is used as shm prefix @@ -30,10 +30,9 @@ func NewVppAdapter(addr string, useShm bool) adapter.VppAPI { } // addr is used as socket path return socketclient.NewVppClient(addr) - } -// NewStatsAdapter returns stats vpp api adapter, used for reading statistics with vppapiclient library. +// NewStatsAdapter returns VPP stats API adapter, implemented as wrapper for vppapiclient library. func NewStatsAdapter(socketName string) adapter.StatsAPI { return vppapiclient.NewStatClient(socketName) } diff --git a/plugins/govppmux/govpp_channel.go b/plugins/govppmux/binapi_client.go similarity index 69% rename from plugins/govppmux/govpp_channel.go rename to plugins/govppmux/binapi_client.go index 70f723e823..20b360aa32 100644 --- a/plugins/govppmux/govpp_channel.go +++ b/plugins/govppmux/binapi_client.go @@ -1,16 +1,16 @@ -// Copyright (c) 2018 Cisco and/or its affiliates. +// Copyright (c) 2019 Cisco and/or its affiliates. // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package govppmux @@ -26,6 +26,42 @@ import ( "github.com/ligato/cn-infra/logging/measure" ) +// NewAPIChannel returns a new API channel for communication with VPP via govpp core. +// It uses default buffer sizes for the request and reply Go channels. +// +// Example of binary API call from some plugin using GOVPP: +// ch, _ := govpp_mux.NewAPIChannel() +// ch.SendRequest(req).ReceiveReply +func (p *Plugin) NewAPIChannel() (govppapi.Channel, error) { + ch, err := p.vppConn.NewAPIChannel() + if err != nil { + return nil, err + } + retryCfg := retryConfig{ + p.config.RetryRequestCount, + p.config.RetryRequestTimeout, + } + return newGovppChan(ch, retryCfg, p.tracer), nil +} + +// NewAPIChannelBuffered returns a new API channel for communication with VPP via govpp core. +// It allows to specify custom buffer sizes for the request and reply Go channels. +// +// Example of binary API call from some plugin using GOVPP: +// ch, _ := govpp_mux.NewAPIChannelBuffered(100, 100) +// ch.SendRequest(req).ReceiveReply +func (p *Plugin) NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (govppapi.Channel, error) { + ch, err := p.vppConn.NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize) + if err != nil { + return nil, err + } + retryCfg := retryConfig{ + p.config.RetryRequestCount, + p.config.RetryRequestTimeout, + } + return newGovppChan(ch, retryCfg, p.tracer), nil +} + // goVppChan implements govpp channel interface. Instance is returned by NewAPIChannel() or NewAPIChannelBuffered(), // and contains *govpp.channel dynamic type (vppChan field). Implemented methods allow custom handling of low-level // govpp. @@ -148,8 +184,10 @@ func (r *govppRequestCtx) ReceiveReply(reply govppapi.Message) error { err = r.sendRequest(r.requestMsg).ReceiveReply(reply) } + atomic.AddUint64(&stats.RequestsDone, 1) if err != nil { - atomic.AddUint64(&stats.RequestsFailed, 1) + trackError(err.Error()) + atomic.AddUint64(&stats.RequestsErrors, 1) } took := time.Since(r.start) @@ -184,18 +222,25 @@ func (c *goVppChan) SendMultiRequest(request govppapi.Message) govppapi.MultiReq func (r *govppMultirequestCtx) ReceiveReply(reply govppapi.Message) (bool, error) { // Receive reply from original send last, err := r.requestCtx.ReceiveReply(reply) - if last { + if last || err != nil { took := time.Since(r.start) trackMsgRequestDur(r.requestMsg.GetMessageName(), took) + + atomic.AddUint64(&stats.RequestsDone, 1) if err != nil { - atomic.AddUint64(&stats.RequestsFailed, 1) + trackError(err.Error()) + atomic.AddUint64(&stats.RequestsErrors, 1) } + defer func() { r.task.End() if r.tracer != nil { r.tracer.LogTime(r.requestMsg.GetMessageName(), r.start) } }() + } else { + atomic.AddUint64(&stats.RequestReplies, 1) + trackMsgReply(reply.GetMessageName()) } return last, err } diff --git a/plugins/govppmux/govpp_channel_test.go b/plugins/govppmux/binapi_client_test.go similarity index 100% rename from plugins/govppmux/govpp_channel_test.go rename to plugins/govppmux/binapi_client_test.go diff --git a/plugins/govppmux/config.go b/plugins/govppmux/config.go new file mode 100644 index 0000000000..ae3431425a --- /dev/null +++ b/plugins/govppmux/config.go @@ -0,0 +1,68 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package govppmux + +import "time" + +// Config groups the configurable parameter of GoVpp. +type Config struct { + TraceEnabled bool `json:"trace-enabled"` + ReconnectResync bool `json:"resync-after-reconnect"` + HealthCheckProbeInterval time.Duration `json:"health-check-probe-interval"` + HealthCheckReplyTimeout time.Duration `json:"health-check-reply-timeout"` + HealthCheckThreshold int `json:"health-check-threshold"` + ReplyTimeout time.Duration `json:"reply-timeout"` + // Connect to VPP for configuration requests via the shared memory instead of through the socket. + ConnectViaShm bool `json:"connect-via-shm"` + // The prefix prepended to the name used for shared memory (SHM) segments. If not set, + // shared memory segments are created directly in the SHM directory /dev/shm. + ShmPrefix string `json:"shm-prefix"` + BinAPISocketPath string `json:"binapi-socket-path"` + StatsSocketPath string `json:"stats-socket-path"` + // How many times can be request resent in case vpp is suddenly disconnected. + RetryRequestCount int `json:"retry-request-count"` + // Time between request resend attempts. Default is 500ms. + RetryRequestTimeout time.Duration `json:"retry-request-timeout"` + // How many times can be connection request resent in case the vpp is not reachable. + RetryConnectCount int `json:"retry-connect-count"` + // Time between connection request resend attempts. Default is 1s. + RetryConnectTimeout time.Duration `json:"retry-connect-timeout"` +} + +func defaultConfig() *Config { + return &Config{ + HealthCheckProbeInterval: time.Second, + HealthCheckReplyTimeout: 250 * time.Millisecond, + HealthCheckThreshold: 1, + ReplyTimeout: time.Second, + RetryRequestTimeout: 500 * time.Millisecond, + RetryConnectTimeout: time.Second, + } +} + +func (p *Plugin) loadConfig() (*Config, error) { + cfg := defaultConfig() + + found, err := p.Cfg.LoadValue(cfg) + if err != nil { + return nil, err + } else if found { + p.Log.Debugf("config loaded from file %q", p.Cfg.GetConfigName()) + } else { + p.Log.Debugf("config file %q not found, using default config", p.Cfg.GetConfigName()) + } + + return cfg, nil +} diff --git a/plugins/govppmux/options.go b/plugins/govppmux/options.go index 59ce76c61d..6506eb8261 100644 --- a/plugins/govppmux/options.go +++ b/plugins/govppmux/options.go @@ -17,6 +17,7 @@ package govppmux import ( "github.com/ligato/cn-infra/datasync/resync" "github.com/ligato/cn-infra/health/statuscheck" + "github.com/ligato/cn-infra/rpc/rest" ) // DefaultPlugin is default instance of Plugin @@ -27,6 +28,7 @@ func NewPlugin(opts ...Option) *Plugin { p := &Plugin{} p.PluginName = "govpp" + p.HTTPHandlers = &rest.DefaultPlugin p.StatusCheck = &statuscheck.DefaultPlugin p.Resync = &resync.DefaultPlugin diff --git a/plugins/govppmux/plugin_impl_govppmux.go b/plugins/govppmux/plugin_impl_govppmux.go index c21c7957cc..9d88d778ef 100644 --- a/plugins/govppmux/plugin_impl_govppmux.go +++ b/plugins/govppmux/plugin_impl_govppmux.go @@ -16,7 +16,9 @@ package govppmux import ( "context" + "fmt" "os" + "strings" "sync" "time" @@ -26,19 +28,18 @@ import ( "github.com/ligato/cn-infra/datasync/resync" "github.com/ligato/cn-infra/health/statuscheck" "github.com/ligato/cn-infra/infra" + "github.com/ligato/cn-infra/logging" "github.com/ligato/cn-infra/logging/measure" - "github.com/ligato/cn-infra/logging/measure/model/apitrace" + "github.com/ligato/cn-infra/rpc/rest" "github.com/pkg/errors" "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" _ "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1908" ) -// Default path to socket for VPP stats -const defaultStatsSocket = "/run/vpp/stats.sock" - var ( disabledSocketClient = os.Getenv("GOVPPMUX_NOSOCK") != "" ) @@ -75,84 +76,39 @@ type Plugin struct { // so that they do not mix with other plugin fields. type Deps struct { infra.PluginDeps - StatusCheck statuscheck.PluginStatusWriter - Resync *resync.Plugin -} - -// Config groups the configurable parameter of GoVpp. -type Config struct { - TraceEnabled bool `json:"trace-enabled"` - ReconnectResync bool `json:"resync-after-reconnect"` - HealthCheckProbeInterval time.Duration `json:"health-check-probe-interval"` - HealthCheckReplyTimeout time.Duration `json:"health-check-reply-timeout"` - HealthCheckThreshold int `json:"health-check-threshold"` - ReplyTimeout time.Duration `json:"reply-timeout"` - // Connect to VPP for configuration requests via the shared memory instead of through the socket. - ConnectViaShm bool `json:"connect-via-shm"` - // The prefix prepended to the name used for shared memory (SHM) segments. If not set, - // shared memory segments are created directly in the SHM directory /dev/shm. - ShmPrefix string `json:"shm-prefix"` - BinAPISocketPath string `json:"binapi-socket-path"` - StatsSocketPath string `json:"stats-socket-path"` - // How many times can be request resent in case vpp is suddenly disconnected. - RetryRequestCount int `json:"retry-request-count"` - // Time between request resend attempts. Default is 500ms. - RetryRequestTimeout time.Duration `json:"retry-request-timeout"` - // How many times can be connection request resent in case the vpp is not reachable. - RetryConnectCount int `json:"retry-connect-count"` - // Time between connection request resend attempts. Default is 1s. - RetryConnectTimeout time.Duration `json:"retry-connect-timeout"` -} - -func defaultConfig() *Config { - return &Config{ - HealthCheckProbeInterval: time.Second, - HealthCheckReplyTimeout: 250 * time.Millisecond, - HealthCheckThreshold: 1, - ReplyTimeout: time.Second, - RetryRequestTimeout: 500 * time.Millisecond, - RetryConnectTimeout: time.Second, - } -} - -func (p *Plugin) loadConfig() (*Config, error) { - cfg := defaultConfig() - - found, err := p.Cfg.LoadValue(cfg) - if err != nil { - return nil, err - } else if found { - p.Log.Debugf("config loaded from file %q", p.Cfg.GetConfigName()) - } else { - p.Log.Debugf("config file %q not found, using default config", p.Cfg.GetConfigName()) - } - - return cfg, nil + HTTPHandlers rest.HTTPHandlers + StatusCheck statuscheck.PluginStatusWriter + Resync *resync.Plugin } // Init is the entry point called by Agent Core. A single binary-API connection to VPP is established. -func (p *Plugin) Init() error { - var err error - +func (p *Plugin) Init() (err error) { if p.config, err = p.loadConfig(); err != nil { return err } p.Log.Debugf("config: %+v", p.config) + govpp.HealthCheckProbeInterval = p.config.HealthCheckProbeInterval govpp.HealthCheckReplyTimeout = p.config.HealthCheckReplyTimeout govpp.HealthCheckThreshold = p.config.HealthCheckThreshold govpp.DefaultReplyTimeout = p.config.ReplyTimeout + if p.config.TraceEnabled { p.tracer = measure.NewTracer("govpp-mux") p.Log.Info("VPP API trace enabled") } + // register REST API handlers + p.registerHandlers(p.HTTPHandlers) + if p.vppAdapter == nil { - address := p.config.BinAPISocketPath - useShm := disabledSocketClient || p.config.ConnectViaShm + var address string + useShm := disabledSocketClient || p.config.ConnectViaShm || p.config.ShmPrefix != "" if useShm { address = p.config.ShmPrefix + } else { + address = p.config.BinAPISocketPath } p.vppAdapter = NewVppAdapter(address, useShm) } else { @@ -162,9 +118,9 @@ func (p *Plugin) Init() error { // TODO: Async connect & automatic reconnect support is not yet implemented in the agent, // so synchronously wait until connected to VPP. + startTime := time.Now() p.Log.Debugf("connecting to VPP..") - startTime := time.Now() p.vppConn, p.vppConChan, err = govpp.AsyncConnect(p.vppAdapter, p.config.RetryConnectCount, p.config.RetryConnectTimeout) if err != nil { return err @@ -182,10 +138,10 @@ func (p *Plugin) Init() error { } } - vppConnectTime := time.Since(startTime) - p.Log.Debugf("connection to VPP established (took %s)", vppConnectTime.Round(time.Millisecond)) + connectDur := time.Since(startTime) + p.Log.Debugf("connection to VPP established (took %s)", connectDur.Round(time.Millisecond)) - if err := p.updateVPPInfo(p.vppConn); err != nil { + if err := p.updateVPPInfo(); err != nil { return errors.WithMessage(err, "retrieving VPP info failed") } @@ -194,7 +150,7 @@ func (p *Plugin) Init() error { if p.config.StatsSocketPath != "" { statsSocket = p.config.StatsSocketPath } else { - statsSocket = defaultStatsSocket + statsSocket = adapter.DefaultStatsSocket } statsAdapter := NewStatsAdapter(statsSocket) if statsAdapter == nil { @@ -241,104 +197,67 @@ func (p *Plugin) Close() error { return nil } -// NewAPIChannel returns a new API channel for communication with VPP via govpp core. -// It uses default buffer sizes for the request and reply Go channels. -// -// Example of binary API call from some plugin using GOVPP: -// ch, _ := govpp_mux.NewAPIChannel() -// ch.SendRequest(req).ReceiveReply -func (p *Plugin) NewAPIChannel() (govppapi.Channel, error) { - ch, err := p.vppConn.NewAPIChannel() - if err != nil { - return nil, err - } - retryCfg := retryConfig{ - p.config.RetryRequestCount, - p.config.RetryRequestTimeout, - } - return newGovppChan(ch, retryCfg, p.tracer), nil +// VPPInfo returns information about VPP session. +func (p *Plugin) VPPInfo() (VPPInfo, error) { + p.infoMu.Lock() + defer p.infoMu.Unlock() + return p.vppInfo, nil } -// NewAPIChannelBuffered returns a new API channel for communication with VPP via govpp core. -// It allows to specify custom buffer sizes for the request and reply Go channels. -// -// Example of binary API call from some plugin using GOVPP: -// ch, _ := govpp_mux.NewAPIChannelBuffered(100, 100) -// ch.SendRequest(req).ReceiveReply -func (p *Plugin) NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (govppapi.Channel, error) { - ch, err := p.vppConn.NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize) - if err != nil { - return nil, err - } - retryCfg := retryConfig{ - p.config.RetryRequestCount, - p.config.RetryRequestTimeout, +func (p *Plugin) updateVPPInfo() error { + if p.vppConn == nil { + return fmt.Errorf("VPP connection is nil") } - return newGovppChan(ch, retryCfg, p.tracer), nil -} -// GetTrace returns all trace entries measured so far -func (p *Plugin) GetTrace() *apitrace.Trace { - if !p.config.TraceEnabled { - return nil + vppAPIChan, err := p.vppConn.NewAPIChannel() + if err != nil { + return err } - return p.tracer.Get() -} + defer vppAPIChan.Close() -// ListStats returns all stats names -func (p *Plugin) ListStats(prefixes ...string) ([]string, error) { - if p.statsAdapter == nil { - return nil, nil - } - return p.statsAdapter.ListStats(prefixes...) -} + vpeHandler := vppcalls.CompatibleVpeHandler(vppAPIChan) -// DumpStats returns all stats with name, type and value -func (p *Plugin) DumpStats(prefixes ...string) ([]*adapter.StatEntry, error) { - if p.statsAdapter == nil { - return nil, nil + version, err := vpeHandler.RunCli("show version verbose") + if err != nil { + p.Log.Warnf("RunCli error: %v", err) + } else { + p.Log.Debugf("vpp# show version verbose\n%s", version) } - return p.statsAdapter.DumpStats(prefixes...) -} -// GetSystemStats retrieves system statistics of the connected VPP instance like Vector rate, Input rate, etc. -func (p *Plugin) GetSystemStats() (*govppapi.SystemStats, error) { - if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { - return nil, nil + cmdline, err := vpeHandler.RunCli("show version cmdline") + if err != nil { + p.Log.Warnf("RunCli error: %v", err) + } else { + out := strings.Replace(cmdline, "\n", "", -1) + p.Log.Debugf("vpp# show version cmdline:\n%s", out) } - return p.statsConn.GetSystemStats() -} -// GetNodeStats retrieves a list of Node VPP counters (vectors, clocks, ...) -func (p *Plugin) GetNodeStats() (*govppapi.NodeStats, error) { - if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { - return nil, nil + ver, err := vpeHandler.GetVersionInfo() + if err != nil { + return err } - return p.statsConn.GetNodeStats() -} -// GetInterfaceStats retrieves all counters related to the VPP interfaces -func (p *Plugin) GetInterfaceStats() (*govppapi.InterfaceStats, error) { - if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { - return nil, nil - } - return p.statsConn.GetInterfaceStats() -} + p.Log.Infof("VPP version: %v", ver.Version) -// GetErrorStats retrieves VPP error counters -func (p *Plugin) GetErrorStats(names ...string) (*govppapi.ErrorStats, error) { - if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { - return nil, nil + vpe, err := vpeHandler.GetVpeInfo() + if err != nil { + return err } - return p.statsConn.GetErrorStats() -} -// GetErrorStats retrieves VPP error counters -func (p *Plugin) GetBufferStats() (*govppapi.BufferStats, error) { - if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { - return nil, nil + p.Log.WithFields(logging.Fields{ + "PID": vpe.PID, + "ClientID": vpe.ClientIdx, + }).Debugf("loaded %d VPP modules: %v", len(vpe.ModuleVersions), vpe.ModuleVersions) + + p.infoMu.Lock() + p.vppInfo = VPPInfo{ + Connected: true, + VersionInfo: *ver, + VpeInfo: *vpe, } - return p.statsConn.GetBufferStats() + p.infoMu.Unlock() + + return nil } // handleVPPConnectionEvents handles VPP connection events. @@ -349,7 +268,7 @@ func (p *Plugin) handleVPPConnectionEvents(ctx context.Context) { select { case event := <-p.vppConChan: if event.State == govpp.Connected { - if err := p.updateVPPInfo(p.vppConn); err != nil { + if err := p.updateVPPInfo(); err != nil { p.Log.Errorf("updating VPP info failed: %v", err) } @@ -383,45 +302,3 @@ func (p *Plugin) handleVPPConnectionEvents(ctx context.Context) { } } } - -// VPPInfo returns information about VPP session. -func (p *Plugin) VPPInfo() (VPPInfo, error) { - p.infoMu.Lock() - defer p.infoMu.Unlock() - return p.vppInfo, nil -} - -func (p *Plugin) updateVPPInfo(provider govppapi.ChannelProvider) error { - vppAPIChan, err := provider.NewAPIChannel() - if err != nil { - return err - } - defer vppAPIChan.Close() - - vpeHandler := vppcalls.CompatibleVpeHandler(vppAPIChan) - - ver, err := vpeHandler.GetVersionInfo() - if err != nil { - return err - } - - p.Log.Infof("VPP version: %v", ver.Version) - - vpe, err := vpeHandler.GetVpeInfo() - if err != nil { - return err - } - - p.Log.Debugf("VPP session details: PID=%d ClientIdx=%d", vpe.PID, vpe.ClientIdx) - p.Log.Debugf("loaded %d VPP modules: %v", len(vpe.ModuleVersions), vpe.ModuleVersions) - - p.infoMu.Lock() - p.vppInfo = VPPInfo{ - Connected: true, - VersionInfo: *ver, - VpeInfo: *vpe, - } - p.infoMu.Unlock() - - return nil -} diff --git a/plugins/govppmux/rest.go b/plugins/govppmux/rest.go new file mode 100644 index 0000000000..5ff07fdb29 --- /dev/null +++ b/plugins/govppmux/rest.go @@ -0,0 +1,39 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package govppmux + +import ( + "net/http" + + "github.com/ligato/cn-infra/rpc/rest" + "github.com/unrolled/render" +) + +// registerHandlers registers all supported REST APIs. +func (p *Plugin) registerHandlers(http rest.HTTPHandlers) { + if http == nil { + p.Log.Debug("No http handler provided, skipping registration of REST handlers") + return + } + http.RegisterHTTPHandler("/govppmux/stats", p.statsHandler, "GET") +} + +func (p *Plugin) statsHandler(formatter *render.Render) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + if err := formatter.JSON(w, http.StatusOK, GetStats()); err != nil { + p.Log.Warnf("stats handler errored: %v", err) + } + } +} diff --git a/plugins/govppmux/stats.go b/plugins/govppmux/stats.go index ac1b016b66..db7fb6be02 100644 --- a/plugins/govppmux/stats.go +++ b/plugins/govppmux/stats.go @@ -28,7 +28,9 @@ var ( ) func init() { + stats.Errors = make(metrics.Calls) stats.Messages = make(metrics.Calls) + stats.Replies = make(metrics.Calls) } func GetStats() *Stats { @@ -39,13 +41,22 @@ func GetStats() *Stats { return s } +// Stats defines various statistics for govppmux plugin. type Stats struct { ChannelsCreated uint64 ChannelsOpen uint64 - RequestsSent uint64 - RequestsFailed uint64 - AllMessages metrics.CallStats - Messages metrics.Calls + + RequestsSent uint64 + RequestsDone uint64 + RequestsErrors uint64 + RequestReplies uint64 + + Errors metrics.Calls + + AllMessages metrics.CallStats + Messages metrics.Calls + + Replies metrics.Calls } func (s *Stats) getOrCreateMessage(msg string) *metrics.CallStats { @@ -69,6 +80,46 @@ func trackMsgRequestDur(m string, d time.Duration) { statsMu.Unlock() } +func (s *Stats) getOrCreateReply(msg string) *metrics.CallStats { + statsMu.RLock() + ms, ok := s.Replies[msg] + statsMu.RUnlock() + if !ok { + ms = &metrics.CallStats{Name: msg} + statsMu.Lock() + s.Replies[msg] = ms + statsMu.Unlock() + } + return ms +} + +func trackMsgReply(m string) { + ms := stats.getOrCreateReply(m) + statsMu.Lock() + ms.Increment(0) + statsMu.Unlock() +} + +func (s *Stats) getOrCreateError(msg string) *metrics.CallStats { + statsMu.RLock() + ms, ok := s.Errors[msg] + statsMu.RUnlock() + if !ok { + ms = &metrics.CallStats{Name: msg} + statsMu.Lock() + s.Errors[msg] = ms + statsMu.Unlock() + } + return ms +} + +func trackError(m string) { + ms := stats.getOrCreateError(m) + statsMu.Lock() + ms.Increment(0) + statsMu.Unlock() +} + func init() { expvar.Publish("govppstats", expvar.Func(func() interface{} { return GetStats() diff --git a/plugins/govppmux/stats_client.go b/plugins/govppmux/stats_client.go new file mode 100644 index 0000000000..00e4404064 --- /dev/null +++ b/plugins/govppmux/stats_client.go @@ -0,0 +1,77 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package govppmux + +import ( + "git.fd.io/govpp.git/adapter" + govppapi "git.fd.io/govpp.git/api" + govpp "git.fd.io/govpp.git/core" +) + +// ListStats returns all stats names +func (p *Plugin) ListStats(prefixes ...string) ([]string, error) { + if p.statsAdapter == nil { + return nil, nil + } + return p.statsAdapter.ListStats(prefixes...) +} + +// DumpStats returns all stats with name, type and value +func (p *Plugin) DumpStats(prefixes ...string) ([]*adapter.StatEntry, error) { + if p.statsAdapter == nil { + return nil, nil + } + return p.statsAdapter.DumpStats(prefixes...) +} + +// GetSystemStats retrieves system statistics of the connected VPP instance like Vector rate, Input rate, etc. +func (p *Plugin) GetSystemStats() (*govppapi.SystemStats, error) { + if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { + return nil, nil + } + return p.statsConn.GetSystemStats() +} + +// GetNodeStats retrieves a list of Node VPP counters (vectors, clocks, ...) +func (p *Plugin) GetNodeStats() (*govppapi.NodeStats, error) { + if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { + return nil, nil + } + return p.statsConn.GetNodeStats() +} + +// GetInterfaceStats retrieves all counters related to the VPP interfaces +func (p *Plugin) GetInterfaceStats() (*govppapi.InterfaceStats, error) { + if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { + return nil, nil + } + return p.statsConn.GetInterfaceStats() +} + +// GetErrorStats retrieves VPP error counters +func (p *Plugin) GetErrorStats(names ...string) (*govppapi.ErrorStats, error) { + if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { + return nil, nil + } + return p.statsConn.GetErrorStats() +} + +// GetErrorStats retrieves VPP error counters +func (p *Plugin) GetBufferStats() (*govppapi.BufferStats, error) { + if p.statsConn == nil || p.statsConn.(*govpp.StatsConnection) == nil { + return nil, nil + } + return p.statsConn.GetBufferStats() +} diff --git a/plugins/govppmux/vppcalls/vpp1901/vpe_vppcalls.go b/plugins/govppmux/vppcalls/vpp1901/vpe_vppcalls.go index f19b188ca6..f217d22883 100644 --- a/plugins/govppmux/vppcalls/vpp1901/vpe_vppcalls.go +++ b/plugins/govppmux/vppcalls/vpp1901/vpe_vppcalls.go @@ -19,6 +19,7 @@ import ( "strings" govppapi "git.fd.io/govpp.git/api" + "github.com/pkg/errors" "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/memclnt" @@ -27,10 +28,10 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, vpe.Messages...) - msgs = append(msgs, memclnt.Messages...) + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, memclnt.AllMessages()...) - vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ + vppcalls.Versions["19.01"] = vppcalls.HandlerVersion{ Msgs: msgs, New: func(ch govppapi.Channel) vppcalls.VpeVppAPI { return NewVpeHandler(ch) @@ -118,7 +119,7 @@ func (h *VpeHandler) RunCli(cmd string) (string, error) { reply := &vpe.CliInbandReply{} if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { - return "", err + return "", errors.Wrapf(err, "running VPP CLI command '%s' failed", cmd) } return reply.Reply, nil diff --git a/plugins/govppmux/vppcalls/vpp1904/vpe_vppcalls.go b/plugins/govppmux/vppcalls/vpp1904/vpe_vppcalls.go index 07377f618d..f5950165c6 100644 --- a/plugins/govppmux/vppcalls/vpp1904/vpe_vppcalls.go +++ b/plugins/govppmux/vppcalls/vpp1904/vpe_vppcalls.go @@ -19,6 +19,7 @@ import ( "strings" govppapi "git.fd.io/govpp.git/api" + "github.com/pkg/errors" "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/memclnt" @@ -27,10 +28,10 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, vpe.Messages...) - msgs = append(msgs, memclnt.Messages...) + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, memclnt.AllMessages()...) - vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ + vppcalls.Versions["19.04"] = vppcalls.HandlerVersion{ Msgs: msgs, New: func(ch govppapi.Channel) vppcalls.VpeVppAPI { return NewVpeHandler(ch) @@ -118,7 +119,7 @@ func (h *VpeHandler) RunCli(cmd string) (string, error) { reply := &vpe.CliInbandReply{} if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { - return "", err + return "", errors.Wrapf(err, "running VPP CLI command '%s' failed", cmd) } return reply.Reply, nil diff --git a/plugins/govppmux/vppcalls/vpp1908/vpe_vppcalls.go b/plugins/govppmux/vppcalls/vpp1908/vpe_vppcalls.go new file mode 100644 index 0000000000..6673d4a628 --- /dev/null +++ b/plugins/govppmux/vppcalls/vpp1908/vpe_vppcalls.go @@ -0,0 +1,130 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + "strings" + + govppapi "git.fd.io/govpp.git/api" + "github.com/pkg/errors" + + "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memclnt" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, memclnt.AllMessages()...) + + vppcalls.Versions["19.08"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel) vppcalls.VpeVppAPI { + return NewVpeHandler(ch) + }, + } +} + +type VpeHandler struct { + ch govppapi.Channel +} + +func NewVpeHandler(ch govppapi.Channel) *VpeHandler { + return &VpeHandler{ch} +} + +// Ping pings the VPP. +func (h *VpeHandler) Ping() error { + req := &vpe.ControlPing{} + reply := &vpe.ControlPingReply{} + + return h.ch.SendRequest(req).ReceiveReply(reply) +} + +// GetVersionInfo retrieves version info +func (h *VpeHandler) GetVersionInfo() (*vppcalls.VersionInfo, error) { + req := &vpe.ShowVersion{} + reply := &vpe.ShowVersionReply{} + + if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + info := &vppcalls.VersionInfo{ + Program: reply.Program, + Version: reply.Version, + BuildDate: reply.BuildDate, + BuildDirectory: reply.BuildDirectory, + } + + return info, nil +} + +// GetVpeInfo retrieves vpe information. +func (h *VpeHandler) GetVpeInfo() (*vppcalls.VpeInfo, error) { + req := &vpe.ControlPing{} + reply := &vpe.ControlPingReply{} + + if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + info := &vppcalls.VpeInfo{ + PID: reply.VpePID, + ClientIdx: reply.ClientIndex, + } + + { + req := &memclnt.APIVersions{} + reply := &memclnt.APIVersionsReply{} + + if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + for _, v := range reply.APIVersions { + name := string(cleanBytes(v.Name)) + name = strings.TrimSuffix(name, ".api") + info.ModuleVersions = append(info.ModuleVersions, vppcalls.ModuleVersion{ + Name: name, + Major: v.Major, + Minor: v.Minor, + Patch: v.Patch, + }) + } + } + + return info, nil +} + +// RunCli executes CLI command and returns output +func (h *VpeHandler) RunCli(cmd string) (string, error) { + req := &vpe.CliInband{ + Cmd: cmd, + } + reply := &vpe.CliInbandReply{} + + if err := h.ch.SendRequest(req).ReceiveReply(reply); err != nil { + return "", errors.Wrapf(err, "running VPP CLI command '%s' failed", cmd) + } + + return reply.Reply, nil +} + +func cleanBytes(b []byte) []byte { + return bytes.SplitN(b, []byte{0x00}, 2)[0] +} diff --git a/plugins/govppmux/vppcalls/vppcalls_api.go b/plugins/govppmux/vppcalls/vppcalls_api.go index 4bf8b6de89..7c17c4b033 100644 --- a/plugins/govppmux/vppcalls/vppcalls_api.go +++ b/plugins/govppmux/vppcalls/vppcalls_api.go @@ -15,6 +15,14 @@ type VersionInfo struct { BuildDirectory string } +// Release returns version in shortened format YY.MM that describes release. +func (v VersionInfo) Release() string { + if len(v.Version) < 5 { + return "" + } + return v.Version[:5] +} + // VpeInfo contains information about VPP connection and process. type VpeInfo struct { PID uint32 diff --git a/plugins/kvscheduler/api/kv_scheduler_api.go b/plugins/kvscheduler/api/kv_scheduler_api.go index bf15d7430f..97219b05aa 100644 --- a/plugins/kvscheduler/api/kv_scheduler_api.go +++ b/plugins/kvscheduler/api/kv_scheduler_api.go @@ -225,7 +225,9 @@ type KVScheduler interface { // however. For example, notifications for values already created by NB // are ignored. But otherwise, SB values (not managed by NB) are untouched // by reconciliation or any other operation of the scheduler/descriptor. - PushSBNotification(key string, value proto.Message, metadata Metadata) error + // Note: Origin in KVWithMetadata is ignored and can be left unset + // (automatically assumed to be FromSB). + PushSBNotification(notif... KVWithMetadata) error // GetMetadataMap returns (read-only) map associating value label with value // metadata of a given descriptor. diff --git a/plugins/kvscheduler/api/txn_options.go b/plugins/kvscheduler/api/txn_options.go index e515824d96..3111ac2a68 100644 --- a/plugins/kvscheduler/api/txn_options.go +++ b/plugins/kvscheduler/api/txn_options.go @@ -268,4 +268,4 @@ func WithSimulation(ctx context.Context) context.Context { func IsWithSimulation(ctx context.Context) bool { _, withSimulation := ctx.Value(txnSimulationCtxKey).(*txnSimulationOpt) return withSimulation -} \ No newline at end of file +} diff --git a/plugins/kvscheduler/api/txn_record.go b/plugins/kvscheduler/api/txn_record.go index 8153ecd736..76bb2e38a5 100644 --- a/plugins/kvscheduler/api/txn_record.go +++ b/plugins/kvscheduler/api/txn_record.go @@ -49,9 +49,9 @@ func (t TxnType) String() string { case NBTransaction: return "NB Transaction" case RetryFailedOps: - return "RETRY" + return "Retry Transaction" } - return "UNKNOWN" + return "UndefinedTxnType" } // RecordedTxn is used to record executed transaction. @@ -128,7 +128,7 @@ func (txn *RecordedTxn) StringWithOpts(resultOnly, verbose bool, indent int) str if !resultOnly { // transaction arguments str += indent1 + "* transaction arguments:\n" - str += indent2 + fmt.Sprintf("- seq-num: %d\n", txn.SeqNum) + str += indent2 + fmt.Sprintf("- seqNum: %d\n", txn.SeqNum) if txn.TxnType == NBTransaction && txn.ResyncType != NotResync { ResyncType := "Full Resync" if txn.ResyncType == DownstreamResync { @@ -244,7 +244,7 @@ func (op *RecordedTxnOp) StringWithOpts(index int, verbose bool, indent int) str flags = append(flags, "WAS-UNIMPLEMENTED") } // -> REMOVED / MISSING - if op.PrevState == ValueState_REMOVED && !op.IsRecreate { + if op.PrevState == ValueState_REMOVED && op.Operation == TxnOperation_DELETE { flags = append(flags, "ALREADY-REMOVED") } if op.PrevState == ValueState_MISSING { diff --git a/plugins/kvscheduler/datachange_test.go b/plugins/kvscheduler/datachange_test.go index 89e1a32c5f..b6e8dff965 100644 --- a/plugins/kvscheduler/datachange_test.go +++ b/plugins/kvscheduler/datachange_test.go @@ -2040,3 +2040,163 @@ func TestFailedDeleteOfDerivedValue(t *testing.T) { err = scheduler.Close() Expect(err).To(BeNil()) } + +func TestFailedRecreateOfDerivedValue(t *testing.T) { + RegisterTestingT(t) + + // prepare KV Scheduler + scheduler := NewPlugin(UseDeps(func(deps *Deps) { + deps.HTTPHandlers = nil + })) + err := scheduler.Init() + Expect(err).To(BeNil()) + + // prepare mocks + mockSB := test.NewMockSouthbound() + // descriptor: + descriptor := test.NewMockDescriptor(&KVDescriptor{ + Name: descriptor1Name, + NBKeyPrefix: prefixA, + KeySelector: prefixSelector(prefixA), + ValueTypeName: proto.MessageName(test.NewArrayValue()), + DerivedValues: test.ArrayValueDerBuilder, + WithMetadata: true, + UpdateWithRecreate: func(key string, oldValue, newValue proto.Message, metadata Metadata) bool { + return key == prefixA+baseValue1+"/item1" + }, + }, mockSB, 0) + scheduler.RegisterKVDescriptor(descriptor) + + // run non-resync transaction against empty SB + arrayVal1 := test.NewArrayValueWithSuffix("-v1", "item1") + schedulerTxn := scheduler.StartNBTransaction() + schedulerTxn.SetValue(prefixA+baseValue1, arrayVal1) + seqNum, err := schedulerTxn.Commit(testCtx) + Expect(seqNum).To(BeEquivalentTo(0)) + Expect(err).ShouldNot(HaveOccurred()) + + // check the state of SB + Expect(mockSB.GetKeysWithInvalidData()).To(BeEmpty()) + // -> base value 1 + value := mockSB.GetValue(prefixA + baseValue1) + Expect(value).ToNot(BeNil()) + Expect(proto.Equal(value.Value, arrayVal1)).To(BeTrue()) + Expect(value.Metadata).ToNot(BeNil()) + Expect(value.Metadata.(test.MetaWithInteger).GetInteger()).To(BeEquivalentTo(0)) + Expect(value.Origin).To(BeEquivalentTo(FromNB)) + // -> item1 derived from base value 1 + value = mockSB.GetValue(prefixA + baseValue1 + "/item1") + Expect(value).ToNot(BeNil()) + Expect(proto.Equal(value.Value, test.NewStringValue("item1-v1"))).To(BeTrue()) + Expect(value.Metadata).To(BeNil()) + Expect(value.Origin).To(BeEquivalentTo(FromNB)) + + // plan error before 2nd txn + failedCreateClb := func() { + mockSB.SetValue(prefixA+baseValue1, test.NewArrayValue(), + &test.OnlyInteger{Integer: 0}, FromNB, false) + } + mockSB.PlanError(prefixA+baseValue1+"/item1", nil, nil) // Delete + mockSB.PlanError(prefixA+baseValue1+"/item1", errors.New("failed to create value"), failedCreateClb) // (Re)Create + + // run 2nd non-resync transaction that will have errors + startTime := time.Now() + schedulerTxn2 := scheduler.StartNBTransaction() + arrayVal2 := test.NewArrayValueWithSuffix("-v2", "item1") + schedulerTxn2.SetValue(prefixA+baseValue1, arrayVal2) + seqNum, err = schedulerTxn2.Commit(testCtx) + stopTime := time.Now() + Expect(seqNum).To(BeEquivalentTo(1)) + Expect(err).ToNot(BeNil()) + txnErr := err.(*TransactionError) + Expect(txnErr.GetTxnInitError()).ShouldNot(HaveOccurred()) + kvErrors := txnErr.GetKVErrors() + Expect(kvErrors).To(HaveLen(1)) + Expect(kvErrors[0].Key).To(BeEquivalentTo(prefixA + baseValue1 + "/item1")) + Expect(kvErrors[0].TxnOperation).To(BeEquivalentTo(TxnOperation_CREATE)) + Expect(kvErrors[0].Error.Error()).To(BeEquivalentTo("failed to create value")) + + // check transaction operations + txnHistory := scheduler.GetTransactionHistory(time.Time{}, time.Now()) + Expect(txnHistory).To(HaveLen(2)) + txn := txnHistory[1] + Expect(txn.PreRecord).To(BeFalse()) + Expect(txn.Start.After(startTime)).To(BeTrue()) + Expect(txn.Start.Before(txn.Stop)).To(BeTrue()) + Expect(txn.Stop.Before(stopTime)).To(BeTrue()) + Expect(txn.SeqNum).To(BeEquivalentTo(1)) + Expect(txn.TxnType).To(BeEquivalentTo(NBTransaction)) + Expect(txn.ResyncType).To(BeEquivalentTo(NotResync)) + Expect(txn.Description).To(BeEmpty()) + checkRecordedValues(txn.Values, []RecordedKVPair{ + {Key: prefixA + baseValue1, Value: utils.RecordProtoMessage(arrayVal2), Origin: FromNB}, + }) + + // -> planned + txnOps := RecordedTxnOps{ + { + Operation: TxnOperation_UPDATE, + Key: prefixA + baseValue1, + PrevValue: utils.RecordProtoMessage(arrayVal1), + NewValue: utils.RecordProtoMessage(arrayVal2), + PrevState: ValueState_CONFIGURED, + NewState: ValueState_CONFIGURED, + }, + { + Operation: TxnOperation_DELETE, + Key: prefixA + baseValue1 + "/item1", + IsDerived: true, + PrevValue: utils.RecordProtoMessage(test.NewStringValue("item1-v1")), + PrevState: ValueState_CONFIGURED, + NewState: ValueState_REMOVED, + IsRecreate: true, + }, + { + Operation: TxnOperation_CREATE, + Key: prefixA + baseValue1 + "/item1", + IsDerived: true, + NewValue: utils.RecordProtoMessage(test.NewStringValue("item1-v2")), + PrevState: ValueState_REMOVED, + NewState: ValueState_CONFIGURED, + IsRecreate: true, + }, + } + checkTxnOperations(txn.Planned, txnOps) + + // -> executed + txnOps = RecordedTxnOps{ + { + Operation: TxnOperation_UPDATE, + Key: prefixA + baseValue1, + PrevValue: utils.RecordProtoMessage(arrayVal1), + NewValue: utils.RecordProtoMessage(arrayVal2), + PrevState: ValueState_CONFIGURED, + NewState: ValueState_CONFIGURED, + }, + { + Operation: TxnOperation_DELETE, + Key: prefixA + baseValue1 + "/item1", + IsDerived: true, + PrevValue: utils.RecordProtoMessage(test.NewStringValue("item1-v1")), + PrevState: ValueState_CONFIGURED, + NewState: ValueState_REMOVED, + IsRecreate: true, + }, + { + Operation: TxnOperation_CREATE, + Key: prefixA + baseValue1 + "/item1", + IsDerived: true, + NewValue: utils.RecordProtoMessage(test.NewStringValue("item1-v2")), + PrevState: ValueState_REMOVED, + NewState: ValueState_FAILED, + NewErr: errors.New("failed to create value"), + IsRecreate: true, + }, + } + checkTxnOperations(txn.Executed, txnOps) + + // close scheduler + err = scheduler.Close() + Expect(err).To(BeNil()) +} + diff --git a/plugins/kvscheduler/internal/graph/graph_api.go b/plugins/kvscheduler/internal/graph/graph_api.go index 14dfc8d879..9c3379c9fe 100644 --- a/plugins/kvscheduler/internal/graph/graph_api.go +++ b/plugins/kvscheduler/internal/graph/graph_api.go @@ -131,6 +131,11 @@ type RWAccess interface { Save() } +// TargetIterator is a callback applied on every target. +// For each label it will be called n+1 times, where n is the number of targets +// available for the given label and the extra call will be made with nil target. +type TargetIterator func (target Node, label string) (skipLabel, abort bool) + // Node is a read-only handle to a single graph node. type Node interface { // GetKey returns the key associated with the node. @@ -153,6 +158,10 @@ type Node interface { // edges of the given relation points to. GetTargets(relation string) RuntimeTargets + // IterTargets allows to iterate over the set of nodes that the edges of the given + // relation points to. + IterTargets(relation string, callback TargetIterator) + // GetSources returns edges pointing to this node in the reverse // orientation. GetSources(relation string) RuntimeTargets diff --git a/plugins/kvscheduler/internal/graph/node_read.go b/plugins/kvscheduler/internal/graph/node_read.go index 9cbe25ce4c..c8ccd22f4b 100644 --- a/plugins/kvscheduler/internal/graph/node_read.go +++ b/plugins/kvscheduler/internal/graph/node_read.go @@ -90,6 +90,32 @@ func (node *nodeR) GetTargets(relation string) (runtimeTargets RuntimeTargets) { return runtimeTargets } +// IterTargets allows to iterate over the set of nodes that the edges of the given +// relation points to. +func (node *nodeR) IterTargets(relation string, callback TargetIterator) { + for i := node.targets.RelationBegin(relation); i < len(node.targets); i++ { + if node.targets[i].Relation != relation { + break + } + for _, key := range node.targets[i].MatchingKeys.Iterate() { + skipLabel, abort := callback(node.graph.nodes[key], node.targets[i].Label) + if abort { + return + } + if skipLabel { + // no more targets from this label to iterate through + // (just the closing nil one) + break + } + } + // mark the end of the targets for the given label with nil target + _, abort := callback(nil, node.targets[i].Label) + if abort { + return + } + } +} + // GetSources returns edges pointing to this node in the reverse // orientation. func (node *nodeR) GetSources(relation string) (runtimeTargets RuntimeTargets) { diff --git a/plugins/kvscheduler/internal/registry/registry_impl.go b/plugins/kvscheduler/internal/registry/registry_impl.go index d403e6f986..898e1a321a 100644 --- a/plugins/kvscheduler/internal/registry/registry_impl.go +++ b/plugins/kvscheduler/internal/registry/registry_impl.go @@ -19,6 +19,7 @@ import ( . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" "github.com/ligato/vpp-agent/plugins/kvscheduler/internal/utils" + "fmt" ) const ( @@ -111,8 +112,11 @@ func (reg *registry) GetDescriptorForKey(key string) *KVDescriptor { var keyDescriptor *KVDescriptor for _, descriptor := range reg.descriptors { if descriptor.KeySelector(key) { + if keyDescriptor != nil { + panic(fmt.Sprintf("key %s is selected by both %s and %s descriptors", + key, keyDescriptor.Name, descriptor.Name)) + } keyDescriptor = descriptor - break } } // add entry to cache diff --git a/plugins/kvscheduler/internal/test/model/values.pb.go b/plugins/kvscheduler/internal/test/model/values.pb.go index 0204db053c..850b448825 100644 --- a/plugins/kvscheduler/internal/test/model/values.pb.go +++ b/plugins/kvscheduler/internal/test/model/values.pb.go @@ -3,9 +3,11 @@ package model -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -19,7 +21,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type ArrayValue struct { - Items []string `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` + Items []string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + ItemSuffix string `protobuf:"bytes,2,opt,name=item_suffix,json=itemSuffix,proto3" json:"item_suffix,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -29,7 +32,7 @@ func (m *ArrayValue) Reset() { *m = ArrayValue{} } func (m *ArrayValue) String() string { return proto.CompactTextString(m) } func (*ArrayValue) ProtoMessage() {} func (*ArrayValue) Descriptor() ([]byte, []int) { - return fileDescriptor_values_f4aee9239d9ccefd, []int{0} + return fileDescriptor_5d19e76c3b90e014, []int{0} } func (m *ArrayValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ArrayValue.Unmarshal(m, b) @@ -37,8 +40,8 @@ func (m *ArrayValue) XXX_Unmarshal(b []byte) error { func (m *ArrayValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ArrayValue.Marshal(b, m, deterministic) } -func (dst *ArrayValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ArrayValue.Merge(dst, src) +func (m *ArrayValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ArrayValue.Merge(m, src) } func (m *ArrayValue) XXX_Size() int { return xxx_messageInfo_ArrayValue.Size(m) @@ -56,6 +59,13 @@ func (m *ArrayValue) GetItems() []string { return nil } +func (m *ArrayValue) GetItemSuffix() string { + if m != nil { + return m.ItemSuffix + } + return "" +} + type StringValue struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -67,7 +77,7 @@ func (m *StringValue) Reset() { *m = StringValue{} } func (m *StringValue) String() string { return proto.CompactTextString(m) } func (*StringValue) ProtoMessage() {} func (*StringValue) Descriptor() ([]byte, []int) { - return fileDescriptor_values_f4aee9239d9ccefd, []int{1} + return fileDescriptor_5d19e76c3b90e014, []int{1} } func (m *StringValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StringValue.Unmarshal(m, b) @@ -75,8 +85,8 @@ func (m *StringValue) XXX_Unmarshal(b []byte) error { func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) } -func (dst *StringValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringValue.Merge(dst, src) +func (m *StringValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringValue.Merge(m, src) } func (m *StringValue) XXX_Size() int { return xxx_messageInfo_StringValue.Size(m) @@ -99,15 +109,16 @@ func init() { proto.RegisterType((*StringValue)(nil), "model.StringValue") } -func init() { proto.RegisterFile("values.proto", fileDescriptor_values_f4aee9239d9ccefd) } +func init() { proto.RegisterFile("values.proto", fileDescriptor_5d19e76c3b90e014) } -var fileDescriptor_values_f4aee9239d9ccefd = []byte{ - // 102 bytes of a gzipped FileDescriptorProto +var fileDescriptor_5d19e76c3b90e014 = []byte{ + // 125 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0x29, 0x4d, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcd, 0xcd, 0x4f, 0x49, 0xcd, 0x51, - 0x52, 0xe2, 0xe2, 0x72, 0x2c, 0x2a, 0x4a, 0xac, 0x0c, 0x03, 0xc9, 0x09, 0x89, 0x70, 0xb1, 0x66, - 0x96, 0xa4, 0xe6, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4a, 0xca, 0x5c, - 0xdc, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x70, 0x45, 0x60, 0x93, 0x24, 0x18, 0x15, 0x18, 0x41, - 0x8a, 0xc0, 0x9c, 0x24, 0x36, 0xb0, 0xb1, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xec, - 0xab, 0xd4, 0x66, 0x00, 0x00, 0x00, + 0x72, 0xe6, 0xe2, 0x72, 0x2c, 0x2a, 0x4a, 0xac, 0x0c, 0x03, 0xc9, 0x09, 0x89, 0x70, 0xb1, 0x66, + 0x96, 0xa4, 0xe6, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x42, 0xf2, 0x5c, + 0xdc, 0x20, 0x46, 0x7c, 0x71, 0x69, 0x5a, 0x5a, 0x66, 0x85, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x67, + 0x10, 0x17, 0x48, 0x28, 0x18, 0x2c, 0xa2, 0xa4, 0xcc, 0xc5, 0x1d, 0x5c, 0x52, 0x94, 0x99, 0x97, + 0x0e, 0x37, 0x05, 0x6c, 0x95, 0x04, 0x23, 0x58, 0x25, 0x84, 0x93, 0xc4, 0x06, 0xb6, 0xd7, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x67, 0x1c, 0xed, 0x87, 0x00, 0x00, 0x00, } diff --git a/plugins/kvscheduler/internal/test/model/values.proto b/plugins/kvscheduler/internal/test/model/values.proto index eea93e3090..33347e22aa 100644 --- a/plugins/kvscheduler/internal/test/model/values.proto +++ b/plugins/kvscheduler/internal/test/model/values.proto @@ -4,6 +4,7 @@ package model; message ArrayValue { repeated string items = 1; + string item_suffix = 2; } message StringValue { diff --git a/plugins/kvscheduler/internal/test/southbound.go b/plugins/kvscheduler/internal/test/southbound.go index 6d86725b2a..1eb50673e4 100644 --- a/plugins/kvscheduler/internal/test/southbound.go +++ b/plugins/kvscheduler/internal/test/southbound.go @@ -210,15 +210,17 @@ func (ms *MockSouthbound) executeChange(descriptor string, opType MockOpType, ke } err := plannedErrors[0].err clb := plannedErrors[0].afterErrClb - operation.Err = err - ms.opHistory = append(ms.opHistory, operation) - ms.Unlock() + if err != nil { + operation.Err = err + ms.opHistory = append(ms.opHistory, operation) + ms.Unlock() - if clb != nil { - clb() - } + if clb != nil { + clb() + } - return err + return err + } } // the simulated operation has succeeded diff --git a/plugins/kvscheduler/internal/test/values.go b/plugins/kvscheduler/internal/test/values.go index b2c9685f97..ed577e9368 100644 --- a/plugins/kvscheduler/internal/test/values.go +++ b/plugins/kvscheduler/internal/test/values.go @@ -33,6 +33,12 @@ func NewArrayValue(items ...string) proto.Message { return &ArrayValue{Items: items} } +// NewArrayValue creates a new instance of ArrayValue with a suffix +// appended into each item value (but not key). +func NewArrayValueWithSuffix(suffix string, items ...string) proto.Message { + return &ArrayValue{Items: items, ItemSuffix: suffix} +} + // StringValueComparator is (a custom) KVDescriptor.ValueComparator for string values. func StringValueComparator(key string, v1, v2 proto.Message) bool { sv1, isStringVal1 := v1.(*StringValue) @@ -52,7 +58,7 @@ func ArrayValueDerBuilder(key string, value proto.Message) []KeyValuePair { for _, item := range arrayVal.Items { derivedVals = append(derivedVals, KeyValuePair{ Key: key + "/" + item, - Value: NewStringValue(item), + Value: NewStringValue(item + arrayVal.ItemSuffix), }) } } diff --git a/plugins/kvscheduler/node_utils.go b/plugins/kvscheduler/node_utils.go index e1a9b949bf..94463ca0a4 100644 --- a/plugins/kvscheduler/node_utils.go +++ b/plugins/kvscheduler/node_utils.go @@ -293,13 +293,13 @@ func isNodeReady(node graph.Node) bool { // for SB values dependencies are not checked return true } - ready, _ := isNodeReadyRec(node, 0, make(map[string]int)) + ready, _ := isNodeReadyRec(node, 0, make(map[string]int), false) return ready } // isNodeReadyRec is a recursive call from within isNodeReady. // visited = map{ key -> depth } -func isNodeReadyRec(node graph.Node, depth int, visited map[string]int) (ready bool, cycleDepth int) { +func isNodeReadyRec(node graph.Node, depth int, visited map[string]int, checkSCC bool) (ready bool, cycleDepth int) { if targetDepth, wasVisited := visited[node.GetKey()]; wasVisited { return true, targetDepth } @@ -307,33 +307,47 @@ func isNodeReadyRec(node graph.Node, depth int, visited map[string]int) (ready b visited[node.GetKey()] = depth defer delete(visited, node.GetKey()) - for _, targets := range node.GetTargets(DependencyRelation) { - satisfied := false - for _, target := range targets.Nodes { - if getNodeState(target) == kvs.ValueState_REMOVED { - // do not consider values that are (being) removed - continue - } - if isNodeAvailable(target) { - satisfied = true + ready = true // for zero dependencies + var satisfiedLabel bool + cb := func(target graph.Node, label string) (skipLabel, abort bool) { + if target == nil { // end of the available targets for this label + if !satisfiedLabel { + ready = false + abort = true + return } + satisfiedLabel = false // clear for the next label + return + } - // test if node is inside a strongly-connected component (treated as one node) - targetReady, targetCycleDepth := isNodeReadyRec(target, depth+1, visited) - if targetReady && targetCycleDepth <= depth { - // this node is reachable from the target - satisfied = true - if targetCycleDepth < cycleDepth { - // update how far back in the branch this node can reach following dependencies - cycleDepth = targetCycleDepth - } + if getNodeState(target) == kvs.ValueState_REMOVED { + // do not consider values that are (being) removed + return + } + + if isNodeAvailable(target) { + satisfiedLabel = true + if !checkSCC { + skipLabel = true + return } } - if !satisfied { - return false, cycleDepth + + // test if node is inside a strongly-connected component (treated as one node) + targetReady, targetCycleDepth := isNodeReadyRec(target, depth+1, visited, true) + if targetReady && targetCycleDepth <= depth { + // this node is reachable from the target + satisfiedLabel = true + if targetCycleDepth < cycleDepth { + // update how far back in the branch this node can reach following dependencies + cycleDepth = targetCycleDepth + } } + return } - return true, cycleDepth + + node.IterTargets(DependencyRelation, cb) + return } func canNodeHaveMetadata(node graph.Node) bool { diff --git a/plugins/kvscheduler/notification_test.go b/plugins/kvscheduler/notification_test.go index 2d12769e11..68afd16185 100644 --- a/plugins/kvscheduler/notification_test.go +++ b/plugins/kvscheduler/notification_test.go @@ -215,8 +215,11 @@ func TestNotifications(t *testing.T) { // send notification startTime = time.Now() mockSB.SetValue(prefixA+baseValue1, test.NewArrayValue("item1"), &test.OnlyInteger{Integer: 10}, FromSB, false) - notifError := scheduler.PushSBNotification(prefixA+baseValue1, test.NewArrayValue("item1"), - &test.OnlyInteger{Integer: 10}) + notifError := scheduler.PushSBNotification(KVWithMetadata{ + Key: prefixA+baseValue1, + Value: test.NewArrayValue("item1"), + Metadata: &test.OnlyInteger{Integer: 10}, + }) Expect(notifError).ShouldNot(HaveOccurred()) // wait until the notification is processed @@ -434,8 +437,10 @@ func TestNotifications(t *testing.T) { // send 2nd notification startTime = time.Now() mockSB.SetValue(prefixA+baseValue1, test.NewArrayValue("item1", "item2"), &test.OnlyInteger{Integer: 11}, FromSB, false) - notifError = scheduler.PushSBNotification(prefixA+baseValue1, test.NewArrayValue("item1", "item2"), - &test.OnlyInteger{Integer: 11}) + notifError = scheduler.PushSBNotification(KVWithMetadata{ + Key: prefixA+baseValue1, + Value: test.NewArrayValue("item1", "item2"), + Metadata: &test.OnlyInteger{Integer: 11}}) Expect(notifError).ShouldNot(HaveOccurred()) // wait until the notification is processed @@ -589,7 +594,11 @@ func TestNotifications(t *testing.T) { // send 3rd notification startTime = time.Now() mockSB.SetValue(prefixA+baseValue1, nil, nil, FromSB, false) - notifError = scheduler.PushSBNotification(prefixA+baseValue1, nil, nil) + notifError = scheduler.PushSBNotification(KVWithMetadata{ + Key: prefixA+baseValue1, + Value: nil, + Metadata: nil, + }) Expect(notifError).ShouldNot(HaveOccurred()) // wait until the notification is processed @@ -847,8 +856,11 @@ func TestNotificationsWithRetry(t *testing.T) { // send notification startTime := time.Now() - notifError := scheduler.PushSBNotification(prefixA+baseValue1, test.NewArrayValue("item1", "item2"), - &test.OnlyInteger{Integer: 10}) + notifError := scheduler.PushSBNotification(KVWithMetadata{ + Key: prefixA+baseValue1, + Value: test.NewArrayValue("item1", "item2"), + Metadata: &test.OnlyInteger{Integer: 10}, + }) Expect(notifError).ShouldNot(HaveOccurred()) // wait until the notification is processed diff --git a/plugins/kvscheduler/plugin_scheduler.go b/plugins/kvscheduler/plugin_scheduler.go index c29d6b6b7e..e951bfdb90 100644 --- a/plugins/kvscheduler/plugin_scheduler.go +++ b/plugins/kvscheduler/plugin_scheduler.go @@ -286,19 +286,19 @@ func (s *Scheduler) TransactionBarrier() { s.txnLock.Unlock() } -// PushSBNotification notifies about a spontaneous value change in the SB +// PushSBNotification notifies about a spontaneous value change(s) in the SB // plane (i.e. not triggered by NB transaction). -func (s *Scheduler) PushSBNotification(key string, value proto.Message, metadata kvs.Metadata) error { +func (s *Scheduler) PushSBNotification(notif ...kvs.KVWithMetadata) error { txn := &transaction{ txnType: kvs.SBNotification, - values: []kvForTxn{ - { - key: key, - value: value, - metadata: metadata, - origin: kvs.FromSB, - }, - }, + } + for _, value := range notif { + txn.values = append(txn.values, kvForTxn{ + key: value.Key, + value: value.Value, + metadata: value.Metadata, + origin: kvs.FromSB, + }) } return s.enqueueTxn(txn) } diff --git a/plugins/kvscheduler/refresh.go b/plugins/kvscheduler/refresh.go index 5cd644dcfe..2f14091ed3 100644 --- a/plugins/kvscheduler/refresh.go +++ b/plugins/kvscheduler/refresh.go @@ -571,4 +571,4 @@ func (s *Scheduler) validRetrievedDerivedKV(node graph.Node, descriptor *kvs.KVD // return true -> let's overwrite invalidly retrieved derived value } return true -} \ No newline at end of file +} diff --git a/plugins/kvscheduler/txn_exec.go b/plugins/kvscheduler/txn_exec.go index b7d666a466..b8f31839af 100644 --- a/plugins/kvscheduler/txn_exec.go +++ b/plugins/kvscheduler/txn_exec.go @@ -235,7 +235,7 @@ func (s *Scheduler) applyValue(args *applyValueArgs) (executed kvs.RecordedTxnOp // run selected operation switch txnOp.Operation { case kvs.TxnOperation_DELETE: - executed, err = s.applyDelete(node, txnOp, args, args.isDepUpdate) + executed, err = s.applyDelete(node, txnOp, args, args.isDepUpdate, false) case kvs.TxnOperation_CREATE: executed, err = s.applyCreate(node, txnOp, args) case kvs.TxnOperation_UPDATE: @@ -255,7 +255,9 @@ func (s *Scheduler) applyValue(args *applyValueArgs) (executed kvs.RecordedTxnOp } // applyDelete removes value. -func (s *Scheduler) applyDelete(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, args *applyValueArgs, pending bool) (executed kvs.RecordedTxnOps, err error) { +func (s *Scheduler) applyDelete(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, args *applyValueArgs, + pending, recreate bool) (executed kvs.RecordedTxnOps, err error) { + if s.logGraphWalk { endLog := s.logNodeVisit("applyDelete", args) defer endLog() @@ -289,7 +291,7 @@ func (s *Scheduler) applyDelete(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg } else { // removed by request txnOp.NewState = kvs.ValueState_REMOVED - if args.isDerived { + if args.isDerived && !recreate { args.graphW.DeleteNode(args.kv.key) } else { s.updateNodeState(node, txnOp.NewState, args) @@ -341,7 +343,7 @@ func (s *Scheduler) applyDelete(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg } // update values that depend on this kv-pair - depExecs, inheritedErr := s.runDepUpdates(node, args) + depExecs, inheritedErr := s.runDepUpdates(node, args, false) executed = append(executed, depExecs...) if inheritedErr != nil { err = inheritedErr @@ -479,7 +481,7 @@ func (s *Scheduler) applyCreate(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg executed = append(executed, txnOp) // update values that depend on this kv-pair - depExecs, inheritedErr := s.runDepUpdates(node, args) + depExecs, inheritedErr := s.runDepUpdates(node, args, true) executed = append(executed, depExecs...) if inheritedErr != nil { err = inheritedErr @@ -517,7 +519,7 @@ func (s *Scheduler) applyUpdate(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg descriptor := s.registry.GetDescriptorForKey(args.kv.key) handler := newDescriptorHandler(descriptor) if !args.dryRun && args.kv.origin == kvs.FromNB { - err = handler.validate(node.GetKey(), node.GetValue()) + err = handler.validate(node.GetKey(), args.kv.value) if err != nil { node.SetValue(args.kv.value) // save the invalid value node.SetFlags(&UnavailValueFlag{}) @@ -551,13 +553,14 @@ func (s *Scheduler) applyUpdate(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg delOp := s.preRecordTxnOp(args, node) delOp.Operation = kvs.TxnOperation_DELETE delOp.NewValue = nil - delExec, inheritedErr := s.applyDelete(node, delOp, args, false) + delExec, inheritedErr := s.applyDelete(node, delOp, args, false, true) executed = append(executed, delExec...) if inheritedErr != nil { err = inheritedErr return } // create the new revision of the value + node = args.graphW.SetNode(args.kv.key) createOp := s.preRecordTxnOp(args, node) createOp.Operation = kvs.TxnOperation_CREATE createOp.PrevValue = nil @@ -581,9 +584,9 @@ func (s *Scheduler) applyUpdate(node graph.NodeRW, txnOp *kvs.RecordedTxnOp, arg } // if the new dependencies are not satisfied => delete and set as pending with the new value - if !isNodeReady(node) { + if !equivalent && !isNodeReady(node) { node.SetValue(prevValue) // apply delete on the original value - delExec, inheritedErr := s.applyDelete(node, txnOp, args, true) + delExec, inheritedErr := s.applyDelete(node, txnOp, args, true, false) executed = append(executed, delExec...) if inheritedErr != nil { err = inheritedErr @@ -744,7 +747,7 @@ func (s *Scheduler) applyDerived(derivedVals []kvForTxn, args *applyValueArgs, c } // runDepUpdates triggers dependency updates on all nodes that depend on the given node. -func (s *Scheduler) runDepUpdates(node graph.Node, args *applyValueArgs) (executed kvs.RecordedTxnOps, err error) { +func (s *Scheduler) runDepUpdates(node graph.Node, args *applyValueArgs, forUnavailable bool) (executed kvs.RecordedTxnOps, err error) { if s.logGraphWalk { endLog := s.logNodeVisit("runDepUpdates", args) defer endLog() @@ -763,6 +766,9 @@ func (s *Scheduler) runDepUpdates(node graph.Node, args *applyValueArgs) (execut if getNodeOrigin(depNode) != kvs.FromNB { continue } + if !isNodeAvailable(depNode) != forUnavailable { + continue + } var value proto.Message if lastUpdate := getNodeLastUpdate(depNode); lastUpdate != nil { value = lastUpdate.value diff --git a/plugins/kvscheduler/txn_process.go b/plugins/kvscheduler/txn_process.go index 747f78cab5..6ad934f2e9 100644 --- a/plugins/kvscheduler/txn_process.go +++ b/plugins/kvscheduler/txn_process.go @@ -207,7 +207,7 @@ func (s *Scheduler) preProcessNBTransaction(txn *transaction) (skip bool) { } // for resync refresh the graph + collect deletes - graphW := s.graph.Write(true,false) + graphW := s.graph.Write(true, false) defer graphW.Release() s.resyncCount++ @@ -311,7 +311,8 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record toRetry := utils.NewSliceBasedKeySet() toRefresh := utils.NewSliceBasedKeySet() - var verboseRefresh bool + var afterErrRefresh bool + var kvErrors []kvs.KeyWithError graphR := s.graph.Read() for _, op := range executed { node := graphR.GetNode(op.Key) @@ -325,12 +326,12 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record } if state == kvs.ValueState_FAILED { toRefresh.Add(baseKey) - verboseRefresh = true + afterErrRefresh = true } if state == kvs.ValueState_RETRYING { toRefresh.Add(baseKey) toRetry.Add(baseKey) - verboseRefresh = true + afterErrRefresh = true } if s.verifyMode { toRefresh.Add(baseKey) @@ -341,52 +342,15 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record // refresh base values which themselves are in a failed state or have derived failed values // - in verifyMode all updated values are re-freshed if toRefresh.Length() > 0 { - graphW := s.graph.Write(true,false) - s.refreshGraph(graphW, toRefresh, nil, verboseRefresh) - - // split values based on the retry metadata - retryTxns := make(map[retryTxnMeta]*retryTxn) - for _, retryKey := range toRetry.Iterate() { - node := graphW.GetNode(retryKey) - lastUpdate := getNodeLastUpdate(node) - // did retry fail? - var alreadyRetried bool - if txn.txnType == kvs.RetryFailedOps { - _, alreadyRetried = txn.retry.keys[retryKey] - } - // determine how long to delay the retry - delay := lastUpdate.retryArgs.Period - if alreadyRetried && lastUpdate.retryArgs.ExpBackoff { - delay = txn.retry.delay * 2 - } - // determine which attempt this is - attempt := 1 - if alreadyRetried { - attempt = txn.retry.attempt + 1 - } - // determine which transaction this retry is for - seqNum := txn.seqNum - if alreadyRetried { - seqNum = txn.retry.txnSeqNum - } - // add key into the set to retry within a single transaction - retryMeta := retryTxnMeta{ - txnSeqNum: seqNum, - delay: delay, - attempt: attempt, - } - if _, has := retryTxns[retryMeta]; !has { - retryTxns[retryMeta] = &retryTxn{ - retryTxnMeta: retryMeta, - keys: make(map[string]uint64), - } - } - retryTxns[retryMeta].keys[retryKey] = lastUpdate.txnSeqNum - } + // changes brought by refresh triggered solely for the verification are + // not saved into the graph + graphW := s.graph.Write(afterErrRefresh, false) + s.refreshGraph(graphW, toRefresh, nil, afterErrRefresh) + s.scheduleRetries(txn, graphW, toRetry) - // schedule a series of re-try transactions for failed values - for _, retryTxn := range retryTxns { - s.enqueueRetry(retryTxn) + // if enabled, verify transaction effects + if s.verifyMode { + kvErrors = s.verifyTransaction(graphW, executed) } graphW.Release() } @@ -407,63 +371,6 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record // clear the set of updated states s.updatedStates = utils.NewSliceBasedKeySet() - // if enabled, verify transaction effects - var kvErrors []kvs.KeyWithError - if s.verifyMode { - graphR = s.graph.Read() - for _, op := range executed { - key := op.Key - node := graphR.GetNode(key) - if node == nil { - continue - } - state := getNodeState(node) - if state == kvs.ValueState_RETRYING || state == kvs.ValueState_FAILED { - // effects of failed operations are uncertain and cannot be therefore verified - continue - } - expValue := getNodeLastAppliedValue(node) - lastOp := getNodeLastOperation(node) - expToNotExist := expValue == nil || state == kvs.ValueState_PENDING || state == kvs.ValueState_INVALID - if expToNotExist && isNodeAvailable(node) { - kvErrors = append(kvErrors, kvs.KeyWithError{ - Key: key, - Error: kvs.NewVerificationError(key, kvs.ExpectedToNotExist), - TxnOperation: lastOp, - }) - continue - } - if expValue == nil { - // properly removed - continue - } - if !expToNotExist && !isNodeAvailable(node) { - kvErrors = append(kvErrors, kvs.KeyWithError{ - Key: key, - Error: kvs.NewVerificationError(key, kvs.ExpectedToExist), - TxnOperation: lastOp, - }) - continue - } - descriptor := s.registry.GetDescriptorForKey(key) - handler := newDescriptorHandler(descriptor) - equivalent := handler.equivalentValues(key, node.GetValue(), expValue) - if !equivalent { - kvErrors = append(kvErrors, kvs.KeyWithError{ - Key: key, - Error: kvs.NewVerificationError(key, kvs.NotEquivalent), - TxnOperation: lastOp, - }) - s.Log.WithFields( - logging.Fields{ - "applied": expValue, - "refreshed": node.GetValue(), - }).Warn("Detected non-equivalent applied vs. refreshed values") - } - } - graphR.Release() - } - // build transaction error var txnErr error for _, txnOp := range executed { @@ -513,7 +420,7 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record // delete removed values from the graph after the notifications have been sent if removed.Length() > 0 { - graphW := s.graph.Write(true,true) + graphW := s.graph.Write(true, true) for _, key := range removed.Iterate() { graphW.DeleteNode(key) } @@ -521,6 +428,111 @@ func (s *Scheduler) postProcessTransaction(txn *transaction, executed kvs.Record } } +// scheduleRetries schedules a series of re-try transactions for failed values +func (s *Scheduler) scheduleRetries(txn *transaction, graphR graph.ReadAccess, toRetry utils.KeySet) { + // split values based on the retry metadata + retryTxns := make(map[retryTxnMeta]*retryTxn) + for _, retryKey := range toRetry.Iterate() { + node := graphR.GetNode(retryKey) + lastUpdate := getNodeLastUpdate(node) + // did retry fail? + var alreadyRetried bool + if txn.txnType == kvs.RetryFailedOps { + _, alreadyRetried = txn.retry.keys[retryKey] + } + // determine how long to delay the retry + delay := lastUpdate.retryArgs.Period + if alreadyRetried && lastUpdate.retryArgs.ExpBackoff { + delay = txn.retry.delay * 2 + } + // determine which attempt this is + attempt := 1 + if alreadyRetried { + attempt = txn.retry.attempt + 1 + } + // determine which transaction this retry is for + seqNum := txn.seqNum + if alreadyRetried { + seqNum = txn.retry.txnSeqNum + } + // add key into the set to retry within a single transaction + retryMeta := retryTxnMeta{ + txnSeqNum: seqNum, + delay: delay, + attempt: attempt, + } + if _, has := retryTxns[retryMeta]; !has { + retryTxns[retryMeta] = &retryTxn{ + retryTxnMeta: retryMeta, + keys: make(map[string]uint64), + } + } + retryTxns[retryMeta].keys[retryKey] = lastUpdate.txnSeqNum + } + + // schedule a series of re-try transactions for failed values + for _, retryTxn := range retryTxns { + s.enqueueRetry(retryTxn) + } +} + +// verifyTransaction verifies if the effect of the transaction is as expected. +func (s *Scheduler) verifyTransaction(graphR graph.ReadAccess, executed kvs.RecordedTxnOps) (kvErrors []kvs.KeyWithError) { + for _, op := range executed { + key := op.Key + node := graphR.GetNode(key) + if node == nil { + continue + } + state := getNodeState(node) + if state == kvs.ValueState_RETRYING || state == kvs.ValueState_FAILED { + // effects of failed operations are uncertain and cannot be therefore verified + continue + } + + expValue := getNodeLastAppliedValue(node) + lastOp := getNodeLastOperation(node) + + expToNotExist := expValue == nil || state == kvs.ValueState_PENDING || state == kvs.ValueState_INVALID + if expToNotExist && isNodeAvailable(node) { + kvErrors = append(kvErrors, kvs.KeyWithError{ + Key: key, + Error: kvs.NewVerificationError(key, kvs.ExpectedToNotExist), + TxnOperation: lastOp, + }) + continue + } + if expValue == nil { + // properly removed + continue + } + if !expToNotExist && !isNodeAvailable(node) { + kvErrors = append(kvErrors, kvs.KeyWithError{ + Key: key, + Error: kvs.NewVerificationError(key, kvs.ExpectedToExist), + TxnOperation: lastOp, + }) + continue + } + descriptor := s.registry.GetDescriptorForKey(key) + handler := newDescriptorHandler(descriptor) + equivalent := handler.equivalentValues(key, node.GetValue(), expValue) + if !equivalent { + kvErrors = append(kvErrors, kvs.KeyWithError{ + Key: key, + Error: kvs.NewVerificationError(key, kvs.NotEquivalent), + TxnOperation: lastOp, + }) + s.Log.WithFields( + logging.Fields{ + "applied": expValue, + "refreshed": node.GetValue(), + }).Warn("Detected non-equivalent applied vs. refreshed values") + } + } + return +} + // filterNotification checks if the received notification should be filtered // or normally applied. func (s *Scheduler) filterNotification(graphR graph.ReadAccess, key string, value proto.Message, txnSeqNum uint64) bool { diff --git a/plugins/kvscheduler/txn_record.go b/plugins/kvscheduler/txn_record.go index e7e2e81745..e9ff24e666 100644 --- a/plugins/kvscheduler/txn_record.go +++ b/plugins/kvscheduler/txn_record.go @@ -22,6 +22,8 @@ import ( "strings" "time" + "github.com/gogo/protobuf/proto" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" "github.com/ligato/vpp-agent/plugins/kvscheduler/internal/graph" "github.com/ligato/vpp-agent/plugins/kvscheduler/internal/utils" @@ -76,6 +78,10 @@ func (s *Scheduler) GetRecordedTransaction(SeqNum uint64) (txn *kvs.RecordedTxn) // preRecordTxnOp prepares txn operation record - fills attributes that we can even // before executing the operation. func (s *Scheduler) preRecordTxnOp(args *applyValueArgs, node graph.Node) *kvs.RecordedTxnOp { + var prevValue proto.Message + if getNodeState(node) != kvs.ValueState_REMOVED { + prevValue = utils.RecordProtoMessage(node.GetValue()) + } prevOrigin := getNodeOrigin(node) if prevOrigin == kvs.UnknownOrigin { // new value @@ -84,7 +90,7 @@ func (s *Scheduler) preRecordTxnOp(args *applyValueArgs, node graph.Node) *kvs.R _, prevErr := getNodeError(node) return &kvs.RecordedTxnOp{ Key: args.kv.key, - PrevValue: utils.RecordProtoMessage(node.GetValue()), + PrevValue: prevValue, NewValue: utils.RecordProtoMessage(args.kv.value), PrevState: getNodeState(node), PrevErr: prevErr, @@ -137,21 +143,16 @@ func (s *Scheduler) preRecordTransaction(txn *transaction, planned kvs.RecordedT // if enabled, print txn summary if s.config.PrintTxnSummary { // build header for the log - txnInfo := txn.txnType.String() + txnInfo := "" if txn.txnType == kvs.NBTransaction && txn.nb.resyncType != kvs.NotResync { - resyncType := "Full Resync" - if txn.nb.resyncType == kvs.DownstreamResync { - resyncType = "SB Sync" - } - if txn.nb.resyncType == kvs.UpstreamResync { - resyncType = "NB Sync" - } - txnInfo = fmt.Sprintf("%s (%s)", txn.txnType.String(), resyncType) + txnInfo = fmt.Sprintf("%s", txn.nb.resyncType.String()) + } else if txn.txnType == kvs.RetryFailedOps && txn.retry != nil { + txnInfo = fmt.Sprintf("retrying TX #%d (attempt %d)", txn.retry.txnSeqNum, txn.retry.attempt) } + msg := fmt.Sprintf("#%d - %s", record.SeqNum, txn.txnType.String()) + n := 115 - len(msg) var buf strings.Builder buf.WriteString("+======================================================================================================================+\n") - msg := fmt.Sprintf("Transaction #%d", record.SeqNum) - n := 115 - len(msg) buf.WriteString(fmt.Sprintf("| %s %"+strconv.Itoa(n)+"s |\n", msg, txnInfo)) buf.WriteString("+======================================================================================================================+\n") buf.WriteString(record.StringWithOpts(false, false, 2)) @@ -172,12 +173,15 @@ func (s *Scheduler) recordTransaction(txn *transaction, txnRecord *kvs.RecordedT txnRecord.Executed = executed if s.config.PrintTxnSummary { + txnType := txn.txnType.String() + msg := fmt.Sprintf("#%d - %s", txnRecord.SeqNum, txnType) + elapsed := stop.Sub(start) + msg2 := fmt.Sprintf("took %v", elapsed.Round(time.Microsecond*100)) + var buf strings.Builder buf.WriteString("o----------------------------------------------------------------------------------------------------------------------o\n") buf.WriteString(txnRecord.StringWithOpts(true, false, 2)) buf.WriteString("x----------------------------------------------------------------------------------------------------------------------x\n") - msg := fmt.Sprintf("#%d", txnRecord.SeqNum) - msg2 := fmt.Sprintf("took %v", stop.Sub(start).Round(time.Microsecond*100)) buf.WriteString(fmt.Sprintf("| %s %"+fmt.Sprint(115-len(msg))+"s |\n", msg, msg2)) buf.WriteString("x----------------------------------------------------------------------------------------------------------------------x\n") fmt.Println(buf.String()) diff --git a/plugins/linux/ifplugin/descriptor/adapter/interface.go b/plugins/linux/ifplugin/descriptor/adapter/interface.go index a7d1912daf..1553e75e42 100644 --- a/plugins/linux/ifplugin/descriptor/adapter/interface.go +++ b/plugins/linux/ifplugin/descriptor/adapter/interface.go @@ -4,8 +4,8 @@ package adapter import ( "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/api/models/linux/interfaces" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/api/models/linux/interfaces" "github.com/ligato/vpp-agent/plugins/linux/ifplugin/ifaceidx" ) diff --git a/plugins/linux/ifplugin/descriptor/interface.go b/plugins/linux/ifplugin/descriptor/interface.go index b0889287d2..1b3b95ed26 100644 --- a/plugins/linux/ifplugin/descriptor/interface.go +++ b/plugins/linux/ifplugin/descriptor/interface.go @@ -27,7 +27,6 @@ import ( "github.com/gogo/protobuf/proto" prototypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" - "github.com/vishvananda/netlink" "golang.org/x/sys/unix" "github.com/ligato/cn-infra/idxmap" @@ -63,9 +62,10 @@ const ( defaultLoopbackMTU = 65536 // dependency labels - tapInterfaceDep = "vpp-tap-interface-exists" - vethPeerDep = "veth-peer-exists" - microserviceDep = "microservice-available" + existingHostInterfaceDep = "host-interface-exists" + tapInterfaceDep = "vpp-tap-interface-exists" + vethPeerDep = "veth-peer-exists" + microserviceDep = "microservice-available" // suffix attached to logical names of duplicate VETH interfaces vethDuplicateSuffix = "-DUPLICATE" @@ -108,6 +108,10 @@ var ( // ErrNamespaceWithoutReference is returned when namespace is missing reference. ErrNamespaceWithoutReference = errors.New("namespace defined without name") + // ErrExistingWithNamespace is returned when namespace is specified for + // EXISTING interface. + ErrExistingWithNamespace = errors.New("EXISTING interface defined with namespace") + // ErrInvalidIPWithMask is returned when address is invalid or mask is missing ErrInvalidIPWithMask = errors.New("IP with mask is not valid") @@ -249,28 +253,50 @@ func (d *InterfaceDescriptor) MetadataFactory() idxmap.NamedMappingRW { // Validate validates Linux interface configuration. func (d *InterfaceDescriptor) Validate(key string, linuxIf *interfaces.Interface) error { + // validate name (this should never happen, since key is derived from name) if linuxIf.GetName() == "" { return kvs.NewInvalidValueError(ErrInterfaceWithoutName, "name") } - addrs := linuxIf.GetIpAddresses() - for _, a := range addrs { + + // validate IP addresses + for _, a := range linuxIf.GetIpAddresses() { + // TODO: perhaps we could assume default mask if there isnt one? if _, _, err := net.ParseCIDR(a); err != nil { return kvs.NewInvalidValueError(ErrInvalidIPWithMask, "ip_addresses") } } - if linuxIf.GetType() == interfaces.Interface_UNDEFINED { - return kvs.NewInvalidValueError(ErrInterfaceWithoutType, "type") - } - if linuxIf.GetType() == interfaces.Interface_TAP_TO_VPP && d.vppIfPlugin == nil { - return ErrTAPRequiresVPPIfPlugin + // validate namespace + if ns := linuxIf.GetNamespace(); ns != nil { + if ns.GetType() == namespace.NetNamespace_UNDEFINED || ns.GetReference() == "" { + return kvs.NewInvalidValueError(ErrNamespaceWithoutReference, "namespace") + } } - if linuxIf.GetNamespace() != nil && - (linuxIf.GetNamespace().GetType() == namespace.NetNamespace_UNDEFINED || - linuxIf.GetNamespace().GetReference() == "") { - return kvs.NewInvalidValueError(ErrNamespaceWithoutReference, "namespace") + + // validate type + switch linuxIf.GetType() { + case interfaces.Interface_EXISTING: + if linuxIf.GetLink() != nil { + return kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, "link") + } + // For now support only the same namespace as the agent. + if linuxIf.GetNamespace() != nil { + return kvs.NewInvalidValueError(ErrExistingWithNamespace, "namespace") + } + case interfaces.Interface_LOOPBACK: + if linuxIf.GetLink() != nil { + return kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, "link") + } + case interfaces.Interface_TAP_TO_VPP: + if d.vppIfPlugin == nil { + return ErrTAPRequiresVPPIfPlugin + } + case interfaces.Interface_UNDEFINED: + return kvs.NewInvalidValueError(ErrInterfaceWithoutType, "type") } - switch linuxIf.Link.(type) { + + // validate link + switch linuxIf.GetLink().(type) { case *interfaces.Interface_Tap: if linuxIf.GetType() != interfaces.Interface_TAP_TO_VPP { return kvs.NewInvalidValueError(ErrInterfaceReferenceMismatch, "link") @@ -309,6 +335,21 @@ func (d *InterfaceDescriptor) Create(key string, linuxIf *interfaces.Interface) metadata, err = d.createTAPToVPP(nsCtx, key, linuxIf) case interfaces.Interface_LOOPBACK: metadata, err = d.createLoopback(nsCtx, linuxIf) + case interfaces.Interface_EXISTING: + // We expect that the interface already exists, therefore nothing needs to be done. + // We just get the metadata for the interface. + getMetadata := func(linuxIf *interfaces.Interface) (*ifaceidx.LinuxIfMetadata, error) { + link, err := d.ifHandler.GetLinkByName(getHostIfName(linuxIf)) + if err != nil { + d.log.Error(err) + return nil, err + } + return &ifaceidx.LinuxIfMetadata{ + Namespace: linuxIf.Namespace, + LinuxIfIndex: link.Attrs().Index, + }, nil + } + metadata, err = getMetadata(linuxIf) default: return nil, ErrUnsupportedLinuxInterfaceType } @@ -431,7 +472,7 @@ func (d *InterfaceDescriptor) Delete(key string, linuxIf *interfaces.Interface, nsCtx := nslinuxcalls.NewNamespaceMgmtCtx() revert, err := d.nsPlugin.SwitchToNamespace(nsCtx, linuxIf.Namespace) if err != nil { - d.log.Error(err) + d.log.Error("switch to namespace failed:", err) return err } defer revert() @@ -461,6 +502,10 @@ func (d *InterfaceDescriptor) Delete(key string, linuxIf *interfaces.Interface, return d.deleteAutoTAP(nsCtx, key, linuxIf, metadata) case interfaces.Interface_LOOPBACK: return d.deleteLoopback(nsCtx, linuxIf) + case interfaces.Interface_EXISTING: + // We only need to unconfigure the interface. + // Nothing else needs to be done. + return nil } err = ErrUnsupportedLinuxInterfaceType @@ -484,9 +529,8 @@ func (d *InterfaceDescriptor) Update(key string, oldLinuxIf, newLinuxIf *interfa // update host name if oldHostName != newHostName { - d.ifHandler.RenameInterface(oldHostName, newHostName) - if err != nil { - d.log.Error(err) + if err := d.ifHandler.RenameInterface(oldHostName, newHostName); err != nil { + d.log.Error("renaming interface failed:", err) return nil, err } } @@ -618,6 +662,14 @@ func (d *InterfaceDescriptor) UpdateWithRecreate(key string, oldLinuxIf, newLinu func (d *InterfaceDescriptor) Dependencies(key string, linuxIf *interfaces.Interface) []kvs.Dependency { var dependencies []kvs.Dependency + // EXISTING depends on a referenced Linux interface in the default namespace + if linuxIf.Type == interfaces.Interface_EXISTING { + dependencies = append(dependencies, kvs.Dependency{ + Label: existingHostInterfaceDep, + Key: interfaces.InterfaceHostNameKey(getHostIfName(linuxIf)), + }) + } + if linuxIf.Type == interfaces.Interface_TAP_TO_VPP { // dependency on VPP TAP dependencies = append(dependencies, kvs.Dependency{ @@ -724,6 +776,7 @@ func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetada // receive results from the go routines ifaces := make(map[string]adapter.InterfaceKVWithMetadata) // interface logical name -> interface data indexes := make(map[int]struct{}) // already retrieved interfaces by their Linux indexes + for idx := 0; idx < goRoutinesCnt; idx++ { retrieved := <-ch if retrieved.err != nil { @@ -733,7 +786,7 @@ func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetada // skip if this interface was already retrieved and this is not the expected // namespace from correlation - remember, the same namespace may have // multiple different references - rewrite := false + var rewrite bool if _, alreadyRetrieved := indexes[kv.Metadata.LinuxIfIndex]; alreadyRetrieved { if expCfg, hasExpCfg := ifCfg[kv.Value.Name]; hasExpCfg { if proto.Equal(expCfg.Namespace, kv.Value.Namespace) { @@ -817,6 +870,7 @@ func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetada // present in every -th network namespace from the list. func (d *InterfaceDescriptor) retrieveInterfaces(nsList []*namespace.NetNamespace, goRoutineIdx, goRoutinesCnt int, ch chan<- retrievedIfaces) { var retrieved retrievedIfaces + agentPrefix := d.serviceLabel.GetAgentPrefix() nsCtx := nslinuxcalls.NewNamespaceMgmtCtx() @@ -825,26 +879,24 @@ func (d *InterfaceDescriptor) retrieveInterfaces(nsList []*namespace.NetNamespac // switch to the namespace revert, err := d.nsPlugin.SwitchToNamespace(nsCtx, nsRef) if err != nil { - d.log.WithFields(logging.Fields{ - "err": err, - "namespace": nsRef, - }).Warn("Failed to retrieve interfaces from the namespace") + d.log.WithField("namespace", nsRef). + Warn("Failed to switch namespace:", err) continue // continue with the next namespace } // get all links in the namespace links, err := d.ifHandler.GetLinkList() if err != nil { + d.log.Error("Failed to get link list:", err) // switch back to the default namespace before returning error revert() retrieved.err = err - d.log.Error(retrieved.err) break } // retrieve every interface managed by this agent for _, link := range links { - intf := &interfaces.Interface{ + iface := &interfaces.Interface{ Namespace: nsRef, HostIfName: link.Attrs().Name, PhysAddress: link.Attrs().HardwareAddr.String(), @@ -859,44 +911,48 @@ func (d *InterfaceDescriptor) retrieveInterfaces(nsList []*namespace.NetNamespac alias = strings.TrimPrefix(alias, agentPrefix) // parse alias to obtain logical references - var vppTapIfName string - if link.Type() == (&netlink.Veth{}).Type() { + if link.Type() == "veth" { + iface.Type = interfaces.Interface_VETH var vethPeerIfName string - intf.Type = interfaces.Interface_VETH - intf.Name, vethPeerIfName = parseVethAlias(alias) - intf.Link = &interfaces.Interface_Veth{ - Veth: &interfaces.VethLink{PeerIfName: vethPeerIfName}} - } else if link.Type() == (&netlink.Tuntap{}).Type() || link.Type() == "tun" /* not defined in vishvananda */ { - intf.Type = interfaces.Interface_TAP_TO_VPP - intf.Name, vppTapIfName, _ = parseTapAlias(alias) - intf.Link = &interfaces.Interface_Tap{ - Tap: &interfaces.TapLink{VppTapIfName: vppTapIfName}} + iface.Name, vethPeerIfName = parseVethAlias(alias) + iface.Link = &interfaces.Interface_Veth{ + Veth: &interfaces.VethLink{ + PeerIfName: vethPeerIfName, + }, + } + } else if link.Type() == "tuntap" || link.Type() == "tun" /* not defined in vishvananda */ { + iface.Type = interfaces.Interface_TAP_TO_VPP + var vppTapIfName string + iface.Name, vppTapIfName, _ = parseTapAlias(alias) + iface.Link = &interfaces.Interface_Tap{ + Tap: &interfaces.TapLink{ + VppTapIfName: vppTapIfName, + }, + } } else if link.Attrs().Name == defaultLoopbackName { - intf.Type = interfaces.Interface_LOOPBACK - intf.Name = alias + iface.Type = interfaces.Interface_LOOPBACK + iface.Name = alias } else { // unsupported interface type supposedly configured by agent => print warning d.log.WithFields(logging.Fields{ "if-host-name": link.Attrs().Name, - "if-type": link.Type(), "namespace": nsRef, - }).Warn("Managed interface of unsupported type") + }).Warnf("Managed interface of unsupported type: %s", link.Type()) continue } // skip interfaces with invalid aliases - if intf.Name == "" { + if iface.Name == "" { continue } // read interface status - intf.Enabled, err = d.ifHandler.IsInterfaceUp(link.Attrs().Name) + iface.Enabled, err = d.ifHandler.IsInterfaceUp(link.Attrs().Name) if err != nil { d.log.WithFields(logging.Fields{ "if-host-name": link.Attrs().Name, "namespace": nsRef, - "err": err, - }).Warn("Failed to read interface status") + }).Warn("Failed to read interface status:", err) } // read assigned IP addresses @@ -905,8 +961,7 @@ func (d *InterfaceDescriptor) retrieveInterfaces(nsList []*namespace.NetNamespac d.log.WithFields(logging.Fields{ "if-host-name": link.Attrs().Name, "namespace": nsRef, - "err": err, - }).Warn("Failed to read IP addresses") + }).Warn("Failed to read address list:", err) } for _, address := range addressList { if address.Scope == unix.RT_SCOPE_LINK { @@ -915,37 +970,35 @@ func (d *InterfaceDescriptor) retrieveInterfaces(nsList []*namespace.NetNamespac } mask, _ := address.Mask.Size() addrStr := address.IP.String() + "/" + strconv.Itoa(mask) - intf.IpAddresses = append(intf.IpAddresses, addrStr) + iface.IpAddresses = append(iface.IpAddresses, addrStr) } // read checksum offloading - if intf.Type == interfaces.Interface_VETH { + if iface.Type == interfaces.Interface_VETH { rxOn, txOn, err := d.ifHandler.GetChecksumOffloading(link.Attrs().Name) if err != nil { d.log.WithFields(logging.Fields{ "if-host-name": link.Attrs().Name, "namespace": nsRef, - "err": err, - }).Warn("Failed to read checksum offloading") + }).Warn("Failed to read checksum offloading:", err) } else { if !rxOn { - intf.GetVeth().RxChecksumOffloading = interfaces.VethLink_CHKSM_OFFLOAD_DISABLED + iface.GetVeth().RxChecksumOffloading = interfaces.VethLink_CHKSM_OFFLOAD_DISABLED } if !txOn { - intf.GetVeth().TxChecksumOffloading = interfaces.VethLink_CHKSM_OFFLOAD_DISABLED + iface.GetVeth().TxChecksumOffloading = interfaces.VethLink_CHKSM_OFFLOAD_DISABLED } } } // build key-value pair for the retrieved interface retrieved.interfaces = append(retrieved.interfaces, adapter.InterfaceKVWithMetadata{ - //Key: interfaces.InterfaceKey(intf.Name), - Key: models.Key(intf), - Value: intf, + Key: models.Key(iface), + Value: iface, Origin: kvs.FromNB, Metadata: &ifaceidx.LinuxIfMetadata{ LinuxIfIndex: link.Attrs().Index, - VPPTapName: vppTapIfName, + VPPTapName: iface.GetTap().GetVppTapIfName(), Namespace: nsRef, }, }) @@ -987,8 +1040,7 @@ func (d *InterfaceDescriptor) setInterfaceNamespace(ctx nslinuxcalls.NamespaceMg } // Move the interface into the namespace. - err = d.ifHandler.SetLinkNamespace(link, ns) - if err != nil { + if err := d.ifHandler.SetLinkNamespace(link, ns); err != nil { return errors.Errorf("failed to set interface %s file descriptor: %v", link.Attrs().Name, err) } @@ -1013,8 +1065,7 @@ func (d *InterfaceDescriptor) setInterfaceNamespace(ctx nslinuxcalls.NamespaceMg if !isIPv6 && address.IP.IsLinkLocalUnicast() { continue } - err = d.ifHandler.AddInterfaceIP(ifName, address) - if err != nil { + if err := d.ifHandler.AddInterfaceIP(ifName, address); err != nil { if err.Error() == "file exists" { continue } @@ -1102,7 +1153,6 @@ func getSysctl(name string) (string, error) { if err != nil { return "", err } - return string(data[:len(data)-1]), nil } @@ -1112,6 +1162,5 @@ func setSysctl(name, value string) (string, error) { if err := ioutil.WriteFile(fullName, []byte(value), 0644); err != nil { return "", err } - return getSysctl(name) } diff --git a/plugins/linux/ifplugin/descriptor/interface_tap.go b/plugins/linux/ifplugin/descriptor/interface_tap.go index f6833b49c4..aa2dc87dfe 100644 --- a/plugins/linux/ifplugin/descriptor/interface_tap.go +++ b/plugins/linux/ifplugin/descriptor/interface_tap.go @@ -27,8 +27,10 @@ import ( // createTAPToVPP moves Linux-side of the VPP-TAP interface to the destination namespace // and sets the requested host name, IP addresses, etc. -func (d *InterfaceDescriptor) createTAPToVPP(nsCtx nslinuxcalls.NamespaceMgmtCtx, key string, - linuxIf *interfaces.Interface) (metadata *ifaceidx.LinuxIfMetadata, err error) { +func (d *InterfaceDescriptor) createTAPToVPP( + nsCtx nslinuxcalls.NamespaceMgmtCtx, key string, linuxIf *interfaces.Interface, +) ( + md *ifaceidx.LinuxIfMetadata, err error) { // determine TAP interface name as set by VPP ifplugin vppTapName := linuxIf.GetTap().GetVppTapIfName() @@ -45,7 +47,8 @@ func (d *InterfaceDescriptor) createTAPToVPP(nsCtx nslinuxcalls.NamespaceMgmtCtx agentPrefix := d.serviceLabel.GetAgentPrefix() // add alias to associate TAP with the logical name and VPP-TAP reference - err = d.ifHandler.SetInterfaceAlias(vppTapHostName, agentPrefix+getTapAlias(linuxIf, vppTapHostName)) + alias := agentPrefix + getTapAlias(linuxIf, vppTapHostName) + err = d.ifHandler.SetInterfaceAlias(vppTapHostName, alias) if err != nil { d.log.Error(err) return nil, err @@ -67,8 +70,7 @@ func (d *InterfaceDescriptor) createTAPToVPP(nsCtx nslinuxcalls.NamespaceMgmtCtx defer revert() // rename from temporary host name to the request host name - d.ifHandler.RenameInterface(vppTapHostName, hostName) - if err != nil { + if err := d.ifHandler.RenameInterface(vppTapHostName, hostName); err != nil { d.log.Error(err) return nil, err } @@ -79,13 +81,12 @@ func (d *InterfaceDescriptor) createTAPToVPP(nsCtx nslinuxcalls.NamespaceMgmtCtx d.log.Error(err) return nil, err } - metadata = &ifaceidx.LinuxIfMetadata{ + + return &ifaceidx.LinuxIfMetadata{ VPPTapName: vppTapName, Namespace: linuxIf.Namespace, LinuxIfIndex: link.Attrs().Index, - } - - return metadata, nil + }, nil } // deleteAutoTAP returns TAP interface back to the default namespace and renames diff --git a/plugins/linux/ifplugin/descriptor/interface_veth.go b/plugins/linux/ifplugin/descriptor/interface_veth.go index 630c9f3521..fc9a94140f 100644 --- a/plugins/linux/ifplugin/descriptor/interface_veth.go +++ b/plugins/linux/ifplugin/descriptor/interface_veth.go @@ -26,8 +26,10 @@ import ( // createVETH creates a new VETH pair if neither of VETH-ends are configured, or just // applies configuration to the unfinished VETH-end with a temporary host name. -func (d *InterfaceDescriptor) createVETH(nsCtx nslinuxcalls.NamespaceMgmtCtx, key string, - linuxIf *interfaces.Interface) (metadata *ifaceidx.LinuxIfMetadata, err error) { +func (d *InterfaceDescriptor) createVETH( + nsCtx nslinuxcalls.NamespaceMgmtCtx, key string, linuxIf *interfaces.Interface, +) ( + md *ifaceidx.LinuxIfMetadata, err error) { // determine host/logical/temporary interface names hostName := getHostIfName(linuxIf) @@ -92,12 +94,11 @@ func (d *InterfaceDescriptor) createVETH(nsCtx nslinuxcalls.NamespaceMgmtCtx, ke d.log.Error(err) return nil, err } - metadata = &ifaceidx.LinuxIfMetadata{ + + return &ifaceidx.LinuxIfMetadata{ Namespace: linuxIf.Namespace, LinuxIfIndex: link.Attrs().Index, - } - - return metadata, nil + }, nil } // deleteVETH either un-configures one VETH-end if the other end is still configured, or diff --git a/plugins/linux/ifplugin/descriptor/watcher.go b/plugins/linux/ifplugin/descriptor/watcher.go index 7a09288fcb..f1bd40e5dc 100644 --- a/plugins/linux/ifplugin/descriptor/watcher.go +++ b/plugins/linux/ifplugin/descriptor/watcher.go @@ -251,10 +251,11 @@ func (w *InterfaceWatcher) notifyScheduler(ifName string, enabled bool) { delete(w.ifaces, ifName) } - w.kvscheduler.PushSBNotification( - ifmodel.InterfaceHostNameKey(ifName), - value, - nil) + w.kvscheduler.PushSBNotification(kvs.KVWithMetadata{ + Key: ifmodel.InterfaceHostNameKey(ifName), + Value: value, + Metadata: nil, + }) } func (w *InterfaceWatcher) needsUpdate(ifName string, isEnabled bool) bool { diff --git a/plugins/linux/iptablesplugin/descriptor/rulechain.go b/plugins/linux/iptablesplugin/descriptor/rulechain.go index 3cbeeba82f..0890b36a67 100644 --- a/plugins/linux/iptablesplugin/descriptor/rulechain.go +++ b/plugins/linux/iptablesplugin/descriptor/rulechain.go @@ -271,7 +271,7 @@ func (d *RuleChainDescriptor) Dependencies(key string, rch *linux_iptables.RuleC } // microservice must be available - if rch.Namespace.Type == linux_namespace.NetNamespace_MICROSERVICE { + if rch.Namespace != nil && rch.Namespace.Type == linux_namespace.NetNamespace_MICROSERVICE { deps = append(deps, kvs.Dependency{ Label: microserviceDep + "-" + rch.Namespace.Reference, Key: linux_namespace.MicroserviceKey(rch.Namespace.Reference), diff --git a/plugins/linux/iptablesplugin/iptablesplugin.go b/plugins/linux/iptablesplugin/iptablesplugin.go index ff5fd7ab52..4c3e1c21cd 100644 --- a/plugins/linux/iptablesplugin/iptablesplugin.go +++ b/plugins/linux/iptablesplugin/iptablesplugin.go @@ -36,7 +36,8 @@ type IPTablesPlugin struct { Deps // From configuration file - disabled bool + disabled bool + configFound bool // system handlers iptHandler linuxcalls.IPTablesAPI @@ -75,7 +76,7 @@ func (p *IPTablesPlugin) Init() error { // init iptables handler p.iptHandler = linuxcalls.NewIPTablesHandler() err = p.iptHandler.Init() - if err != nil { + if err != nil && p.configFound { // just warn here, iptables / ip6tables just may not be installed - will return // an error by attempt to configure it p.Log.Warnf("Error by initializing iptables handler: %v", err) @@ -112,5 +113,6 @@ func (p *IPTablesPlugin) retrieveConfig() (*Config, error) { if err != nil { return nil, err } + p.configFound = true return config, err } diff --git a/plugins/linux/nsplugin/descriptor/microservice.go b/plugins/linux/nsplugin/descriptor/microservice.go index a40c857026..ad3708ae80 100644 --- a/plugins/linux/nsplugin/descriptor/microservice.go +++ b/plugins/linux/nsplugin/descriptor/microservice.go @@ -297,10 +297,12 @@ func (d *MicroserviceDescriptor) processNewMicroservice(microserviceLabel string // Notify scheduler about new microservice if d.msStateInSync { - d.kvscheduler.PushSBNotification( - nsmodel.MicroserviceKey(ms.Label), - &prototypes.Empty{}, - nil) + d.kvscheduler.PushSBNotification(kvs.KVWithMetadata{ + Key: nsmodel.MicroserviceKey(ms.Label), + Value: &prototypes.Empty{}, + Metadata: nil, + + }) } } @@ -321,10 +323,11 @@ func (d *MicroserviceDescriptor) processTerminatedMicroservice(id string) { // Notify scheduler about terminated microservice if d.msStateInSync { - d.kvscheduler.PushSBNotification( - nsmodel.MicroserviceKey(ms.Label), - nil, - nil) + d.kvscheduler.PushSBNotification(kvs.KVWithMetadata{ + Key: nsmodel.MicroserviceKey(ms.Label), + Value: nil, + Metadata: nil, + }) } } diff --git a/plugins/linux/nsplugin/ns_plugin.go b/plugins/linux/nsplugin/ns_plugin.go index 3e280594e2..958df050f1 100644 --- a/plugins/linux/nsplugin/ns_plugin.go +++ b/plugins/linux/nsplugin/ns_plugin.go @@ -162,32 +162,47 @@ func (p *NsPlugin) SwitchToNamespace(ctx nsLinuxcalls.NamespaceMgmtCtx, ns *nsmo return func() {}, err } + l := p.Log.WithFields(logging.Fields{ + "orig-ns": origns.String(), + "orig-ns-fd": int(origns), + }) + closeNs := func(ns netns.NsHandle) { + if err := ns.Close(); err != nil { + l.Debugf("closing NsHandle (%v) failed: %v", err) + } + } + // Get network namespace file descriptor. nsHandle, err := p.GetNamespaceHandle(ctx, ns) if err != nil { - origns.Close() + closeNs(origns) return func() {}, err } - defer nsHandle.Close() + defer closeNs(nsHandle) // Lock the OS Thread so we don't accidentally switch namespaces later. ctx.LockOSThread() + l = p.Log.WithFields(logging.Fields{ + "ns": nsHandle.String(), + "ns-fd": int(nsHandle), + "orig-ns": origns.String(), + "orig-ns-fd": int(origns), + }) + // Switch the namespace. - l := p.Log.WithFields(logging.Fields{"ns": nsHandle.String(), "ns-fd": int(nsHandle)}) if err := p.sysHandler.SetNamespace(nsHandle); err != nil { + l.Errorf("Failed to switch to Linux network namespace (%v): %v", ns, err) ctx.UnlockOSThread() - origns.Close() - l.Errorf("Failed to switch Linux network namespace (%v): %v", ns, err) + closeNs(origns) return func() {}, err } return func() { - l := p.Log.WithFields(logging.Fields{"orig-ns": origns.String(), "orig-ns-fd": int(origns)}) if err := p.sysHandler.SetNamespace(origns); err != nil { - l.Errorf("Failed to switch Linux network namespace: %v", err) + l.Errorf("Failed to switch to original Linux network namespace: %v", err) } - origns.Close() + closeNs(origns) ctx.UnlockOSThread() }, nil } diff --git a/plugins/orchestrator/dispatcher.go b/plugins/orchestrator/dispatcher.go index 1cf1683cbc..c9bf8c99de 100644 --- a/plugins/orchestrator/dispatcher.go +++ b/plugins/orchestrator/dispatcher.go @@ -21,9 +21,11 @@ import ( "time" "github.com/ligato/cn-infra/logging" + "github.com/pkg/errors" "golang.org/x/net/context" "github.com/gogo/protobuf/proto" + "github.com/ligato/vpp-agent/pkg/models" kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" ) @@ -36,16 +38,25 @@ type KeyVal struct { // KVPairs represents key-value pairs. type KVPairs map[string]proto.Message +type Status = kvs.ValueStatus + +type Result struct { + Key string + Status *Status +} + type Dispatcher interface { ListData() KVPairs - PushData(context.Context, []KeyVal) ([]kvs.KeyWithError, error) + PushData(context.Context, []KeyVal) ([]Result, error) + GetStatus(key string) (*Status, error) + ListState() (KVPairs, error) } type dispatcher struct { - log logging.Logger - kvs kvs.KVScheduler - mu sync.Mutex - store *memStore + log logging.Logger + kvs kvs.KVScheduler + mu sync.Mutex + db KVStore } // ListData retrieves actual data. @@ -53,16 +64,41 @@ func (p *dispatcher) ListData() KVPairs { p.mu.Lock() defer p.mu.Unlock() - return p.store.ListAll() + return p.db.ListAll() +} + +func (p *dispatcher) GetStatus(key string) (*Status, error) { + s := p.kvs.GetValueStatus(key) + status := s.GetValue() + if status == nil { + return nil, errors.Errorf("status for key %q not found", key) + } + return status, nil } // PushData updates actual data. -func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []kvs.KeyWithError, err error) { +func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (results []Result, err error) { + trace.Logf(ctx, "pushData", "%d KV pairs", len(kvPairs)) + + // validate key-value pairs + uniq := make(map[string]struct{}) + for _, kv := range kvPairs { + if kv.Val != nil { + // check if given key matches the key generated from value + if k := models.Key(kv.Val); k != kv.Key { + return nil, errors.Errorf("given key %q does not match with key generated from value: %q (value: %#v)", kv.Key, k, kv.Val) + } + } + // check if key is unique + if _, ok := uniq[kv.Key]; ok { + return nil, errors.Errorf("found multiple key-value pairs with same key: ") + } + uniq[kv.Key] = struct{}{} + } + p.mu.Lock() defer p.mu.Unlock() - trace.Logf(ctx, "kvPairs", "%d", len(kvPairs)) - pr := trace.StartRegion(ctx, "prepare kv data") dataSrc, ok := DataSrcFromContext(ctx) @@ -70,22 +106,22 @@ func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []k dataSrc = "global" } - p.log.Debugf("Pushing data with %d KV pairs (source: %s)", len(kvPairs), dataSrc) + p.log.Debugf("Push data with %d KV pairs (source: %s)", len(kvPairs), dataSrc) txn := p.kvs.StartNBTransaction() if typ, _ := kvs.IsResync(ctx); typ == kvs.FullResync { trace.Log(ctx, "resyncType", typ.String()) - p.store.Reset(dataSrc) + p.db.Reset(dataSrc) for _, kv := range kvPairs { if kv.Val == nil { - p.log.Debugf(" - PUT: %q (skipped nil value)", kv.Key) + p.log.Debugf(" - PUT: %q (skipped nil value for resync)", kv.Key) continue } p.log.Debugf(" - PUT: %q ", kv.Key) - p.store.Update(dataSrc, kv.Key, kv.Val) + p.db.Update(dataSrc, kv.Key, kv.Val) } - allPairs := p.store.ListAll() + allPairs := p.db.ListAll() p.log.Debugf("will resync %d pairs", len(allPairs)) for k, v := range allPairs { txn.SetValue(k, v) @@ -95,11 +131,11 @@ func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []k if kv.Val == nil { p.log.Debugf(" - DELETE: %q", kv.Key) txn.SetValue(kv.Key, nil) - p.store.Delete(dataSrc, kv.Key) + p.db.Delete(dataSrc, kv.Key) } else { p.log.Debugf(" - UPDATE: %q ", kv.Key) txn.SetValue(kv.Key, kv.Val) - p.store.Update(dataSrc, kv.Key, kv.Val) + p.db.Update(dataSrc, kv.Key, kv.Val) } } } @@ -111,7 +147,7 @@ func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []k seqID, err := txn.Commit(ctx) if err != nil { if txErr, ok := err.(*kvs.TransactionError); ok && len(txErr.GetKVErrors()) > 0 { - kvErrs = txErr.GetKVErrors() + kvErrs := txErr.GetKVErrors() var errInfo = "" for i, kvErr := range kvErrs { errInfo += fmt.Sprintf(" - %3d. error (%s) %s - %v\n", i+1, kvErr.TxnOperation, kvErr.Key, kvErr.Error) @@ -120,25 +156,47 @@ func (p *dispatcher) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []k fmt.Println(errInfo) } else { p.log.Errorf("Transaction failed: %v", err) + return nil, err } - return kvErrs, err + return nil, err + } + + p.kvs.TransactionBarrier() + + for key := range uniq { + s := p.kvs.GetValueStatus(key) + /*results = append(results, KeyVal{ + Key: key, + Val: s.Value, + })*/ + results = append(results, Result{ + Key: key, + Status: s.GetValue(), + }) } took := time.Since(t).Round(time.Microsecond * 100) p.log.Infof("Transaction #%d successful! (took %v)", seqID, took) - return nil, nil + return results, nil } -type dataSrcKeyT string - -var dataSrcKey = dataSrcKeyT("dataSrc") +// ListState retrieves running state. +func (p *dispatcher) ListState() (KVPairs, error) { + p.mu.Lock() + defer p.mu.Unlock() -func DataSrcContext(ctx context.Context, dataSrc string) context.Context { - return context.WithValue(ctx, dataSrcKey, dataSrc) -} + pairs := KVPairs{} + for _, prefix := range p.kvs.GetRegisteredNBKeyPrefixes() { + data, err := p.kvs.DumpValuesByKeyPrefix(prefix, kvs.CachedView) + if err != nil { + return nil, err + } + for _, d := range data { + //status := p.kvs.GetValueStatus(d.Key) + pairs[d.Key] = d.Value + } + } -func DataSrcFromContext(ctx context.Context) (dataSrc string, ok bool) { - dataSrc, ok = ctx.Value(dataSrcKey).(string) - return + return pairs, nil } diff --git a/plugins/orchestrator/genericmanager.go b/plugins/orchestrator/genericmanager.go index 74aeb8329c..e935de57f8 100644 --- a/plugins/orchestrator/genericmanager.go +++ b/plugins/orchestrator/genericmanager.go @@ -15,6 +15,9 @@ package orchestrator import ( + "fmt" + "strings" + "github.com/gogo/protobuf/proto" "github.com/gogo/status" "github.com/ligato/cn-infra/logging" @@ -40,25 +43,21 @@ func (s *genericManagerSvc) Capabilities(ctx context.Context, req *api.Capabilit func (s *genericManagerSvc) SetConfig(ctx context.Context, req *api.SetConfigRequest) (*api.SetConfigResponse, error) { s.log.Debug("------------------------------") - s.log.Debugf("=> Configurator.SetConfig: %d items", len(req.Updates)) + s.log.Debugf("=> GenericMgr.SetConfig: %d items", len(req.Updates)) s.log.Debug("------------------------------") for _, item := range req.Updates { s.log.Debugf(" - %v", item) } s.log.Debug("------------------------------") - if req.OverwriteAll { - ctx = kvs.WithResync(ctx, kvs.FullResync, true) - } - var ops = make(map[string]api.UpdateResult_Operation) var kvPairs []KeyVal for _, update := range req.Updates { item := update.Item - /*if item == nil { + if item == nil { return nil, status.Error(codes.InvalidArgument, "change item is nil") - }*/ + } var ( key string val proto.Message @@ -80,7 +79,7 @@ func (s *genericManagerSvc) SetConfig(ctx context.Context, req *api.SetConfigReq if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - key := model.KeyPrefix() + item.Id.Name + key = model.KeyPrefix() + item.Id.Name ops[key] = api.UpdateResult_DELETE } else { return nil, status.Error(codes.InvalidArgument, "ProtoItem has no key or val defined.") @@ -92,21 +91,30 @@ func (s *genericManagerSvc) SetConfig(ctx context.Context, req *api.SetConfigReq } ctx = DataSrcContext(ctx, "grpc") - kvErrs, err := s.dispatch.PushData(ctx, kvPairs) + if req.OverwriteAll { + ctx = kvs.WithResync(ctx, kvs.FullResync, true) + } + results, err := s.dispatch.PushData(ctx, kvPairs) if err != nil { st := status.New(codes.FailedPrecondition, err.Error()) return nil, st.Err() } - results := []*api.UpdateResult{} - for _, kvErr := range kvErrs { - results = append(results, &api.UpdateResult{ - Key: kvErr.Key, + updateResults := []*api.UpdateResult{} + for _, res := range results { + var msg string + if details := res.Status.GetDetails(); len(details) > 0 { + msg = strings.Join(res.Status.GetDetails(), ", ") + } else { + msg = res.Status.GetError() + } + updateResults = append(updateResults, &api.UpdateResult{ + Key: res.Key, Status: &api.ItemStatus{ - //State: api.ItemStatus_FAILURE, - Message: kvErr.Error.Error(), + Status: res.Status.State.String(), + Message: msg, }, - Op: ops[kvErr.Key], + //Op: res.Status.LastOperation.String(), }) } @@ -124,19 +132,36 @@ func (s *genericManagerSvc) SetConfig(ctx context.Context, req *api.SetConfigReq } */ - return &api.SetConfigResponse{Results: results}, nil + return &api.SetConfigResponse{Results: updateResults}, nil } func (s *genericManagerSvc) GetConfig(context.Context, *api.GetConfigRequest) (*api.GetConfigResponse, error) { - var items []*api.GetConfigResponse_ConfigItem + var items []*api.ConfigItem - for _, data := range s.dispatch.ListData() { + for key, data := range s.dispatch.ListData() { item, err := models.MarshalItem(data) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - items = append(items, &api.GetConfigResponse_ConfigItem{ - Item: item, + var itemStatus *api.ItemStatus + st, err := s.dispatch.GetStatus(key) + if err != nil { + s.log.Warnf("GetStatus failed: %v", err) + } else { + var msg string + if details := st.GetDetails(); len(details) > 0 { + msg = strings.Join(st.GetDetails(), ", ") + } else { + msg = st.GetError() + } + itemStatus = &api.ItemStatus{ + Status: st.GetState().String(), + Message: msg, + } + } + items = append(items, &api.ConfigItem{ + Item: item, + Status: itemStatus, }) } @@ -144,7 +169,30 @@ func (s *genericManagerSvc) GetConfig(context.Context, *api.GetConfigRequest) (* } func (s *genericManagerSvc) DumpState(context.Context, *api.DumpStateRequest) (*api.DumpStateResponse, error) { - return nil, status.Error(codes.Unimplemented, "Not implemented yet") + pairs, err := s.dispatch.ListState() + if err != nil { + return nil, err + } + + fmt.Printf("dispatch.ListState: %d pairs", len(pairs)) + for key, val := range pairs { + fmt.Printf(" - [%s] %+v\n", key, proto.CompactTextString(val)) + } + + var states []*api.StateItem + for _, kv := range pairs { + item, err := models.MarshalItem(kv) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + meta := map[string]string{} + states = append(states, &api.StateItem{ + Item: item, + Metadata: meta, + }) + } + + return &api.DumpStateResponse{Items: states}, nil } func (s *genericManagerSvc) Subscribe(req *api.SubscribeRequest, server api.GenericManager_SubscribeServer) error { diff --git a/plugins/orchestrator/orchestrator.go b/plugins/orchestrator/orchestrator.go index 937c1cde92..91365d19ae 100644 --- a/plugins/orchestrator/orchestrator.go +++ b/plugins/orchestrator/orchestrator.go @@ -15,8 +15,12 @@ package orchestrator import ( + "os" + "strings" + "github.com/ligato/cn-infra/datasync" "github.com/ligato/cn-infra/infra" + "github.com/ligato/cn-infra/logging" "github.com/ligato/cn-infra/rpc/grpc" "golang.org/x/net/context" @@ -25,6 +29,13 @@ import ( kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" ) +var ( + // EnableStatusPublishing enables status publishing. + EnableStatusPublishing = os.Getenv("ENABLE_STATUS_PUBLISHING") != "" + + debugOrchestrator = os.Getenv("DEBUG_ORCHESTRATOR") != "" +) + // Plugin implements sync service for GRPC. type Plugin struct { Deps @@ -43,17 +54,18 @@ type Plugin struct { type Deps struct { infra.PluginDeps - GRPC grpc.Server - KVScheduler kvs.KVScheduler - Watcher datasync.KeyValProtoWatcher + GRPC grpc.Server + KVScheduler kvs.KVScheduler + Watcher datasync.KeyValProtoWatcher + StatusPublisher datasync.KeyProtoValWriter } // Init registers the service to GRPC server. func (p *Plugin) Init() (err error) { p.dispatcher = &dispatcher{ - log: p.Log.NewLogger("dispatcher"), - store: newMemStore(), - kvs: p.KVScheduler, + log: logging.DefaultRegistry.NewLogger("dispatcher"), + db: newMemStore(), + kvs: p.KVScheduler, } // register grpc service @@ -77,7 +89,6 @@ func (p *Plugin) Init() (err error) { var prefixes []string for _, prefix := range nbPrefixes { - //prefix = path.Join("config", prefix) p.log.Debugf("- watching NB prefix: %s", prefix) prefixes = append(prefixes, prefix) } @@ -99,6 +110,10 @@ func (p *Plugin) Init() (err error) { func (p *Plugin) AfterInit() (err error) { go p.watchEvents() + statusChan := make(chan *kvs.BaseValueStatus, 100) + p.kvs.WatchValueStatus(statusChan, nil) + go p.watchStatus(statusChan) + return nil } @@ -125,15 +140,13 @@ func (p *Plugin) watchEvents() { var kvPairs []KeyVal for _, x := range e.GetChanges() { - kv := KeyVal{Key: x.GetKey()} + kv := KeyVal{ + Key: x.GetKey(), + } if x.GetChangeType() != datasync.Delete { kv.Val, err = models.UnmarshalLazyValue(kv.Key, x) if err != nil { - p.log.Errorf("unmarshal value for key %s failed: %v", kv.Key, err) - continue - } - if k := models.Key(kv.Val); k != kv.Key { - p.log.Errorf("value for key %s does not match generated model key: %v", kv.Key, k) + p.log.Errorf("decoding value for key %q failed: %v", kv.Key, err) continue } } @@ -152,11 +165,10 @@ func (p *Plugin) watchEvents() { if ctx == nil { ctx = context.Background() } - ctx = DataSrcContext(ctx, "watcher") + ctx = DataSrcContext(ctx, "datasync") ctx = kvs.WithRetryDefault(ctx) _, err = p.PushData(ctx, kvPairs) - e.Done(err) case e := <-p.resyncChan: @@ -170,11 +182,7 @@ func (p *Plugin) watchEvents() { key := x.GetKey() val, err := models.UnmarshalLazyValue(key, x) if err != nil { - p.log.Errorf("unmarshal value for key %s failed: %v", key, err) - continue - } - if k := models.Key(val); k != key { - p.log.Errorf("value for key %s does not match generated model key: %v", key, k) + p.log.Errorf("unmarshal value for key %q failed: %v", key, err) continue } kvPairs = append(kvPairs, KeyVal{ @@ -200,13 +208,58 @@ func (p *Plugin) watchEvents() { if ctx == nil { ctx = context.Background() } - ctx = DataSrcContext(ctx, "watcher") + ctx = DataSrcContext(ctx, "datasync") ctx = kvs.WithResync(ctx, kvs.FullResync, true) ctx = kvs.WithRetryDefault(ctx) _, err := p.PushData(ctx, kvPairs) - e.Done(err) + } } } + +func (p *Plugin) watchStatus(ch <-chan *kvs.BaseValueStatus) { + for { + select { + case s := <-ch: + + p.debugf("STATUS: %15s %v ===> %v (%v) %v", + s.Value.State, s.Value.Details, s.Value.Key, s.Value.LastOperation, s.Value.Error) + for _, dv := range s.DerivedValues { + p.debugf(" \t%15s %v ---> %v (%v) %v", + dv.State, dv.Details, dv.Key, dv.LastOperation, dv.Error) + } + + if EnableStatusPublishing { + p.publishStatuses([]Result{ + {Key: s.Value.Key, Status: s.Value}, + }) + } + } + } +} + +func (p *Plugin) publishStatuses(results []Result) { + if p.StatusPublisher == nil { + return + } + + p.debugf("publishing %d statuses", len(results)) + for _, res := range results { + statusKey := strings.Replace(res.Key, "config/", "config-status/", 1) + if statusKey == res.Key { + p.debugf("replace for key %q failed", res.Key) + continue + } + if err := p.StatusPublisher.Put(statusKey, res.Status, datasync.WithClientLifetimeTTL()); err != nil { + p.debugf("publishing status for key %q failed: %v", statusKey, err) + } + } +} + +func (p *Plugin) debugf(f string, a ...interface{}) { + if debugOrchestrator { + p.log.Debugf(f, a...) + } +} diff --git a/plugins/orchestrator/store.go b/plugins/orchestrator/store.go index f7f4d402e9..215f290d2a 100644 --- a/plugins/orchestrator/store.go +++ b/plugins/orchestrator/store.go @@ -15,20 +15,22 @@ package orchestrator import ( + "context" "sort" "github.com/gogo/protobuf/proto" ) -// KVDB describes interface for key-value store. -/*type KVDB interface { - Reset(dataSrc string) +// KVStore describes an interface for key-value store used by dispatcher. +type KVStore interface { ListAll() KVPairs List(dataSrc string) KVPairs Update(dataSrc, key string, val proto.Message) Delete(dataSrc, key string) -}*/ + Reset(dataSrc string) +} +// memStore is KVStore implementation that stores data in memory. type memStore struct { db map[string]KVPairs } @@ -39,12 +41,7 @@ func newMemStore() *memStore { } } -// Reset clears all key-value data. -func (s *memStore) Reset(dataSrc string) { - delete(s.db, dataSrc) -} - -// List lists actual key-value pairs. +// List lists all key-value pairs. func (s *memStore) ListAll() KVPairs { var dataSrcs []string for dataSrc := range s.db { @@ -69,11 +66,6 @@ func (s *memStore) List(dataSrc string) KVPairs { return pairs } -// Delete deletes value stored under given key. -func (s *memStore) Delete(dataSrc, key string) { - delete(s.db[dataSrc], key) -} - // Update updates value stored under key with given value. func (s *memStore) Update(dataSrc, key string, val proto.Message) { if _, ok := s.db[dataSrc]; !ok { @@ -81,3 +73,26 @@ func (s *memStore) Update(dataSrc, key string, val proto.Message) { } s.db[dataSrc][key] = val } + +// Delete deletes value stored under given key. +func (s *memStore) Delete(dataSrc, key string) { + delete(s.db[dataSrc], key) +} + +// Reset clears all key-value data. +func (s *memStore) Reset(dataSrc string) { + delete(s.db, dataSrc) +} + +type dataSrcKeyT string + +var dataSrcKey = dataSrcKeyT("dataSrc") + +func DataSrcContext(ctx context.Context, dataSrc string) context.Context { + return context.WithValue(ctx, dataSrcKey, dataSrc) +} + +func DataSrcFromContext(ctx context.Context) (dataSrc string, ok bool) { + dataSrc, ok = ctx.Value(dataSrcKey).(string) + return +} diff --git a/plugins/orchestrator/watcher/aggregator.go b/plugins/orchestrator/watcher/aggregator.go new file mode 100644 index 0000000000..25f35540c0 --- /dev/null +++ b/plugins/orchestrator/watcher/aggregator.go @@ -0,0 +1,329 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package watcher + +import ( + "context" + "fmt" + "strings" + + "github.com/ligato/cn-infra/datasync" + "github.com/ligato/cn-infra/datasync/kvdbsync/local" + "github.com/ligato/cn-infra/datasync/resync" + "github.com/ligato/cn-infra/datasync/syncbase" + "github.com/ligato/cn-infra/infra" + "github.com/ligato/cn-infra/logging" + "github.com/ligato/cn-infra/utils/safeclose" +) + +// Option is a function that acts on a Plugin to inject Dependencies or configuration +type Option func(*Aggregator) + +// UseWatchers returns option that sets watchers. +func UseWatchers(watchers ...datasync.KeyValProtoWatcher) Option { + return func(p *Aggregator) { + p.Watchers = watchers + } +} + +// Aggregator is an adapter that allows multiple +// watchers (KeyValProtoWatcher) to be aggregated in one. +// Watch request is delegated to all of them. +type Aggregator struct { + infra.PluginDeps + + keyPrefixes []string + localKVs map[string]datasync.KeyVal + + Resync *resync.Plugin + Local *syncbase.Registry + Watchers []datasync.KeyValProtoWatcher +} + +// NewPlugin creates a new Plugin with the provides Options +func NewPlugin(opts ...Option) *Aggregator { + p := &Aggregator{} + + p.PluginName = "aggregator" + p.Local = local.DefaultRegistry + p.Resync = &resync.DefaultPlugin + + for _, o := range opts { + o(p) + } + p.PluginDeps.SetupLog() + + return p +} + +func (p *Aggregator) Init() error { + p.localKVs = map[string]datasync.KeyVal{} + return nil +} + +// Watch subscribes to every transport available within transport aggregator +// and also subscribes to localclient (local.Registry). +// The function implements KeyValProtoWatcher.Watch(). +func (p *Aggregator) Watch( + resyncName string, + changeChan chan datasync.ChangeEvent, + resyncChan chan datasync.ResyncEvent, + keyPrefixes ...string, +) (datasync.WatchRegistration, error) { + + p.keyPrefixes = keyPrefixes + + // prepare list of watchers + var watchers []datasync.KeyValProtoWatcher + for _, w := range p.Watchers { + if l, ok := w.(*syncbase.Registry); ok && p.Local != nil && l == p.Local { + p.Log.Warn("found local registry (localclient) in watchers, ignoring it..") + continue + } + watchers = append(watchers, w) + } + p.Watchers = watchers + + // start watch for all watchers + p.Log.Infof("Watch for %v with %d prefixes", resyncName, len(keyPrefixes)) + + aggrResync := make(chan datasync.ResyncEvent, len(watchers)) + + go p.watchAggrResync(aggrResync, resyncChan) + + var registrations []datasync.WatchRegistration + for i, adapter := range watchers { + partChange := make(chan datasync.ChangeEvent) + partResync := make(chan datasync.ResyncEvent) + + name := fmt.Sprint(adapter) + "/" + resyncName + watcherReg, err := adapter.Watch(name, changeChan, partResync, keyPrefixes...) + if err != nil { + return nil, err + } + + go func(i int, chanChange chan datasync.ChangeEvent, chanResync chan datasync.ResyncEvent) { + for { + select { + case e := <-chanChange: + p.Log.Debugf("watcher %d got CHANGE PART, sending to aggregated", i) + changeChan <- e + + case e := <-chanResync: + p.Log.Debugf("watcher %d got RESYNC PART, sending to aggregated", i) + aggrResync <- e + } + } + }(i+1, partChange, partResync) + + if watcherReg != nil { + registrations = append(registrations, watcherReg) + } + } + + // register and watch for localclient + partResync := make(chan datasync.ResyncEvent) + partChange := make(chan datasync.ChangeEvent) + + go p.watchLocalEvents(partChange, changeChan, partResync) + + name := "LOCAL" + "/" + resyncName + localReg, err := p.Local.Watch(name, partChange, partResync, keyPrefixes...) + if err != nil { + return nil, err + } + + p.Log.Debug("added localclient as aggregated watcher") + + registrations = append(registrations, localReg) + + return &WatchRegistration{ + Registrations: registrations, + }, nil +} + +func (p *Aggregator) watchAggrResync(aggrResync, resyncCh chan datasync.ResyncEvent) { + aggregatedResync := func(allResyncs []datasync.ResyncEvent) { + var prefixKeyVals = map[string]map[string]datasync.KeyVal{} + + kvToKeyVals := func(prefix string, kv datasync.KeyVal) { + keyVals, ok := prefixKeyVals[prefix] + if !ok { + p.Log.Debugf(" - keyval prefix: %v", prefix) + keyVals = map[string]datasync.KeyVal{} + prefixKeyVals[prefix] = keyVals + } + key := kv.GetKey() + if _, ok := keyVals[key]; ok { + p.Log.Warnf("resync from watcher overwrites key: %v", key) + } + keyVals[key] = kv + } + + // process resync events from all watchers + p.Log.Debugf("preparing keyvals for aggregated resync from %d cached resyncs", len(allResyncs)) + for _, ev := range allResyncs { + for prefix, iterator := range ev.GetValues() { + for { + kv, allReceived := iterator.GetNext() + if allReceived { + break + } + + kvToKeyVals(prefix, kv) + } + } + } + + // process keyvals from localclient + p.Log.Debugf("preparing localclient keyvals for aggregated resync with %d keyvals", len(allResyncs)) + for key, kv := range p.localKVs { + var kvprefix string + for _, prefix := range p.keyPrefixes { + if strings.HasPrefix(key, prefix) { + kvprefix = prefix + break + } + } + if kvprefix == "" { + p.Log.Warnf("not found registered prefix for keyval from localclient with key: %v", key) + } + kvToKeyVals(kvprefix, kv) + } + + // prepare aggregated resync + var vals = map[string]datasync.KeyValIterator{} + for prefix, keyVals := range prefixKeyVals { + var data []datasync.KeyVal + for _, kv := range keyVals { + data = append(data, kv) + } + vals[prefix] = syncbase.NewKVIterator(data) + } + resEv := syncbase.NewResyncEventDB(context.Background(), vals) + + p.Log.Debugf("sending aggregated resync event (%d prefixes) to original resync channel", len(vals)) + resyncCh <- resEv + p.Log.Debugf("aggregated resync was accepted, waiting for done chan") + resErr := <-resEv.DoneChan + p.Log.Debugf("aggregated resync done (err=%v) watchers", resErr) + + } + + var cachedResyncs []datasync.ResyncEvent + + // process resync events from watchers + for { + select { + case e, ok := <-aggrResync: + if !ok { + p.Log.Debugf("aggrResync channel was closed") + return + } + + cachedResyncs = append(cachedResyncs, e) + p.Log.Debugf("watchers received resync event (%d/%d watchers done)", len(cachedResyncs), len(p.Watchers)) + + e.Done(nil) + } + + if len(cachedResyncs) == len(p.Watchers) { + p.Log.Debug("resyncs from all watchers received, calling aggregated resync") + aggregatedResync(cachedResyncs) + // clear resyncs + cachedResyncs = nil + } + } +} + +func (p *Aggregator) watchLocalEvents(partChange, changeChan chan datasync.ChangeEvent, partResync chan datasync.ResyncEvent) { + for { + select { + case e := <-partChange: + p.Log.Debugf("LOCAL got CHANGE part, %d changes, sending to aggregated", len(e.GetChanges())) + + for _, change := range e.GetChanges() { + key := change.GetKey() + switch change.GetChangeType() { + case datasync.Delete: + p.Log.Debugf(" - DEL %s", key) + delete(p.localKVs, key) + case datasync.Put: + p.Log.Debugf(" - PUT %s", key) + p.localKVs[key] = change + } + } + changeChan <- e + + case e := <-partResync: + p.Log.Debugf("LOCAL watcher got RESYNC part, sending to aggregated") + + p.localKVs = map[string]datasync.KeyVal{} + for _, iterator := range e.GetValues() { + for { + kv, allReceived := iterator.GetNext() + if allReceived { + break + } + + key := kv.GetKey() + p.localKVs[key] = kv + } + } + p.Log.Debugf("LOCAL watcher resynced %d keyvals", len(p.localKVs)) + e.Done(nil) + + p.Log.Debug("LOCAL watcher calling RESYNC") + p.Resync.DoResync() + } + } +} + +// WatchRegistration is adapter that allows multiple +// registrations (WatchRegistration) to be aggregated in one. +// Close operation is applied collectively to all included registration. +type WatchRegistration struct { + Registrations []datasync.WatchRegistration +} + +// Register new key for all available aggregator objects. Call Register(keyPrefix) on specific registration +// to add the key from that registration only +func (wa *WatchRegistration) Register(resyncName, keyPrefix string) error { + for _, registration := range wa.Registrations { + if err := registration.Register(resyncName, keyPrefix); err != nil { + logging.DefaultLogger.Warnf("aggregated register failed: %v", err) + } + } + + return nil +} + +// Unregister closed registration of specific key under all available aggregator objects. +// Call Unregister(keyPrefix) on specific registration to remove the key from that registration only +func (wa *WatchRegistration) Unregister(keyPrefix string) error { + for _, registration := range wa.Registrations { + if err := registration.Unregister(keyPrefix); err != nil { + logging.DefaultLogger.Warnf("aggregated unregister failed: %v", err) + } + } + + return nil +} + +// Close every registration under the aggregator. +// This function implements WatchRegistration.Close(). +func (wa *WatchRegistration) Close() error { + return safeclose.Close(wa.Registrations) +} diff --git a/plugins/restapi/handlers.go b/plugins/restapi/handlers.go index 55e3aa8e06..7b545c092e 100644 --- a/plugins/restapi/handlers.go +++ b/plugins/restapi/handlers.go @@ -32,31 +32,35 @@ import ( "github.com/ligato/vpp-agent/plugins/restapi/resturl" ) +var ( + // ErrHandlerUnavailable represents error returned when particular + // handler is not available + ErrHandlerUnavailable = errors.New("Handler is not available") +) + // Registers ABF REST handler func (p *Plugin) registerABFHandler() { - unavailHandler := errors.New("abfHandler is not available") p.registerHTTPHandler(resturl.ABF, GET, func() (interface{}, error) { if p.abfHandler == nil { - return nil, unavailHandler + return nil, ErrHandlerUnavailable } return p.abfHandler.DumpABFPolicy() }) } // Registers access list REST handlers -func (p *Plugin) registerAccessListHandlers() { - unavailHandler := errors.New("aclHandler is not available") +func (p *Plugin) registerACLHandlers() { // GET IP ACLs p.registerHTTPHandler(resturl.ACLIP, GET, func() (interface{}, error) { if p.aclHandler == nil { - return nil, unavailHandler + return nil, ErrHandlerUnavailable } return p.aclHandler.DumpACL() }) // GET MACIP ACLs p.registerHTTPHandler(resturl.ACLMACIP, GET, func() (interface{}, error) { if p.aclHandler == nil { - return nil, unavailHandler + return nil, ErrHandlerUnavailable } return p.aclHandler.DumpMACIPACL() }) @@ -95,23 +99,18 @@ func (p *Plugin) registerInterfaceHandlers() { } // Registers NAT REST handlers -func (p *Plugin) registerNatHandlers() { - unavailHandler := errors.New("natHandler is not available") - // GET NAT configuration - /*p.registerHTTPHandler(resturl.NatURL, GET, func() (interface{}, error) { - return p.natHandler.Nat44Dump() - })*/ +func (p *Plugin) registerNATHandlers() { // GET NAT global config p.registerHTTPHandler(resturl.NatGlobal, GET, func() (interface{}, error) { if p.natHandler == nil { - return nil, unavailHandler + return nil, ErrHandlerUnavailable } return p.natHandler.Nat44GlobalConfigDump() }) // GET DNAT config p.registerHTTPHandler(resturl.NatDNat, GET, func() (interface{}, error) { if p.natHandler == nil { - return nil, unavailHandler + return nil, ErrHandlerUnavailable } return p.natHandler.DNat44Dump() }) @@ -121,14 +120,23 @@ func (p *Plugin) registerNatHandlers() { func (p *Plugin) registerL2Handlers() { // GET bridge domains p.registerHTTPHandler(resturl.Bd, GET, func() (interface{}, error) { + if p.l2Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l2Handler.DumpBridgeDomains() }) // GET FIB entries p.registerHTTPHandler(resturl.Fib, GET, func() (interface{}, error) { + if p.l2Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l2Handler.DumpL2FIBs() }) // GET cross connects p.registerHTTPHandler(resturl.Xc, GET, func() (interface{}, error) { + if p.l2Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l2Handler.DumpXConnectPairs() }) } @@ -137,20 +145,68 @@ func (p *Plugin) registerL2Handlers() { func (p *Plugin) registerL3Handlers() { // GET ARP entries p.registerHTTPHandler(resturl.Arps, GET, func() (interface{}, error) { + if p.l3Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l3Handler.DumpArpEntries() }) // GET proxy ARP interfaces p.registerHTTPHandler(resturl.PArpIfs, GET, func() (interface{}, error) { + if p.l3Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l3Handler.DumpProxyArpInterfaces() }) // GET proxy ARP ranges p.registerHTTPHandler(resturl.PArpRngs, GET, func() (interface{}, error) { + if p.l3Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l3Handler.DumpProxyArpRanges() }) // GET static routes p.registerHTTPHandler(resturl.Routes, GET, func() (interface{}, error) { + if p.l3Handler == nil { + return nil, ErrHandlerUnavailable + } return p.l3Handler.DumpRoutes() }) + // GET scan ip neighbor setup + p.registerHTTPHandler(resturl.IPScanNeigh, GET, func() (interface{}, error) { + if p.l3Handler == nil { + return nil, ErrHandlerUnavailable + } + return p.l3Handler.GetIPScanNeighbor() + }) +} + +// Registers IPSec plugin REST handlers +func (p *Plugin) registerIPSecHandlers() { + // GET IPSec SPD entries + p.registerHTTPHandler(resturl.SPDs, GET, func() (interface{}, error) { + if p.ipSecHandler == nil { + return nil, ErrHandlerUnavailable + } + return p.ipSecHandler.DumpIPSecSPD() + }) + // GET IPSec SA entries + p.registerHTTPHandler(resturl.SAs, GET, func() (interface{}, error) { + if p.ipSecHandler == nil { + return nil, ErrHandlerUnavailable + } + return p.ipSecHandler.DumpIPSecSA() + }) +} + +// Registers punt plugin REST handlers +func (p *Plugin) registerPuntHandlers() { + // GET punt registered socket entries + p.registerHTTPHandler(resturl.PuntSocket, GET, func() (interface{}, error) { + if p.puntHandler == nil { + return nil, ErrHandlerUnavailable + } + return p.puntHandler.DumpRegisteredPuntSockets() + }) } // Registers linux interface plugin REST handlers diff --git a/plugins/restapi/options.go b/plugins/restapi/options.go index 697952e188..c07df891aa 100644 --- a/plugins/restapi/options.go +++ b/plugins/restapi/options.go @@ -16,6 +16,7 @@ package restapi import ( "github.com/ligato/cn-infra/rpc/rest" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin" "github.com/ligato/vpp-agent/plugins/govppmux" "github.com/ligato/vpp-agent/plugins/vpp/aclplugin" @@ -36,6 +37,7 @@ func NewPlugin(opts ...Option) *Plugin { p.VPPACLPlugin = &aclplugin.DefaultPlugin p.VPPIfPlugin = &ifplugin.DefaultPlugin p.VPPL2Plugin = &l2plugin.DefaultPlugin + p.VPPL3Plugin = &l3plugin.DefaultPlugin for _, o := range opts { o(p) diff --git a/plugins/restapi/plugin_restapi.go b/plugins/restapi/plugin_restapi.go index 1f667a5bde..74f5c392c2 100644 --- a/plugins/restapi/plugin_restapi.go +++ b/plugins/restapi/plugin_restapi.go @@ -18,9 +18,6 @@ import ( "net/http" "sync" - "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" - "github.com/ligato/vpp-agent/plugins/vpp/aclplugin" - "git.fd.io/govpp.git/api" "github.com/ligato/cn-infra/infra" "github.com/ligato/cn-infra/rpc/rest" @@ -33,13 +30,18 @@ import ( l3linuxcalls "github.com/ligato/vpp-agent/plugins/linux/l3plugin/linuxcalls" "github.com/ligato/vpp-agent/plugins/restapi/resturl" telemetryvppcalls "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls" + abfvppcalls "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin" aclvppcalls "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin" ifvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" + ipsecvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/l2plugin" l2vppcalls "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin" l3vppcalls "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" natvppcalls "github.com/ligato/vpp-agent/plugins/vpp/natplugin/vppcalls" + puntvppcalls "github.com/ligato/vpp-agent/plugins/vpp/puntplugin/vppcalls" ) // REST api methods @@ -56,19 +58,20 @@ type Plugin struct { index *index // Channels - vppChan api.Channel - dumpChan api.Channel + vppChan api.Channel // Handlers vpeHandler vpevppcalls.VpeVppAPI teleHandler telemetryvppcalls.TelemetryVppAPI // VPP Handlers - abfHandler vppcalls.ABFVppRead - aclHandler aclvppcalls.ACLVppRead - ifHandler ifvppcalls.InterfaceVppRead - natHandler natvppcalls.NatVppRead - l2Handler l2vppcalls.L2VppAPI - l3Handler l3vppcalls.L3VppAPI + abfHandler abfvppcalls.ABFVppRead + aclHandler aclvppcalls.ACLVppRead + ifHandler ifvppcalls.InterfaceVppRead + natHandler natvppcalls.NatVppRead + l2Handler l2vppcalls.L2VppAPI + l3Handler l3vppcalls.L3VppAPI + ipSecHandler ipsecvppcalls.IPSecVPPRead + puntHandler puntvppcalls.PuntVPPRead // Linux handlers linuxIfHandler iflinuxcalls.NetlinkAPIRead linuxL3Handler l3linuxcalls.NetlinkAPIRead @@ -84,6 +87,7 @@ type Deps struct { VPPACLPlugin aclplugin.API VPPIfPlugin ifplugin.API VPPL2Plugin *l2plugin.L2Plugin + VPPL3Plugin *l3plugin.L3Plugin } // index defines map of main index page entries @@ -99,42 +103,67 @@ type indexItem struct { // Init initializes the Rest Plugin func (p *Plugin) Init() (err error) { - // Check VPP dependency - /*if p.VPP == nil { - return fmt.Errorf("REST plugin requires VPP plugin API") - }*/ - // VPP channels if p.vppChan, err = p.GoVppmux.NewAPIChannel(); err != nil { return err } - if p.dumpChan, err = p.GoVppmux.NewAPIChannel(); err != nil { - return err - } // VPP Indexes - aclIndexes := p.VPPACLPlugin.GetACLIndex() ifIndexes := p.VPPIfPlugin.GetInterfaceIndex() bdIndexes := p.VPPL2Plugin.GetBDIndex() dhcpIndexes := p.VPPIfPlugin.GetDHCPIndex() + aclIndexes := p.VPPACLPlugin.GetACLIndex() // TODO: make ACL optional + vrfIndexes := p.VPPL3Plugin.GetVRFIndex() - // Initialize handlers + // Initialize VPP handlers p.vpeHandler = vpevppcalls.CompatibleVpeHandler(p.vppChan) + if p.vpeHandler == nil { + p.Log.Info("VPP main handler is not available, it will be skipped") + } p.teleHandler = telemetryvppcalls.CompatibleTelemetryHandler(p.vppChan, p.GoVppmux) + if p.teleHandler == nil { + p.Log.Info("VPP Telemetry handler is not available, it will be skipped") + } - // VPP handlers - p.abfHandler = vppcalls.CompatibleABFVppHandler(p.vppChan, p.dumpChan, aclIndexes, ifIndexes, p.Log) - p.aclHandler = aclvppcalls.CompatibleACLVppHandler(p.vppChan, p.dumpChan, ifIndexes, p.Log) + // core p.ifHandler = ifvppcalls.CompatibleInterfaceVppHandler(p.vppChan, p.Log) - p.natHandler = natvppcalls.CompatibleNatVppHandler(p.vppChan, ifIndexes, dhcpIndexes, p.Log) + if p.ifHandler == nil { + p.Log.Info("VPP Interface handler is not available, it will be skipped") + } p.l2Handler = l2vppcalls.CompatibleL2VppHandler(p.vppChan, ifIndexes, bdIndexes, p.Log) - p.l3Handler = l3vppcalls.CompatibleL3VppHandler(p.vppChan, ifIndexes, p.Log) + if p.l2Handler == nil { + p.Log.Info("VPP L2 handler is not available, it will be skipped") + } + p.l3Handler = l3vppcalls.CompatibleL3VppHandler(p.vppChan, ifIndexes, vrfIndexes, p.Log) + if p.l3Handler == nil { + p.Log.Info("VPP L3 handler is not available, it will be skipped") + } + p.ipSecHandler = ipsecvppcalls.CompatibleIPSecVppHandler(p.vppChan, ifIndexes, p.Log) + if p.ipSecHandler == nil { + p.Log.Info("VPP IPSec handler is not available, it will be skipped") + } + + // plugins (might not be available - disabled) + p.abfHandler = abfvppcalls.CompatibleABFVppHandler(p.vppChan, aclIndexes, ifIndexes, p.Log) + if p.abfHandler == nil { + p.Log.Infof("ABF handler is not available, it will be skipped") + } + p.aclHandler = aclvppcalls.CompatibleACLVppHandler(p.vppChan, ifIndexes, p.Log) + if p.aclHandler == nil { + p.Log.Infof("ACL handler is not available, it will be skipped") + } + p.natHandler = natvppcalls.CompatibleNatVppHandler(p.vppChan, ifIndexes, dhcpIndexes, p.Log) + if p.natHandler == nil { + p.Log.Infof("NAT handler is not available, it will be skipped") + } + p.puntHandler = puntvppcalls.CompatiblePuntVppHandler(p.vppChan, ifIndexes, p.Log) + if p.puntHandler == nil { + p.Log.Infof("Punt handler is not available, it will be skipped") + } // Linux handlers - //if p.Linux != nil { p.linuxIfHandler = iflinuxcalls.NewNetLinkHandler() p.linuxL3Handler = l3linuxcalls.NewNetLinkHandler() - //} p.index = &index{ ItemMap: getIndexPageItems(), @@ -151,24 +180,27 @@ func (p *Plugin) AfterInit() (err error) { p.Log.Debug("REST API Plugin is up and running") // VPP handlers - p.registerABFHandler() - p.registerAccessListHandlers() + p.registerTelemetryHandlers() + p.registerCommandHandler() + + // core p.registerInterfaceHandlers() - p.registerNatHandlers() p.registerL2Handlers() p.registerL3Handlers() + p.registerIPSecHandlers() + + // plugins + p.registerABFHandler() + p.registerACLHandlers() + p.registerNATHandlers() + p.registerPuntHandlers() // Linux handlers - //if p.Linux != nil { p.registerLinuxInterfaceHandlers() p.registerLinuxL3Handlers() - //} - // Telemetry, command, index, tracer - p.registerTelemetryHandlers() - p.registerCommandHandler() + // Index and stats handlers p.registerIndexHandlers() - p.registerStatsHandler() return nil @@ -176,7 +208,7 @@ func (p *Plugin) AfterInit() (err error) { // Close is used to clean up resources used by Plugin func (p *Plugin) Close() (err error) { - return safeclose.Close(p.vppChan, p.dumpChan) + return safeclose.Close(p.vppChan) } // Fill index item lists @@ -245,6 +277,7 @@ func getPermissionsGroups() []*access.PermissionGroup { Name: "dump", Permissions: []*access.PermissionGroup_Permissions{ newPermission(resturl.Index, GET), + newPermission(resturl.ABF, GET), newPermission(resturl.ACLIP, GET), newPermission(resturl.ACLMACIP, GET), newPermission(resturl.Interface, GET), diff --git a/plugins/restapi/resturl/urls.go b/plugins/restapi/resturl/urls.go index 72d15e3c33..444caee8b4 100644 --- a/plugins/restapi/resturl/urls.go +++ b/plugins/restapi/resturl/urls.go @@ -64,8 +64,6 @@ const ( // VPP NAT const ( - // NatURL is a REST path of a NAT - NatURL = "/dump/vpp/v2/nat" // NatGlobal is a REST path of a global NAT config NatGlobal = "/dump/vpp/v2/nat/global" // NatDNat is a REST path of a DNAT configurations @@ -92,6 +90,21 @@ const ( PArpIfs = "/dump/vpp/v2/proxyarp/interfaces" // PArpRngs is rest proxy ARP ranges path PArpRngs = "/dump/vpp/v2/proxyarp/ranges" + // IPScanNeigh is rest IP scan neighbor setup path + IPScanNeigh = "/dump/vpp/v2/ipscanneigh" +) + +// VPP IPSec plugin +const ( + // SPDs is rest IPSec security policy database path + SPDs = "/dump/vpp/v2/ipsec/spds" + // SAs is rest IPSec security association path + SAs = "/dump/vpp/v2/ipsec/sas" +) + +const ( + // PuntSocket is rest punt registered socket path + PuntSocket = "/dump/vpp/v2/punt/sockets" ) // Command diff --git a/plugins/telemetry/config.go b/plugins/telemetry/config.go index 1ef38375f6..f3796e51f9 100644 --- a/plugins/telemetry/config.go +++ b/plugins/telemetry/config.go @@ -16,12 +16,22 @@ package telemetry import "time" +const ( + // default period between updates + defaultUpdatePeriod = time.Second * 30 + // minimum period between updates + minimumUpdatePeriod = time.Second * 1 +) + // Config file representation for telemetry plugin type Config struct { // Custom polling interval, default value is 30s PollingInterval time.Duration `json:"polling-interval"` // Allows to disable plugin Disabled bool `json:"disabled"` + // Skip collecting some of the metrics: + // runtime, memory, buffers, nodes, interfaces + Skipped []string `json:"skipped"` } func defaultConfig() *Config { diff --git a/plugins/telemetry/metrics.go b/plugins/telemetry/metrics.go new file mode 100644 index 0000000000..8db159ec45 --- /dev/null +++ b/plugins/telemetry/metrics.go @@ -0,0 +1,521 @@ +package telemetry + +import ( + "context" + "fmt" + "strconv" + + "github.com/prometheus/client_golang/prometheus" +) + +const ( + // Registry path for telemetry metrics + registryPath = "/metrics" + + vppMetricsNamespace = "vpp" + + // Metrics label used for agent label + agentLabel = "agent" +) + +// Runtime metrics +const ( + runtimeMetricsNamespace = "runtime" + + runtimeThreadLabel = "thread" + runtimeThreadIDLabel = "threadID" + runtimeItemLabel = "item" + + runtimeCallsMetric = "calls" + runtimeVectorsMetric = "vectors" + runtimeSuspendsMetric = "suspends" + runtimeClocksMetric = "clocks" + runtimeVectorsPerCallMetric = "vectors_per_call" +) + +// Memory metrics +const ( + memoryMetricsNamespace = "memory" + + memoryThreadLabel = "thread" + memoryThreadIDLabel = "threadID" + + memoryObjectsMetric = "objects" + memoryUsedMetric = "used" + memoryTotalMetric = "total" + memoryFreeMetric = "free" + memoryReclaimedMetric = "reclaimed" + memoryOverheadMetric = "overhead" + memorySizeMetric = "size" + memoryPagesMetric = "pages" +) + +// Buffers metrics +const ( + buffersMetricsNamespace = "buffers" + + buffersThreadIDLabel = "threadID" + buffersItemLabel = "item" + buffersIndexLabel = "index" + + buffersSizeMetric = "size" + buffersAllocMetric = "alloc" + buffersFreeMetric = "free" + buffersNumAllocMetric = "num_alloc" + buffersNumFreeMetric = "num_free" +) + +// Node metrics +const ( + nodeMetricsNamespace = "nodes" + + nodeCounterItemLabel = "item" + nodeCounterReasonLabel = "reason" + + nodeCounterCounterMetric = "counter" +) + +// Interface metrics +const ( + ifMetricsNamespace = "interfaces" + + ifCounterNameLabel = "name" + ifCounterIndexLabel = "index" + + ifCounterRxPackets = "rx_packets" + ifCounterRxBytes = "rx_bytes" + ifCounterRxErrors = "rx_errors" + ifCounterTxPackets = "tx_packets" + ifCounterTxBytes = "tx_bytes" + ifCounterTxErrors = "tx_errors" + ifCounterDrops = "drops" + ifCounterPunts = "punts" + ifCounterIP4 = "ip4" + ifCounterIP6 = "ip6" + ifCounterRxNoBuf = "rx_no_buf" + ifCounterRxMiss = "rx_miss" +) + +type prometheusMetrics struct { + runtimeGaugeVecs map[string]*prometheus.GaugeVec + runtimeStats map[string]*runtimeStats + + memoryGaugeVecs map[string]*prometheus.GaugeVec + memoryStats map[string]*memoryStats + + buffersGaugeVecs map[string]*prometheus.GaugeVec + buffersStats map[string]*buffersStats + + nodeCounterGaugeVecs map[string]*prometheus.GaugeVec + nodeCounterStats map[string]*nodeCounterStats + + ifCounterGaugeVecs map[string]*prometheus.GaugeVec + ifCounterStats map[string]*ifCounterStats +} + +type runtimeStats struct { + threadName string + threadID uint + itemName string + metrics map[string]prometheus.Gauge +} + +type memoryStats struct { + threadName string + threadID uint + metrics map[string]prometheus.Gauge +} + +type buffersStats struct { + threadID uint + itemName string + itemIndex uint + metrics map[string]prometheus.Gauge +} + +type nodeCounterStats struct { + itemName string + metrics map[string]prometheus.Gauge +} + +type ifCounterStats struct { + name string + metrics map[string]prometheus.Gauge +} + +func (p *Plugin) registerPrometheus() error { + p.Log.Debugf("registering prometheus registry path: %v", registryPath) + + // Runtime metrics + p.runtimeGaugeVecs = make(map[string]*prometheus.GaugeVec) + p.runtimeStats = make(map[string]*runtimeStats) + + for _, metric := range [][2]string{ + {runtimeCallsMetric, "Number of calls"}, + {runtimeVectorsMetric, "Number of vectors"}, + {runtimeSuspendsMetric, "Number of suspends"}, + {runtimeClocksMetric, "Number of clocks"}, + {runtimeVectorsPerCallMetric, "Number of vectors per call"}, + } { + name := metric[0] + p.runtimeGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: vppMetricsNamespace, + Subsystem: runtimeMetricsNamespace, + Name: name, + Help: metric[1], + ConstLabels: prometheus.Labels{ + agentLabel: p.ServiceLabel.GetAgentLabel(), + }, + }, []string{runtimeItemLabel, runtimeThreadLabel, runtimeThreadIDLabel}) + + } + + // register created vectors to prometheus + for name, metric := range p.runtimeGaugeVecs { + if err := p.Prometheus.Register(registryPath, metric); err != nil { + p.Log.Errorf("failed to register %v metric: %v", name, err) + return err + } + } + + // Memory metrics + p.memoryGaugeVecs = make(map[string]*prometheus.GaugeVec) + p.memoryStats = make(map[string]*memoryStats) + + for _, metric := range [][2]string{ + {memoryObjectsMetric, "Number of objects"}, + {memoryUsedMetric, "Used memory"}, + {memoryTotalMetric, "Total memory"}, + {memoryFreeMetric, "Free memory"}, + {memoryReclaimedMetric, "Reclaimed memory"}, + {memoryOverheadMetric, "Overhead"}, + {memorySizeMetric, "Size"}, + {memoryPagesMetric, "Pages"}, + } { + name := metric[0] + p.memoryGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: vppMetricsNamespace, + Subsystem: memoryMetricsNamespace, + Name: name, + Help: metric[1], + ConstLabels: prometheus.Labels{ + agentLabel: p.ServiceLabel.GetAgentLabel(), + }, + }, []string{memoryThreadLabel, memoryThreadIDLabel}) + + } + + // register created vectors to prometheus + for name, metric := range p.memoryGaugeVecs { + if err := p.Prometheus.Register(registryPath, metric); err != nil { + p.Log.Errorf("failed to register %v metric: %v", name, err) + return err + } + } + + // Buffers metrics + p.buffersGaugeVecs = make(map[string]*prometheus.GaugeVec) + p.buffersStats = make(map[string]*buffersStats) + + for _, metric := range [][2]string{ + {buffersSizeMetric, "Size of buffer"}, + {buffersAllocMetric, "Allocated"}, + {buffersFreeMetric, "Free"}, + {buffersNumAllocMetric, "Number of allocated"}, + {buffersNumFreeMetric, "Number of free"}, + } { + name := metric[0] + p.buffersGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: vppMetricsNamespace, + Subsystem: buffersMetricsNamespace, + Name: name, + Help: metric[1], + ConstLabels: prometheus.Labels{ + agentLabel: p.ServiceLabel.GetAgentLabel(), + }, + }, []string{buffersThreadIDLabel, buffersItemLabel, buffersIndexLabel}) + + } + + // register created vectors to prometheus + for name, metric := range p.buffersGaugeVecs { + if err := p.Prometheus.Register(registryPath, metric); err != nil { + p.Log.Errorf("failed to register %v metric: %v", name, err) + return err + } + } + + // Node counters metrics + p.nodeCounterGaugeVecs = make(map[string]*prometheus.GaugeVec) + p.nodeCounterStats = make(map[string]*nodeCounterStats) + + for _, metric := range [][2]string{ + {nodeCounterCounterMetric, "Counter"}, + } { + name := metric[0] + p.nodeCounterGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: vppMetricsNamespace, + Subsystem: nodeMetricsNamespace, + Name: name, + Help: metric[1], + ConstLabels: prometheus.Labels{ + agentLabel: p.ServiceLabel.GetAgentLabel(), + }, + }, []string{nodeCounterItemLabel, nodeCounterReasonLabel}) + + } + + // register created vectors to prometheus + for name, metric := range p.nodeCounterGaugeVecs { + if err := p.Prometheus.Register(registryPath, metric); err != nil { + p.Log.Errorf("failed to register %v metric: %v", name, err) + return err + } + } + + // Interface counter metrics + p.ifCounterGaugeVecs = make(map[string]*prometheus.GaugeVec) + p.ifCounterStats = make(map[string]*ifCounterStats) + + for _, metric := range [][2]string{ + {ifCounterRxPackets, "RX packets"}, + {ifCounterRxBytes, "RX bytes"}, + {ifCounterRxErrors, "RX errors"}, + {ifCounterTxPackets, "TX packets"}, + {ifCounterTxBytes, "TX bytes"}, + {ifCounterTxErrors, "TX errors"}, + {ifCounterDrops, "Drops"}, + {ifCounterPunts, "Punts"}, + {ifCounterIP4, "IP4"}, + {ifCounterIP6, "IP6"}, + {ifCounterRxNoBuf, "RX nobuf"}, + {ifCounterRxMiss, "RX miss"}, + } { + name := metric[0] + p.ifCounterGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: vppMetricsNamespace, + Subsystem: ifMetricsNamespace, + Name: name, + Help: metric[1], + ConstLabels: prometheus.Labels{ + agentLabel: p.ServiceLabel.GetAgentLabel(), + }, + }, []string{ifCounterNameLabel, ifCounterIndexLabel}) + + } + + // register created vectors to prometheus + for name, metric := range p.ifCounterGaugeVecs { + if err := p.Prometheus.Register(registryPath, metric); err != nil { + p.Log.Errorf("failed to register %v metric: %v", name, err) + return err + } + } + + return nil +} + +func (p *Plugin) updatePrometheus(ctx context.Context) { + p.tracef("running update") + + if !p.skipped[runtimeMetricsNamespace] { + // Update runtime + runtimeInfo, err := p.handler.GetRuntimeInfo(ctx) + if err != nil { + p.Log.Errorf("GetRuntimeInfo failed: %v", err) + } else { + p.tracef("runtime info: %+v", runtimeInfo) + for _, thread := range runtimeInfo.GetThreads() { + for _, item := range thread.Items { + stats, ok := p.runtimeStats[item.Name] + if !ok { + stats = &runtimeStats{ + threadID: thread.ID, + threadName: thread.Name, + itemName: item.Name, + metrics: map[string]prometheus.Gauge{}, + } + + // add gauges with corresponding labels into vectors + for k, vec := range p.runtimeGaugeVecs { + stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ + runtimeItemLabel: item.Name, + runtimeThreadLabel: thread.Name, + runtimeThreadIDLabel: strconv.Itoa(int(thread.ID)), + }) + if err != nil { + p.Log.Error(err) + } + } + } + + stats.metrics[runtimeCallsMetric].Set(float64(item.Calls)) + stats.metrics[runtimeVectorsMetric].Set(float64(item.Vectors)) + stats.metrics[runtimeSuspendsMetric].Set(float64(item.Suspends)) + stats.metrics[runtimeClocksMetric].Set(item.Clocks) + stats.metrics[runtimeVectorsPerCallMetric].Set(item.VectorsPerCall) + } + } + } + } + + if !p.skipped[buffersMetricsNamespace] { + // Update buffers + buffersInfo, err := p.handler.GetBuffersInfo(ctx) + if err != nil { + p.Log.Errorf("GetBuffersInfo failed: %v", err) + } else { + p.tracef("buffers info: %+v", buffersInfo) + for _, item := range buffersInfo.GetItems() { + stats, ok := p.buffersStats[item.Name] + if !ok { + stats = &buffersStats{ + threadID: item.ThreadID, + itemName: item.Name, + itemIndex: item.Index, + metrics: map[string]prometheus.Gauge{}, + } + + // add gauges with corresponding labels into vectors + for k, vec := range p.buffersGaugeVecs { + stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ + buffersThreadIDLabel: strconv.Itoa(int(item.ThreadID)), + buffersItemLabel: item.Name, + buffersIndexLabel: strconv.Itoa(int(item.Index)), + }) + if err != nil { + p.Log.Error(err) + } + } + } + + stats.metrics[buffersSizeMetric].Set(float64(item.Size)) + stats.metrics[buffersAllocMetric].Set(float64(item.Alloc)) + stats.metrics[buffersFreeMetric].Set(float64(item.Free)) + stats.metrics[buffersNumAllocMetric].Set(float64(item.NumAlloc)) + stats.metrics[buffersNumFreeMetric].Set(float64(item.NumFree)) + } + } + } + + if !p.skipped[memoryMetricsNamespace] { + // Update memory + memoryInfo, err := p.handler.GetMemory(ctx) + if err != nil { + p.Log.Errorf("GetMemory failed: %v", err) + } else { + p.tracef("memory info: %+v", memoryInfo) + for _, thread := range memoryInfo.GetThreads() { + stats, ok := p.memoryStats[thread.Name] + if !ok { + stats = &memoryStats{ + threadName: thread.Name, + threadID: thread.ID, + metrics: map[string]prometheus.Gauge{}, + } + + // add gauges with corresponding labels into vectors + for k, vec := range p.memoryGaugeVecs { + stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ + memoryThreadLabel: thread.Name, + memoryThreadIDLabel: strconv.Itoa(int(thread.ID)), + }) + if err != nil { + p.Log.Error(err) + } + } + } + + stats.metrics[memoryObjectsMetric].Set(float64(thread.Objects)) + stats.metrics[memoryUsedMetric].Set(float64(thread.Used)) + stats.metrics[memoryTotalMetric].Set(float64(thread.Total)) + stats.metrics[memoryFreeMetric].Set(float64(thread.Free)) + stats.metrics[memoryReclaimedMetric].Set(float64(thread.Reclaimed)) + stats.metrics[memoryOverheadMetric].Set(float64(thread.Overhead)) + stats.metrics[memorySizeMetric].Set(float64(thread.Size)) + stats.metrics[memoryPagesMetric].Set(float64(thread.Pages)) + } + } + } + + if !p.skipped[nodeMetricsNamespace] { + // Update node counters + nodeCountersInfo, err := p.handler.GetNodeCounters(ctx) + if err != nil { + p.Log.Errorf("GetNodeCounters failed: %v", err) + } else { + p.tracef("node counters info: %+v", nodeCountersInfo) + for _, item := range nodeCountersInfo.GetCounters() { + stats, ok := p.nodeCounterStats[item.Name] + if !ok { + stats = &nodeCounterStats{ + itemName: item.Name, + metrics: map[string]prometheus.Gauge{}, + } + + // add gauges with corresponding labels into vectors + for k, vec := range p.nodeCounterGaugeVecs { + stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ + nodeCounterItemLabel: item.Node, + nodeCounterReasonLabel: item.Name, + }) + if err != nil { + p.Log.Error(err) + } + } + } + + stats.metrics[nodeCounterCounterMetric].Set(float64(item.Value)) + } + } + } + + if !p.skipped[ifMetricsNamespace] { + // Update interface counters + ifStats, err := p.handler.GetInterfaceStats(ctx) + if err != nil { + p.Log.Errorf("GetInterfaceStats failed: %v", err) + return + } else { + p.tracef("interface stats: %+v", ifStats) + if ifStats == nil { + return + } + for _, item := range ifStats.Interfaces { + stats, ok := p.ifCounterStats[item.InterfaceName] + if !ok { + stats = &ifCounterStats{ + name: item.InterfaceName, + metrics: map[string]prometheus.Gauge{}, + } + + // add gauges with corresponding labels into vectors + for k, vec := range p.ifCounterGaugeVecs { + stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ + ifCounterNameLabel: item.InterfaceName, + ifCounterIndexLabel: fmt.Sprint(item.InterfaceIndex), + }) + if err != nil { + p.Log.Error(err) + } + } + } + + stats.metrics[ifCounterRxPackets].Set(float64(item.RxPackets)) + stats.metrics[ifCounterRxBytes].Set(float64(item.RxBytes)) + stats.metrics[ifCounterRxErrors].Set(float64(item.RxErrors)) + stats.metrics[ifCounterTxPackets].Set(float64(item.TxPackets)) + stats.metrics[ifCounterTxBytes].Set(float64(item.TxBytes)) + stats.metrics[ifCounterTxErrors].Set(float64(item.TxErrors)) + stats.metrics[ifCounterDrops].Set(float64(item.Drops)) + stats.metrics[ifCounterPunts].Set(float64(item.Punts)) + stats.metrics[ifCounterIP4].Set(float64(item.IP4)) + stats.metrics[ifCounterIP6].Set(float64(item.IP6)) + stats.metrics[ifCounterRxNoBuf].Set(float64(item.RxNoBuf)) + stats.metrics[ifCounterRxMiss].Set(float64(item.RxMiss)) + } + } + } + + p.tracef("update complete") +} diff --git a/plugins/telemetry/prometheus.go b/plugins/telemetry/prometheus.go deleted file mode 100644 index abd7c9b9b8..0000000000 --- a/plugins/telemetry/prometheus.go +++ /dev/null @@ -1,389 +0,0 @@ -package telemetry - -import ( - "context" - "os" - "strconv" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" -) - -var ( - debug = os.Getenv("DEBUG_TELEMETRY") != "" -) - -const ( - // Registry path for telemetry metrics - registryPath = "/vpp" - - // Metrics label used for agent label - agentLabel = "agent" - - // Runtime - runtimeThreadLabel = "thread" - runtimeThreadIDLabel = "threadID" - runtimeItemLabel = "item" - - runtimeCallsMetric = "calls" - runtimeVectorsMetric = "vectors" - runtimeSuspendsMetric = "suspends" - runtimeClocksMetric = "clocks" - runtimeVectorsPerCallMetric = "vectors_per_call" - - // Memory - memoryThreadLabel = "thread" - memoryThreadIDLabel = "threadID" - - memoryObjectsMetric = "objects" - memoryUsedMetric = "used" - memoryTotalMetric = "total" - memoryFreeMetric = "free" - memoryReclaimedMetric = "reclaimed" - memoryOverheadMetric = "overhead" - memorySizeMetric = "size" - memoryPagesMetric = "pages" - - // Buffers - buffersThreadIDLabel = "threadID" - buffersItemLabel = "item" - buffersIndexLabel = "index" - - buffersSizeMetric = "size" - buffersAllocMetric = "alloc" - buffersFreeMetric = "free" - buffersNumAllocMetric = "num_alloc" - buffersNumFreeMetric = "num_free" - - // Node counters - nodeCounterItemLabel = "item" - nodeCounterReasonLabel = "reason" - - nodeCounterCountMetric = "count" -) - -type prometheusMetrics struct { - runtimeGaugeVecs map[string]*prometheus.GaugeVec - runtimeStats map[string]*runtimeStats - - memoryGaugeVecs map[string]*prometheus.GaugeVec - memoryStats map[string]*memoryStats - - buffersGaugeVecs map[string]*prometheus.GaugeVec - buffersStats map[string]*buffersStats - - nodeCounterGaugeVecs map[string]*prometheus.GaugeVec - nodeCounterStats map[string]*nodeCounterStats -} - -type runtimeStats struct { - threadName string - threadID uint - itemName string - metrics map[string]prometheus.Gauge -} - -type memoryStats struct { - threadName string - threadID uint - metrics map[string]prometheus.Gauge -} - -type buffersStats struct { - threadID uint - itemName string - itemIndex uint - metrics map[string]prometheus.Gauge -} - -type nodeCounterStats struct { - itemName string - metrics map[string]prometheus.Gauge -} - -func (p *Plugin) registerPrometheus() error { - p.Log.Debugf("registering prometheus registry path: %v", registryPath) - - // Register '/vpp' registry path - err := p.Prometheus.NewRegistry(registryPath, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}) - if err != nil { - return err - } - - // Runtime metrics - p.runtimeGaugeVecs = make(map[string]*prometheus.GaugeVec) - p.runtimeStats = make(map[string]*runtimeStats) - - for _, metric := range [][2]string{ - {runtimeCallsMetric, "Number of calls"}, - {runtimeVectorsMetric, "Number of vectors"}, - {runtimeSuspendsMetric, "Number of suspends"}, - {runtimeClocksMetric, "Number of clocks"}, - {runtimeVectorsPerCallMetric, "Number of vectors per call"}, - } { - name := metric[0] - p.runtimeGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "vpp", - Subsystem: "runtime", - Name: name, - Help: metric[1], - ConstLabels: prometheus.Labels{ - agentLabel: p.ServiceLabel.GetAgentLabel(), - }, - }, []string{runtimeItemLabel, runtimeThreadLabel, runtimeThreadIDLabel}) - - } - - // register created vectors to prometheus - for name, metric := range p.runtimeGaugeVecs { - if err := p.Prometheus.Register(registryPath, metric); err != nil { - p.Log.Errorf("failed to register %v metric: %v", name, err) - return err - } - } - - // Memory metrics - p.memoryGaugeVecs = make(map[string]*prometheus.GaugeVec) - p.memoryStats = make(map[string]*memoryStats) - - for _, metric := range [][2]string{ - {memoryObjectsMetric, "Number of objects"}, - {memoryUsedMetric, "Used memory"}, - {memoryTotalMetric, "Total memory"}, - {memoryFreeMetric, "Free memory"}, - {memoryReclaimedMetric, "Reclaimed memory"}, - {memoryOverheadMetric, "Overhead"}, - {memorySizeMetric, "Size"}, - {memoryPagesMetric, "Pages"}, - } { - name := metric[0] - p.memoryGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "vpp", - Subsystem: "memory", - Name: name, - Help: metric[1], - ConstLabels: prometheus.Labels{ - agentLabel: p.ServiceLabel.GetAgentLabel(), - }, - }, []string{memoryThreadLabel, memoryThreadIDLabel}) - - } - - // register created vectors to prometheus - for name, metric := range p.memoryGaugeVecs { - if err := p.Prometheus.Register(registryPath, metric); err != nil { - p.Log.Errorf("failed to register %v metric: %v", name, err) - return err - } - } - - // Buffers metrics - p.buffersGaugeVecs = make(map[string]*prometheus.GaugeVec) - p.buffersStats = make(map[string]*buffersStats) - - for _, metric := range [][2]string{ - {buffersSizeMetric, "Size of buffer"}, - {buffersAllocMetric, "Allocated"}, - {buffersFreeMetric, "Free"}, - {buffersNumAllocMetric, "Number of allocated"}, - {buffersNumFreeMetric, "Number of free"}, - } { - name := metric[0] - p.buffersGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "vpp", - Subsystem: "buffers", - Name: name, - Help: metric[1], - ConstLabels: prometheus.Labels{ - agentLabel: p.ServiceLabel.GetAgentLabel(), - }, - }, []string{buffersThreadIDLabel, buffersItemLabel, buffersIndexLabel}) - - } - - // register created vectors to prometheus - for name, metric := range p.buffersGaugeVecs { - if err := p.Prometheus.Register(registryPath, metric); err != nil { - p.Log.Errorf("failed to register %v metric: %v", name, err) - return err - } - } - - // Node counters metrics - p.nodeCounterGaugeVecs = make(map[string]*prometheus.GaugeVec) - p.nodeCounterStats = make(map[string]*nodeCounterStats) - - for _, metric := range [][2]string{ - {nodeCounterCountMetric, "Count"}, - } { - name := metric[0] - p.nodeCounterGaugeVecs[name] = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "vpp", - Subsystem: "node_counter", - Name: name, - Help: metric[1], - ConstLabels: prometheus.Labels{ - agentLabel: p.ServiceLabel.GetAgentLabel(), - }, - }, []string{nodeCounterItemLabel, nodeCounterReasonLabel}) - - } - - // register created vectors to prometheus - for name, metric := range p.nodeCounterGaugeVecs { - if err := p.Prometheus.Register(registryPath, metric); err != nil { - p.Log.Errorf("failed to register %v metric: %v", name, err) - return err - } - } - - return nil -} - -func (p *Plugin) updatePrometheus(ctx context.Context) { - p.tracef("running update") - - // Update runtime - runtimeInfo, err := p.handler.GetRuntimeInfo(ctx) - if err != nil { - p.Log.Errorf("GetRuntimeInfo failed: %v", err) - } else { - p.tracef("runtime info: %+v", runtimeInfo) - for _, thread := range runtimeInfo.Threads { - for _, item := range thread.Items { - stats, ok := p.runtimeStats[item.Name] - if !ok { - stats = &runtimeStats{ - threadID: thread.ID, - threadName: thread.Name, - itemName: item.Name, - metrics: map[string]prometheus.Gauge{}, - } - - // add gauges with corresponding labels into vectors - for k, vec := range p.runtimeGaugeVecs { - stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ - runtimeItemLabel: item.Name, - runtimeThreadLabel: thread.Name, - runtimeThreadIDLabel: strconv.Itoa(int(thread.ID)), - }) - if err != nil { - p.Log.Error(err) - } - } - } - - stats.metrics[runtimeCallsMetric].Set(float64(item.Calls)) - stats.metrics[runtimeVectorsMetric].Set(float64(item.Vectors)) - stats.metrics[runtimeSuspendsMetric].Set(float64(item.Suspends)) - stats.metrics[runtimeClocksMetric].Set(item.Clocks) - stats.metrics[runtimeVectorsPerCallMetric].Set(item.VectorsPerCall) - } - } - } - - // Update buffers - buffersInfo, err := p.handler.GetBuffersInfo(ctx) - if err != nil { - p.Log.Errorf("GetBuffersInfo failed: %v", err) - } else { - p.tracef("buffers info: %+v", buffersInfo) - for _, item := range buffersInfo.Items { - stats, ok := p.buffersStats[item.Name] - if !ok { - stats = &buffersStats{ - threadID: item.ThreadID, - itemName: item.Name, - itemIndex: item.Index, - metrics: map[string]prometheus.Gauge{}, - } - - // add gauges with corresponding labels into vectors - for k, vec := range p.buffersGaugeVecs { - stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ - buffersThreadIDLabel: strconv.Itoa(int(item.ThreadID)), - buffersItemLabel: item.Name, - buffersIndexLabel: strconv.Itoa(int(item.Index)), - }) - if err != nil { - p.Log.Error(err) - } - } - } - - stats.metrics[buffersSizeMetric].Set(float64(item.Size)) - stats.metrics[buffersAllocMetric].Set(float64(item.Alloc)) - stats.metrics[buffersFreeMetric].Set(float64(item.Free)) - stats.metrics[buffersNumAllocMetric].Set(float64(item.NumAlloc)) - stats.metrics[buffersNumFreeMetric].Set(float64(item.NumFree)) - } - } - - // Update node counters - nodeCountersInfo, err := p.handler.GetNodeCounters(ctx) - if err != nil { - p.Log.Errorf("GetNodeCounters failed: %v", err) - } else { - p.tracef("node counters info: %+v", nodeCountersInfo) - for _, item := range nodeCountersInfo.Counters { - stats, ok := p.nodeCounterStats[item.Name] - if !ok { - stats = &nodeCounterStats{ - itemName: item.Name, - metrics: map[string]prometheus.Gauge{}, - } - - // add gauges with corresponding labels into vectors - for k, vec := range p.nodeCounterGaugeVecs { - stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ - nodeCounterItemLabel: item.Node, - nodeCounterReasonLabel: item.Name, - }) - if err != nil { - p.Log.Error(err) - } - } - } - - stats.metrics[nodeCounterCountMetric].Set(float64(item.Value)) - } - } - - // Update memory - memoryInfo, err := p.handler.GetMemory(ctx) - if err != nil { - p.Log.Errorf("GetMemory failed: %v", err) - } else { - p.tracef("memory info: %+v", memoryInfo) - for _, thread := range memoryInfo.Threads { - stats, ok := p.memoryStats[thread.Name] - if !ok { - stats = &memoryStats{ - threadName: thread.Name, - threadID: thread.ID, - metrics: map[string]prometheus.Gauge{}, - } - - // add gauges with corresponding labels into vectors - for k, vec := range p.memoryGaugeVecs { - stats.metrics[k], err = vec.GetMetricWith(prometheus.Labels{ - memoryThreadLabel: thread.Name, - memoryThreadIDLabel: strconv.Itoa(int(thread.ID)), - }) - if err != nil { - p.Log.Error(err) - } - } - } - - stats.metrics[memoryObjectsMetric].Set(float64(thread.Objects)) - stats.metrics[memoryUsedMetric].Set(float64(thread.Used)) - stats.metrics[memoryTotalMetric].Set(float64(thread.Total)) - stats.metrics[memoryFreeMetric].Set(float64(thread.Free)) - stats.metrics[memoryReclaimedMetric].Set(float64(thread.Reclaimed)) - stats.metrics[memoryOverheadMetric].Set(float64(thread.Overhead)) - stats.metrics[memorySizeMetric].Set(float64(thread.Size)) - stats.metrics[memoryPagesMetric].Set(float64(thread.Pages)) - } - } -} diff --git a/plugins/telemetry/telemetry.conf b/plugins/telemetry/telemetry.conf index d1f8027191..3a05580371 100644 --- a/plugins/telemetry/telemetry.conf +++ b/plugins/telemetry/telemetry.conf @@ -3,3 +3,7 @@ polling-interval: 30000000000 # If set to true, telemetry plugin is disabled. disabled: false + +# Skip collecting some of the metrics. +# runtime, memory, buffers, nodes, interfaces +#skipped: [nodes] diff --git a/plugins/telemetry/telemetry.go b/plugins/telemetry/telemetry.go index b9abed933a..9fb24a9d08 100644 --- a/plugins/telemetry/telemetry.go +++ b/plugins/telemetry/telemetry.go @@ -17,6 +17,7 @@ package telemetry import ( "context" "fmt" + "os" "sync" "time" @@ -30,14 +31,10 @@ import ( _ "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls/vpp1908" ) -const ( - // default period between updates - defaultUpdatePeriod = time.Second * 30 - // minimum period between updates - minimumUpdatePeriod = time.Second * 1 -) +var debug = os.Getenv("DEBUG_TELEMETRY") != "" // Plugin registers Telemetry Plugin type Plugin struct { @@ -50,6 +47,7 @@ type Plugin struct { // From config file updatePeriod time.Duration disabled bool + skipped map[string]bool wg sync.WaitGroup quit chan struct{} @@ -66,6 +64,7 @@ type Deps struct { // Init initializes Telemetry Plugin func (p *Plugin) Init() error { p.quit = make(chan struct{}) + p.skipped = make(map[string]bool, 0) // Telemetry config file config, err := p.loadConfig() @@ -88,6 +87,10 @@ func (p *Plugin) Init() error { p.Log.Warnf("polling period has to be at least %s, using default: %v", minimumUpdatePeriod, defaultUpdatePeriod) } + // Store map of skipped metrics + for _, skip := range config.Skipped { + p.skipped[skip] = true + } } // This serves as fallback if the config was not found or if the value is not set in config. if p.updatePeriod == 0 { diff --git a/plugins/telemetry/vppcalls/vpp1901/telemetry_vppcalls.go b/plugins/telemetry/vppcalls/vpp1901/telemetry_vppcalls.go index d8ccc564d2..84a522a633 100644 --- a/plugins/telemetry/vppcalls/vpp1901/telemetry_vppcalls.go +++ b/plugins/telemetry/vppcalls/vpp1901/telemetry_vppcalls.go @@ -31,8 +31,8 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, memclnt.Messages...) - msgs = append(msgs, vpe.Messages...) + msgs = append(msgs, memclnt.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) vppcalls.Versions["19.01"] = vppcalls.HandlerVersion{ Msgs: msgs, @@ -53,19 +53,25 @@ func NewTelemetryVppHandler(ch govppapi.Channel, stats govppapi.StatsProvider) * return &TelemetryHandler{ch, stats, vpeHandler} } +func (h *TelemetryHandler) GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error) { + // not implemented for 19.01 + return nil, nil +} + var ( // Regular expression to parse output from `show memory` memoryRe = regexp.MustCompile( `Thread\s+(\d+)\s+(\w+).?\s+` + `virtual memory start 0x[0-9abcdef]+, size ([\dkmg\.]+), ([\dkmg\.]+) pages, page size ([\dkmg\.]+)\s+` + - `(?:\s+(?:numa [\d]+|not mapped|unknown): [\dkmg\.]+ pages, [\dkmg\.]+\s+)+\s+` + + `(?:page information not available.*\s+)*` + + `(?:(?:\s+(?:numa [\d]+|not mapped|unknown): [\dkmg\.]+ pages, [\dkmg\.]+\s+)+\s+)*` + `\s+total: ([\dkmgKMG\.]+), used: ([\dkmgKMG\.]+), free: ([\dkmgKMG\.]+), trimmable: ([\dkmgKMG\.]+)`, ) ) // GetMemory retrieves `show memory` info. func (h *TelemetryHandler) GetMemory(ctx context.Context) (*vppcalls.MemoryInfo, error) { - data, err := h.RunCli("show memory") + data, err := h.RunCli("show memory main-heap") if err != nil { return nil, err } diff --git a/plugins/telemetry/vppcalls/vpp1904/telemetry_vppcalls.go b/plugins/telemetry/vppcalls/vpp1904/telemetry_vppcalls.go index beb50b1764..a8ee54bd03 100644 --- a/plugins/telemetry/vppcalls/vpp1904/telemetry_vppcalls.go +++ b/plugins/telemetry/vppcalls/vpp1904/telemetry_vppcalls.go @@ -31,8 +31,8 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, memclnt.Messages...) - msgs = append(msgs, vpe.Messages...) + msgs = append(msgs, memclnt.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) vppcalls.Versions["19.04"] = vppcalls.HandlerVersion{ Msgs: msgs, @@ -57,8 +57,9 @@ var ( // Regular expression to parse output from `show memory` memoryRe = regexp.MustCompile( `Thread\s+(\d+)\s+(\w+).?\s+` + - `virtual memory start 0x[0-9abcdef]+, size ([\dkmg\.]+), ([\dkmg\.]+) pages, page size ([\dkmg\.]+)\s+` + - `(?:\s+(?:numa [\d]+|not mapped|unknown): [\dkmg\.]+ pages, [\dkmg\.]+\s+)+\s+` + + `virtual memory start 0x[0-9a-f]+, size ([\dkmg\.]+), ([\dkmg\.]+) pages, page size ([\dkmg\.]+)\s+` + + `(?:page information not available.*\s+)*` + + `(?:(?:\s+(?:numa [\d]+|not mapped|unknown): [\dkmg\.]+ pages, [\dkmg\.]+\s+)+\s+)*` + `\s+total: ([\dkmgKMG\.]+), used: ([\dkmgKMG\.]+), free: ([\dkmgKMG\.]+), trimmable: ([\dkmgKMG\.]+)`, ) ) @@ -69,7 +70,7 @@ func (h *TelemetryHandler) GetMemory(ctx context.Context) (*vppcalls.MemoryInfo, } func (h *TelemetryHandler) getMemoryCLI(ctx context.Context) (*vppcalls.MemoryInfo, error) { - data, err := h.vpe.RunCli("show memory") + data, err := h.vpe.RunCli("show memory main-heap") if err != nil { return nil, err } @@ -112,6 +113,15 @@ func (h *TelemetryHandler) getMemoryCLI(ctx context.Context) (*vppcalls.MemoryIn return info, nil } +func (h *TelemetryHandler) GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error) { + stats, err := h.stats.GetInterfaceStats() + if err != nil { + return nil, err + } + + return stats, nil +} + var ( // Regular expression to parse output from `show node counters` nodeCountersRe = regexp.MustCompile(`^\s+(\d+)\s+([\w-\/]+)\s+(.+)$`) diff --git a/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls.go b/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls.go new file mode 100644 index 0000000000..fb7f18c24c --- /dev/null +++ b/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls.go @@ -0,0 +1,464 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "context" + "fmt" + "regexp" + "strconv" + "strings" + + govppapi "git.fd.io/govpp.git/api" + vpevppcalls "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" + "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memclnt" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, memclnt.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) + + vppcalls.Versions["19.08"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, stats govppapi.StatsProvider) vppcalls.TelemetryVppAPI { + return NewTelemetryVppHandler(ch, stats) + }, + } +} + +type TelemetryHandler struct { + ch govppapi.Channel + stats govppapi.StatsProvider + vpe vpevppcalls.VpeVppAPI +} + +func NewTelemetryVppHandler(ch govppapi.Channel, stats govppapi.StatsProvider) *TelemetryHandler { + vpeHandler := vpp1908.NewVpeHandler(ch) + return &TelemetryHandler{ch, stats, vpeHandler} +} + +var ( + // Regular expression to parse output from `show memory` + memoryRe = regexp.MustCompile( + `Thread\s+(\d+)\s+(\w+).?\s+` + + `virtual memory start 0x[0-9a-f]+, size ([\dkmg\.]+), ([\dkmg\.]+) pages, page size ([\dkmg\.]+)\s+` + + `(?:page information not available.*\s+)*` + + `(?:(?:\s+(?:numa [\d]+|not mapped|unknown): [\dkmg\.]+ pages, [\dkmg\.]+\s+)*\s+)*` + + `\s+total: ([\dkmgKMG\.]+), used: ([\dkmgKMG\.]+), free: ([\dkmgKMG\.]+), trimmable: ([\dkmgKMG\.]+)`, + ) +) + +// GetMemory retrieves `show memory` info. +func (h *TelemetryHandler) GetMemory(ctx context.Context) (*vppcalls.MemoryInfo, error) { + return h.getMemoryCLI(ctx) +} + +func (h *TelemetryHandler) getMemoryCLI(ctx context.Context) (*vppcalls.MemoryInfo, error) { + data, err := h.vpe.RunCli("show memory main-heap") + if err != nil { + return nil, err + } + + input := string(data) + threadMatches := memoryRe.FindAllStringSubmatch(input, -1) + + if len(threadMatches) == 0 && input != "" { + return nil, fmt.Errorf("invalid memory input: %q", input) + } + + var threads []vppcalls.MemoryThread + for _, matches := range threadMatches { + fields := matches[1:] + if len(fields) != 9 { + return nil, fmt.Errorf("invalid memory data %v for thread: %q", fields, matches[0]) + } + id, err := strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return nil, err + } + thread := &vppcalls.MemoryThread{ + ID: uint(id), + Name: fields[1], + Size: strToUint64(fields[2]), + Pages: strToUint64(fields[3]), + PageSize: strToUint64(fields[4]), + Total: strToUint64(fields[5]), + Used: strToUint64(fields[6]), + Free: strToUint64(fields[7]), + Reclaimed: strToUint64(fields[8]), + } + threads = append(threads, *thread) + } + + info := &vppcalls.MemoryInfo{ + Threads: threads, + } + + return info, nil +} + +func (h *TelemetryHandler) GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error) { + stats, err := h.stats.GetInterfaceStats() + if err != nil { + return nil, err + } + + return stats, nil +} + +var ( + // Regular expression to parse output from `show node counters` + nodeCountersRe = regexp.MustCompile(`^\s+(\d+)\s+([\w-\/]+)\s+(.+)$`) +) + +// GetNodeCounters retrieves node counters info. +func (h *TelemetryHandler) GetNodeCounters(ctx context.Context) (*vppcalls.NodeCounterInfo, error) { + if h.stats == nil { + return h.getNodeCountersCLI() + } + return h.getNodeCountersStats() +} + +// GetNodeCounters retrieves node counters info. +func (h *TelemetryHandler) getNodeCountersStats() (*vppcalls.NodeCounterInfo, error) { + errStats, err := h.stats.GetErrorStats() + if err != nil { + return nil, err + } else if errStats == nil { + return nil, nil + } + + var counters []vppcalls.NodeCounter + + for _, c := range errStats.Errors { + node, reason := SplitErrorName(c.CounterName) + counters = append(counters, vppcalls.NodeCounter{ + Value: c.Value, + Node: node, + Name: reason, + }) + } + + info := &vppcalls.NodeCounterInfo{ + Counters: counters, + } + + return info, nil +} + +// GetNodeCounters retrieves node counters info. +func (h *TelemetryHandler) getNodeCountersCLI() (*vppcalls.NodeCounterInfo, error) { + data, err := h.vpe.RunCli("show node counters") + if err != nil { + return nil, err + } + + var counters []vppcalls.NodeCounter + + for i, line := range strings.Split(string(data), "\n") { + // Skip empty lines + if strings.TrimSpace(line) == "" { + continue + } + // Check first line + if i == 0 { + fields := strings.Fields(line) + // Verify header + if len(fields) != 3 || fields[0] != "Count" { + return nil, fmt.Errorf("invalid header for `show node counters` received: %q", line) + } + continue + } + + // Parse lines using regexp + matches := nodeCountersRe.FindStringSubmatch(line) + if len(matches)-1 != 3 { + return nil, fmt.Errorf("parsing failed for `show node counters` line: %q", line) + } + fields := matches[1:] + + counters = append(counters, vppcalls.NodeCounter{ + Value: strToUint64(fields[0]), + Node: fields[1], + Name: fields[2], + }) + } + + info := &vppcalls.NodeCounterInfo{ + Counters: counters, + } + + return info, nil +} + +var ( + // Regular expression to parse output from `show runtime` + runtimeRe = regexp.MustCompile(`(?:-+\n)?(?:Thread (\d+) (\w+)(?: \(lcore \d+\))?\n)?` + + `Time ([0-9\.e-]+), average vectors/node ([0-9\.e-]+), last (\d+) main loops ([0-9\.e-]+) per node ([0-9\.e-]+)\s+` + + `vector rates in ([0-9\.e-]+), out ([0-9\.e-]+), drop ([0-9\.e-]+), punt ([0-9\.e-]+)\n` + + `\s+Name\s+State\s+Calls\s+Vectors\s+Suspends\s+Clocks\s+Vectors/Call\s+(?:Perf Ticks\s+)?` + + `((?:[\w-:\.]+\s+\w+(?:[ -]\w+)*\s+\d+\s+\d+\s+\d+\s+[0-9\.e-]+\s+[0-9\.e-]+\s+)+)`) + runtimeItemsRe = regexp.MustCompile(`([\w-:\.]+)\s+(\w+(?:[ -]\w+)*)\s+(\d+)\s+(\d+)\s+(\d+)\s+([0-9\.e-]+)\s+([0-9\.e-]+)\s+`) +) + +// GetRuntimeInfo retrieves how runtime info. +func (h *TelemetryHandler) GetRuntimeInfo(ctx context.Context) (*vppcalls.RuntimeInfo, error) { + if h.stats == nil { + return h.getRuntimeInfoCLI() + } + return h.getRuntimeInfoStats() +} + +// GetRuntimeInfo retrieves how runtime info. +func (h *TelemetryHandler) getRuntimeInfoStats() (*vppcalls.RuntimeInfo, error) { + nodeStats, err := h.stats.GetNodeStats() + if err != nil { + return nil, err + } else if nodeStats == nil { + return nil, nil + } + + var threads []vppcalls.RuntimeThread + + thread := vppcalls.RuntimeThread{ + Name: "ALL", + } + + for _, node := range nodeStats.Nodes { + thread.Items = append(thread.Items, vppcalls.RuntimeItem{ + Index: uint(node.NodeIndex), + Name: node.NodeName, + //State: fields[1], + Calls: node.Calls, + Vectors: node.Vectors, + Suspends: node.Suspends, + Clocks: float64(node.Clocks), + VectorsPerCall: float64(node.Vectors) / float64(node.Calls), + }) + } + + threads = append(threads, thread) + + info := &vppcalls.RuntimeInfo{ + Threads: threads, + } + + return info, nil +} + +// GetRuntimeInfo retrieves how runtime info. +func (h *TelemetryHandler) getRuntimeInfoCLI() (*vppcalls.RuntimeInfo, error) { + data, err := h.vpe.RunCli("show runtime") + if err != nil { + return nil, err + } + + input := string(data) + threadMatches := runtimeRe.FindAllStringSubmatch(input, -1) + + if len(threadMatches) == 0 && input != "" { + return nil, fmt.Errorf("invalid runtime input: %q", input) + } + + var threads []vppcalls.RuntimeThread + for _, matches := range threadMatches { + fields := matches[1:] + if len(fields) != 12 { + return nil, fmt.Errorf("invalid runtime data for thread (len=%v): %q", len(fields), matches[0]) + } + thread := vppcalls.RuntimeThread{ + ID: uint(strToUint64(fields[0])), + Name: fields[1], + Time: strToFloat64(fields[2]), + AvgVectorsPerNode: strToFloat64(fields[3]), + LastMainLoops: strToUint64(fields[4]), + VectorsPerMainLoop: strToFloat64(fields[5]), + VectorLengthPerNode: strToFloat64(fields[6]), + VectorRatesIn: strToFloat64(fields[7]), + VectorRatesOut: strToFloat64(fields[8]), + VectorRatesDrop: strToFloat64(fields[9]), + VectorRatesPunt: strToFloat64(fields[10]), + } + + itemMatches := runtimeItemsRe.FindAllStringSubmatch(fields[11], -1) + for _, matches := range itemMatches { + fields := matches[1:] + if len(fields) != 7 { + return nil, fmt.Errorf("invalid runtime data for thread item: %q", matches[0]) + } + thread.Items = append(thread.Items, vppcalls.RuntimeItem{ + Name: fields[0], + State: fields[1], + Calls: strToUint64(fields[2]), + Vectors: strToUint64(fields[3]), + Suspends: strToUint64(fields[4]), + Clocks: strToFloat64(fields[5]), + VectorsPerCall: strToFloat64(fields[6]), + }) + } + + threads = append(threads, thread) + } + + info := &vppcalls.RuntimeInfo{ + Threads: threads, + } + + return info, nil +} + +var ( + // Regular expression to parse output from `show buffers` + buffersRe = regexp.MustCompile( + `^(\w+(?:[ \-]\w+)*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+([\dkmg\.]+)\s+([\dkmg\.]+)\s+([\dkmg\.]+)\s+([\dkmg\.]+)(?:\s+)?$`, + ) +) + +// GetBuffersInfo retrieves buffers info from VPP. +func (h *TelemetryHandler) GetBuffersInfo(ctx context.Context) (*vppcalls.BuffersInfo, error) { + if h.stats == nil { + return h.getBuffersInfoCLI() + } + return h.getBuffersInfoStats() +} + +func (h *TelemetryHandler) getBuffersInfoStats() (*vppcalls.BuffersInfo, error) { + bufStats, err := h.stats.GetBufferStats() + if err != nil { + return nil, err + } else if bufStats == nil { + return nil, nil + } + + var items []vppcalls.BuffersItem + + for _, c := range bufStats.Buffer { + items = append(items, vppcalls.BuffersItem{ + Name: c.PoolName, + Alloc: uint64(c.Used), + Free: uint64(c.Available), + //Cached: c.Cached, + }) + } + + info := &vppcalls.BuffersInfo{ + Items: items, + } + + return info, nil +} + +func (h *TelemetryHandler) getBuffersInfoCLI() (*vppcalls.BuffersInfo, error) { + data, err := h.vpe.RunCli("show buffers") + if err != nil { + return nil, err + } + + var items []vppcalls.BuffersItem + + for i, line := range strings.Split(string(data), "\n") { + // Skip empty lines + if strings.TrimSpace(line) == "" { + continue + } + // Check first line + if i == 0 { + fields := strings.Fields(line) + // Verify header + if len(fields) != 11 || fields[0] != "Pool" { + return nil, fmt.Errorf("invalid header for `show buffers` received: %q", line) + } + continue + } + + // Parse lines using regexp + matches := buffersRe.FindStringSubmatch(line) + if len(matches)-1 != 9 { + return nil, fmt.Errorf("parsing failed (%d matches) for `show buffers` line: %q", len(matches), line) + } + fields := matches[1:] + + items = append(items, vppcalls.BuffersItem{ + //ThreadID: uint(strToUint64(fields[0])), + Name: fields[0], + Index: uint(strToUint64(fields[1])), + Size: strToUint64(fields[3]), + Alloc: strToUint64(fields[7]), + Free: strToUint64(fields[5]), + //NumAlloc: strToUint64(fields[6]), + //NumFree: strToUint64(fields[7]), + }) + } + + info := &vppcalls.BuffersInfo{ + Items: items, + } + + return info, nil +} + +func strToFloat64(s string) float64 { + // Replace 'k' (thousands) with 'e3' to make it parsable with strconv + s = strings.Replace(s, "k", "e3", 1) + s = strings.Replace(s, "K", "e3", 1) + s = strings.Replace(s, "m", "e6", 1) + s = strings.Replace(s, "M", "e6", 1) + s = strings.Replace(s, "g", "e9", 1) + s = strings.Replace(s, "G", "e9", 1) + + num, err := strconv.ParseFloat(s, 10) + if err != nil { + return 0 + } + return num +} + +func strToUint64(s string) uint64 { + return uint64(strToFloat64(s)) +} + +var ( + errorNameLikeMemifRe = regexp.MustCompile(`^[A-Za-z0-9-]+([0-9]+\/[0-9]+|pg\/stream)`) + errorNameLikeGigabitRe = regexp.MustCompile(`^[A-Za-z0-9]+[0-9a-f]+(\/[0-9a-f]+){2}`) +) + +func SplitErrorName(str string) (node, reason string) { + parts := strings.Split(str, "/") + switch len(parts) { + case 1: + return parts[0], "" + case 2: + return parts[0], parts[1] + case 3: + if strings.Contains(parts[1], " ") { + return parts[0], strings.Join(parts[1:], "/") + } + if errorNameLikeMemifRe.MatchString(str) { + return strings.Join(parts[:2], "/"), parts[2] + } + default: + if strings.Contains(parts[2], " ") { + return strings.Join(parts[:2], "/"), strings.Join(parts[2:], "/") + } + if errorNameLikeGigabitRe.MatchString(str) { + return strings.Join(parts[:3], "/"), strings.Join(parts[3:], "/") + } + } + return strings.Join(parts[:len(parts)-1], "/"), parts[len(parts)-1] +} diff --git a/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls_test.go b/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls_test.go new file mode 100644 index 0000000000..dda265d1dc --- /dev/null +++ b/plugins/telemetry/vppcalls/vpp1908/telemetry_vppcalls_test.go @@ -0,0 +1,550 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "context" + "testing" + + . "github.com/onsi/gomega" + + "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls" + "github.com/ligato/vpp-agent/plugins/telemetry/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" +) + +func TestGetBuffers(t *testing.T) { + ctx, handler := testSetup(t) + defer ctx.TeardownTestCtx() + + const reply = `Pool Name Index NUMA Size Data Size Total Avail Cached Used +default-numa-0 0 0 2304 2048 17290 17290 0 0 ` + ctx.MockVpp.MockReply(&vpe.CliInbandReply{ + Reply: reply, + }) + + info, err := handler.GetBuffersInfo(context.TODO()) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(info.Items).To(HaveLen(1)) + Expect(info.Items[0]).To(Equal(vppcalls.BuffersItem{ + //ThreadID: 0, + Name: "default-numa-0", + Index: 0, + Size: 2304, + Alloc: 0, + Free: 17290, + //NumAlloc: 256, + //NumFree: 19, + })) + /*Expect(info.Items[1]).To(Equal(vppcalls.BuffersItem{ + ThreadID: 0, + Name: "lacp-ethernet", + Index: 1, + Size: 256, + Alloc: 1130000, + Free: 27000, + NumAlloc: 512, + NumFree: 12, + })) + Expect(info.Items[2]).To(Equal(vppcalls.BuffersItem{ + ThreadID: 0, + Name: "marker-ethernet", + Index: 2, + Size: 256, + Alloc: 1110000000, + Free: 0, + NumAlloc: 0, + NumFree: 0, + }))*/ +} + +func TestGetRuntime(t *testing.T) { + tests := []struct { + name string + reply string + threadCount int + itemCount int + itemIdx int + item vppcalls.RuntimeItem + }{ + { + name: "19.08", + reply: `Time 84714.7, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 + vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 + Name State Calls Vectors Suspends Clocks Vectors/Call +acl-plugin-fa-cleaner-process event wait 6 5 1 1.10e4 0.00 +api-rx-from-ring active 0 0 7870 8.63e5 0.00 +avf-process event wait 0 0 1 4.53e3 0.00 +bfd-process event wait 0 0 1 7.01e3 0.00 +bond-process event wait 0 0 1 2.95e3 0.00 +cdp-process any wait 0 0 1 5.46e3 0.00 +dhcp-client-process any wait 0 0 847 6.63e3 0.00 +dhcp6-client-cp-process any wait 0 0 1 1.52e3 0.00 +dhcp6-pd-client-cp-process any wait 0 0 1 1.71e3 0.00 +dhcp6-pd-reply-publisher-proce event wait 0 0 1 9.73e2 0.00 +dhcp6-reply-publisher-process event wait 0 0 1 9.12e2 0.00 +dns-resolver-process any wait 0 0 85 8.98e3 0.00 +fib-walk any wait 0 0 42247 1.08e4 0.00 +flow-report-process any wait 0 0 1 1.33e3 0.00 +flowprobe-timer-process any wait 0 0 1 5.18e3 0.00 +gbp-scanner event wait 0 0 1 5.17e3 0.00 +igmp-timer-process event wait 0 0 1 6.53e3 0.00 +ikev2-manager-process any wait 0 0 84353 7.84e3 0.00 +ioam-export-process any wait 0 0 1 1.64e3 0.00 +ip-neighbor-scan-process any wait 0 0 1412 9.65e3 0.00 +ip-route-resolver-process any wait 0 0 847 6.12e3 0.00 +ip4-reassembly-expire-walk any wait 0 0 8464 6.92e3 0.00 +ip6-icmp-neighbor-discovery-ev any wait 0 0 84353 8.58e3 0.00 +ip6-reassembly-expire-walk any wait 0 0 8464 6.67e3 0.00 +l2fib-mac-age-scanner-process event wait 0 0 1 1.98e3 0.00 +lacp-process event wait 0 0 1 1.58e5 0.00 +lisp-retry-service any wait 0 0 42247 1.08e4 0.00 +lldp-process event wait 0 0 1 8.76e4 0.00 +memif-process event wait 0 0 1 9.34e3 0.00 +nat-det-expire-walk done 1 0 0 2.92e3 0.00 +nat-ha-process event wait 0 0 1 4.12e3 0.00 +nat64-expire-walk event wait 0 0 1 2.41e3 0.00 +nsh-md2-ioam-export-process any wait 0 0 1 1.10e4 0.00 +perfmon-periodic-process event wait 0 0 1 3.61e7 0.00 +rd-cp-process any wait 0 0 1 1.55e3 0.00 +send-dhcp6-client-message-proc any wait 0 0 1 2.22e3 0.00 +send-dhcp6-pd-client-message-p any wait 0 0 1 1.43e3 0.00 +send-rs-process any wait 0 0 1 1.49e3 0.00 +startup-config-process done 1 0 1 5.68e3 0.00 +statseg-collector-process time wait 0 0 8464 2.79e5 0.00 +udp-ping-process any wait 0 0 1 6.96e3 0.00 +unix-cli-127.0.0.1:mdns done 2 0 4 2.14e9 0.00 +unix-epoll-input polling 20325059 0 0 1.13e7 0.00 +vhost-user-process any wait 0 0 1 3.73e3 0.00 +vhost-user-send-interrupt-proc any wait 0 0 1 1.28e3 0.00 +vpe-link-state-process event wait 0 0 1 9.63e2 0.00 +vpe-oam-process any wait 0 0 41419 9.59e3 0.00 +vxlan-gpe-ioam-export-process any wait 0 0 1 1.60e3 0.00 +wildcard-ip4-arp-publisher-pro event wait 0 0 1 1.44e3 0.00 +`, + threadCount: 1, + itemCount: 49, + item: vppcalls.RuntimeItem{ + Name: "acl-plugin-fa-cleaner-process", + State: "event wait", + Calls: 6, + Vectors: 5, + Suspends: 1, + Clocks: 1.10e4, + VectorsPerCall: 0, + }, + }, + { + name: "one thread", + reply: `Time 3151.2, average vectors/node 1.00, last 128 main loops 0.00 per node 0.00 + vector rates in 2.8561e-3, out 0.0000e0, drop 4.4428e-3, punt 0.0000e0 + Name State Calls Vectors Suspends Clocks Vectors/Call Perf Ticks +acl-plugin-fa-cleaner-process event wait 0 0 1 5.14e3 0.00 +af-packet-input interrupt wa 9 9 0 1.55e5 1.00 +api-rx-from-ring any wait 0 0 4735 4.72e6 0.00 +avf-process event wait 0 0 1 4.52e3 0.00 +bfd-process event wait 0 0 1 6.59e3 0.00 +bond-process event wait 0 0 1 2.07e3 0.00 +cdp-process any wait 0 0 1 4.43e3 0.00 +dhcp-client-process any wait 0 0 32 8.73e3 0.00 +dhcp6-client-cp-process any wait 0 0 1 1.94e3 0.00 +dhcp6-pd-client-cp-process any wait 0 0 1 1.73e3 0.00 +dhcp6-pd-reply-publisher-proce event wait 0 0 1 1.01e3 0.00 +dhcp6-reply-publisher-process event wait 0 0 1 8.75e2 0.00 +dns-resolver-process any wait 0 0 4 2.11e4 0.00 +error-drop active 14 14 0 1.29e5 1.00 +ethernet-input active 9 9 0 6.41e5 1.00 +fib-walk any wait 0 0 1571 2.12e4 0.00 +flow-report-process any wait 0 0 1 1.13e3 0.00 +flowprobe-timer-process any wait 0 0 1 5.27e3 0.00 +gbp-scanner event wait 0 0 1 5.36e3 0.00 +igmp-timer-process event wait 0 0 1 5.24e4 0.00 +ikev2-manager-process any wait 0 0 3132 1.32e4 0.00 +ioam-export-process any wait 0 0 1 1.18e3 0.00 +ip-neighbor-scan-process any wait 0 0 53 1.49e4 0.00 +ip-route-resolver-process any wait 0 0 32 5.80e3 0.00 +ip4-drop active 5 5 0 3.13e3 1.00 +ip4-local active 5 5 0 1.00e4 1.00 +ip4-lookup active 5 5 0 1.08e6 1.00 +ip4-reassembly-expire-walk any wait 0 0 315 1.27e4 0.00 +ip6-icmp-neighbor-discovery-ev any wait 0 0 3132 1.12e4 0.00 +ip6-input active 9 9 0 3.41e3 1.00 +ip6-not-enabled active 9 9 0 1.47e3 1.00 +ip6-reassembly-expire-walk any wait 0 0 315 8.52e3 0.00 +l2fib-mac-age-scanner-process event wait 0 0 1 1.18e3 0.00 +lacp-process event wait 0 0 1 1.84e5 0.00 +lisp-retry-service any wait 0 0 1571 1.49e4 0.00 +lldp-process event wait 0 0 1 5.81e5 0.00 +memif-process any wait 0 0 1168 1.11e5 0.00 +nat-det-expire-walk done 1 0 0 2.50e3 0.00 +nat64-expire-walk event wait 0 0 1 1.34e4 0.00 +nsh-md2-ioam-export-process any wait 0 0 1 7.89e3 0.00 +perfmon-periodic-process event wait 0 0 1 1.18e8 0.00 +rd-cp-process any wait 0 0 1 1.52e3 0.00 +send-dhcp6-client-message-proc any wait 0 0 1 1.56e3 0.00 +send-dhcp6-pd-client-message-p any wait 0 0 1 1.53e3 0.00 +send-rs-process any wait 0 0 1 1.69e3 0.00 +startup-config-process done 1 0 1 6.13e3 0.00 +statseg-collector-process time wait 0 0 315 3.77e5 0.00 +udp-ping-process any wait 0 0 1 1.62e4 0.00 +unix-cli-127.0.0.1:39670 event wait 0 0 103 2.26e7 0.00 +unix-cli-127.0.0.1:40652 active 1 0 3 4.64e9 0.00 +unix-epoll-input polling 1698354 0 0 5.00e6 0.00 +vhost-user-process any wait 0 0 1 5.29e3 0.00 +vhost-user-send-interrupt-proc any wait 0 0 1 1.88e3 0.00 +vpe-link-state-process event wait 0 0 15 2.33e4 0.00 +vpe-oam-process any wait 0 0 1540 1.21e4 0.00 +vxlan-gpe-ioam-export-process any wait 0 0 1 1.38e3 0.00 +wildcard-ip4-arp-publisher-pro event wait 0 0 1 2.24e3 0.00 +`, + threadCount: 1, + itemCount: 57, + itemIdx: 1, + item: vppcalls.RuntimeItem{ + Name: "af-packet-input", + State: "interrupt wa", + Calls: 9, + Vectors: 9, + Suspends: 0, + Clocks: 1.55e5, + VectorsPerCall: 1, + }, + }, + { + name: "three threads", + reply: `Thread 0 vpp_main (lcore 0) +Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 + vector rates in 0.0000e0, out 5.0000e-2, drop 0.0000e0, punt 0.0000e0 + Name State Calls Vectors Suspends Clocks Vectors/Call +acl-plugin-fa-cleaner-process event wait 6 5 1 3.12e4 0.00 +api-rx-from-ring any wait 0 0 31 8.61e6 0.00 +avf-process event wait 0 0 1 7.79e3 0.00 +bfd-process event wait 0 0 1 6.80e3 0.00 +cdp-process any wait 0 0 1 1.78e8 0.00 +dhcp-client-process any wait 0 0 1 2.59e3 0.00 +dns-resolver-process any wait 0 0 1 3.35e3 0.00 +fib-walk any wait 0 0 11 1.08e4 0.00 +flow-report-process any wait 0 0 1 1.64e3 0.00 +flowprobe-timer-process any wait 0 0 1 1.16e4 0.00 +igmp-timer-process event wait 0 0 1 1.81e4 0.00 +ikev2-manager-process any wait 0 0 22 5.47e3 0.00 +ioam-export-process any wait 0 0 1 3.26e3 0.00 +ip-route-resolver-process any wait 0 0 1 1.69e3 0.00 +ip4-reassembly-expire-walk any wait 0 0 3 4.27e3 0.00 +ip6-icmp-neighbor-discovery-ev any wait 0 0 22 4.48e3 0.00 +ip6-reassembly-expire-walk any wait 0 0 3 6.88e3 0.00 +l2fib-mac-age-scanner-process event wait 0 0 1 3.94e3 0.00 +lacp-process event wait 0 0 1 1.35e8 0.00 +lisp-retry-service any wait 0 0 11 9.68e3 0.00 +lldp-process event wait 0 0 1 1.49e8 0.00 +memif-process event wait 0 0 1 2.67e4 0.00 +nat-det-expire-walk done 1 0 0 5.42e3 0.00 +nat64-expire-walk event wait 0 0 1 5.87e4 0.00 +rd-cp-process any wait 0 0 614363 3.93e2 0.00 +send-rs-process any wait 0 0 1 3.22e3 0.00 +startup-config-process done 1 0 1 1.33e4 0.00 +udp-ping-process any wait 0 0 1 3.69e4 0.00 +unix-cli-127.0.0.1:38448 active 0 0 23 6.72e7 0.00 +unix-epoll-input polling 8550283 0 0 3.77e3 0.00 +vhost-user-process any wait 0 0 1 2.48e3 0.00 +vhost-user-send-interrupt-proc any wait 0 0 1 1.43e3 0.00 +vpe-link-state-process event wait 0 0 1 1.58e3 0.00 +vpe-oam-process any wait 0 0 11 9.20e3 0.00 +vxlan-gpe-ioam-export-process any wait 0 0 1 1.59e4 0.00 +wildcard-ip4-arp-publisher-pro event wait 0 0 1 1.03e4 0.00 +--------------- +Thread 1 vpp_wk_0 (lcore 1) +Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 + vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 + Name State Calls Vectors Suspends Clocks Vectors/Call +unix-epoll-input polling 15251181 0 0 3.67e3 0.00 +--------------- +Thread 2 vpp_wk_1 (lcore 2) +Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 + vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 + Name State Calls Vectors Suspends Clocks Vectors/Call +unix-epoll-input polling 20563870 0 0 3.56e3 0.00 +`, + threadCount: 3, + itemCount: 36, + item: vppcalls.RuntimeItem{ + Name: "acl-plugin-fa-cleaner-process", + State: "event wait", + Calls: 6, + Vectors: 5, + Suspends: 1, + Clocks: 3.12e4, + VectorsPerCall: 0, + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ctx, handler := testSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vpe.CliInbandReply{Reply: test.reply}) + + info, err := handler.GetRuntimeInfo(context.TODO()) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(len(info.Threads)).To(Equal(test.threadCount)) + Expect(info.Threads[0].Items).To(HaveLen(test.itemCount)) + Expect(info.Threads[0].Items[test.itemIdx]).To(Equal(test.item)) + }) + } +} + +func TestGetMemory(t *testing.T) { + tests := []struct { + name string + reply string + threadCount int + threadIdx int + thread vppcalls.MemoryThread + }{ + { + name: "single", + reply: `Thread 0 vpp_main + virtual memory start 0x7f60d0ee7000, size 1048640k, 262160 pages, page size 4k + numa 0: 5677 pages, 22708k + not mapped: 256483 pages, 1025932k + total: 1.00G, used: 19.18M, free: 1004.88M, trimmable: 1004.87M +no traced allocations +`, + threadCount: 1, + threadIdx: 0, + thread: vppcalls.MemoryThread{ + ID: 0, + Name: "vpp_main", + Size: 1048.64e6, + Pages: 262160, + PageSize: 4000, + Used: 19.18e6, + Total: 1e9, + Free: 1004.88e6, + Reclaimed: 1004.87e6, + }, + }, + { + name: "unknown", + reply: `Thread 0 vpp_main + virtual memory start 0x7f60d0ee7000, size 1048640k, 262160 pages, page size 4k + numa 0: 5677 pages, 22708k + not mapped: 256483 pages, 1025932k + unknown: 368 pages, 1472k + total: 1.00G, used: 19.18M, free: 1004.88M, trimmable: 1004.87M +no traced allocations +`, + threadCount: 1, + threadIdx: 0, + thread: vppcalls.MemoryThread{ + ID: 0, + Name: "vpp_main", + Size: 1048.64e6, + Pages: 262160, + PageSize: 4000, + Used: 19.18e6, + Total: 1e9, + Free: 1004.88e6, + Reclaimed: 1004.87e6, + }, + }, + { + name: "3 workers", + reply: `Thread 0 vpp_main + virtual memory start 0x7f1fb0e0f000, size 1048640k, 262160 pages, page size 4k + numa 0: 5587 pages, 22348k + not mapped: 256573 pages, 1026292k + total: 1.00G, used: 24.33M, free: 999.73M, trimmable: 996.12M +no traced allocations + + +Thread 1 vpp_wk_0 + virtual memory start 0x7f1fb0e0f000, size 1048640k, 262160 pages, page size 4k + numa 0: 5587 pages, 22348k + not mapped: 256573 pages, 1026292k + total: 1.00G, used: 24.33M, free: 999.73M, trimmable: 996.12M +no traced allocations + + +Thread 2 vpp_wk_1 + virtual memory start 0x7f1fb0e0f000, size 1048640k, 262160 pages, page size 4k + numa 0: 5587 pages, 22348k + not mapped: 256573 pages, 1026292k + total: 1.00G, used: 24.33M, free: 999.73M, trimmable: 996.12M +no traced allocations + + +Thread 3 vpp_wk_2 + virtual memory start 0x7f1fb0e0f000, size 1048640k, 262160 pages, page size 4k + numa 0: 5587 pages, 22348k + not mapped: 256573 pages, 1026292k + total: 1.00G, used: 24.33M, free: 999.73M, trimmable: 996.12M +no traced allocations +`, + threadCount: 4, + threadIdx: 1, + thread: vppcalls.MemoryThread{ + ID: 1, + Name: "vpp_wk_0", + Size: 1048.64e6, + Pages: 262160, + PageSize: 4000, + Used: 24.33e6, + Total: 1e9, + Free: 999.73e6, + Reclaimed: 996.12e6, + }, + }, + { + name: "19.08 update", + reply: `Thread 0 vpp_main + virtual memory start 0x7ff41b3ca000, size 1048640k, 262160 pages, page size 4k + page information not available (errno 1) + total: 1.00G, used: 19.81M, free: 1004.25M, trimmable: 1004.24M +`, + threadCount: 1, + threadIdx: 0, + thread: vppcalls.MemoryThread{ + ID: 0, + Name: "vpp_main", + Size: 1048.64e6, + Pages: 262160, + PageSize: 4000, + Used: 19.81e6, + Total: 1e9, + Free: 1004.25e6, + Reclaimed: 1004.24e6, + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ctx, handler := testSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vpe.CliInbandReply{Reply: test.reply}) + + info, err := handler.GetMemory(context.TODO()) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(info.Threads).To(HaveLen(test.threadCount)) + Expect(info.Threads[test.threadIdx]).To(Equal(test.thread)) + }) + } +} + +func TestGetNodeCounters(t *testing.T) { + ctx, handler := testSetup(t) + defer ctx.TeardownTestCtx() + + const reply = ` Count Node Reason + 32 ipsec-output-ip4 IPSec policy protect + 32 esp-encrypt ESP pkts received + 64 ipsec-input-ip4 IPSEC pkts received + 32 ip4-icmp-input unknown type + 32 ip4-icmp-input echo replies sent + 14 ethernet-input l3 mac mismatch + 1 arp-input ARP replies sent + 4 ip4-input ip4 spoofed local-address packet drops + 2 memif1/1-output interface is down + 1 cdp-input good cdp packets (processed) +` + ctx.MockVpp.MockReply(&vpe.CliInbandReply{ + Reply: reply, + }) + + info, err := handler.GetNodeCounters(context.TODO()) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(info.Counters).To(HaveLen(10)) + Expect(info.Counters[0]).To(Equal(vppcalls.NodeCounter{ + Value: 32, + Node: "ipsec-output-ip4", + Name: "IPSec policy protect", + })) + Expect(info.Counters[6]).To(Equal(vppcalls.NodeCounter{ + Value: 1, + Node: "arp-input", + Name: "ARP replies sent", + })) + Expect(info.Counters[7]).To(Equal(vppcalls.NodeCounter{ + Value: 4, + Node: "ip4-input", + Name: "ip4 spoofed local-address packet drops", + })) + Expect(info.Counters[8]).To(Equal(vppcalls.NodeCounter{ + Value: 2, + Node: "memif1/1-output", + Name: "interface is down", + })) + Expect(info.Counters[9]).To(Equal(vppcalls.NodeCounter{ + Value: 1, + Node: "cdp-input", + Name: "good cdp packets (processed)", + })) + + /*Expect(info.Counters[0]).To(Equal(vppcalls.NodeCounter{ + Value: 32, + Name: "ipsec-output-ip4/IPSec policy protect", + })) + Expect(info.Counters[6]).To(Equal(vppcalls.NodeCounter{ + Value: 1, + Name: "arp-input/ARP replies sent", + })) + Expect(info.Counters[7]).To(Equal(vppcalls.NodeCounter{ + Value: 4, + Name: "ip4-input/ip4 spoofed local-address packet drops", + })) + Expect(info.Counters[8]).To(Equal(vppcalls.NodeCounter{ + Value: 2, + Name: "memif1/1-output/interface is down", + })) + Expect(info.Counters[9]).To(Equal(vppcalls.NodeCounter{ + Value: 1, + Name: "cdp-input/good cdp packets (processed)", + }))*/ +} + +func testSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.TelemetryVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + handler := vpp1908.NewTelemetryVppHandler(ctx.MockChannel, nil) + return ctx, handler +} + +func TestSplitErrorName(t *testing.T) { + tests := []struct { + name string + input string + expNode, expReason string + }{ + {"basic", "ipsec-input-ip4/IPSEC pkts received", "ipsec-input-ip4", "IPSEC pkts received"}, + {"ifname", "memif1/1001-output/interface is down", "memif1/1001-output", "interface is down"}, + {"reslash", "tcp6-input/inconsistent ip/tcp lengths", "tcp6-input", "inconsistent ip/tcp lengths"}, + {"toomany", "memif1/1001-output/Unrecognized / unknown chunk or chunk-state mismatch", "memif1/1001-output", "Unrecognized / unknown chunk or chunk-state mismatch"}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + RegisterTestingT(t) + + node, reason := vpp1908.SplitErrorName(test.input) + Expect(node).To(Equal(test.expNode)) + Expect(reason).To(Equal(test.expReason)) + }) + } +} diff --git a/plugins/telemetry/vppcalls/vppcalls_api.go b/plugins/telemetry/vppcalls/vppcalls_api.go index 7f0b7ce563..ead710f2e7 100644 --- a/plugins/telemetry/vppcalls/vppcalls_api.go +++ b/plugins/telemetry/vppcalls/vppcalls_api.go @@ -19,7 +19,8 @@ import ( govppapi "git.fd.io/govpp.git/api" log "github.com/ligato/cn-infra/logging" - "github.com/ligato/vpp-agent/plugins/govppmux" + + "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" ) var Versions = map[string]HandlerVersion{} @@ -35,6 +36,7 @@ type TelemetryVppAPI interface { GetNodeCounters(context.Context) (*NodeCounterInfo, error) GetRuntimeInfo(context.Context) (*RuntimeInfo, error) GetBuffersInfo(context.Context) (*BuffersInfo, error) + GetInterfaceStats(context.Context) (*govppapi.InterfaceStats, error) } // MemoryInfo contains values returned from 'show memory' @@ -42,6 +44,14 @@ type MemoryInfo struct { Threads []MemoryThread `json:"threads"` } +// GetThreads is safe getter for threads, +func (i *MemoryInfo) GetThreads() []MemoryThread { + if i == nil { + return nil + } + return i.Threads +} + // MemoryThread represents single thread memory counters type MemoryThread struct { ID uint `json:"id"` @@ -62,6 +72,14 @@ type NodeCounterInfo struct { Counters []NodeCounter `json:"counters"` } +// GetCounters is safe getter for counters, +func (i *NodeCounterInfo) GetCounters() []NodeCounter { + if i == nil { + return nil + } + return i.Counters +} + // NodeCounter represents single node counter type NodeCounter struct { Value uint64 `json:"value"` @@ -74,6 +92,14 @@ type RuntimeInfo struct { Threads []RuntimeThread `json:"threads"` } +// GetThreads is safe getter for threads, +func (i *RuntimeInfo) GetThreads() []RuntimeThread { + if i == nil { + return nil + } + return i.Threads +} + // RuntimeThread represents single runtime thread type RuntimeThread struct { ID uint `json:"id"` @@ -107,6 +133,14 @@ type BuffersInfo struct { Items []BuffersItem `json:"items"` } +// GetItems is safe getter for items, +func (i *BuffersInfo) GetItems() []BuffersItem { + if i == nil { + return nil + } + return i.Items +} + // BuffersItem represents single buffers item type BuffersItem struct { ThreadID uint `json:"thread_id"` @@ -119,19 +153,20 @@ type BuffersItem struct { NumFree uint64 `json:"num_free"` } -func CompatibleTelemetryHandler(ch govppapi.Channel, vpp govppmux.StatsAPI) TelemetryVppAPI { - status, err := vpp.VPPInfo() +func CompatibleTelemetryHandler(ch govppapi.Channel, vpp govppapi.StatsProvider) TelemetryVppAPI { + vpe := vppcalls.CompatibleVpeHandler(ch) + info, err := vpe.GetVersionInfo() if err != nil { - log.Warnf("retrieving VPP status failed: %v", err) + log.Warnf("retrieving VPP info failed: %v", err) return nil } - if status.Connected { - ver := status.GetReleaseVersion() + if ver := info.Release(); ver != "" { + log.Debug("telemetry checking release: ", ver) if h, ok := Versions[ver]; ok { if err := ch.CheckCompatiblity(h.Msgs...); err != nil { - log.Debugf("version %s not compatible", ver) + log.Debugf("telemetry version %s not compatible: %v", ver, err) } - log.Debug("found compatible version: ", ver) + log.Debug("telemetry found compatible release: ", ver) return h.New(ch, vpp) } } diff --git a/plugins/vpp/abfplugin/abfplugin.go b/plugins/vpp/abfplugin/abfplugin.go index 38bbdf6e3a..3656c66a91 100644 --- a/plugins/vpp/abfplugin/abfplugin.go +++ b/plugins/vpp/abfplugin/abfplugin.go @@ -31,6 +31,7 @@ import ( _ "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls/vpp1908" ) // ABFPlugin is a plugin that manages ACL-based forwarding. @@ -38,8 +39,7 @@ type ABFPlugin struct { Deps // GoVPP channels - vppCh govppapi.Channel - dumpVppCh govppapi.Channel + vppCh govppapi.Channel abfHandler vppcalls.ABFVppAPI abfDescriptor *descriptor.ABFDescriptor @@ -67,12 +67,9 @@ func (p *ABFPlugin) Init() error { if p.vppCh, err = p.GoVppmux.NewAPIChannel(); err != nil { return errors.Errorf("failed to create GoVPP API channel: %v", err) } - if p.dumpVppCh, err = p.GoVppmux.NewAPIChannel(); err != nil { - return errors.Errorf("failed to create GoVPP API dump channel: %v", err) - } // init handler - p.abfHandler = vppcalls.CompatibleABFVppHandler(p.vppCh, p.dumpVppCh, p.ACLPlugin.GetACLIndex(), p.IfPlugin.GetInterfaceIndex(), p.Log) + p.abfHandler = vppcalls.CompatibleABFVppHandler(p.vppCh, p.ACLPlugin.GetACLIndex(), p.IfPlugin.GetInterfaceIndex(), p.Log) if p.abfHandler == nil { return errors.New("abfHandler is not available") } diff --git a/plugins/vpp/abfplugin/vppcalls/abf_vppcalls.go b/plugins/vpp/abfplugin/vppcalls/abf_vppcalls.go index 200e9968ba..20edffce86 100644 --- a/plugins/vpp/abfplugin/vppcalls/abf_vppcalls.go +++ b/plugins/vpp/abfplugin/vppcalls/abf_vppcalls.go @@ -63,10 +63,10 @@ var Versions = map[string]HandlerVersion{} type HandlerVersion struct { Msgs []govppapi.Message - New func(govppapi.Channel, aclidx.ACLMetadataIndex, ifaceidx.IfaceMetadataIndex) ABFVppAPI + New func(govppapi.Channel, aclidx.ACLMetadataIndex, ifaceidx.IfaceMetadataIndex, logging.Logger) ABFVppAPI } -func CompatibleABFVppHandler(ch, dch govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) ABFVppAPI { +func CompatibleABFVppHandler(ch govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) ABFVppAPI { if len(Versions) == 0 { // abfplugin is not loaded return nil @@ -77,7 +77,7 @@ func CompatibleABFVppHandler(ch, dch govppapi.Channel, aclIdx aclidx.ACLMetadata continue } log.Debug("found compatible version:", ver) - return h.New(ch, aclIdx, ifIdx) + return h.New(ch, aclIdx, ifIdx, log) } panic("no compatible version available") } diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1901/abf_vppcalls_test.go b/plugins/vpp/abfplugin/vppcalls/vpp1901/abf_vppcalls_test.go index d495d4e75d..7f57095e02 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1901/abf_vppcalls_test.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1901/abf_vppcalls_test.go @@ -19,13 +19,14 @@ import ( "testing" "github.com/ligato/cn-infra/logging/logrus" - "github.com/ligato/vpp-agent/api/models/vpp/abf" + . "github.com/onsi/gomega" + + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/abf" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" - . "github.com/onsi/gomega" ) func TestGetABFVersion(t *testing.T) { @@ -270,6 +271,6 @@ func abfTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.ABFVppAPI, iface log := logrus.NewLogger("test-log") aclIdx := aclidx.NewACLIndex(log, "acl-index") ifIdx := ifaceidx.NewIfaceIndex(log, "if-index") - abfHandler := NewABFVppHandler(ctx.MockChannel, nil, aclIdx, ifIdx) + abfHandler := NewABFVppHandler(ctx.MockChannel, aclIdx, ifIdx, log) return ctx, abfHandler, ifIdx } diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1901/dump_abf_vppcalls.go b/plugins/vpp/abfplugin/vppcalls/vpp1901/dump_abf_vppcalls.go index 10e9dcc1d8..dfe7779d20 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1901/dump_abf_vppcalls.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1901/dump_abf_vppcalls.go @@ -55,7 +55,7 @@ func (h *ABFVppHandler) dumpABFInterfaces() (map[uint32][]*vpp_abf.ABF_AttachedI abfIfs := make(map[uint32][]*vpp_abf.ABF_AttachedInterface) req := &abf.AbfItfAttachDump{} - reqCtx := h.dumpChannel.SendMultiRequest(req) + reqCtx := h.callsChannel.SendMultiRequest(req) for { reply := &abf.AbfItfAttachDetails{} @@ -93,7 +93,7 @@ func (h *ABFVppHandler) dumpABFInterfaces() (map[uint32][]*vpp_abf.ABF_AttachedI func (h *ABFVppHandler) dumpABFPolicy() ([]*vppcalls.ABFDetails, error) { var abfs []*vppcalls.ABFDetails req := &abf.AbfPolicyDump{} - reqCtx := h.dumpChannel.SendMultiRequest(req) + reqCtx := h.callsChannel.SendMultiRequest(req) for { reply := &abf.AbfPolicyDetails{} diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1901/vppcalls_handlers.go b/plugins/vpp/abfplugin/vppcalls/vpp1901/vppcalls_handlers.go index dcffae0e21..c00b8e4ef8 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1901/vppcalls_handlers.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1901/vppcalls_handlers.go @@ -16,39 +16,40 @@ package vpp1901 import ( govppapi "git.fd.io/govpp.git/api" - "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" + "github.com/ligato/cn-infra/logging" "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/abf" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" ) func init() { var msgs []govppapi.Message - msgs = append(msgs, abf.Messages...) + msgs = append(msgs, abf.AllMessages()...) vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ Msgs: msgs, - New: func(ch govppapi.Channel, aclIndexes aclidx.ACLMetadataIndex, ifIndexes ifaceidx.IfaceMetadataIndex) vppcalls.ABFVppAPI { - return &ABFVppHandler{ - callsChannel: ch, - dumpChannel: ch, - aclIndexes: aclIndexes, - ifIndexes: ifIndexes, - } + New: func(ch govppapi.Channel, aclIndexes aclidx.ACLMetadataIndex, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) vppcalls.ABFVppAPI { + return NewABFVppHandler(ch, aclIndexes, ifIndexes, log) }, } } -// ABFVppHandler is accessor for abfrelated vppcalls methods +// ABFVppHandler is accessor for abf-related vppcalls methods type ABFVppHandler struct { callsChannel govppapi.Channel - dumpChannel govppapi.Channel aclIndexes aclidx.ACLMetadataIndex ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger } // NewABFVppHandler returns new ABFVppHandler. -func NewABFVppHandler(calls, dump govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex) *ABFVppHandler { - return &ABFVppHandler{calls, dump, aclIdx, ifIdx} +func NewABFVppHandler(calls govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *ABFVppHandler { + return &ABFVppHandler{ + callsChannel: calls, + aclIndexes: aclIdx, + ifIndexes: ifIdx, + log: log, + } } diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1904/abf_vppcalls_test.go b/plugins/vpp/abfplugin/vppcalls/vpp1904/abf_vppcalls_test.go index 9d01a2d64d..ab2ec1ca8f 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1904/abf_vppcalls_test.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1904/abf_vppcalls_test.go @@ -19,13 +19,14 @@ import ( "testing" "github.com/ligato/cn-infra/logging/logrus" - "github.com/ligato/vpp-agent/api/models/vpp/abf" + . "github.com/onsi/gomega" + + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/abf" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" - . "github.com/onsi/gomega" ) func TestGetABFVersion(t *testing.T) { @@ -270,6 +271,6 @@ func abfTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.ABFVppAPI, iface log := logrus.NewLogger("test-log") aclIdx := aclidx.NewACLIndex(log, "acl-index") ifIdx := ifaceidx.NewIfaceIndex(log, "if-index") - abfHandler := NewABFVppHandler(ctx.MockChannel, nil, aclIdx, ifIdx) + abfHandler := NewABFVppHandler(ctx.MockChannel, aclIdx, ifIdx, log) return ctx, abfHandler, ifIdx } diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1904/dump_abf_vppcalls.go b/plugins/vpp/abfplugin/vppcalls/vpp1904/dump_abf_vppcalls.go index 5c24ad0b2e..c547f8ce84 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1904/dump_abf_vppcalls.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1904/dump_abf_vppcalls.go @@ -55,7 +55,7 @@ func (h *ABFVppHandler) dumpABFInterfaces() (map[uint32][]*vpp_abf.ABF_AttachedI abfIfs := make(map[uint32][]*vpp_abf.ABF_AttachedInterface) req := &abf.AbfItfAttachDump{} - reqCtx := h.dumpChannel.SendMultiRequest(req) + reqCtx := h.callsChannel.SendMultiRequest(req) for { reply := &abf.AbfItfAttachDetails{} @@ -93,7 +93,7 @@ func (h *ABFVppHandler) dumpABFInterfaces() (map[uint32][]*vpp_abf.ABF_AttachedI func (h *ABFVppHandler) dumpABFPolicy() ([]*vppcalls.ABFDetails, error) { var abfs []*vppcalls.ABFDetails req := &abf.AbfPolicyDump{} - reqCtx := h.dumpChannel.SendMultiRequest(req) + reqCtx := h.callsChannel.SendMultiRequest(req) for { reply := &abf.AbfPolicyDetails{} diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1904/vppcalls_handlers.go b/plugins/vpp/abfplugin/vppcalls/vpp1904/vppcalls_handlers.go index dbb8dc2ca1..d36ed64313 100644 --- a/plugins/vpp/abfplugin/vppcalls/vpp1904/vppcalls_handlers.go +++ b/plugins/vpp/abfplugin/vppcalls/vpp1904/vppcalls_handlers.go @@ -16,39 +16,40 @@ package vpp1904 import ( govppapi "git.fd.io/govpp.git/api" - "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" + "github.com/ligato/cn-infra/logging" "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/abf" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" ) func init() { var msgs []govppapi.Message - msgs = append(msgs, abf.Messages...) + msgs = append(msgs, abf.AllMessages()...) vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ Msgs: msgs, - New: func(ch govppapi.Channel, aclIndexes aclidx.ACLMetadataIndex, ifIndexes ifaceidx.IfaceMetadataIndex) vppcalls.ABFVppAPI { - return &ABFVppHandler{ - callsChannel: ch, - dumpChannel: ch, - aclIndexes: aclIndexes, - ifIndexes: ifIndexes, - } + New: func(ch govppapi.Channel, aclIndexes aclidx.ACLMetadataIndex, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) vppcalls.ABFVppAPI { + return NewABFVppHandler(ch, aclIndexes, ifIndexes, log) }, } } -// ABFVppHandler is accessor for abfrelated vppcalls methods +// ABFVppHandler is accessor for abf-related vppcalls methods type ABFVppHandler struct { callsChannel govppapi.Channel - dumpChannel govppapi.Channel aclIndexes aclidx.ACLMetadataIndex ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger } // NewABFVppHandler returns new ABFVppHandler. -func NewABFVppHandler(calls, dump govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex) *ABFVppHandler { - return &ABFVppHandler{calls, dump, aclIdx, ifIdx} +func NewABFVppHandler(calls govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *ABFVppHandler { + return &ABFVppHandler{ + callsChannel: calls, + aclIndexes: aclIdx, + ifIndexes: ifIdx, + log: log, + } } diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls.go b/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls.go new file mode 100644 index 0000000000..98272cebe9 --- /dev/null +++ b/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls.go @@ -0,0 +1,189 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" + + "github.com/go-errors/errors" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/abf" +) + +const ( + // NextHopViaLabelUnset constant has to be assigned into the field next hop via label + // in abf_policy_add_del binary message if next hop via label is not defined. + NextHopViaLabelUnset uint32 = 0xfffff + 1 + + // ClassifyTableIndexUnset is a default value for field classify_table_index + // in abf_policy_add_del binary message. + ClassifyTableIndexUnset = ^uint32(0) +) + +// GetAbfVersion retrieves version of the VPP ABF plugin +func (h *ABFVppHandler) GetAbfVersion() (ver string, err error) { + req := &abf.AbfPluginGetVersion{} + reply := &abf.AbfPluginGetVersionReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return "", err + } + + return fmt.Sprintf("%d.%d", reply.Major, reply.Minor), nil +} + +// AddAbfPolicy creates new ABF entry together with a list of forwarding paths +func (h *ABFVppHandler) AddAbfPolicy(policyID, aclID uint32, abfPaths []*vpp_abf.ABF_ForwardingPath) error { + if err := h.abfAddDelPolicy(policyID, aclID, abfPaths, true); err != nil { + return errors.Errorf("failed to add ABF policy %d (ACL: %v): %v", policyID, aclID, err) + } + return nil +} + +// DeleteAbfPolicy removes existing ABF entry +func (h *ABFVppHandler) DeleteAbfPolicy(policyID uint32, abfPaths []*vpp_abf.ABF_ForwardingPath) error { + if err := h.abfAddDelPolicy(policyID, 0, abfPaths, false); err != nil { + return errors.Errorf("failed to delete ABF policy %d: %v", policyID, err) + } + return nil +} + +// AbfAttachInterfaceIPv4 attaches IPv4 interface to the ABF +func (h *ABFVppHandler) AbfAttachInterfaceIPv4(policyID, ifIdx, priority uint32) error { + if err := h.abfAttachDetachInterface(policyID, ifIdx, priority, true, false); err != nil { + return errors.Errorf("failed to attach IPv4 interface %d to ABF policy %d: %v", ifIdx, policyID, err) + } + return nil +} + +// AbfDetachInterfaceIPv4 detaches IPV4 interface from the ABF +func (h *ABFVppHandler) AbfDetachInterfaceIPv4(policyID, ifIdx, priority uint32) error { + if err := h.abfAttachDetachInterface(policyID, ifIdx, priority, false, false); err != nil { + return errors.Errorf("failed to detach IPv4 interface %d from ABF policy %d: %v", ifIdx, policyID, err) + } + return nil +} + +// AbfAttachInterfaceIPv6 attaches IPv6 interface to the ABF +func (h *ABFVppHandler) AbfAttachInterfaceIPv6(policyID, ifIdx, priority uint32) error { + if err := h.abfAttachDetachInterface(policyID, ifIdx, priority, true, true); err != nil { + return errors.Errorf("failed to attach IPv6 interface %d to ABF policy %d: %v", ifIdx, policyID, err) + } + return nil +} + +// AbfDetachInterfaceIPv6 detaches IPv6 interface from the ABF +func (h *ABFVppHandler) AbfDetachInterfaceIPv6(policyID, ifIdx, priority uint32) error { + if err := h.abfAttachDetachInterface(policyID, ifIdx, priority, false, true); err != nil { + return errors.Errorf("failed to detach IPv6 interface %d from ABF policy %d: %v", ifIdx, policyID, err) + } + return nil +} + +func (h *ABFVppHandler) abfAttachDetachInterface(policyID, ifIdx, priority uint32, isAdd, isIPv6 bool) error { + req := &abf.AbfItfAttachAddDel{ + IsAdd: boolToUint(isAdd), + Attach: abf.AbfItfAttach{ + PolicyID: policyID, + SwIfIndex: ifIdx, + Priority: priority, + IsIPv6: boolToUint(isIPv6), + }, + } + reply := &abf.AbfItfAttachAddDelReply{} + + return h.callsChannel.SendRequest(req).ReceiveReply(reply) +} + +func (h *ABFVppHandler) abfAddDelPolicy(policyID, aclID uint32, abfPaths []*vpp_abf.ABF_ForwardingPath, isAdd bool) error { + req := &abf.AbfPolicyAddDel{ + IsAdd: boolToUint(isAdd), + Policy: abf.AbfPolicy{ + PolicyID: policyID, + ACLIndex: aclID, + Paths: h.toFibPaths(abfPaths), + NPaths: uint8(len(abfPaths)), + }, + } + reply := &abf.AbfPolicyAddDelReply{} + + return h.callsChannel.SendRequest(req).ReceiveReply(reply) +} + +func (h *ABFVppHandler) toFibPaths(abfPaths []*vpp_abf.ABF_ForwardingPath) (fibPaths []abf.FibPath) { + var err error + for _, abfPath := range abfPaths { + // fib path interface + ifData, exists := h.ifIndexes.LookupByName(abfPath.InterfaceName) + if !exists { + continue + } + + fibPath := abf.FibPath{ + SwIfIndex: ifData.SwIfIndex, + Weight: uint8(abfPath.Weight), + Preference: uint8(abfPath.Preference), + Type: setFibPathType(abfPath.Dvr), + } + if fibPath.Nh, fibPath.Proto, err = setFibPathNhAndProto(abfPath.NextHopIp); err != nil { + h.log.Errorf("ABF path next hop error: %v", err) + } + fibPaths = append(fibPaths, fibPath) + } + + return fibPaths +} + +// supported cases are DVR and normal +func setFibPathType(isDvr bool) abf.FibPathType { + if isDvr { + return abf.FIB_API_PATH_TYPE_DVR + } + return abf.FIB_API_PATH_TYPE_NORMAL +} + +// resolve IP address and return FIB path next hop (IP address) and IPv4/IPv6 version +func setFibPathNhAndProto(ipStr string) (nh abf.FibPathNh, proto abf.FibPathNhProto, err error) { + netIP := net.ParseIP(ipStr) + if netIP == nil { + return nh, proto, errors.Errorf("failed to parse next hop IP address %s", ipStr) + } + var au abf.AddressUnion + if ipv4 := netIP.To4(); ipv4 == nil { + var address abf.IP6Address + proto = abf.FIB_API_PATH_NH_PROTO_IP6 + copy(address[:], netIP[:]) + au.SetIP6(address) + } else { + var address abf.IP4Address + proto = abf.FIB_API_PATH_NH_PROTO_IP4 + copy(address[:], netIP[12:]) + au.SetIP4(address) + } + return abf.FibPathNh{ + Address: au, + ViaLabel: NextHopViaLabelUnset, + ClassifyTableIndex: ClassifyTableIndexUnset, + }, proto, nil +} + +func boolToUint(input bool) uint8 { + if input { + return 1 + } + return 0 +} diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls_test.go b/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls_test.go new file mode 100644 index 0000000000..464228ef15 --- /dev/null +++ b/plugins/vpp/abfplugin/vppcalls/vpp1908/abf_vppcalls_test.go @@ -0,0 +1,276 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + . "github.com/onsi/gomega" + + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" + "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/abf" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" +) + +func TestGetABFVersion(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfPluginGetVersionReply{ + Major: 1, + Minor: 0, + }) + version, err := abfHandler.GetAbfVersion() + + Expect(err).To(BeNil()) + Expect(version).To(Equal("1.0")) +} + +func TestAddABFPolicy(t *testing.T) { + ctx, abfHandler, ifIndexes := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfPolicyAddDelReply{}) + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{ + SwIfIndex: 5, + }) + ifIndexes.Put("if2", &ifaceidx.IfaceMetadata{ + SwIfIndex: 10, + }) + + err := abfHandler.AddAbfPolicy(1, 2, []*vpp_abf.ABF_ForwardingPath{ + { + InterfaceName: "if1", + NextHopIp: "10.0.0.1", + }, + { + InterfaceName: "if2", + NextHopIp: "ffff::", + }, + }) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfPolicyAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(1))) + Expect(req.Policy.PolicyID).To(Equal(uint32(1))) + Expect(req.Policy.ACLIndex).To(Equal(uint32(2))) + Expect(req.Policy.NPaths).To(Equal(uint8(2))) + Expect(req.Policy.Paths[0].SwIfIndex).To(Equal(uint32(5))) + Expect(req.Policy.Paths[0].Nh.Address.GetIP4()).To(BeEquivalentTo(abf.IP4Address([4]uint8{10, 0, 0, 1}))) + Expect(req.Policy.Paths[1].SwIfIndex).To(Equal(uint32(10))) + Expect(req.Policy.Paths[1].Nh.Address.GetIP6()).To(BeEquivalentTo(abf.IP6Address([16]uint8{255, 255}))) +} + +func TestAddABFPolicyError(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfPolicyAddDelReply{ + Retval: 1, + }) + + err := abfHandler.AddAbfPolicy(1, 2, nil) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteABFPolicy(t *testing.T) { + ctx, abfHandler, ifIndexes := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfPolicyAddDelReply{}) + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{ + SwIfIndex: 5, + }) + ifIndexes.Put("if2", &ifaceidx.IfaceMetadata{ + SwIfIndex: 10, + }) + + err := abfHandler.DeleteAbfPolicy(1, []*vpp_abf.ABF_ForwardingPath{ + { + InterfaceName: "if1", + NextHopIp: "10.0.0.1", + }, + { + InterfaceName: "if2", + NextHopIp: "ffff::", + }, + }) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfPolicyAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(0))) + Expect(req.Policy.PolicyID).To(Equal(uint32(1))) + Expect(req.Policy.NPaths).To(Equal(uint8(2))) + Expect(req.Policy.Paths[0].SwIfIndex).To(Equal(uint32(5))) + Expect(req.Policy.Paths[0].Nh.Address.XXX_UnionData[:4]).To(BeEquivalentTo(net.ParseIP("10.0.0.1").To4())) + Expect(req.Policy.Paths[1].SwIfIndex).To(Equal(uint32(10))) + Expect(req.Policy.Paths[1].Nh.Address.XXX_UnionData[:]).To(BeEquivalentTo(net.ParseIP("ffff::").To16())) +} + +func TestDeleteABFPolicyError(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfPolicyAddDelReply{ + Retval: 1, + }) + + err := abfHandler.DeleteAbfPolicy(1, nil) + + Expect(err).ToNot(BeNil()) +} + +func TestAttachABFInterfaceIPv4(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{}) + + err := abfHandler.AbfAttachInterfaceIPv4(1, 2, 3) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfItfAttachAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(1))) + Expect(req.Attach.PolicyID).To(Equal(uint32(1))) + Expect(req.Attach.SwIfIndex).To(Equal(uint32(2))) + Expect(req.Attach.Priority).To(Equal(uint32(3))) + Expect(req.Attach.IsIPv6).To(Equal(uint8(0))) +} + +func TestAttachABFInterfaceIPv4Error(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{ + Retval: -1, + }) + + err := abfHandler.AbfAttachInterfaceIPv4(1, 2, 3) + + Expect(err).ToNot(BeNil()) +} + +func TestAttachABFInterfaceIPv6(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{}) + + err := abfHandler.AbfAttachInterfaceIPv6(1, 2, 3) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfItfAttachAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(1))) + Expect(req.Attach.PolicyID).To(Equal(uint32(1))) + Expect(req.Attach.SwIfIndex).To(Equal(uint32(2))) + Expect(req.Attach.Priority).To(Equal(uint32(3))) + Expect(req.Attach.IsIPv6).To(Equal(uint8(1))) +} + +func TestAttachABFInterfaceIPv6Error(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{ + Retval: -1, + }) + + err := abfHandler.AbfAttachInterfaceIPv6(1, 2, 3) + + Expect(err).ToNot(BeNil()) +} + +func TestDetachABFInterfaceIPv4(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{}) + + err := abfHandler.AbfDetachInterfaceIPv4(1, 2, 3) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfItfAttachAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(0))) + Expect(req.Attach.PolicyID).To(Equal(uint32(1))) + Expect(req.Attach.SwIfIndex).To(Equal(uint32(2))) + Expect(req.Attach.Priority).To(Equal(uint32(3))) + Expect(req.Attach.IsIPv6).To(Equal(uint8(0))) +} + +func TestDetachABFInterfaceIPv4Error(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{ + Retval: -1, + }) + + err := abfHandler.AbfDetachInterfaceIPv4(1, 2, 3) + + Expect(err).ToNot(BeNil()) +} + +func TestDetachABFInterfaceIPv6(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{}) + + err := abfHandler.AbfDetachInterfaceIPv6(1, 2, 3) + + Expect(err).To(BeNil()) + req, ok := ctx.MockChannel.Msg.(*abf.AbfItfAttachAddDel) + Expect(ok).To(BeTrue()) + Expect(req.IsAdd).To(Equal(uint8(0))) + Expect(req.Attach.PolicyID).To(Equal(uint32(1))) + Expect(req.Attach.SwIfIndex).To(Equal(uint32(2))) + Expect(req.Attach.Priority).To(Equal(uint32(3))) + Expect(req.Attach.IsIPv6).To(Equal(uint8(1))) +} + +func TestDetachABFInterfaceIPv6Error(t *testing.T) { + ctx, abfHandler, _ := abfTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&abf.AbfItfAttachAddDelReply{ + Retval: -1, + }) + + err := abfHandler.AbfDetachInterfaceIPv6(1, 2, 3) + + Expect(err).ToNot(BeNil()) +} + +func abfTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.ABFVppAPI, ifaceidx.IfaceMetadataIndexRW) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + aclIdx := aclidx.NewACLIndex(log, "acl-index") + ifIdx := ifaceidx.NewIfaceIndex(log, "if-index") + abfHandler := NewABFVppHandler(ctx.MockChannel, aclIdx, ifIdx, log) + return ctx, abfHandler, ifIdx +} diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1908/dump_abf_vppcalls.go b/plugins/vpp/abfplugin/vppcalls/vpp1908/dump_abf_vppcalls.go new file mode 100644 index 0000000000..6fd3d91157 --- /dev/null +++ b/plugins/vpp/abfplugin/vppcalls/vpp1908/dump_abf_vppcalls.go @@ -0,0 +1,177 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + vpp_abf "github.com/ligato/vpp-agent/api/models/vpp/abf" + "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/abf" +) + +// placeholder for unknown names +const unknownName = "" + +// DumpABFPolicy retrieves VPP ABF configuration. +func (h *ABFVppHandler) DumpABFPolicy() ([]*vppcalls.ABFDetails, error) { + // retrieve ABF interfaces + attachedIfs, err := h.dumpABFInterfaces() + if err != nil { + return nil, err + } + + // retrieve ABF policy + abfPolicy, err := h.dumpABFPolicy() + if err != nil { + return nil, err + } + + // merge attached interfaces data to policy + for _, policy := range abfPolicy { + ifData, ok := attachedIfs[policy.Meta.PolicyID] + if ok { + policy.ABF.AttachedInterfaces = ifData + } + } + + return abfPolicy, nil +} + +func (h *ABFVppHandler) dumpABFInterfaces() (map[uint32][]*vpp_abf.ABF_AttachedInterface, error) { + // ABF index <-> attached interfaces + abfIfs := make(map[uint32][]*vpp_abf.ABF_AttachedInterface) + + req := &abf.AbfItfAttachDump{} + reqCtx := h.callsChannel.SendMultiRequest(req) + + for { + reply := &abf.AbfItfAttachDetails{} + last, err := reqCtx.ReceiveReply(reply) + if err != nil { + return nil, err + } + if last { + break + } + + // interface name + ifName, _, exists := h.ifIndexes.LookupBySwIfIndex(reply.Attach.SwIfIndex) + if !exists { + ifName = unknownName + } + + // attached interface entry + attached := &vpp_abf.ABF_AttachedInterface{ + InputInterface: ifName, + Priority: reply.Attach.Priority, + IsIpv6: uintToBool(reply.Attach.IsIPv6), + } + + _, ok := abfIfs[reply.Attach.PolicyID] + if !ok { + abfIfs[reply.Attach.PolicyID] = []*vpp_abf.ABF_AttachedInterface{} + } + abfIfs[reply.Attach.PolicyID] = append(abfIfs[reply.Attach.PolicyID], attached) + } + + return abfIfs, nil +} + +func (h *ABFVppHandler) dumpABFPolicy() ([]*vppcalls.ABFDetails, error) { + var abfs []*vppcalls.ABFDetails + req := &abf.AbfPolicyDump{} + reqCtx := h.callsChannel.SendMultiRequest(req) + + for { + reply := &abf.AbfPolicyDetails{} + last, err := reqCtx.ReceiveReply(reply) + if err != nil { + return nil, err + } + if last { + break + } + + // ACL name + aclName, _, exists := h.aclIndexes.LookupByIndex(reply.Policy.ACLIndex) + if !exists { + aclName = unknownName + } + + // paths + var fwdPaths []*vpp_abf.ABF_ForwardingPath + for _, path := range reply.Policy.Paths { + // interface name + ifName, _, exists := h.ifIndexes.LookupBySwIfIndex(path.SwIfIndex) + if !exists { + ifName = unknownName + } + + // base fields + fwdPath := &vpp_abf.ABF_ForwardingPath{ + NextHopIp: parseNextHopToString(path.Nh, path.Proto), + InterfaceName: ifName, + Weight: uint32(path.Weight), + Preference: uint32(path.Preference), + Dvr: isDvr(path.Type), + } + fwdPaths = append(fwdPaths, fwdPath) + } + + abfData := &vppcalls.ABFDetails{ + ABF: &vpp_abf.ABF{ + Index: reply.Policy.PolicyID, + AclName: aclName, + ForwardingPaths: fwdPaths, + }, + Meta: &vppcalls.ABFMeta{ + PolicyID: reply.Policy.PolicyID, + }, + } + + abfs = append(abfs, abfData) + } + + return abfs, nil +} + +// returns next hop IP address +func parseNextHopToString(nh abf.FibPathNh, proto abf.FibPathNhProto) string { + if proto == abf.FIB_API_PATH_NH_PROTO_IP4 { + addr := nh.Address.GetIP4() + return net.IP(addr[:]).To4().String() + } + if proto == abf.FIB_API_PATH_NH_PROTO_IP6 { + addr := nh.Address.GetIP6() + return net.IP(addr[:]).To16().String() + } + return "" +} + +// abf fib currently supports only DVR or normal mode +func isDvr(pathType abf.FibPathType) (isDvr bool) { + if pathType == abf.FIB_API_PATH_TYPE_DVR { + return true + } + return false +} + +func uintToBool(value uint8) bool { + if value == 0 { + return false + } + return true +} diff --git a/plugins/vpp/abfplugin/vppcalls/vpp1908/vppcalls_handlers.go b/plugins/vpp/abfplugin/vppcalls/vpp1908/vppcalls_handlers.go new file mode 100644 index 0000000000..3521bea928 --- /dev/null +++ b/plugins/vpp/abfplugin/vppcalls/vpp1908/vppcalls_handlers.go @@ -0,0 +1,55 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging" + + "github.com/ligato/vpp-agent/plugins/vpp/abfplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/abf" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, abf.AllMessages()...) + + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, aclIndexes aclidx.ACLMetadataIndex, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) vppcalls.ABFVppAPI { + return NewABFVppHandler(ch, aclIndexes, ifIndexes, log) + }, + } +} + +// ABFVppHandler is accessor for abf-related vppcalls methods +type ABFVppHandler struct { + callsChannel govppapi.Channel + aclIndexes aclidx.ACLMetadataIndex + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +// NewABFVppHandler returns new ABFVppHandler. +func NewABFVppHandler(calls govppapi.Channel, aclIdx aclidx.ACLMetadataIndex, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *ABFVppHandler { + return &ABFVppHandler{ + callsChannel: calls, + aclIndexes: aclIdx, + ifIndexes: ifIdx, + log: log, + } +} diff --git a/plugins/vpp/aclplugin/aclplugin.go b/plugins/vpp/aclplugin/aclplugin.go index 3bc9834e99..559a23489c 100644 --- a/plugins/vpp/aclplugin/aclplugin.go +++ b/plugins/vpp/aclplugin/aclplugin.go @@ -32,6 +32,7 @@ import ( _ "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls/vpp1908" ) // ACLPlugin is a plugin that manages ACLs. @@ -39,8 +40,7 @@ type ACLPlugin struct { Deps // GoVPP channels - vppCh govppapi.Channel - dumpVppCh govppapi.Channel + vppCh govppapi.Channel aclHandler vppcalls.ACLVppAPI aclDescriptor *descriptor.ACLDescriptor @@ -67,12 +67,9 @@ func (p *ACLPlugin) Init() error { if p.vppCh, err = p.GoVppmux.NewAPIChannel(); err != nil { return errors.Errorf("failed to create GoVPP API channel: %v", err) } - if p.dumpVppCh, err = p.GoVppmux.NewAPIChannel(); err != nil { - return errors.Errorf("failed to create GoVPP API dump channel: %v", err) - } // init handlers - p.aclHandler = vppcalls.CompatibleACLVppHandler(p.vppCh, p.dumpVppCh, p.IfPlugin.GetInterfaceIndex(), p.Log) + p.aclHandler = vppcalls.CompatibleACLVppHandler(p.vppCh, p.IfPlugin.GetInterfaceIndex(), p.Log) if p.aclHandler == nil { return errors.New("aclHandler is not available") } diff --git a/plugins/vpp/aclplugin/descriptor/adapter/acl.go b/plugins/vpp/aclplugin/descriptor/adapter/acl.go index f3f007f067..aa48c71157 100644 --- a/plugins/vpp/aclplugin/descriptor/adapter/acl.go +++ b/plugins/vpp/aclplugin/descriptor/adapter/acl.go @@ -4,9 +4,9 @@ package adapter import ( "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/api/models/vpp/acl" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/aclidx" + "github.com/ligato/vpp-agent/api/models/vpp/acl" ) ////////// type-safe key-value pair with metadata ////////// diff --git a/plugins/vpp/aclplugin/vppcalls/acl_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/acl_vppcalls.go index 03017cbff8..228190458b 100644 --- a/plugins/vpp/aclplugin/vppcalls/acl_vppcalls.go +++ b/plugins/vpp/aclplugin/vppcalls/acl_vppcalls.go @@ -82,13 +82,13 @@ type ACLVppAPI interface { AddACLToInterfaceAsIngress(aclIndex uint32, ifName string) error // AddACLToInterfaceAsEgress adds ACL (L3/L4) to single interface as egress. AddACLToInterfaceAsEgress(aclIndex uint32, ifName string) error - // AddACLToInterfaceAsIngress deletes ACL (L3/L4) from single interface as ingress. + // DeleteACLFromInterfaceAsIngress deletes ACL (L3/L4) from single interface as ingress. DeleteACLFromInterfaceAsIngress(aclIndex uint32, ifName string) error - // AddACLToInterfaceAsEgress deletes ACL (L3/L4) from single interface as egress. + // DeleteACLFromInterfaceAsEgress deletes ACL (L3/L4) from single interface as egress. DeleteACLFromInterfaceAsEgress(aclIndex uint32, ifName string) error - // AddACLToInterfaceAsIngress adds MACIP ACL (L2) to single interface. + // AddMACIPACLToInterface adds MACIP ACL (L2) to single interface. AddMACIPACLToInterface(aclIndex uint32, ifName string) error - // AddACLToInterfaceAsEgress deletes MACIP ACL (L2) from single interface. + // DeleteMACIPACLFromInterface deletes MACIP ACL (L2) from single interface. DeleteMACIPACLFromInterface(aclIndex uint32, ifName string) error } @@ -115,7 +115,7 @@ type HandlerVersion struct { New func(govppapi.Channel, ifaceidx.IfaceMetadataIndex) ACLVppAPI } -func CompatibleACLVppHandler(ch, dch govppapi.Channel, idx ifaceidx.IfaceMetadataIndex, log logging.Logger) ACLVppAPI { +func CompatibleACLVppHandler(ch govppapi.Channel, idx ifaceidx.IfaceMetadataIndex, log logging.Logger) ACLVppAPI { if len(Versions) == 0 { // aclplugin is not loaded return nil diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1901/acl_vppcalls_test.go b/plugins/vpp/aclplugin/vppcalls/vpp1901/acl_vppcalls_test.go index b49d18748a..2e9b9377b2 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1901/acl_vppcalls_test.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1901/acl_vppcalls_test.go @@ -233,7 +233,7 @@ func setupACLTest(t *testing.T) *testCtx { ctx := vppcallmock.SetupTestCtx(t) ifaceIdx := ifaceidx.NewIfaceIndex(logrus.NewLogger("test"), "test") - aclHandler := NewACLVppHandler(ctx.MockChannel, ctx.MockChannel, ifaceIdx) + aclHandler := NewACLVppHandler(ctx.MockChannel, ifaceIdx) return &testCtx{ TestCtx: ctx, diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1901/dump_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/vpp1901/dump_vppcalls.go index 43db19a50f..039c74fd82 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1901/dump_vppcalls.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1901/dump_vppcalls.go @@ -150,7 +150,7 @@ func (h *ACLVppHandler) DumpACLInterfaces(indices []uint32) (map[uint32]*acl.ACL msgIP := &acl_api.ACLInterfaceListDump{ SwIfIndex: 0xffffffff, // dump all } - reqIP := h.dumpChannel.SendMultiRequest(msgIP) + reqIP := h.callsChannel.SendMultiRequest(msgIP) for { replyIP := &acl_api.ACLInterfaceListDetails{} stop, err := reqIP.ReceiveReply(replyIP) @@ -222,7 +222,7 @@ func (h *ACLVppHandler) DumpMACIPACLInterfaces(indices []uint32) (map[uint32]*ac msgMACIP := &acl_api.MacipACLInterfaceListDump{ SwIfIndex: 0xffffffff, // dump all } - reqMACIP := h.dumpChannel.SendMultiRequest(msgMACIP) + reqMACIP := h.callsChannel.SendMultiRequest(msgMACIP) for { replyMACIP := &acl_api.MacipACLInterfaceListDetails{} stop, err := reqMACIP.ReceiveReply(replyMACIP) @@ -278,7 +278,7 @@ func (h *ACLVppHandler) DumpIPAcls() (map[vppcalls.ACLMeta][]acl_api.ACLRule, er req := &acl_api.ACLDump{ ACLIndex: 0xffffffff, } - reqContext := h.dumpChannel.SendMultiRequest(req) + reqContext := h.callsChannel.SendMultiRequest(req) for { msg := &acl_api.ACLDetails{} stop, err := reqContext.ReceiveReply(msg) @@ -307,7 +307,7 @@ func (h *ACLVppHandler) DumpMacIPAcls() (map[vppcalls.ACLMeta][]acl_api.MacipACL req := &acl_api.MacipACLDump{ ACLIndex: 0xffffffff, } - reqContext := h.dumpChannel.SendMultiRequest(req) + reqContext := h.callsChannel.SendMultiRequest(req) for { msg := &acl_api.MacipACLDetails{} stop, err := reqContext.ReceiveReply(msg) @@ -377,7 +377,7 @@ func (h *ACLVppHandler) DumpInterfaceACLList(swIndex uint32) (*acl_api.ACLInterf } reply := &acl_api.ACLInterfaceListDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -391,7 +391,7 @@ func (h *ACLVppHandler) DumpInterfaceMACIPACLList(swIndex uint32) (*acl_api.Maci } reply := &acl_api.MacipACLInterfaceListDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -404,7 +404,7 @@ func (h *ACLVppHandler) DumpInterfacesLists() ([]*acl_api.ACLInterfaceListDetail SwIfIndex: 0xffffffff, // dump all } - reqIPACL := h.dumpChannel.SendMultiRequest(msgIPACL) + reqIPACL := h.callsChannel.SendMultiRequest(msgIPACL) var IPaclInterfaces []*acl_api.ACLInterfaceListDetails for { @@ -424,7 +424,7 @@ func (h *ACLVppHandler) DumpInterfacesLists() ([]*acl_api.ACLInterfaceListDetail SwIfIndex: 0xffffffff, // dump all } - reqMACIPACL := h.dumpChannel.SendMultiRequest(msgMACIPACL) + reqMACIPACL := h.callsChannel.SendMultiRequest(msgMACIPACL) var MACIPaclInterfaces []*acl_api.MacipACLInterfaceListDetails for { @@ -464,7 +464,7 @@ func (h *ACLVppHandler) getIPACLDetails(idx uint32) (aclRule *acl.ACL, err error } reply := &acl_api.ACLDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -511,7 +511,7 @@ func (h *ACLVppHandler) getMACIPACLDetails(idx uint32) (aclRule *acl.ACL, err er } reply := &acl_api.MacipACLDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1901/vppcalls_handlers.go b/plugins/vpp/aclplugin/vppcalls/vpp1901/vppcalls_handlers.go index 60bb6cdd1e..8c0b8bd38c 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1901/vppcalls_handlers.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1901/vppcalls_handlers.go @@ -24,12 +24,12 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, acl.Messages...) + msgs = append(msgs, acl.AllMessages()...) vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ Msgs: msgs, New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) vppcalls.ACLVppAPI { - return NewACLVppHandler(ch, ch, ifIdx) + return NewACLVppHandler(ch, ifIdx) }, } } @@ -37,14 +37,12 @@ func init() { // ACLVppHandler is accessor for acl-related vppcalls methods type ACLVppHandler struct { callsChannel govppapi.Channel - dumpChannel govppapi.Channel ifIndexes ifaceidx.IfaceMetadataIndex } -func NewACLVppHandler(ch, dch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) *ACLVppHandler { +func NewACLVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) *ACLVppHandler { return &ACLVppHandler{ callsChannel: ch, - dumpChannel: dch, ifIndexes: ifIdx, } } diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1904/acl_vppcalls_test.go b/plugins/vpp/aclplugin/vppcalls/vpp1904/acl_vppcalls_test.go index 3ace0901e6..7efb48cb58 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1904/acl_vppcalls_test.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1904/acl_vppcalls_test.go @@ -233,7 +233,7 @@ func setupACLTest(t *testing.T) *testCtx { ctx := vppcallmock.SetupTestCtx(t) ifaceIdx := ifaceidx.NewIfaceIndex(logrus.NewLogger("test"), "test") - aclHandler := NewACLVppHandler(ctx.MockChannel, ctx.MockChannel, ifaceIdx) + aclHandler := NewACLVppHandler(ctx.MockChannel, ifaceIdx) return &testCtx{ TestCtx: ctx, diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1904/dump_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/vpp1904/dump_vppcalls.go index 89808bbe25..d03fb0d69d 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1904/dump_vppcalls.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1904/dump_vppcalls.go @@ -150,7 +150,7 @@ func (h *ACLVppHandler) DumpACLInterfaces(indices []uint32) (map[uint32]*acl.ACL msgIP := &acl_api.ACLInterfaceListDump{ SwIfIndex: 0xffffffff, // dump all } - reqIP := h.dumpChannel.SendMultiRequest(msgIP) + reqIP := h.callsChannel.SendMultiRequest(msgIP) for { replyIP := &acl_api.ACLInterfaceListDetails{} stop, err := reqIP.ReceiveReply(replyIP) @@ -222,7 +222,7 @@ func (h *ACLVppHandler) DumpMACIPACLInterfaces(indices []uint32) (map[uint32]*ac msgMACIP := &acl_api.MacipACLInterfaceListDump{ SwIfIndex: 0xffffffff, // dump all } - reqMACIP := h.dumpChannel.SendMultiRequest(msgMACIP) + reqMACIP := h.callsChannel.SendMultiRequest(msgMACIP) for { replyMACIP := &acl_api.MacipACLInterfaceListDetails{} stop, err := reqMACIP.ReceiveReply(replyMACIP) @@ -278,7 +278,7 @@ func (h *ACLVppHandler) DumpIPAcls() (map[vppcalls.ACLMeta][]acl_api.ACLRule, er req := &acl_api.ACLDump{ ACLIndex: 0xffffffff, } - reqContext := h.dumpChannel.SendMultiRequest(req) + reqContext := h.callsChannel.SendMultiRequest(req) for { msg := &acl_api.ACLDetails{} stop, err := reqContext.ReceiveReply(msg) @@ -307,7 +307,7 @@ func (h *ACLVppHandler) DumpMacIPAcls() (map[vppcalls.ACLMeta][]acl_api.MacipACL req := &acl_api.MacipACLDump{ ACLIndex: 0xffffffff, } - reqContext := h.dumpChannel.SendMultiRequest(req) + reqContext := h.callsChannel.SendMultiRequest(req) for { msg := &acl_api.MacipACLDetails{} stop, err := reqContext.ReceiveReply(msg) @@ -377,7 +377,7 @@ func (h *ACLVppHandler) DumpInterfaceACLList(swIndex uint32) (*acl_api.ACLInterf } reply := &acl_api.ACLInterfaceListDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -391,7 +391,7 @@ func (h *ACLVppHandler) DumpInterfaceMACIPACLList(swIndex uint32) (*acl_api.Maci } reply := &acl_api.MacipACLInterfaceListDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -404,7 +404,7 @@ func (h *ACLVppHandler) DumpInterfacesLists() ([]*acl_api.ACLInterfaceListDetail SwIfIndex: 0xffffffff, // dump all } - reqIPACL := h.dumpChannel.SendMultiRequest(msgIPACL) + reqIPACL := h.callsChannel.SendMultiRequest(msgIPACL) var IPaclInterfaces []*acl_api.ACLInterfaceListDetails for { @@ -424,7 +424,7 @@ func (h *ACLVppHandler) DumpInterfacesLists() ([]*acl_api.ACLInterfaceListDetail SwIfIndex: 0xffffffff, // dump all } - reqMACIPACL := h.dumpChannel.SendMultiRequest(msgMACIPACL) + reqMACIPACL := h.callsChannel.SendMultiRequest(msgMACIPACL) var MACIPaclInterfaces []*acl_api.MacipACLInterfaceListDetails for { @@ -464,7 +464,7 @@ func (h *ACLVppHandler) getIPACLDetails(idx uint32) (aclRule *acl.ACL, err error } reply := &acl_api.ACLDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } @@ -511,7 +511,7 @@ func (h *ACLVppHandler) getMACIPACLDetails(idx uint32) (aclRule *acl.ACL, err er } reply := &acl_api.MacipACLDetails{} - if err := h.dumpChannel.SendRequest(req).ReceiveReply(reply); err != nil { + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { return nil, err } diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1904/vppcalls_handlers.go b/plugins/vpp/aclplugin/vppcalls/vpp1904/vppcalls_handlers.go index 677fa97335..57ee22ecee 100644 --- a/plugins/vpp/aclplugin/vppcalls/vpp1904/vppcalls_handlers.go +++ b/plugins/vpp/aclplugin/vppcalls/vpp1904/vppcalls_handlers.go @@ -24,12 +24,12 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, acl.Messages...) + msgs = append(msgs, acl.AllMessages()...) vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ Msgs: msgs, New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) vppcalls.ACLVppAPI { - return NewACLVppHandler(ch, ch, ifIdx) + return NewACLVppHandler(ch, ifIdx) }, } } @@ -37,14 +37,12 @@ func init() { // ACLVppHandler is accessor for acl-related vppcalls methods type ACLVppHandler struct { callsChannel govppapi.Channel - dumpChannel govppapi.Channel ifIndexes ifaceidx.IfaceMetadataIndex } -func NewACLVppHandler(ch, dch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) *ACLVppHandler { +func NewACLVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) *ACLVppHandler { return &ACLVppHandler{ callsChannel: ch, - dumpChannel: dch, ifIndexes: ifIdx, } } diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls.go new file mode 100644 index 0000000000..d1e3736684 --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls.go @@ -0,0 +1,341 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + "strings" + + acl "github.com/ligato/vpp-agent/api/models/vpp/acl" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" + aclapi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" +) + +// AddACL implements ACL handler. +func (h *ACLVppHandler) AddACL(rules []*acl.ACL_Rule, aclName string) (uint32, error) { + // Prepare Ip rules + aclIPRules, err := transformACLIpRules(rules) + if err != nil { + return 0, err + } + if len(aclIPRules) == 0 { + return 0, fmt.Errorf("no rules found for ACL %v", aclName) + } + + req := &aclapi.ACLAddReplace{ + ACLIndex: 0xffffffff, // to make new Entry + Count: uint32(len(aclIPRules)), + Tag: []byte(aclName), + R: aclIPRules, + } + reply := &aclapi.ACLAddReplaceReply{} + + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, fmt.Errorf("failed to write ACL %v: %v", aclName, err) + } + + return reply.ACLIndex, nil +} + +// AddMACIPACL implements ACL handler. +func (h *ACLVppHandler) AddMACIPACL(rules []*acl.ACL_Rule, aclName string) (uint32, error) { + // Prepare MAc Ip rules + aclMacIPRules, err := h.transformACLMacIPRules(rules) + if err != nil { + return 0, err + } + if len(aclMacIPRules) == 0 { + return 0, fmt.Errorf("no rules found for ACL %v", aclName) + } + + req := &aclapi.MacipACLAdd{ + Count: uint32(len(aclMacIPRules)), + Tag: []byte(aclName), + R: aclMacIPRules, + } + reply := &aclapi.MacipACLAddReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, fmt.Errorf("failed to write ACL %v: %v", aclName, err) + } + + return reply.ACLIndex, nil +} + +// ModifyACL implements ACL handler. +func (h *ACLVppHandler) ModifyACL(aclIndex uint32, rules []*acl.ACL_Rule, aclName string) error { + // Prepare Ip rules + aclIPRules, err := transformACLIpRules(rules) + if err != nil { + return err + } + if len(aclIPRules) == 0 { + return nil + } + + req := &aclapi.ACLAddReplace{ + ACLIndex: aclIndex, + Count: uint32(len(aclIPRules)), + Tag: []byte(aclName), + R: aclIPRules, + } + reply := &aclapi.ACLAddReplaceReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to write ACL %v: %v", aclName, err) + } + + return nil +} + +// ModifyMACIPACL implements ACL handler. +func (h *ACLVppHandler) ModifyMACIPACL(aclIndex uint32, rules []*acl.ACL_Rule, aclName string) error { + // Prepare MAc Ip rules + aclMacIPRules, err := h.transformACLMacIPRules(rules) + if err != nil { + return err + } + if len(aclMacIPRules) == 0 { + return fmt.Errorf("no rules found for ACL %v", aclName) + } + + req := &aclapi.MacipACLAddReplace{ + ACLIndex: aclIndex, + Count: uint32(len(aclMacIPRules)), + Tag: []byte(aclName), + R: aclMacIPRules, + } + reply := &aclapi.MacipACLAddReplaceReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to write ACL %v: %v", aclName, err) + } + + return nil +} + +// DeleteACL implements ACL handler. +func (h *ACLVppHandler) DeleteACL(aclIndex uint32) error { + req := &aclapi.ACLDel{ + ACLIndex: aclIndex, + } + reply := &aclapi.ACLDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to remove L3/L4 ACL %v: %v", aclIndex, err) + } + + return nil +} + +// DeleteMACIPACL implements ACL handler. +func (h *ACLVppHandler) DeleteMACIPACL(aclIndex uint32) error { + req := &aclapi.MacipACLDel{ + ACLIndex: aclIndex, + } + reply := &aclapi.MacipACLDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to remove L2 ACL %v: %v", aclIndex, err) + } + + return nil +} + +// Method transforms provided set of IP proto ACL rules to binapi ACL rules. +func transformACLIpRules(rules []*acl.ACL_Rule) (aclIPRules []aclapi.ACLRule, err error) { + for _, rule := range rules { + aclRule := &aclapi.ACLRule{ + IsPermit: uint8(rule.Action), + } + // Match + if ipRule := rule.GetIpRule(); ipRule != nil { + // Concerned to IP rules only + // L3 + if ipRule.Ip != nil { + aclRule, err = ipACL(ipRule.Ip, aclRule) + if err != nil { + return nil, err + } + } + // ICMP/L4 + if ipRule.Icmp != nil { + aclRule = icmpACL(ipRule.Icmp, aclRule) + } else if ipRule.Tcp != nil { + aclRule = tcpACL(ipRule.Tcp, aclRule) + } else if ipRule.Udp != nil { + aclRule = udpACL(ipRule.Udp, aclRule) + } + aclIPRules = append(aclIPRules, *aclRule) + } + } + return aclIPRules, nil +} + +func (h *ACLVppHandler) transformACLMacIPRules(rules []*acl.ACL_Rule) (aclMacIPRules []aclapi.MacipACLRule, err error) { + for _, rule := range rules { + aclMacIPRule := &aclapi.MacipACLRule{ + IsPermit: uint8(rule.Action), + } + // Matche + if macIPRule := rule.GetMacipRule(); macIPRule != nil { + // Concerned to MAC IP rules only + // Source IP Address + Prefix + srcIPAddress := net.ParseIP(macIPRule.SourceAddress) + if srcIPAddress.To4() != nil { + aclMacIPRule.IsIPv6 = 0 + aclMacIPRule.SrcIPAddr = srcIPAddress.To4() + aclMacIPRule.SrcIPPrefixLen = uint8(macIPRule.SourceAddressPrefix) + } else if srcIPAddress.To16() != nil { + aclMacIPRule.IsIPv6 = 1 + aclMacIPRule.SrcIPAddr = srcIPAddress.To16() + aclMacIPRule.SrcIPPrefixLen = uint8(macIPRule.SourceAddressPrefix) + } else { + return nil, fmt.Errorf("invalid IP address %v", macIPRule.SourceAddress) + } + // MAC + mask + srcMac, err := net.ParseMAC(macIPRule.SourceMacAddress) + if err != nil { + return aclMacIPRules, err + } + srcMacMask, err := net.ParseMAC(macIPRule.SourceMacAddressMask) + if err != nil { + return aclMacIPRules, err + } + aclMacIPRule.SrcMac = srcMac + aclMacIPRule.SrcMacMask = srcMacMask + aclMacIPRules = append(aclMacIPRules, *aclMacIPRule) + } + } + return aclMacIPRules, nil +} + +// The function sets an IP ACL rule fields into provided ACL Rule object. Source +// and destination addresses have to be the same IP version and contain a network mask. +func ipACL(ipRule *acl.ACL_Rule_IpRule_Ip, aclRule *aclapi.ACLRule) (*aclapi.ACLRule, error) { + var ( + err error + srcIP net.IP + srcNetwork *net.IPNet + dstIP net.IP + dstNetwork *net.IPNet + srcMask uint8 + dstMask uint8 + ) + + if strings.TrimSpace(ipRule.SourceNetwork) != "" { + // Resolve source address + srcIP, srcNetwork, err = net.ParseCIDR(ipRule.SourceNetwork) + if err != nil { + return nil, err + } + if srcIP.To4() == nil && srcIP.To16() == nil { + return aclRule, fmt.Errorf("source address %v is invalid", ipRule.SourceNetwork) + } + maskSize, _ := srcNetwork.Mask.Size() + srcMask = uint8(maskSize) + } + + if strings.TrimSpace(ipRule.DestinationNetwork) != "" { + // Resolve destination address + dstIP, dstNetwork, err = net.ParseCIDR(ipRule.DestinationNetwork) + if err != nil { + return nil, err + } + if dstIP.To4() == nil && dstIP.To16() == nil { + return aclRule, fmt.Errorf("destination address %v is invalid", ipRule.DestinationNetwork) + } + maskSize, _ := dstNetwork.Mask.Size() + dstMask = uint8(maskSize) + } + + // Check IP version (they should be the same), beware: IPv4 address can be converted to IPv6. + if (srcIP.To4() != nil && dstIP.To4() == nil && dstIP.To16() != nil) || + (srcIP.To4() == nil && srcIP.To16() != nil && dstIP.To4() != nil) { + return aclRule, fmt.Errorf("source address %v and destionation address %v have different IP versions", + ipRule.SourceNetwork, ipRule.DestinationNetwork) + } + + if srcIP.To4() != nil || dstIP.To4() != nil { + // Ipv4 case + aclRule.IsIPv6 = 0 + aclRule.SrcIPAddr = srcIP.To4() + aclRule.SrcIPPrefixLen = srcMask + aclRule.DstIPAddr = dstIP.To4() + aclRule.DstIPPrefixLen = dstMask + } else if srcIP.To16() != nil || dstIP.To16() != nil { + // Ipv6 case + aclRule.IsIPv6 = 1 + aclRule.SrcIPAddr = srcIP.To16() + aclRule.SrcIPPrefixLen = srcMask + aclRule.DstIPAddr = dstIP.To16() + aclRule.DstIPPrefixLen = dstMask + } else { + // Both empty + aclRule.IsIPv6 = 0 + } + return aclRule, nil +} + +// The function sets an ICMP ACL rule fields into provided ACL Rule object. +// The ranges are exclusive, use first = 0 and last = 255/65535 (icmpv4/icmpv6) to match "any". +func icmpACL(icmpRule *acl.ACL_Rule_IpRule_Icmp, aclRule *aclapi.ACLRule) *aclapi.ACLRule { + if icmpRule == nil { + return aclRule + } + if icmpRule.Icmpv6 { + aclRule.Proto = vppcalls.ICMPv6Proto // IANA ICMPv6 + aclRule.IsIPv6 = 1 + // ICMPv6 type range + aclRule.SrcportOrIcmptypeFirst = uint16(icmpRule.IcmpTypeRange.First) + aclRule.SrcportOrIcmptypeLast = uint16(icmpRule.IcmpTypeRange.Last) + // ICMPv6 code range + aclRule.DstportOrIcmpcodeFirst = uint16(icmpRule.IcmpCodeRange.First) + aclRule.DstportOrIcmpcodeLast = uint16(icmpRule.IcmpCodeRange.First) + } else { + aclRule.Proto = vppcalls.ICMPv4Proto // IANA ICMPv4 + aclRule.IsIPv6 = 0 + // ICMPv4 type range + aclRule.SrcportOrIcmptypeFirst = uint16(icmpRule.IcmpTypeRange.First) + aclRule.SrcportOrIcmptypeLast = uint16(icmpRule.IcmpTypeRange.Last) + // ICMPv4 code range + aclRule.DstportOrIcmpcodeFirst = uint16(icmpRule.IcmpCodeRange.First) + aclRule.DstportOrIcmpcodeLast = uint16(icmpRule.IcmpCodeRange.Last) + } + return aclRule +} + +// Sets an TCP ACL rule fields into provided ACL Rule object. +func tcpACL(tcpRule *acl.ACL_Rule_IpRule_Tcp, aclRule *aclapi.ACLRule) *aclapi.ACLRule { + aclRule.Proto = vppcalls.TCPProto // IANA TCP + aclRule.SrcportOrIcmptypeFirst = uint16(tcpRule.SourcePortRange.LowerPort) + aclRule.SrcportOrIcmptypeLast = uint16(tcpRule.SourcePortRange.UpperPort) + aclRule.DstportOrIcmpcodeFirst = uint16(tcpRule.DestinationPortRange.LowerPort) + aclRule.DstportOrIcmpcodeLast = uint16(tcpRule.DestinationPortRange.UpperPort) + aclRule.TCPFlagsValue = uint8(tcpRule.TcpFlagsValue) + aclRule.TCPFlagsMask = uint8(tcpRule.TcpFlagsMask) + return aclRule +} + +// Sets an UDP ACL rule fields into provided ACL Rule object. +func udpACL(udpRule *acl.ACL_Rule_IpRule_Udp, aclRule *aclapi.ACLRule) *aclapi.ACLRule { + aclRule.Proto = vppcalls.UDPProto // IANA UDP + aclRule.SrcportOrIcmptypeFirst = uint16(udpRule.SourcePortRange.LowerPort) + aclRule.SrcportOrIcmptypeLast = uint16(udpRule.SourcePortRange.UpperPort) + aclRule.DstportOrIcmpcodeFirst = uint16(udpRule.DestinationPortRange.LowerPort) + aclRule.DstportOrIcmpcodeLast = uint16(udpRule.DestinationPortRange.UpperPort) + return aclRule +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls_test.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls_test.go new file mode 100644 index 0000000000..774c3c8e5f --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/acl_vppcalls_test.go @@ -0,0 +1,487 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + acl "github.com/ligato/vpp-agent/api/models/vpp/acl" + acl_api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +var aclNoRules []*acl.ACL_Rule + +var aclErr1Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: ".0.", + DestinationNetwork: "10.20.0.0/24", + }, + }, + }, +} + +var aclErr2Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "192.168.1.1/32", + DestinationNetwork: ".0.", + }, + }, + }, +} + +var aclErr3Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "192.168.1.1/32", + DestinationNetwork: "dead::1/64", + }, + }, + }, +} + +var aclErr4Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "192.168.0.1", + SourceAddressPrefix: uint32(16), + SourceMacAddress: "", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, +} + +var aclErr5Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "192.168.0.1", + SourceAddressPrefix: uint32(16), + SourceMacAddress: "11:44:0A:B8:4A:36", + SourceMacAddressMask: "", + }, + }, +} + +var aclErr6Rules = []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "", + SourceAddressPrefix: uint32(16), + SourceMacAddress: "11:44:0A:B8:4A:36", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, +} + +var aclIPrules = []*acl.ACL_Rule{ + { + //RuleName: "permitIPv4", + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "192.168.1.1/32", + DestinationNetwork: "10.20.0.0/24", + }, + }, + }, + { + //RuleName: "permitIPv6", + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "dead::1/64", + DestinationNetwork: "dead::2/64", + }, + }, + }, + { + //RuleName: "permitIP", + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "", + DestinationNetwork: "", + }, + }, + }, + { + //RuleName: "denyICMP", + Action: acl.ACL_Rule_DENY, + IpRule: &acl.ACL_Rule_IpRule{ + Icmp: &acl.ACL_Rule_IpRule_Icmp{ + Icmpv6: false, + IcmpCodeRange: &acl.ACL_Rule_IpRule_Icmp_Range{ + First: 150, + Last: 250, + }, + IcmpTypeRange: &acl.ACL_Rule_IpRule_Icmp_Range{ + First: 1150, + Last: 1250, + }, + }, + }, + }, + { + //RuleName: "denyICMPv6", + Action: acl.ACL_Rule_DENY, + IpRule: &acl.ACL_Rule_IpRule{ + Icmp: &acl.ACL_Rule_IpRule_Icmp{ + Icmpv6: true, + IcmpCodeRange: &acl.ACL_Rule_IpRule_Icmp_Range{ + First: 150, + Last: 250, + }, + IcmpTypeRange: &acl.ACL_Rule_IpRule_Icmp_Range{ + First: 1150, + Last: 1250, + }, + }, + }, + }, + { + //RuleName: "permitTCP", + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Tcp: &acl.ACL_Rule_IpRule_Tcp{ + TcpFlagsMask: 20, + TcpFlagsValue: 10, + SourcePortRange: &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: 150, + UpperPort: 250, + }, + DestinationPortRange: &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: 1150, + UpperPort: 1250, + }, + }, + }, + }, + { + //RuleName: "denyUDP", + Action: acl.ACL_Rule_DENY, + IpRule: &acl.ACL_Rule_IpRule{ + Udp: &acl.ACL_Rule_IpRule_Udp{ + SourcePortRange: &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: 150, + UpperPort: 250, + }, + DestinationPortRange: &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: 1150, + UpperPort: 1250, + }, + }, + }, + }, +} + +var aclMACIPrules = []*acl.ACL_Rule{ + { + //RuleName: "denyIPv4", + Action: acl.ACL_Rule_DENY, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "192.168.0.1", + SourceAddressPrefix: uint32(16), + SourceMacAddress: "11:44:0A:B8:4A:35", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, + { + //RuleName: "denyIPv6", + Action: acl.ACL_Rule_DENY, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "dead::1", + SourceAddressPrefix: uint32(64), + SourceMacAddress: "11:44:0A:B8:4A:35", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, +} + +type testCtx struct { + *vppcallmock.TestCtx + aclHandler *ACLVppHandler + ifIndexes ifaceidx.IfaceMetadataIndexRW +} + +func setupACLTest(t *testing.T) *testCtx { + ctx := vppcallmock.SetupTestCtx(t) + + ifaceIdx := ifaceidx.NewIfaceIndex(logrus.NewLogger("test"), "test") + aclHandler := NewACLVppHandler(ctx.MockChannel, ifaceIdx) + + return &testCtx{ + TestCtx: ctx, + aclHandler: aclHandler, + ifIndexes: ifaceIdx, + } +} + +func (ctx *testCtx) teardownACLTest() { + ctx.TeardownTestCtx() +} + +// Test add IP acl rules +func TestAddIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + + aclIndex, err := ctx.aclHandler.AddACL(aclIPrules, "test0") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + _, err = ctx.aclHandler.AddACL(aclNoRules, "test1") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddACL(aclErr1Rules, "test2") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddACL(aclErr2Rules, "test3") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddACL(aclErr3Rules, "test4") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{}) + _, err = ctx.aclHandler.AddACL(aclIPrules, "test5") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{Retval: -1}) + _, err = ctx.aclHandler.AddACL(aclIPrules, "test6") + Expect(err).To(Not(BeNil())) +} + +// Test add MACIP acl rules +func TestAddMacIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{}) + + aclIndex, err := ctx.aclHandler.AddMACIPACL(aclMACIPrules, "test6") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + _, err = ctx.aclHandler.AddMACIPACL(aclNoRules, "test7") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddMACIPACL(aclErr4Rules, "test8") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddMACIPACL(aclErr5Rules, "test9") + Expect(err).To(Not(BeNil())) + + _, err = ctx.aclHandler.AddMACIPACL(aclErr6Rules, "test10") + Expect(err).To(Not(BeNil())) + Expect(err.Error()).To(BeEquivalentTo("invalid IP address ")) + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + _, err = ctx.aclHandler.AddMACIPACL(aclMACIPrules, "test11") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{Retval: -1}) + _, err = ctx.aclHandler.AddMACIPACL(aclMACIPrules, "test12") + Expect(err).To(Not(BeNil())) +} + +// Test deletion of IP acl rules +func TestDeleteIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + + aclIndex, err := ctx.aclHandler.AddACL(aclIPrules, "test_del0") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + rule2del := []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "10.20.30.1/32", + DestinationNetwork: "10.20.0.0/24", + }, + }, + }, + } + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{ACLIndex: 1}) + aclIndex, err = ctx.aclHandler.AddACL(rule2del, "test_del1") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(1)) + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + err = ctx.aclHandler.DeleteACL(5) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLDelReply{Retval: -1}) + err = ctx.aclHandler.DeleteACL(5) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLDelReply{}) + err = ctx.aclHandler.DeleteACL(1) + Expect(err).To(BeNil()) +} + +// Test deletion of MACIP acl rules +func TestDeleteMACIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{}) + + aclIndex, err := ctx.aclHandler.AddMACIPACL(aclMACIPrules, "test_del2") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + rule2del := []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "192.168.0.1", + SourceAddressPrefix: uint32(16), + SourceMacAddress: "11:44:0A:B8:4A:35", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, + } + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{ACLIndex: 1}) + aclIndex, err = ctx.aclHandler.AddMACIPACL(rule2del, "test_del3") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(1)) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{}) + err = ctx.aclHandler.DeleteMACIPACL(5) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLDelReply{Retval: -1}) + err = ctx.aclHandler.DeleteMACIPACL(5) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLDelReply{}) + err = ctx.aclHandler.DeleteMACIPACL(1) + Expect(err).To(BeNil()) +} + +// Test modification of IP acl rule +func TestModifyIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + + aclIndex, err := ctx.aclHandler.AddACL(aclIPrules, "test_modify") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + rule2modify := []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "10.20.30.1/32", + DestinationNetwork: "10.20.0.0/24", + }, + }, + }, + { + Action: acl.ACL_Rule_PERMIT, + IpRule: &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: "dead:dead::3/64", + DestinationNetwork: "dead:dead::4/64", + }, + }, + }, + } + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{}) + err = ctx.aclHandler.ModifyACL(0, rule2modify, "test_modify0") + Expect(err).To(BeNil()) + + err = ctx.aclHandler.ModifyACL(0, aclErr1Rules, "test_modify1") + Expect(err).To(Not(BeNil())) + + err = ctx.aclHandler.ModifyACL(0, aclNoRules, "test_modify2") + Expect(err).To(BeNil()) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.ModifyACL(0, aclIPrules, "test_modify3") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLAddReplaceReply{Retval: -1}) + err = ctx.aclHandler.ModifyACL(0, aclIPrules, "test_modify4") + Expect(err).To(Not(BeNil())) +} + +// Test modification of MACIP acl rule +func TestModifyMACIPAcl(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReply{}) + + aclIndex, err := ctx.aclHandler.AddMACIPACL(aclMACIPrules, "test_modify") + Expect(err).To(BeNil()) + Expect(aclIndex).To(BeEquivalentTo(0)) + + rule2modify := []*acl.ACL_Rule{ + { + Action: acl.ACL_Rule_DENY, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "192.168.10.1", + SourceAddressPrefix: uint32(24), + SourceMacAddress: "11:44:0A:B8:4A:37", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, + { + Action: acl.ACL_Rule_DENY, + MacipRule: &acl.ACL_Rule_MacIpRule{ + SourceAddress: "dead::2", + SourceAddressPrefix: uint32(64), + SourceMacAddress: "11:44:0A:B8:4A:38", + SourceMacAddressMask: "ff:ff:ff:ff:00:00", + }, + }, + } + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.ModifyMACIPACL(0, rule2modify, "test_modify0") + Expect(err).To(BeNil()) + + err = ctx.aclHandler.ModifyMACIPACL(0, aclErr1Rules, "test_modify1") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.ModifyMACIPACL(0, aclIPrules, "test_modify3") + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{Retval: -1}) + err = ctx.aclHandler.ModifyMACIPACL(0, aclIPrules, "test_modify4") + Expect(err).To(Not(BeNil())) +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls.go new file mode 100644 index 0000000000..ee24b1a66a --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls.go @@ -0,0 +1,650 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + "fmt" + "net" + + "github.com/ligato/cn-infra/logging/logrus" + + acl "github.com/ligato/vpp-agent/api/models/vpp/acl" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" + acl_api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" +) + +// DumpACL implements ACL handler. +func (h *ACLVppHandler) DumpACL() ([]*vppcalls.ACLDetails, error) { + ruleIPData := make(map[vppcalls.ACLMeta][]*acl.ACL_Rule) + + // get all ACLs with IP ruleData + IPRuleACLs, err := h.DumpIPAcls() + if len(IPRuleACLs) < 1 || err != nil { + return nil, err + } + + // resolve IP rules for every ACL + // Note: currently ACL may have only IP ruleData or only MAC IP ruleData + var wasErr error + for identifier, IPRules := range IPRuleACLs { + var rulesDetails []*acl.ACL_Rule + + if len(IPRules) > 0 { + for _, IPRule := range IPRules { + ruleDetails, err := h.getIPRuleDetails(IPRule) + if err != nil { + return nil, fmt.Errorf("failed to get IP Rule %v details: %v", IPRule, err) + } + rulesDetails = append(rulesDetails, ruleDetails) + } + } + ruleIPData[identifier] = rulesDetails + } + + // Prepare separate list of all active ACL indices on the VPP + var indices []uint32 + for identifier := range ruleIPData { + indices = append(indices, identifier.Index) + } + + // Get all ACL indices with ingress and egress interfaces + interfaceData, err := h.DumpACLInterfaces(indices) + if err != nil { + return nil, err + } + + var ACLs []*vppcalls.ACLDetails + // Build a list of ACL ruleData with ruleData, interfaces, index and tag (name) + for identifier, rules := range ruleIPData { + ACLs = append(ACLs, &vppcalls.ACLDetails{ + ACL: &acl.ACL{ + Name: identifier.Tag, + Rules: rules, + Interfaces: interfaceData[identifier.Index], + }, + Meta: &vppcalls.ACLMeta{ + Index: identifier.Index, + Tag: identifier.Tag, + }, + }) + } + + return ACLs, wasErr +} + +// DumpMACIPACL implements ACL handler. +func (h *ACLVppHandler) DumpMACIPACL() ([]*vppcalls.ACLDetails, error) { + ruleMACIPData := make(map[vppcalls.ACLMeta][]*acl.ACL_Rule) + + // get all ACLs with MACIP ruleData + MACIPRuleACLs, err := h.DumpMacIPAcls() + if len(MACIPRuleACLs) < 1 || err != nil { + return nil, err + } + + // resolve MACIP rules for every ACL + for metadata, MACIPRules := range MACIPRuleACLs { + var rulesDetails []*acl.ACL_Rule + + for _, MACIPRule := range MACIPRules { + ruleDetails, err := h.getMACIPRuleDetails(MACIPRule) + if err != nil { + return nil, fmt.Errorf("failed to get MACIP Rule %v details: %v", MACIPRule, err) + } + rulesDetails = append(rulesDetails, ruleDetails) + } + ruleMACIPData[metadata] = rulesDetails + } + + // Prepare separate list of all active ACL indices on the VPP + var indices []uint32 + for identifier := range ruleMACIPData { + indices = append(indices, identifier.Index) + } + + // Get all ACL indices with ingress and egress interfaces + interfaceData, err := h.DumpMACIPACLInterfaces(indices) + if err != nil { + return nil, err + } + + var ACLs []*vppcalls.ACLDetails + // Build a list of ACL ruleData with ruleData, interfaces, index and tag (name) + for metadata, rules := range ruleMACIPData { + ACLs = append(ACLs, &vppcalls.ACLDetails{ + ACL: &acl.ACL{ + Name: metadata.Tag, + Rules: rules, + Interfaces: interfaceData[metadata.Index], + }, + Meta: &vppcalls.ACLMeta{ + Index: metadata.Index, + Tag: metadata.Tag, + }, + }) + } + return ACLs, nil +} + +// DumpACLInterfaces implements ACL handler. +func (h *ACLVppHandler) DumpACLInterfaces(indices []uint32) (map[uint32]*acl.ACL_Interfaces, error) { + // list of ACL-to-interfaces + aclsWithInterfaces := make(map[uint32]*acl.ACL_Interfaces) + + var interfaceData []*vppcalls.ACLToInterface + var wasErr error + + msgIP := &acl_api.ACLInterfaceListDump{ + SwIfIndex: 0xffffffff, // dump all + } + reqIP := h.callsChannel.SendMultiRequest(msgIP) + for { + replyIP := &acl_api.ACLInterfaceListDetails{} + stop, err := reqIP.ReceiveReply(replyIP) + if stop { + break + } + if err != nil { + return aclsWithInterfaces, fmt.Errorf("ACL interface list dump reply error: %v", err) + } + + if replyIP.Count > 0 { + data := &vppcalls.ACLToInterface{ + SwIfIdx: replyIP.SwIfIndex, + } + for i, aclIdx := range replyIP.Acls { + if i < int(replyIP.NInput) { + data.IngressACL = append(data.IngressACL, aclIdx) + } else { + data.EgressACL = append(data.EgressACL, aclIdx) + } + } + interfaceData = append(interfaceData, data) + } + } + + // sort interfaces for every ACL + for _, aclIdx := range indices { + var ingress []string + var egress []string + for _, data := range interfaceData { + // look for ingress + for _, ingressACLIdx := range data.IngressACL { + if ingressACLIdx == aclIdx { + name, _, found := h.ifIndexes.LookupBySwIfIndex(data.SwIfIdx) + if !found { + continue + } + ingress = append(ingress, name) + } + } + // look for egress + for _, egressACLIdx := range data.EgressACL { + if egressACLIdx == aclIdx { + name, _, found := h.ifIndexes.LookupBySwIfIndex(data.SwIfIdx) + if !found { + continue + } + egress = append(egress, name) + } + } + } + + aclsWithInterfaces[aclIdx] = &acl.ACL_Interfaces{ + Egress: egress, + Ingress: ingress, + } + } + + return aclsWithInterfaces, wasErr +} + +// DumpMACIPACLInterfaces implements ACL handler. +func (h *ACLVppHandler) DumpMACIPACLInterfaces(indices []uint32) (map[uint32]*acl.ACL_Interfaces, error) { + // list of ACL-to-interfaces + aclsWithInterfaces := make(map[uint32]*acl.ACL_Interfaces) + + var interfaceData []*vppcalls.ACLToInterface + + msgMACIP := &acl_api.MacipACLInterfaceListDump{ + SwIfIndex: 0xffffffff, // dump all + } + reqMACIP := h.callsChannel.SendMultiRequest(msgMACIP) + for { + replyMACIP := &acl_api.MacipACLInterfaceListDetails{} + stop, err := reqMACIP.ReceiveReply(replyMACIP) + if stop { + break + } + if err != nil { + return nil, fmt.Errorf("MACIP ACL interface list dump reply error: %v", err) + } + if replyMACIP.Count > 0 { + data := &vppcalls.ACLToInterface{ + SwIfIdx: replyMACIP.SwIfIndex, + } + for _, aclIdx := range replyMACIP.Acls { + data.IngressACL = append(data.IngressACL, aclIdx) + } + interfaceData = append(interfaceData, data) + } + } + + for _, aclIdx := range indices { + var ingress []string + for _, data := range interfaceData { + // look for ingress + for _, ingressACLIdx := range data.IngressACL { + if ingressACLIdx == aclIdx { + name, _, found := h.ifIndexes.LookupBySwIfIndex(data.SwIfIdx) + if !found { + continue + } + ingress = append(ingress, name) + } + } + } + var ifaces *acl.ACL_Interfaces + if len(ingress) > 0 { + ifaces = &acl.ACL_Interfaces{ + Egress: nil, + Ingress: ingress, + } + } + aclsWithInterfaces[aclIdx] = ifaces + } + + return aclsWithInterfaces, nil +} + +// DumpIPAcls implements ACL handler. +func (h *ACLVppHandler) DumpIPAcls() (map[vppcalls.ACLMeta][]acl_api.ACLRule, error) { + aclIPRules := make(map[vppcalls.ACLMeta][]acl_api.ACLRule) + var wasErr error + + req := &acl_api.ACLDump{ + ACLIndex: 0xffffffff, + } + reqContext := h.callsChannel.SendMultiRequest(req) + for { + msg := &acl_api.ACLDetails{} + stop, err := reqContext.ReceiveReply(msg) + if err != nil { + return aclIPRules, fmt.Errorf("ACL dump reply error: %v", err) + } + if stop { + break + } + + metadata := vppcalls.ACLMeta{ + Index: msg.ACLIndex, + Tag: string(bytes.SplitN(msg.Tag, []byte{0x00}, 2)[0]), + } + + aclIPRules[metadata] = msg.R + } + + return aclIPRules, wasErr +} + +// DumpMacIPAcls implements ACL handler. +func (h *ACLVppHandler) DumpMacIPAcls() (map[vppcalls.ACLMeta][]acl_api.MacipACLRule, error) { + aclMACIPRules := make(map[vppcalls.ACLMeta][]acl_api.MacipACLRule) + + req := &acl_api.MacipACLDump{ + ACLIndex: 0xffffffff, + } + reqContext := h.callsChannel.SendMultiRequest(req) + for { + msg := &acl_api.MacipACLDetails{} + stop, err := reqContext.ReceiveReply(msg) + if err != nil { + return nil, fmt.Errorf("ACL MACIP dump reply error: %v", err) + } + if stop { + break + } + + metadata := vppcalls.ACLMeta{ + Index: msg.ACLIndex, + Tag: string(bytes.Trim(msg.Tag, "\x00")), + } + + aclMACIPRules[metadata] = msg.R + } + return aclMACIPRules, nil +} + +// DumpInterfaceACLs implements ACL handler. +func (h *ACLVppHandler) DumpInterfaceACLs(swIndex uint32) (acls []*acl.ACL, err error) { + res, err := h.DumpInterfaceACLList(swIndex) + if err != nil { + return nil, err + } + + if res.SwIfIndex != swIndex { + return nil, fmt.Errorf("returned interface index %d does not match request", res.SwIfIndex) + } + + for aidx := range res.Acls { + ipACL, err := h.getIPACLDetails(uint32(aidx)) + if err != nil { + return nil, err + } + acls = append(acls, ipACL) + } + return acls, nil +} + +// DumpInterfaceMACIPACLs implements ACL handler. +func (h *ACLVppHandler) DumpInterfaceMACIPACLs(swIndex uint32) (acls []*acl.ACL, err error) { + resMacIP, err := h.DumpInterfaceMACIPACLList(swIndex) + if err != nil { + return nil, err + } + + if resMacIP.SwIfIndex != swIndex { + return nil, fmt.Errorf("returned interface index %d does not match request", resMacIP.SwIfIndex) + } + + for aidx := range resMacIP.Acls { + macipACL, err := h.getMACIPACLDetails(uint32(aidx)) + if err != nil { + return nil, err + } + acls = append(acls, macipACL) + } + return acls, nil +} + +// DumpInterfaceACLList implements ACL handler. +func (h *ACLVppHandler) DumpInterfaceACLList(swIndex uint32) (*acl_api.ACLInterfaceListDetails, error) { + req := &acl_api.ACLInterfaceListDump{ + SwIfIndex: swIndex, + } + reply := &acl_api.ACLInterfaceListDetails{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + return reply, nil +} + +// DumpInterfaceMACIPACLList implements ACL handler. +func (h *ACLVppHandler) DumpInterfaceMACIPACLList(swIndex uint32) (*acl_api.MacipACLInterfaceListDetails, error) { + req := &acl_api.MacipACLInterfaceListDump{ + SwIfIndex: swIndex, + } + reply := &acl_api.MacipACLInterfaceListDetails{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + return reply, nil +} + +// DumpInterfacesLists implements ACL handler. +func (h *ACLVppHandler) DumpInterfacesLists() ([]*acl_api.ACLInterfaceListDetails, []*acl_api.MacipACLInterfaceListDetails, error) { + msgIPACL := &acl_api.ACLInterfaceListDump{ + SwIfIndex: 0xffffffff, // dump all + } + + reqIPACL := h.callsChannel.SendMultiRequest(msgIPACL) + + var IPaclInterfaces []*acl_api.ACLInterfaceListDetails + for { + reply := &acl_api.ACLInterfaceListDetails{} + stop, err := reqIPACL.ReceiveReply(reply) + if stop { + break + } + if err != nil { + logrus.DefaultLogger().Error(err) + return nil, nil, err + } + IPaclInterfaces = append(IPaclInterfaces, reply) + } + + msgMACIPACL := &acl_api.ACLInterfaceListDump{ + SwIfIndex: 0xffffffff, // dump all + } + + reqMACIPACL := h.callsChannel.SendMultiRequest(msgMACIPACL) + + var MACIPaclInterfaces []*acl_api.MacipACLInterfaceListDetails + for { + reply := &acl_api.MacipACLInterfaceListDetails{} + stop, err := reqMACIPACL.ReceiveReply(reply) + if stop { + break + } + if err != nil { + logrus.DefaultLogger().Error(err) + return nil, nil, err + } + MACIPaclInterfaces = append(MACIPaclInterfaces, reply) + } + + return IPaclInterfaces, MACIPaclInterfaces, nil +} + +func (h *ACLVppHandler) getIPRuleDetails(rule acl_api.ACLRule) (*acl.ACL_Rule, error) { + // Resolve rule actions + aclAction, err := h.resolveRuleAction(rule.IsPermit) + if err != nil { + return nil, err + } + + return &acl.ACL_Rule{ + Action: aclAction, + IpRule: h.getIPRuleMatches(rule), + }, nil +} + +// getIPACLDetails gets details for a given IP ACL from VPP and translates +// them from the binary VPP API format into the ACL Plugin's NB format. +func (h *ACLVppHandler) getIPACLDetails(idx uint32) (aclRule *acl.ACL, err error) { + req := &acl_api.ACLDump{ + ACLIndex: uint32(idx), + } + + reply := &acl_api.ACLDetails{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + var ruleData []*acl.ACL_Rule + for _, r := range reply.R { + rule := &acl.ACL_Rule{} + + ipRule, err := h.getIPRuleDetails(r) + if err != nil { + return nil, err + } + + aclAction, err := h.resolveRuleAction(r.IsPermit) + if err != nil { + return nil, err + } + + rule.IpRule = ipRule.GetIpRule() + rule.Action = aclAction + ruleData = append(ruleData, rule) + } + + return &acl.ACL{Rules: ruleData, Name: string(bytes.SplitN(reply.Tag, []byte{0x00}, 2)[0])}, nil +} + +func (h *ACLVppHandler) getMACIPRuleDetails(rule acl_api.MacipACLRule) (*acl.ACL_Rule, error) { + // Resolve rule actions + aclAction, err := h.resolveRuleAction(rule.IsPermit) + if err != nil { + return nil, err + } + + return &acl.ACL_Rule{ + Action: aclAction, + MacipRule: h.getMACIPRuleMatches(rule), + }, nil +} + +// getMACIPACLDetails gets details for a given MACIP ACL from VPP and translates +// them from the binary VPP API format into the ACL Plugin's NB format. +func (h *ACLVppHandler) getMACIPACLDetails(idx uint32) (aclRule *acl.ACL, err error) { + req := &acl_api.MacipACLDump{ + ACLIndex: uint32(idx), + } + + reply := &acl_api.MacipACLDetails{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return nil, err + } + + var ruleData []*acl.ACL_Rule + for _, r := range reply.R { + rule := &acl.ACL_Rule{} + + ipRule, err := h.getMACIPRuleDetails(r) + if err != nil { + return nil, err + } + + aclAction, err := h.resolveRuleAction(r.IsPermit) + if err != nil { + return nil, err + } + + rule.IpRule = ipRule.GetIpRule() + rule.Action = aclAction + ruleData = append(ruleData, rule) + } + + return &acl.ACL{Rules: ruleData, Name: string(bytes.SplitN(reply.Tag, []byte{0x00}, 2)[0])}, nil +} + +// getIPRuleMatches translates an IP rule from the binary VPP API format into the +// ACL Plugin's NB format +func (h *ACLVppHandler) getIPRuleMatches(r acl_api.ACLRule) *acl.ACL_Rule_IpRule { + var srcIP, dstIP string + if r.IsIPv6 == 1 { + srcIP = net.IP(r.SrcIPAddr).To16().String() + dstIP = net.IP(r.DstIPAddr).To16().String() + } else { + srcIP = net.IP(r.SrcIPAddr[:4]).To4().String() + dstIP = net.IP(r.DstIPAddr[:4]).To4().String() + } + + ipRule := &acl.ACL_Rule_IpRule{ + Ip: &acl.ACL_Rule_IpRule_Ip{ + SourceNetwork: fmt.Sprintf("%s/%d", srcIP, r.SrcIPPrefixLen), + DestinationNetwork: fmt.Sprintf("%s/%d", dstIP, r.DstIPPrefixLen), + }, + } + + switch r.Proto { + case vppcalls.TCPProto: + ipRule.Tcp = h.getTCPMatchRule(r) + case vppcalls.UDPProto: + ipRule.Udp = h.getUDPMatchRule(r) + case vppcalls.ICMPv4Proto, vppcalls.ICMPv6Proto: + ipRule.Icmp = h.getIcmpMatchRule(r) + } + return ipRule +} + +// getMACIPRuleMatches translates an MACIP rule from the binary VPP API format into the +// ACL Plugin's NB format +func (h *ACLVppHandler) getMACIPRuleMatches(rule acl_api.MacipACLRule) *acl.ACL_Rule_MacIpRule { + var srcAddr string + if rule.IsIPv6 == 1 { + srcAddr = net.IP(rule.SrcIPAddr).To16().String() + } else { + srcAddr = net.IP(rule.SrcIPAddr[:4]).To4().String() + } + srcMacAddr := net.HardwareAddr(rule.SrcMac) + srcMacAddrMask := net.HardwareAddr(rule.SrcMacMask) + return &acl.ACL_Rule_MacIpRule{ + SourceAddress: srcAddr, + SourceAddressPrefix: uint32(rule.SrcIPPrefixLen), + SourceMacAddress: srcMacAddr.String(), + SourceMacAddressMask: srcMacAddrMask.String(), + } +} + +// getTCPMatchRule translates a TCP match rule from the binary VPP API format +// into the ACL Plugin's NB format +func (h *ACLVppHandler) getTCPMatchRule(r acl_api.ACLRule) *acl.ACL_Rule_IpRule_Tcp { + dstPortRange := &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: uint32(r.DstportOrIcmpcodeFirst), + UpperPort: uint32(r.DstportOrIcmpcodeLast), + } + srcPortRange := &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: uint32(r.SrcportOrIcmptypeFirst), + UpperPort: uint32(r.SrcportOrIcmptypeLast), + } + tcp := acl.ACL_Rule_IpRule_Tcp{ + DestinationPortRange: dstPortRange, + SourcePortRange: srcPortRange, + TcpFlagsMask: uint32(r.TCPFlagsMask), + TcpFlagsValue: uint32(r.TCPFlagsValue), + } + return &tcp +} + +// getUDPMatchRule translates a UDP match rule from the binary VPP API format +// into the ACL Plugin's NB format +func (h *ACLVppHandler) getUDPMatchRule(r acl_api.ACLRule) *acl.ACL_Rule_IpRule_Udp { + dstPortRange := &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: uint32(r.DstportOrIcmpcodeFirst), + UpperPort: uint32(r.DstportOrIcmpcodeLast), + } + srcPortRange := &acl.ACL_Rule_IpRule_PortRange{ + LowerPort: uint32(r.SrcportOrIcmptypeFirst), + UpperPort: uint32(r.SrcportOrIcmptypeLast), + } + udp := acl.ACL_Rule_IpRule_Udp{ + DestinationPortRange: dstPortRange, + SourcePortRange: srcPortRange, + } + return &udp +} + +// getIcmpMatchRule translates an ICMP match rule from the binary VPP API +// format into the ACL Plugin's NB format +func (h *ACLVppHandler) getIcmpMatchRule(r acl_api.ACLRule) *acl.ACL_Rule_IpRule_Icmp { + icmp := &acl.ACL_Rule_IpRule_Icmp{ + Icmpv6: r.IsIPv6 > 0, + IcmpCodeRange: &acl.ACL_Rule_IpRule_Icmp_Range{}, + IcmpTypeRange: &acl.ACL_Rule_IpRule_Icmp_Range{}, + } + return icmp +} + +// Returns rule action representation in model according to the vpp input +func (h *ACLVppHandler) resolveRuleAction(isPermit uint8) (acl.ACL_Rule_Action, error) { + switch isPermit { + case 0: + return acl.ACL_Rule_DENY, nil + case 1: + return acl.ACL_Rule_PERMIT, nil + case 2: + return acl.ACL_Rule_REFLECT, nil + default: + return acl.ACL_Rule_DENY, fmt.Errorf("invalid match rule %d", isPermit) + } +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls_test.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls_test.go new file mode 100644 index 0000000000..d5027a1921 --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/dump_vppcalls_test.go @@ -0,0 +1,401 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" + acl_api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + . "github.com/onsi/gomega" +) + +// Test translation of IP rule into ACL Plugin's format +func TestGetIPRuleMatch(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + icmpV4Rule := ctx.aclHandler.getIPRuleMatches(acl_api.ACLRule{ + SrcIPAddr: []byte{10, 0, 0, 1}, + SrcIPPrefixLen: 24, + DstIPAddr: []byte{20, 0, 0, 1}, + DstIPPrefixLen: 24, + Proto: vppcalls.ICMPv4Proto, + }) + if icmpV4Rule.GetIcmp() == nil { + t.Fatal("should have icmp match") + } + + icmpV6Rule := ctx.aclHandler.getIPRuleMatches(acl_api.ACLRule{ + IsIPv6: 1, + SrcIPAddr: []byte{'d', 'e', 'd', 'd', 1}, + SrcIPPrefixLen: 64, + DstIPAddr: []byte{'d', 'e', 'd', 'd', 2}, + DstIPPrefixLen: 32, + Proto: vppcalls.ICMPv6Proto, + }) + if icmpV6Rule.GetIcmp() == nil { + t.Fatal("should have icmpv6 match") + } + + tcpRule := ctx.aclHandler.getIPRuleMatches(acl_api.ACLRule{ + SrcIPAddr: []byte{10, 0, 0, 1}, + SrcIPPrefixLen: 24, + DstIPAddr: []byte{20, 0, 0, 1}, + DstIPPrefixLen: 24, + Proto: vppcalls.TCPProto, + }) + if tcpRule.GetTcp() == nil { + t.Fatal("should have tcp match") + } + + udpRule := ctx.aclHandler.getIPRuleMatches(acl_api.ACLRule{ + SrcIPAddr: []byte{10, 0, 0, 1}, + SrcIPPrefixLen: 24, + DstIPAddr: []byte{20, 0, 0, 1}, + DstIPPrefixLen: 24, + Proto: vppcalls.UDPProto, + }) + if udpRule.GetUdp() == nil { + t.Fatal("should have udp match") + } +} + +// Test translation of MACIP rule into ACL Plugin's format +func TestGetMACIPRuleMatches(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + macipV4Rule := ctx.aclHandler.getMACIPRuleMatches(acl_api.MacipACLRule{ + IsPermit: 1, + SrcMac: []byte{2, 'd', 'e', 'a', 'd', 2}, + SrcMacMask: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + SrcIPAddr: []byte{10, 0, 0, 1}, + SrcIPPrefixLen: 32, + }) + if macipV4Rule.GetSourceMacAddress() == "" { + t.Fatal("should have mac match") + } + macipV6Rule := ctx.aclHandler.getMACIPRuleMatches(acl_api.MacipACLRule{ + IsPermit: 0, + IsIPv6: 1, + SrcMac: []byte{2, 'd', 'e', 'a', 'd', 2}, + SrcMacMask: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, + SrcIPAddr: []byte{'d', 'e', 'a', 'd', 1}, + SrcIPPrefixLen: 64, + }) + if macipV6Rule.GetSourceMacAddress() == "" { + t.Fatal("should have mac match") + } +} + +// Test dumping of IP rules +func TestDumpIPACL(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply( + &acl_api.ACLDetails{ + ACLIndex: 0, + Tag: []byte{'a', 'c', 'l', '1'}, + Count: 1, + R: []acl_api.ACLRule{{IsPermit: 1}}, + }, + &acl_api.ACLDetails{ + ACLIndex: 1, + Tag: []byte{'a', 'c', 'l', '2'}, + Count: 2, + R: []acl_api.ACLRule{{IsPermit: 0}, {IsPermit: 2}}, + }, + &acl_api.ACLDetails{ + ACLIndex: 2, + Tag: []byte{'a', 'c', 'l', '3'}, + Count: 3, + R: []acl_api.ACLRule{{IsPermit: 0}, {IsPermit: 1}, {IsPermit: 2}}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 1, + Count: 2, + NInput: 1, + Acls: []uint32{0, 2}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + ctx.ifIndexes.Put("if0", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ifaces, err := ctx.aclHandler.DumpACL() + Expect(err).To(Succeed()) + Expect(ifaces).To(HaveLen(3)) + //Expect(ifaces[0].Identifier.ACLIndex).To(Equal(uint32(0))) + //Expect(ifaces[0].vppcalls.ACLDetails.Rules[0].AclAction).To(Equal(uint32(1))) + //Expect(ifaces[1].Identifier.ACLIndex).To(Equal(uint32(1))) + //Expect(ifaces[2].Identifier.ACLIndex).To(Equal(uint32(2))) +} + +// Test dumping of MACIP rules +func TestDumpMACIPACL(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply( + &acl_api.MacipACLDetails{ + ACLIndex: 0, + Tag: []byte{'a', 'c', 'l', '1'}, + Count: 1, + R: []acl_api.MacipACLRule{{IsPermit: 1}}, + }, + &acl_api.MacipACLDetails{ + ACLIndex: 1, + Tag: []byte{'a', 'c', 'l', '2'}, + Count: 2, + R: []acl_api.MacipACLRule{{IsPermit: 0}, {IsPermit: 2}}, + }, + &acl_api.MacipACLDetails{ + ACLIndex: 2, + Tag: []byte{'a', 'c', 'l', '3'}, + Count: 3, + R: []acl_api.MacipACLRule{{IsPermit: 0}, {IsPermit: 1}, {IsPermit: 2}}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 1, + Count: 2, + Acls: []uint32{0, 2}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + swIfIndexes := ifaceidx.NewIfaceIndex(logrus.DefaultLogger(), "test") + swIfIndexes.Put("if0", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ifaces, err := ctx.aclHandler.DumpMACIPACL() + Expect(err).To(Succeed()) + Expect(ifaces).To(HaveLen(3)) + //Expect(ifaces[0].Identifier.ACLIndex).To(Equal(uint32(0))) + //Expect(ifaces[0].vppcalls.ACLDetails.Rules[0].AclAction).To(Equal(uint32(1))) + //Expect(ifaces[1].Identifier.ACLIndex).To(Equal(uint32(1))) + //Expect(ifaces[2].Identifier.ACLIndex).To(Equal(uint32(2))) +} + +// Test dumping of interfaces with assigned IP rules +func TestDumpACLInterfaces(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 1, + Count: 2, + NInput: 1, + Acls: []uint32{0, 2}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + ctx.ifIndexes.Put("if0", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + indexes := []uint32{0, 2} + ifaces, err := ctx.aclHandler.DumpACLInterfaces(indexes) + Expect(err).To(Succeed()) + Expect(ifaces).To(HaveLen(2)) + Expect(ifaces[0].Ingress).To(Equal([]string{"if0"})) + Expect(ifaces[2].Egress).To(Equal([]string{"if0"})) +} + +// Test dumping of interfaces with assigned MACIP rules +func TestDumpMACIPACLInterfaces(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 1, + Count: 2, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + ctx.ifIndexes.Put("if0", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + indexes := []uint32{0, 1} + ifaces, err := ctx.aclHandler.DumpMACIPACLInterfaces(indexes) + Expect(err).To(Succeed()) + Expect(ifaces).To(HaveLen(2)) + Expect(ifaces[0].Ingress).To(Equal([]string{"if0"})) + Expect(ifaces[0].Egress).To(BeNil()) + Expect(ifaces[1].Ingress).To(Equal([]string{"if0"})) + Expect(ifaces[1].Egress).To(BeNil()) +} + +// Test dumping of all configured ACLs with IP-type ruleData +func TestDumpIPAcls(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLDetails{ + ACLIndex: 0, + Count: 1, + R: []acl_api.ACLRule{{IsPermit: 1}}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + IPRuleACLs, err := ctx.aclHandler.DumpIPAcls() + Expect(err).To(Succeed()) + Expect(IPRuleACLs).To(HaveLen(1)) +} + +// Test dumping of all configured ACLs with MACIP-type ruleData +func TestDumpMacIPAcls(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.MacipACLDetails{ + ACLIndex: 0, + Count: 1, + R: []acl_api.MacipACLRule{{IsPermit: 1}}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + MacIPRuleACLs, err := ctx.aclHandler.DumpMacIPAcls() + Expect(err).To(Succeed()) + Expect(MacIPRuleACLs).To(HaveLen(1)) +} + +func TestDumpInterfaceIPAcls(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 2, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLDetails{ + ACLIndex: 0, + Count: 1, + R: []acl_api.ACLRule{{IsPermit: 1}, {IsPermit: 0}}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLDetails{ + ACLIndex: 1, + Count: 1, + R: []acl_api.ACLRule{{IsPermit: 2}, {IsPermit: 0}}, + }) + + ACLs, err := ctx.aclHandler.DumpInterfaceACLs(0) + Expect(err).To(Succeed()) + Expect(ACLs).To(HaveLen(2)) +} + +func TestDumpInterfaceMACIPAcls(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 2, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.MacipACLDetails{ + ACLIndex: 0, + Count: 1, + R: []acl_api.MacipACLRule{{IsPermit: 1}, {IsPermit: 0}}, + }) + ctx.MockVpp.MockReply(&acl_api.MacipACLDetails{ + ACLIndex: 1, + Count: 1, + R: []acl_api.MacipACLRule{{IsPermit: 2}, {IsPermit: 1}}, + }) + + ACLs, err := ctx.aclHandler.DumpInterfaceMACIPACLs(0) + Expect(err).To(Succeed()) + Expect(ACLs).To(HaveLen(2)) +} + +func TestDumpInterface(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 2, + NInput: 1, + Acls: []uint32{0, 1}, + }) + IPacls, err := ctx.aclHandler.DumpInterfaceACLList(0) + Expect(err).To(BeNil()) + Expect(IPacls.Acls).To(HaveLen(2)) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{}) + IPacls, err = ctx.aclHandler.DumpInterfaceACLList(0) + Expect(err).To(BeNil()) + Expect(IPacls.Acls).To(HaveLen(0)) + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 2, + Acls: []uint32{0, 1}, + }) + MACIPacls, err := ctx.aclHandler.DumpInterfaceMACIPACLList(0) + Expect(err).To(BeNil()) + Expect(MACIPacls.Acls).To(HaveLen(2)) + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{}) + MACIPacls, err = ctx.aclHandler.DumpInterfaceMACIPACLList(0) + Expect(err).To(BeNil()) + Expect(MACIPacls.Acls).To(HaveLen(0)) +} + +func TestDumpInterfaces(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply( + &acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 2, + NInput: 1, + Acls: []uint32{0, 1}, + }, + &acl_api.ACLInterfaceListDetails{ + SwIfIndex: 1, + Count: 1, + NInput: 1, + Acls: []uint32{2}, + }, + &acl_api.ACLInterfaceListDetails{ + SwIfIndex: 2, + Count: 2, + NInput: 1, + Acls: []uint32{3, 4}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 3, + Count: 2, + Acls: []uint32{6, 7}, + }, + &acl_api.MacipACLInterfaceListDetails{ + SwIfIndex: 4, + Count: 1, + Acls: []uint32{5}, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + IPacls, MACIPacls, err := ctx.aclHandler.DumpInterfacesLists() + Expect(err).To(BeNil()) + Expect(IPacls).To(HaveLen(3)) + Expect(MACIPacls).To(HaveLen(2)) +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls.go new file mode 100644 index 0000000000..e532757e99 --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls.go @@ -0,0 +1,338 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + + acl_api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" +) + +// SetACLToInterfacesAsIngress implements ACL handler. +func (h *ACLVppHandler) SetACLToInterfacesAsIngress(ACLIndex uint32, ifIndices []uint32) error { + return h.requestSetACLToInterfaces(&aclInterfaceLogicalReq{ + aclIndex: ACLIndex, + ifIndices: ifIndices, + ingress: true, + }) +} + +// RemoveACLFromInterfacesAsIngress implements ACL handler. +func (h *ACLVppHandler) RemoveACLFromInterfacesAsIngress(ACLIndex uint32, ifIndices []uint32) error { + return h.requestRemoveInterfacesFromACL(&aclInterfaceLogicalReq{ + aclIndex: ACLIndex, + ifIndices: ifIndices, + ingress: true, + }) +} + +// SetACLToInterfacesAsEgress implements ACL handler. +func (h *ACLVppHandler) SetACLToInterfacesAsEgress(ACLIndex uint32, ifIndices []uint32) error { + return h.requestSetACLToInterfaces(&aclInterfaceLogicalReq{ + aclIndex: ACLIndex, + ifIndices: ifIndices, + ingress: false, + }) +} + +// RemoveACLFromInterfacesAsEgress implements ACL handler. +func (h *ACLVppHandler) RemoveACLFromInterfacesAsEgress(ACLIndex uint32, ifIndices []uint32) error { + return h.requestRemoveInterfacesFromACL(&aclInterfaceLogicalReq{ + aclIndex: ACLIndex, + ifIndices: ifIndices, + ingress: false, + }) +} + +// AddACLToInterfaceAsIngress implements ACL handler. +func (h *ACLVppHandler) AddACLToInterfaceAsIngress(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.ACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 1, + SwIfIndex: ifIdx, + IsInput: 1, + } + reply := &acl_api.ACLInterfaceAddDelReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + if err != nil { + return fmt.Errorf("failed to add interface %d to ACL (L3/L4) %d as ingress: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// AddACLToInterfaceAsEgress implements ACL handler. +func (h *ACLVppHandler) AddACLToInterfaceAsEgress(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.ACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 1, + SwIfIndex: ifIdx, + IsInput: 0, + } + reply := &acl_api.ACLInterfaceAddDelReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + if err != nil { + return fmt.Errorf("failed to add interface %d to ACL (L3/L4) %d as egress: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// DeleteACLFromInterfaceAsIngress implements ACL handler. +func (h *ACLVppHandler) DeleteACLFromInterfaceAsIngress(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.ACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 0, + SwIfIndex: ifIdx, + IsInput: 1, + } + reply := &acl_api.ACLInterfaceAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to delete interface %d from ACL (L3/L4) %d as ingress: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// DeleteACLFromInterfaceAsEgress implements ACL handler. +func (h *ACLVppHandler) DeleteACLFromInterfaceAsEgress(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.ACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 0, + SwIfIndex: ifIdx, + IsInput: 0, + } + reply := &acl_api.ACLInterfaceAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to delete interface %d from ACL (L3/L4) %d as egress: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// AddMACIPACLToInterface implements ACL handler. +func (h *ACLVppHandler) AddMACIPACLToInterface(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.MacipACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 1, + SwIfIndex: ifIdx, + } + reply := &acl_api.MacipACLInterfaceAddDelReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + if err != nil { + return fmt.Errorf("failed to add interface %d to MACIP ACL (L2) %d: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// DeleteMACIPACLFromInterface implements ACL handler. +func (h *ACLVppHandler) DeleteMACIPACLFromInterface(aclIndex uint32, ifName string) error { + meta, ok := h.ifIndexes.LookupByName(ifName) + if !ok { + return fmt.Errorf("metadata for interface %s not found", ifName) + } + ifIdx := meta.SwIfIndex + + req := &acl_api.MacipACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 0, + SwIfIndex: ifIdx, + } + reply := &acl_api.MacipACLInterfaceAddDelReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + if err != nil { + return fmt.Errorf("failed to delete interface %d from MACIP ACL (L2) %d: %v", ifIdx, aclIndex, err) + } + + return nil +} + +// SetMACIPACLToInterfaces implements ACL handler. +func (h *ACLVppHandler) SetMACIPACLToInterfaces(aclIndex uint32, ifIndices []uint32) error { + for _, ingressIfIdx := range ifIndices { + req := &acl_api.MacipACLInterfaceAddDel{ + ACLIndex: aclIndex, + IsAdd: 1, + SwIfIndex: ingressIfIdx, + } + reply := &acl_api.MacipACLInterfaceAddDelReply{} + + err := h.callsChannel.SendRequest(req).ReceiveReply(reply) + if err != nil { + return fmt.Errorf("failed to set interface %d to L2 ACL %d: %v", ingressIfIdx, aclIndex, err) + } + } + + return nil +} + +// RemoveMACIPACLFromInterfaces implements ACL handler. +func (h *ACLVppHandler) RemoveMACIPACLFromInterfaces(removedACLIndex uint32, ifIndices []uint32) error { + for _, ifIdx := range ifIndices { + req := &acl_api.MacipACLInterfaceAddDel{ + ACLIndex: removedACLIndex, + SwIfIndex: ifIdx, + IsAdd: 0, + } + reply := &acl_api.MacipACLInterfaceAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("failed to remove L2 ACL %d from interface %d: %v", removedACLIndex, ifIdx, err) + } + } + return nil +} + +// aclInterfaceLogicalReq groups multiple fields to not enumerate all of them in one function call +type aclInterfaceLogicalReq struct { + aclIndex uint32 + ifIndices []uint32 + ingress bool +} + +func (h *ACLVppHandler) requestSetACLToInterfaces(logicalReq *aclInterfaceLogicalReq) error { + for _, aclIfIdx := range logicalReq.ifIndices { + // Create acl list with new entry + var ACLs []uint32 + + // All previously assigned ACLs have to be dumped and added to acl list + aclInterfaceDetails, err := h.DumpInterfaceACLList(aclIfIdx) + if err != nil { + return err + } + + var nInput uint8 + if aclInterfaceDetails != nil { + nInput = aclInterfaceDetails.NInput + if logicalReq.ingress { + // Construct ACL list. ACLs within NInput are defined as ingress, so provided new aclIndex has to be + // added to the beginning of the list + // TODO it would be nicer to add new acl index to newNInput index + ACLs = append(ACLs, logicalReq.aclIndex) + for _, aclIndex := range aclInterfaceDetails.Acls { + ACLs = append(ACLs, aclIndex) + } + nInput++ // Rise NInput + } else { + // Construct ACL list. ACLs outside of NInput are defined as egress, so provided new aclIndex has to be + // added to the end of the list + for _, aclIndex := range aclInterfaceDetails.Acls { + ACLs = append(ACLs, aclIndex) + } + ACLs = append(ACLs, logicalReq.aclIndex) + // NInput remains the same + } + } + + msg := &acl_api.ACLInterfaceSetACLList{ + Acls: ACLs, + Count: uint8(len(ACLs)), + SwIfIndex: aclIfIdx, + NInput: nInput, + } + reply := &acl_api.ACLInterfaceSetACLListReply{} + + err = h.callsChannel.SendRequest(msg).ReceiveReply(reply) + if err != nil { + return err + } + } + + return nil +} + +func (h *ACLVppHandler) requestRemoveInterfacesFromACL(logicalReq *aclInterfaceLogicalReq) error { + var wasErr error + for _, aclIfIdx := range logicalReq.ifIndices { + // Create empty ACL list + var ACLs []uint32 + + // All assigned ACLs have to be dumped + aclInterfaceDetails, err := h.DumpInterfaceACLList(aclIfIdx) + if err != nil { + return err + } + + // Reconstruct ACL list without removed ACL + var nInput uint8 + if aclInterfaceDetails != nil { + nInput = aclInterfaceDetails.NInput + for idx, aclIndex := range aclInterfaceDetails.Acls { + if (aclIndex != logicalReq.aclIndex) || + (logicalReq.ingress && idx >= int(aclInterfaceDetails.NInput)) || + (!logicalReq.ingress && idx < int(aclInterfaceDetails.NInput)) { + ACLs = append(ACLs, aclIndex) + } else { + // Decrease NInput if ingress, otherwise keep it the same + if logicalReq.ingress { + nInput-- + } + } + } + } + + msg := &acl_api.ACLInterfaceSetACLList{ + Acls: ACLs, + Count: uint8(len(ACLs)), + SwIfIndex: aclIfIdx, + NInput: nInput, + } + + reply := &acl_api.ACLInterfaceSetACLListReply{} + err = h.callsChannel.SendRequest(msg).ReceiveReply(reply) + if err != nil { + wasErr = err + } + } + + return wasErr +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls_test.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls_test.go new file mode 100644 index 0000000000..5232e3f8a1 --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/interfaces_vppcalls_test.go @@ -0,0 +1,166 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "testing" + + acl_api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" + . "github.com/onsi/gomega" +) + +// Test assignment of IP acl rule to given interface +func TestRequestSetACLToInterfaces(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err := ctx.aclHandler.SetACLToInterfacesAsIngress(0, []uint32{0}) + Expect(err).To(BeNil()) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err = ctx.aclHandler.SetACLToInterfacesAsEgress(0, []uint32{0}) + Expect(err).To(BeNil()) + + // error cases + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err = ctx.aclHandler.SetACLToInterfacesAsIngress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.SetACLToInterfacesAsIngress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{Retval: -1}) + err = ctx.aclHandler.SetACLToInterfacesAsIngress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) +} + +// Test deletion of IP acl rule from given interface +func TestRequestRemoveInterfacesFromACL(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err := ctx.aclHandler.RemoveACLFromInterfacesAsIngress(0, []uint32{0}) + Expect(err).To(BeNil()) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err = ctx.aclHandler.RemoveACLFromInterfacesAsEgress(0, []uint32{0}) + Expect(err).To(BeNil()) + + // error cases + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{}) + err = ctx.aclHandler.RemoveACLFromInterfacesAsEgress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.RemoveACLFromInterfacesAsEgress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceListDetails{ + SwIfIndex: 0, + Count: 1, + NInput: 1, + Acls: []uint32{0, 1}, + }) + ctx.MockVpp.MockReply(&acl_api.ACLInterfaceSetACLListReply{Retval: -1}) + err = ctx.aclHandler.RemoveACLFromInterfacesAsEgress(0, []uint32{0}) + Expect(err).To(Not(BeNil())) +} + +// Test assignment of MACIP acl rule to given interface +func TestSetMacIPAclToInterface(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceAddDelReply{}) + err := ctx.aclHandler.SetMACIPACLToInterfaces(0, []uint32{0}) + Expect(err).To(BeNil()) + + // error cases + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.SetMACIPACLToInterfaces(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceAddDelReply{Retval: -1}) + err = ctx.aclHandler.SetMACIPACLToInterfaces(0, []uint32{0}) + Expect(err).To(Not(BeNil())) +} + +// Test deletion of MACIP acl rule from given interface +func TestRemoveMacIPIngressACLFromInterfaces(t *testing.T) { + ctx := setupACLTest(t) + defer ctx.teardownACLTest() + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceAddDelReply{}) + err := ctx.aclHandler.RemoveMACIPACLFromInterfaces(1, []uint32{0}) + Expect(err).To(BeNil()) + + // error cases + + ctx.MockVpp.MockReply(&acl_api.MacipACLAddReplaceReply{}) + err = ctx.aclHandler.RemoveMACIPACLFromInterfaces(0, []uint32{0}) + Expect(err).To(Not(BeNil())) + + ctx.MockVpp.MockReply(&acl_api.MacipACLInterfaceAddDelReply{Retval: -1}) + err = ctx.aclHandler.RemoveMACIPACLFromInterfaces(0, []uint32{0}) + Expect(err).To(Not(BeNil())) +} diff --git a/plugins/vpp/aclplugin/vppcalls/vpp1908/vppcalls_handlers.go b/plugins/vpp/aclplugin/vppcalls/vpp1908/vppcalls_handlers.go new file mode 100644 index 0000000000..f2c21ef45f --- /dev/null +++ b/plugins/vpp/aclplugin/vppcalls/vpp1908/vppcalls_handlers.go @@ -0,0 +1,48 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + govppapi "git.fd.io/govpp.git/api" + + "github.com/ligato/vpp-agent/plugins/vpp/aclplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/acl" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, acl.AllMessages()...) + + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) vppcalls.ACLVppAPI { + return NewACLVppHandler(ch, ifIdx) + }, + } +} + +// ACLVppHandler is accessor for acl-related vppcalls methods +type ACLVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex +} + +func NewACLVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex) *ACLVppHandler { + return &ACLVppHandler{ + callsChannel: ch, + ifIndexes: ifIdx, + } +} diff --git a/plugins/vpp/binapi/vpp1901/abf.patch b/plugins/vpp/binapi/vpp1901/abf.patch new file mode 100644 index 0000000000..c4572dc99e --- /dev/null +++ b/plugins/vpp/binapi/vpp1901/abf.patch @@ -0,0 +1,15 @@ +diff --git b/plugins/vpp/binapi/vpp1901/abf/abf.ba.go a/plugins/vpp/binapi/vpp1901/abf/abf.ba.go +index 5f2ab43b1..9efa3beee 100644 +--- a/plugins/vpp/binapi/vpp1901/abf/abf.ba.go ++++ b/plugins/vpp/binapi/vpp1901/abf/abf.ba.go +@@ -97,8 +97,8 @@ type FibPath struct { + NextHopID uint32 + RpfID uint32 + ViaLabel uint32 +- NLabels uint8 +- LabelStack []FibMplsLabel `struc:"[16]FibMplsLabel"` ++ NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED ++ LabelStack []FibMplsLabel + } + + func (*FibPath) GetTypeName() string { diff --git a/plugins/vpp/binapi/vpp1901/abf/abf.ba.go b/plugins/vpp/binapi/vpp1901/abf/abf.ba.go index 510337f6e6..f3f37bf894 100644 --- a/plugins/vpp/binapi/vpp1901/abf/abf.ba.go +++ b/plugins/vpp/binapi/vpp1901/abf/abf.ba.go @@ -1,37 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/abf.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/abf.api.json /* - Package abf is a generated from VPP binary API module 'abf'. +Package abf is a generated VPP binary API for 'abf' module. - It contains following objects: - 5 services +It consists of: 4 types 10 messages + 5 services */ package abf -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpAbfItfAttach(*AbfItfAttachDump) ([]*AbfItfAttachDetails, error) - DumpAbfPolicy(*AbfPolicyDump) ([]*AbfPolicyDetails, error) - AbfItfAttachAddDel(*AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) - AbfPluginGetVersion(*AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) - AbfPolicyAddDel(*AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) -} - -/* Types */ - -// AbfItfAttach represents VPP binary API type 'abf_itf_attach': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "abf" + // VersionCrc is the CRC of this module. + VersionCrc = 0x3abf2f80 +) + +// AbfItfAttach represents VPP binary API type 'abf_itf_attach'. type AbfItfAttach struct { PolicyID uint32 SwIfIndex uint32 @@ -46,7 +42,7 @@ func (*AbfItfAttach) GetCrcString() string { return "aa3ea7fe" } -// AbfPolicy represents VPP binary API type 'abf_policy': +// AbfPolicy represents VPP binary API type 'abf_policy'. type AbfPolicy struct { PolicyID uint32 ACLIndex uint32 @@ -61,7 +57,7 @@ func (*AbfPolicy) GetCrcString() string { return "252c563e" } -// FibMplsLabel represents VPP binary API type 'fib_mpls_label': +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { IsUniform uint8 Label uint32 @@ -76,7 +72,7 @@ func (*FibMplsLabel) GetCrcString() string { return "c93bf35c" } -// FibPath represents VPP binary API type 'fib_path': +// FibPath represents VPP binary API type 'fib_path'. type FibPath struct { SwIfIndex uint32 TableID uint32 @@ -108,9 +104,7 @@ func (*FibPath) GetCrcString() string { return "ba7a81f0" } -/* Messages */ - -// AbfItfAttachAddDel represents VPP binary API message 'abf_itf_attach_add_del': +// AbfItfAttachAddDel represents VPP binary API message 'abf_itf_attach_add_del'. type AbfItfAttachAddDel struct { IsAdd uint8 Attach AbfItfAttach @@ -126,7 +120,7 @@ func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfItfAttachAddDelReply represents VPP binary API message 'abf_itf_attach_add_del_reply': +// AbfItfAttachAddDelReply represents VPP binary API message 'abf_itf_attach_add_del_reply'. type AbfItfAttachAddDelReply struct { Retval int32 } @@ -141,7 +135,7 @@ func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfItfAttachDetails represents VPP binary API message 'abf_itf_attach_details': +// AbfItfAttachDetails represents VPP binary API message 'abf_itf_attach_details'. type AbfItfAttachDetails struct { Attach AbfItfAttach } @@ -156,7 +150,7 @@ func (*AbfItfAttachDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfItfAttachDump represents VPP binary API message 'abf_itf_attach_dump': +// AbfItfAttachDump represents VPP binary API message 'abf_itf_attach_dump'. type AbfItfAttachDump struct{} func (*AbfItfAttachDump) GetMessageName() string { @@ -169,7 +163,7 @@ func (*AbfItfAttachDump) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPluginGetVersion represents VPP binary API message 'abf_plugin_get_version': +// AbfPluginGetVersion represents VPP binary API message 'abf_plugin_get_version'. type AbfPluginGetVersion struct{} func (*AbfPluginGetVersion) GetMessageName() string { @@ -182,7 +176,7 @@ func (*AbfPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPluginGetVersionReply represents VPP binary API message 'abf_plugin_get_version_reply': +// AbfPluginGetVersionReply represents VPP binary API message 'abf_plugin_get_version_reply'. type AbfPluginGetVersionReply struct { Major uint32 Minor uint32 @@ -198,7 +192,7 @@ func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyAddDel represents VPP binary API message 'abf_policy_add_del': +// AbfPolicyAddDel represents VPP binary API message 'abf_policy_add_del'. type AbfPolicyAddDel struct { IsAdd uint8 Policy AbfPolicy @@ -214,7 +208,7 @@ func (*AbfPolicyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPolicyAddDelReply represents VPP binary API message 'abf_policy_add_del_reply': +// AbfPolicyAddDelReply represents VPP binary API message 'abf_policy_add_del_reply'. type AbfPolicyAddDelReply struct { Retval int32 } @@ -229,7 +223,7 @@ func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyDetails represents VPP binary API message 'abf_policy_details': +// AbfPolicyDetails represents VPP binary API message 'abf_policy_details'. type AbfPolicyDetails struct { Policy AbfPolicy } @@ -244,7 +238,7 @@ func (*AbfPolicyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyDump represents VPP binary API message 'abf_policy_dump': +// AbfPolicyDump represents VPP binary API message 'abf_policy_dump'. type AbfPolicyDump struct{} func (*AbfPolicyDump) GetMessageName() string { @@ -270,15 +264,128 @@ func init() { api.RegisterMessage((*AbfPolicyDump)(nil), "abf.AbfPolicyDump") } -var Messages = []api.Message{ - (*AbfItfAttachAddDel)(nil), - (*AbfItfAttachAddDelReply)(nil), - (*AbfItfAttachDetails)(nil), - (*AbfItfAttachDump)(nil), - (*AbfPluginGetVersion)(nil), - (*AbfPluginGetVersionReply)(nil), - (*AbfPolicyAddDel)(nil), - (*AbfPolicyAddDelReply)(nil), - (*AbfPolicyDetails)(nil), - (*AbfPolicyDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AbfItfAttachAddDel)(nil), + (*AbfItfAttachAddDelReply)(nil), + (*AbfItfAttachDetails)(nil), + (*AbfItfAttachDump)(nil), + (*AbfPluginGetVersion)(nil), + (*AbfPluginGetVersionReply)(nil), + (*AbfPolicyAddDel)(nil), + (*AbfPolicyAddDelReply)(nil), + (*AbfPolicyDetails)(nil), + (*AbfPolicyDump)(nil), + } +} + +// RPCService represents RPC service API for abf module. +type RPCService interface { + DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) + DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) + AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) + AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) + AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfItfAttachClient{stream} + return x, nil +} + +type RPCService_DumpAbfItfAttachClient interface { + Recv() (*AbfItfAttachDetails, error) +} + +type serviceClient_DumpAbfItfAttachClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAbfItfAttachClient) Recv() (*AbfItfAttachDetails, error) { + m := new(AbfItfAttachDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfPolicyClient{stream} + return x, nil +} + +type RPCService_DumpAbfPolicyClient interface { + Recv() (*AbfPolicyDetails, error) +} + +type serviceClient_DumpAbfPolicyClient struct { + api.MultiRequestCtx } + +func (c *serviceClient_DumpAbfPolicyClient) Recv() (*AbfPolicyDetails, error) { + m := new(AbfPolicyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) { + out := new(AbfItfAttachAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) { + out := new(AbfPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) { + out := new(AbfPolicyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/acl/acl.ba.go b/plugins/vpp/binapi/vpp1901/acl/acl.ba.go index 911ba31e1a..540b065e16 100644 --- a/plugins/vpp/binapi/vpp1901/acl/acl.ba.go +++ b/plugins/vpp/binapi/vpp1901/acl/acl.ba.go @@ -1,50 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/acl.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/acl.api.json /* - Package acl is a generated from VPP binary API module 'acl'. +Package acl is a generated VPP binary API for 'acl' module. - It contains following objects: - 18 services +It consists of: 2 types 36 messages + 18 services */ package acl -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpACL(*ACLDump) ([]*ACLDetails, error) - DumpACLInterfaceEtypeWhitelist(*ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) - DumpACLInterfaceList(*ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) - DumpMacipACL(*MacipACLDump) ([]*MacipACLDetails, error) - DumpMacipACLInterfaceList(*MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error) - ACLAddReplace(*ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(*ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(*ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(*ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(*ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(*ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(*ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(*ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - MacipACLAdd(*MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(*MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(*MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(*MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(*MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} - -/* Types */ - -// ACLRule represents VPP binary API type 'acl_rule': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "acl" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8ed22cb9 +) + +// ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -68,7 +51,7 @@ func (*ACLRule) GetCrcString() string { return "6f99bf4d" } -// MacipACLRule represents VPP binary API type 'macip_acl_rule': +// MacipACLRule represents VPP binary API type 'macip_acl_rule'. type MacipACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -85,9 +68,7 @@ func (*MacipACLRule) GetCrcString() string { return "70589f1e" } -/* Messages */ - -// ACLAddReplace represents VPP binary API message 'acl_add_replace': +// ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -105,7 +86,7 @@ func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply': +// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. type ACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -121,7 +102,7 @@ func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDel represents VPP binary API message 'acl_del': +// ACLDel represents VPP binary API message 'acl_del'. type ACLDel struct { ACLIndex uint32 } @@ -136,7 +117,7 @@ func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLDelReply represents VPP binary API message 'acl_del_reply': +// ACLDelReply represents VPP binary API message 'acl_del_reply'. type ACLDelReply struct { Retval int32 } @@ -151,7 +132,7 @@ func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDetails represents VPP binary API message 'acl_details': +// ACLDetails represents VPP binary API message 'acl_details'. type ACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -169,7 +150,7 @@ func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDump represents VPP binary API message 'acl_dump': +// ACLDump represents VPP binary API message 'acl_dump'. type ACLDump struct { ACLIndex uint32 } @@ -184,7 +165,7 @@ func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del': +// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { IsAdd uint8 IsInput uint8 @@ -202,7 +183,7 @@ func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply': +// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. type ACLInterfaceAddDelReply struct { Retval int32 } @@ -217,7 +198,7 @@ func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details': +// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -235,7 +216,7 @@ func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump': +// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { SwIfIndex uint32 } @@ -250,7 +231,7 @@ func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details': +// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. type ACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -268,7 +249,7 @@ func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump': +// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { SwIfIndex uint32 } @@ -283,7 +264,7 @@ func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list': +// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. type ACLInterfaceSetACLList struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -301,7 +282,7 @@ func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply': +// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. type ACLInterfaceSetACLListReply struct { Retval int32 } @@ -316,7 +297,7 @@ func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist': +// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -334,7 +315,7 @@ func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply': +// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. type ACLInterfaceSetEtypeWhitelistReply struct { Retval int32 } @@ -349,7 +330,7 @@ func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping': +// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. type ACLPluginControlPing struct{} func (*ACLPluginControlPing) GetMessageName() string { @@ -362,7 +343,7 @@ func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply': +// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. type ACLPluginControlPingReply struct { Retval int32 ClientIndex uint32 @@ -379,7 +360,7 @@ func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries': +// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. type ACLPluginGetConnTableMaxEntries struct{} func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { @@ -392,7 +373,7 @@ func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply': +// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. type ACLPluginGetConnTableMaxEntriesReply struct { ConnTableMaxEntries uint64 } @@ -407,7 +388,7 @@ func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version': +// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. type ACLPluginGetVersion struct{} func (*ACLPluginGetVersion) GetMessageName() string { @@ -420,7 +401,7 @@ func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply': +// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. type ACLPluginGetVersionReply struct { Major uint32 Minor uint32 @@ -436,7 +417,7 @@ func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLAdd represents VPP binary API message 'macip_acl_add': +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. type MacipACLAdd struct { Tag []byte `struc:"[64]byte"` Count uint32 `struc:"sizeof=R"` @@ -453,7 +434,7 @@ func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace': +// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. type MacipACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -471,7 +452,7 @@ func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply': +// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. type MacipACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -487,7 +468,7 @@ func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply': +// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. type MacipACLAddReply struct { ACLIndex uint32 Retval int32 @@ -503,7 +484,7 @@ func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDel represents VPP binary API message 'macip_acl_del': +// MacipACLDel represents VPP binary API message 'macip_acl_del'. type MacipACLDel struct { ACLIndex uint32 } @@ -518,7 +499,7 @@ func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply': +// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. type MacipACLDelReply struct { Retval int32 } @@ -533,7 +514,7 @@ func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDetails represents VPP binary API message 'macip_acl_details': +// MacipACLDetails represents VPP binary API message 'macip_acl_details'. type MacipACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -551,7 +532,7 @@ func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDump represents VPP binary API message 'macip_acl_dump': +// MacipACLDump represents VPP binary API message 'macip_acl_dump'. type MacipACLDump struct { ACLIndex uint32 } @@ -566,7 +547,7 @@ func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del': +// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -583,7 +564,7 @@ func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply': +// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. type MacipACLInterfaceAddDelReply struct { Retval int32 } @@ -598,7 +579,7 @@ func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get': +// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. type MacipACLInterfaceGet struct{} func (*MacipACLInterfaceGet) GetMessageName() string { @@ -611,7 +592,7 @@ func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply': +// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. type MacipACLInterfaceGetReply struct { Count uint32 `struc:"sizeof=Acls"` Acls []uint32 @@ -627,7 +608,7 @@ func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details': +// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -644,7 +625,7 @@ func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump': +// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { SwIfIndex uint32 } @@ -698,41 +679,335 @@ func init() { api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") } -var Messages = []api.Message{ - (*ACLAddReplace)(nil), - (*ACLAddReplaceReply)(nil), - (*ACLDel)(nil), - (*ACLDelReply)(nil), - (*ACLDetails)(nil), - (*ACLDump)(nil), - (*ACLInterfaceAddDel)(nil), - (*ACLInterfaceAddDelReply)(nil), - (*ACLInterfaceEtypeWhitelistDetails)(nil), - (*ACLInterfaceEtypeWhitelistDump)(nil), - (*ACLInterfaceListDetails)(nil), - (*ACLInterfaceListDump)(nil), - (*ACLInterfaceSetACLList)(nil), - (*ACLInterfaceSetACLListReply)(nil), - (*ACLInterfaceSetEtypeWhitelist)(nil), - (*ACLInterfaceSetEtypeWhitelistReply)(nil), - (*ACLPluginControlPing)(nil), - (*ACLPluginControlPingReply)(nil), - (*ACLPluginGetConnTableMaxEntries)(nil), - (*ACLPluginGetConnTableMaxEntriesReply)(nil), - (*ACLPluginGetVersion)(nil), - (*ACLPluginGetVersionReply)(nil), - (*MacipACLAdd)(nil), - (*MacipACLAddReplace)(nil), - (*MacipACLAddReplaceReply)(nil), - (*MacipACLAddReply)(nil), - (*MacipACLDel)(nil), - (*MacipACLDelReply)(nil), - (*MacipACLDetails)(nil), - (*MacipACLDump)(nil), - (*MacipACLInterfaceAddDel)(nil), - (*MacipACLInterfaceAddDelReply)(nil), - (*MacipACLInterfaceGet)(nil), - (*MacipACLInterfaceGetReply)(nil), - (*MacipACLInterfaceListDetails)(nil), - (*MacipACLInterfaceListDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/af_packet/af_packet.ba.go b/plugins/vpp/binapi/vpp1901/af_packet/af_packet.ba.go index 770cd04a8d..27cb63be1e 100644 --- a/plugins/vpp/binapi/vpp1901/af_packet/af_packet.ba.go +++ b/plugins/vpp/binapi/vpp1901/af_packet/af_packet.ba.go @@ -1,35 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/af_packet.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/af_packet.api.json /* - Package af_packet is a generated from VPP binary API module 'af_packet'. +Package af_packet is a generated VPP binary API for 'af_packet' module. - It contains following objects: - 4 services +It consists of: 8 messages + 4 services */ package af_packet -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpAfPacket(*AfPacketDump) ([]*AfPacketDetails, error) - AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(*AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(*AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Messages */ +const ( + // ModuleName is the name of this module. + ModuleName = "af_packet" + // VersionCrc is the CRC of this module. + VersionCrc = 0x206563c +) -// AfPacketCreate represents VPP binary API message 'af_packet_create': +// AfPacketCreate represents VPP binary API message 'af_packet_create'. type AfPacketCreate struct { HostIfName []byte `struc:"[64]byte"` HwAddr []byte `struc:"[6]byte"` @@ -46,7 +43,7 @@ func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply': +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. type AfPacketCreateReply struct { Retval int32 SwIfIndex uint32 @@ -62,7 +59,7 @@ func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDelete represents VPP binary API message 'af_packet_delete': +// AfPacketDelete represents VPP binary API message 'af_packet_delete'. type AfPacketDelete struct { HostIfName []byte `struc:"[64]byte"` } @@ -77,7 +74,7 @@ func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply': +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. type AfPacketDeleteReply struct { Retval int32 } @@ -92,7 +89,7 @@ func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDetails represents VPP binary API message 'af_packet_details': +// AfPacketDetails represents VPP binary API message 'af_packet_details'. type AfPacketDetails struct { SwIfIndex uint32 HostIfName []byte `struc:"[64]byte"` @@ -108,7 +105,7 @@ func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDump represents VPP binary API message 'af_packet_dump': +// AfPacketDump represents VPP binary API message 'af_packet_dump'. type AfPacketDump struct{} func (*AfPacketDump) GetMessageName() string { @@ -121,7 +118,7 @@ func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload': +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. type AfPacketSetL4CksumOffload struct { SwIfIndex uint8 Set uint8 @@ -137,7 +134,7 @@ func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply': +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. type AfPacketSetL4CksumOffloadReply struct { Retval int32 } @@ -163,13 +160,99 @@ func init() { api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") } -var Messages = []api.Message{ - (*AfPacketCreate)(nil), - (*AfPacketCreateReply)(nil), - (*AfPacketDelete)(nil), - (*AfPacketDeleteReply)(nil), - (*AfPacketDetails)(nil), - (*AfPacketDump)(nil), - (*AfPacketSetL4CksumOffload)(nil), - (*AfPacketSetL4CksumOffloadReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } } + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/bfd/bfd.ba.go b/plugins/vpp/binapi/vpp1901/bfd/bfd.ba.go index d7b66f3358..0c078f48b1 100644 --- a/plugins/vpp/binapi/vpp1901/bfd/bfd.ba.go +++ b/plugins/vpp/binapi/vpp1901/bfd/bfd.ba.go @@ -1,45 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/bfd.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/bfd.api.json /* - Package bfd is a generated from VPP binary API module 'bfd'. +Package bfd is a generated VPP binary API for 'bfd' module. - It contains following objects: - 14 services +It consists of: 28 messages + 14 services */ package bfd -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpBfdAuthKeys(*BfdAuthKeysDump) ([]*BfdAuthKeysDetails, error) - DumpBfdUDPSession(*BfdUDPSessionDump) ([]*BfdUDPSessionDetails, error) - BfdAuthDelKey(*BfdAuthDelKey) (*BfdAuthDelKeyReply, error) - BfdAuthSetKey(*BfdAuthSetKey) (*BfdAuthSetKeyReply, error) - BfdUDPAdd(*BfdUDPAdd) (*BfdUDPAddReply, error) - BfdUDPAuthActivate(*BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) - BfdUDPAuthDeactivate(*BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) - BfdUDPDel(*BfdUDPDel) (*BfdUDPDelReply, error) - BfdUDPDelEchoSource(*BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) - BfdUDPGetEchoSource(*BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) - BfdUDPMod(*BfdUDPMod) (*BfdUDPModReply, error) - BfdUDPSessionSetFlags(*BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) - BfdUDPSetEchoSource(*BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) - WantBfdEvents(*WantBfdEvents) (*WantBfdEventsReply, error) -} - -/* Messages */ - -// BfdAuthDelKey represents VPP binary API message 'bfd_auth_del_key': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bfd" + // VersionCrc is the CRC of this module. + VersionCrc = 0xa37bd695 +) + +// BfdAuthDelKey represents VPP binary API message 'bfd_auth_del_key'. type BfdAuthDelKey struct { ConfKeyID uint32 } @@ -54,7 +41,7 @@ func (*BfdAuthDelKey) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthDelKeyReply represents VPP binary API message 'bfd_auth_del_key_reply': +// BfdAuthDelKeyReply represents VPP binary API message 'bfd_auth_del_key_reply'. type BfdAuthDelKeyReply struct { Retval int32 } @@ -69,7 +56,7 @@ func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdAuthKeysDetails represents VPP binary API message 'bfd_auth_keys_details': +// BfdAuthKeysDetails represents VPP binary API message 'bfd_auth_keys_details'. type BfdAuthKeysDetails struct { ConfKeyID uint32 UseCount uint32 @@ -86,7 +73,7 @@ func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdAuthKeysDump represents VPP binary API message 'bfd_auth_keys_dump': +// BfdAuthKeysDump represents VPP binary API message 'bfd_auth_keys_dump'. type BfdAuthKeysDump struct{} func (*BfdAuthKeysDump) GetMessageName() string { @@ -99,7 +86,7 @@ func (*BfdAuthKeysDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthSetKey represents VPP binary API message 'bfd_auth_set_key': +// BfdAuthSetKey represents VPP binary API message 'bfd_auth_set_key'. type BfdAuthSetKey struct { ConfKeyID uint32 KeyLen uint8 @@ -117,7 +104,7 @@ func (*BfdAuthSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthSetKeyReply represents VPP binary API message 'bfd_auth_set_key_reply': +// BfdAuthSetKeyReply represents VPP binary API message 'bfd_auth_set_key_reply'. type BfdAuthSetKeyReply struct { Retval int32 } @@ -132,7 +119,7 @@ func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAdd represents VPP binary API message 'bfd_udp_add': +// BfdUDPAdd represents VPP binary API message 'bfd_udp_add'. type BfdUDPAdd struct { SwIfIndex uint32 DesiredMinTx uint32 @@ -156,7 +143,7 @@ func (*BfdUDPAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAddReply represents VPP binary API message 'bfd_udp_add_reply': +// BfdUDPAddReply represents VPP binary API message 'bfd_udp_add_reply'. type BfdUDPAddReply struct { Retval int32 } @@ -171,7 +158,7 @@ func (*BfdUDPAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAuthActivate represents VPP binary API message 'bfd_udp_auth_activate': +// BfdUDPAuthActivate represents VPP binary API message 'bfd_udp_auth_activate'. type BfdUDPAuthActivate struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -192,7 +179,7 @@ func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAuthActivateReply represents VPP binary API message 'bfd_udp_auth_activate_reply': +// BfdUDPAuthActivateReply represents VPP binary API message 'bfd_udp_auth_activate_reply'. type BfdUDPAuthActivateReply struct { Retval int32 } @@ -207,7 +194,7 @@ func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAuthDeactivate represents VPP binary API message 'bfd_udp_auth_deactivate': +// BfdUDPAuthDeactivate represents VPP binary API message 'bfd_udp_auth_deactivate'. type BfdUDPAuthDeactivate struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -226,7 +213,7 @@ func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAuthDeactivateReply represents VPP binary API message 'bfd_udp_auth_deactivate_reply': +// BfdUDPAuthDeactivateReply represents VPP binary API message 'bfd_udp_auth_deactivate_reply'. type BfdUDPAuthDeactivateReply struct { Retval int32 } @@ -241,7 +228,7 @@ func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPDel represents VPP binary API message 'bfd_udp_del': +// BfdUDPDel represents VPP binary API message 'bfd_udp_del'. type BfdUDPDel struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -259,7 +246,7 @@ func (*BfdUDPDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPDelEchoSource represents VPP binary API message 'bfd_udp_del_echo_source': +// BfdUDPDelEchoSource represents VPP binary API message 'bfd_udp_del_echo_source'. type BfdUDPDelEchoSource struct{} func (*BfdUDPDelEchoSource) GetMessageName() string { @@ -272,7 +259,7 @@ func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPDelEchoSourceReply represents VPP binary API message 'bfd_udp_del_echo_source_reply': +// BfdUDPDelEchoSourceReply represents VPP binary API message 'bfd_udp_del_echo_source_reply'. type BfdUDPDelEchoSourceReply struct { Retval int32 } @@ -287,7 +274,7 @@ func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPDelReply represents VPP binary API message 'bfd_udp_del_reply': +// BfdUDPDelReply represents VPP binary API message 'bfd_udp_del_reply'. type BfdUDPDelReply struct { Retval int32 } @@ -302,7 +289,7 @@ func (*BfdUDPDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPGetEchoSource represents VPP binary API message 'bfd_udp_get_echo_source': +// BfdUDPGetEchoSource represents VPP binary API message 'bfd_udp_get_echo_source'. type BfdUDPGetEchoSource struct{} func (*BfdUDPGetEchoSource) GetMessageName() string { @@ -315,7 +302,7 @@ func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPGetEchoSourceReply represents VPP binary API message 'bfd_udp_get_echo_source_reply': +// BfdUDPGetEchoSourceReply represents VPP binary API message 'bfd_udp_get_echo_source_reply'. type BfdUDPGetEchoSourceReply struct { Retval int32 SwIfIndex uint32 @@ -336,7 +323,7 @@ func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPMod represents VPP binary API message 'bfd_udp_mod': +// BfdUDPMod represents VPP binary API message 'bfd_udp_mod'. type BfdUDPMod struct { SwIfIndex uint32 DesiredMinTx uint32 @@ -357,7 +344,7 @@ func (*BfdUDPMod) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPModReply represents VPP binary API message 'bfd_udp_mod_reply': +// BfdUDPModReply represents VPP binary API message 'bfd_udp_mod_reply'. type BfdUDPModReply struct { Retval int32 } @@ -372,7 +359,7 @@ func (*BfdUDPModReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSessionDetails represents VPP binary API message 'bfd_udp_session_details': +// BfdUDPSessionDetails represents VPP binary API message 'bfd_udp_session_details'. type BfdUDPSessionDetails struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -397,7 +384,7 @@ func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSessionDump represents VPP binary API message 'bfd_udp_session_dump': +// BfdUDPSessionDump represents VPP binary API message 'bfd_udp_session_dump'. type BfdUDPSessionDump struct{} func (*BfdUDPSessionDump) GetMessageName() string { @@ -410,7 +397,7 @@ func (*BfdUDPSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSessionSetFlags represents VPP binary API message 'bfd_udp_session_set_flags': +// BfdUDPSessionSetFlags represents VPP binary API message 'bfd_udp_session_set_flags'. type BfdUDPSessionSetFlags struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -429,7 +416,7 @@ func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSessionSetFlagsReply represents VPP binary API message 'bfd_udp_session_set_flags_reply': +// BfdUDPSessionSetFlagsReply represents VPP binary API message 'bfd_udp_session_set_flags_reply'. type BfdUDPSessionSetFlagsReply struct { Retval int32 } @@ -444,7 +431,7 @@ func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSetEchoSource represents VPP binary API message 'bfd_udp_set_echo_source': +// BfdUDPSetEchoSource represents VPP binary API message 'bfd_udp_set_echo_source'. type BfdUDPSetEchoSource struct { SwIfIndex uint32 } @@ -459,7 +446,7 @@ func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSetEchoSourceReply represents VPP binary API message 'bfd_udp_set_echo_source_reply': +// BfdUDPSetEchoSourceReply represents VPP binary API message 'bfd_udp_set_echo_source_reply'. type BfdUDPSetEchoSourceReply struct { Retval int32 } @@ -474,7 +461,7 @@ func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantBfdEvents represents VPP binary API message 'want_bfd_events': +// WantBfdEvents represents VPP binary API message 'want_bfd_events'. type WantBfdEvents struct { EnableDisable uint32 PID uint32 @@ -490,7 +477,7 @@ func (*WantBfdEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantBfdEventsReply represents VPP binary API message 'want_bfd_events_reply': +// WantBfdEventsReply represents VPP binary API message 'want_bfd_events_reply'. type WantBfdEventsReply struct { Retval int32 } @@ -536,33 +523,236 @@ func init() { api.RegisterMessage((*WantBfdEventsReply)(nil), "bfd.WantBfdEventsReply") } -var Messages = []api.Message{ - (*BfdAuthDelKey)(nil), - (*BfdAuthDelKeyReply)(nil), - (*BfdAuthKeysDetails)(nil), - (*BfdAuthKeysDump)(nil), - (*BfdAuthSetKey)(nil), - (*BfdAuthSetKeyReply)(nil), - (*BfdUDPAdd)(nil), - (*BfdUDPAddReply)(nil), - (*BfdUDPAuthActivate)(nil), - (*BfdUDPAuthActivateReply)(nil), - (*BfdUDPAuthDeactivate)(nil), - (*BfdUDPAuthDeactivateReply)(nil), - (*BfdUDPDel)(nil), - (*BfdUDPDelEchoSource)(nil), - (*BfdUDPDelEchoSourceReply)(nil), - (*BfdUDPDelReply)(nil), - (*BfdUDPGetEchoSource)(nil), - (*BfdUDPGetEchoSourceReply)(nil), - (*BfdUDPMod)(nil), - (*BfdUDPModReply)(nil), - (*BfdUDPSessionDetails)(nil), - (*BfdUDPSessionDump)(nil), - (*BfdUDPSessionSetFlags)(nil), - (*BfdUDPSessionSetFlagsReply)(nil), - (*BfdUDPSetEchoSource)(nil), - (*BfdUDPSetEchoSourceReply)(nil), - (*WantBfdEvents)(nil), - (*WantBfdEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BfdAuthDelKey)(nil), + (*BfdAuthDelKeyReply)(nil), + (*BfdAuthKeysDetails)(nil), + (*BfdAuthKeysDump)(nil), + (*BfdAuthSetKey)(nil), + (*BfdAuthSetKeyReply)(nil), + (*BfdUDPAdd)(nil), + (*BfdUDPAddReply)(nil), + (*BfdUDPAuthActivate)(nil), + (*BfdUDPAuthActivateReply)(nil), + (*BfdUDPAuthDeactivate)(nil), + (*BfdUDPAuthDeactivateReply)(nil), + (*BfdUDPDel)(nil), + (*BfdUDPDelEchoSource)(nil), + (*BfdUDPDelEchoSourceReply)(nil), + (*BfdUDPDelReply)(nil), + (*BfdUDPGetEchoSource)(nil), + (*BfdUDPGetEchoSourceReply)(nil), + (*BfdUDPMod)(nil), + (*BfdUDPModReply)(nil), + (*BfdUDPSessionDetails)(nil), + (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionSetFlags)(nil), + (*BfdUDPSessionSetFlagsReply)(nil), + (*BfdUDPSetEchoSource)(nil), + (*BfdUDPSetEchoSourceReply)(nil), + (*WantBfdEvents)(nil), + (*WantBfdEventsReply)(nil), + } +} + +// RPCService represents RPC service API for bfd module. +type RPCService interface { + DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) + DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) + BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) + BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) + BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) + BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) + BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) + BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) + BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) + BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) + BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) + BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) + BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) + WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdAuthKeysClient{stream} + return x, nil +} + +type RPCService_DumpBfdAuthKeysClient interface { + Recv() (*BfdAuthKeysDetails, error) +} + +type serviceClient_DumpBfdAuthKeysClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdAuthKeysClient) Recv() (*BfdAuthKeysDetails, error) { + m := new(BfdAuthKeysDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdUDPSessionClient{stream} + return x, nil +} + +type RPCService_DumpBfdUDPSessionClient interface { + Recv() (*BfdUDPSessionDetails, error) +} + +type serviceClient_DumpBfdUDPSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdUDPSessionClient) Recv() (*BfdUDPSessionDetails, error) { + m := new(BfdUDPSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { + out := new(BfdAuthDelKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { + out := new(BfdAuthSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { + out := new(BfdUDPAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { + out := new(BfdUDPAuthActivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { + out := new(BfdUDPAuthDeactivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { + out := new(BfdUDPDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { + out := new(BfdUDPDelEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { + out := new(BfdUDPGetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { + out := new(BfdUDPModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { + out := new(BfdUDPSessionSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { + out := new(BfdUDPSetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { + out := new(WantBfdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/bond/bond.ba.go b/plugins/vpp/binapi/vpp1901/bond/bond.ba.go index cb5cc24fd7..04b986009c 100644 --- a/plugins/vpp/binapi/vpp1901/bond/bond.ba.go +++ b/plugins/vpp/binapi/vpp1901/bond/bond.ba.go @@ -1,37 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/bond.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/bond.api.json /* - Package bond is a generated from VPP binary API module 'bond'. +Package bond is a generated VPP binary API for 'bond' module. - It contains following objects: - 6 services +It consists of: 12 messages + 6 services */ package bond -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceBond(*SwInterfaceBondDump) ([]*SwInterfaceBondDetails, error) - DumpSwInterfaceSlave(*SwInterfaceSlaveDump) ([]*SwInterfaceSlaveDetails, error) - BondCreate(*BondCreate) (*BondCreateReply, error) - BondDelete(*BondDelete) (*BondDeleteReply, error) - BondDetachSlave(*BondDetachSlave) (*BondDetachSlaveReply, error) - BondEnslave(*BondEnslave) (*BondEnslaveReply, error) -} - -/* Messages */ - -// BondCreate represents VPP binary API message 'bond_create': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bond" + // VersionCrc is the CRC of this module. + VersionCrc = 0x33cb944c +) + +// BondCreate represents VPP binary API message 'bond_create'. type BondCreate struct { ID uint32 UseCustomMac uint8 @@ -50,7 +45,7 @@ func (*BondCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// BondCreateReply represents VPP binary API message 'bond_create_reply': +// BondCreateReply represents VPP binary API message 'bond_create_reply'. type BondCreateReply struct { Retval int32 SwIfIndex uint32 @@ -66,7 +61,7 @@ func (*BondCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondDelete represents VPP binary API message 'bond_delete': +// BondDelete represents VPP binary API message 'bond_delete'. type BondDelete struct { SwIfIndex uint32 } @@ -81,7 +76,7 @@ func (*BondDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// BondDeleteReply represents VPP binary API message 'bond_delete_reply': +// BondDeleteReply represents VPP binary API message 'bond_delete_reply'. type BondDeleteReply struct { Retval int32 } @@ -96,7 +91,7 @@ func (*BondDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondDetachSlave represents VPP binary API message 'bond_detach_slave': +// BondDetachSlave represents VPP binary API message 'bond_detach_slave'. type BondDetachSlave struct { SwIfIndex uint32 } @@ -111,7 +106,7 @@ func (*BondDetachSlave) GetMessageType() api.MessageType { return api.RequestMessage } -// BondDetachSlaveReply represents VPP binary API message 'bond_detach_slave_reply': +// BondDetachSlaveReply represents VPP binary API message 'bond_detach_slave_reply'. type BondDetachSlaveReply struct { Retval int32 } @@ -126,7 +121,7 @@ func (*BondDetachSlaveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondEnslave represents VPP binary API message 'bond_enslave': +// BondEnslave represents VPP binary API message 'bond_enslave'. type BondEnslave struct { SwIfIndex uint32 BondSwIfIndex uint32 @@ -144,7 +139,7 @@ func (*BondEnslave) GetMessageType() api.MessageType { return api.RequestMessage } -// BondEnslaveReply represents VPP binary API message 'bond_enslave_reply': +// BondEnslaveReply represents VPP binary API message 'bond_enslave_reply'. type BondEnslaveReply struct { Retval int32 } @@ -159,7 +154,7 @@ func (*BondEnslaveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceBondDetails represents VPP binary API message 'sw_interface_bond_details': +// SwInterfaceBondDetails represents VPP binary API message 'sw_interface_bond_details'. type SwInterfaceBondDetails struct { SwIfIndex uint32 ID uint32 @@ -180,7 +175,7 @@ func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceBondDump represents VPP binary API message 'sw_interface_bond_dump': +// SwInterfaceBondDump represents VPP binary API message 'sw_interface_bond_dump'. type SwInterfaceBondDump struct{} func (*SwInterfaceBondDump) GetMessageName() string { @@ -193,7 +188,7 @@ func (*SwInterfaceBondDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSlaveDetails represents VPP binary API message 'sw_interface_slave_details': +// SwInterfaceSlaveDetails represents VPP binary API message 'sw_interface_slave_details'. type SwInterfaceSlaveDetails struct { SwIfIndex uint32 InterfaceName []byte `struc:"[64]byte"` @@ -211,7 +206,7 @@ func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSlaveDump represents VPP binary API message 'sw_interface_slave_dump': +// SwInterfaceSlaveDump represents VPP binary API message 'sw_interface_slave_dump'. type SwInterfaceSlaveDump struct { SwIfIndex uint32 } @@ -241,17 +236,140 @@ func init() { api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "bond.SwInterfaceSlaveDump") } -var Messages = []api.Message{ - (*BondCreate)(nil), - (*BondCreateReply)(nil), - (*BondDelete)(nil), - (*BondDeleteReply)(nil), - (*BondDetachSlave)(nil), - (*BondDetachSlaveReply)(nil), - (*BondEnslave)(nil), - (*BondEnslaveReply)(nil), - (*SwInterfaceBondDetails)(nil), - (*SwInterfaceBondDump)(nil), - (*SwInterfaceSlaveDetails)(nil), - (*SwInterfaceSlaveDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BondCreate)(nil), + (*BondCreateReply)(nil), + (*BondDelete)(nil), + (*BondDeleteReply)(nil), + (*BondDetachSlave)(nil), + (*BondDetachSlaveReply)(nil), + (*BondEnslave)(nil), + (*BondEnslaveReply)(nil), + (*SwInterfaceBondDetails)(nil), + (*SwInterfaceBondDump)(nil), + (*SwInterfaceSlaveDetails)(nil), + (*SwInterfaceSlaveDump)(nil), + } +} + +// RPCService represents RPC service API for bond module. +type RPCService interface { + DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) + DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) + BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) + BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceBondClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceBondClient interface { + Recv() (*SwInterfaceBondDetails, error) } + +type serviceClient_DumpSwInterfaceBondClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceBondClient) Recv() (*SwInterfaceBondDetails, error) { + m := new(SwInterfaceBondDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceSlaveClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceSlaveClient interface { + Recv() (*SwInterfaceSlaveDetails, error) +} + +type serviceClient_DumpSwInterfaceSlaveClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceSlaveClient) Recv() (*SwInterfaceSlaveDetails, error) { + m := new(SwInterfaceSlaveDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { + out := new(BondCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { + out := new(BondDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { + out := new(BondDetachSlaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { + out := new(BondEnslaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/dhcp/dhcp.ba.go b/plugins/vpp/binapi/vpp1901/dhcp/dhcp.ba.go index 21af79c903..d867ada808 100644 --- a/plugins/vpp/binapi/vpp1901/dhcp/dhcp.ba.go +++ b/plugins/vpp/binapi/vpp1901/dhcp/dhcp.ba.go @@ -1,43 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/dhcp.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/dhcp.api.json /* - Package dhcp is a generated from VPP binary API module 'dhcp'. +Package dhcp is a generated VPP binary API for 'dhcp' module. - It contains following objects: - 11 services +It consists of: 5 types 25 messages + 11 services */ package dhcp -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpDHCPClient(*DHCPClientDump) ([]*DHCPClientDetails, error) - DumpDHCPProxy(*DHCPProxyDump) ([]*DHCPProxyDetails, error) - DHCP6ClientsEnableDisable(*DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) - DHCP6DuidLlSet(*DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) - DHCP6PdSendClientMessage(*DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) - DHCP6SendClientMessage(*DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) - DHCPClientConfig(*DHCPClientConfig) (*DHCPClientConfigReply, error) - DHCPProxyConfig(*DHCPProxyConfig) (*DHCPProxyConfigReply, error) - DHCPProxySetVss(*DHCPProxySetVss) (*DHCPProxySetVssReply, error) - WantDHCP6PdReplyEvents(*WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) - WantDHCP6ReplyEvents(*WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) -} - -/* Types */ - -// DHCP6AddressInfo represents VPP binary API type 'dhcp6_address_info': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "dhcp" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8c76d62a +) + +// DHCP6AddressInfo represents VPP binary API type 'dhcp6_address_info'. type DHCP6AddressInfo struct { Address []byte `struc:"[16]byte"` ValidTime uint32 @@ -51,7 +41,7 @@ func (*DHCP6AddressInfo) GetCrcString() string { return "f3d501e2" } -// DHCP6PdPrefixInfo represents VPP binary API type 'dhcp6_pd_prefix_info': +// DHCP6PdPrefixInfo represents VPP binary API type 'dhcp6_pd_prefix_info'. type DHCP6PdPrefixInfo struct { Prefix []byte `struc:"[16]byte"` PrefixLength uint8 @@ -66,7 +56,7 @@ func (*DHCP6PdPrefixInfo) GetCrcString() string { return "c459690e" } -// DHCPClient represents VPP binary API type 'dhcp_client': +// DHCPClient represents VPP binary API type 'dhcp_client'. type DHCPClient struct { SwIfIndex uint32 Hostname []byte `struc:"[64]byte"` @@ -83,7 +73,7 @@ func (*DHCPClient) GetCrcString() string { return "527f7935" } -// DHCPLease represents VPP binary API type 'dhcp_lease': +// DHCPLease represents VPP binary API type 'dhcp_lease'. type DHCPLease struct { SwIfIndex uint32 State uint8 @@ -102,7 +92,7 @@ func (*DHCPLease) GetCrcString() string { return "61090276" } -// DHCPServer represents VPP binary API type 'dhcp_server': +// DHCPServer represents VPP binary API type 'dhcp_server'. type DHCPServer struct { ServerVrfID uint32 DHCPServer []byte `struc:"[16]byte"` @@ -115,9 +105,7 @@ func (*DHCPServer) GetCrcString() string { return "f16506c4" } -/* Messages */ - -// DHCP6ClientsEnableDisable represents VPP binary API message 'dhcp6_clients_enable_disable': +// DHCP6ClientsEnableDisable represents VPP binary API message 'dhcp6_clients_enable_disable'. type DHCP6ClientsEnableDisable struct { Enable uint8 } @@ -132,7 +120,7 @@ func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6ClientsEnableDisableReply represents VPP binary API message 'dhcp6_clients_enable_disable_reply': +// DHCP6ClientsEnableDisableReply represents VPP binary API message 'dhcp6_clients_enable_disable_reply'. type DHCP6ClientsEnableDisableReply struct { Retval int32 } @@ -147,7 +135,7 @@ func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6DuidLlSet represents VPP binary API message 'dhcp6_duid_ll_set': +// DHCP6DuidLlSet represents VPP binary API message 'dhcp6_duid_ll_set'. type DHCP6DuidLlSet struct { DuidLl []byte `struc:"[10]byte"` } @@ -162,7 +150,7 @@ func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6DuidLlSetReply represents VPP binary API message 'dhcp6_duid_ll_set_reply': +// DHCP6DuidLlSetReply represents VPP binary API message 'dhcp6_duid_ll_set_reply'. type DHCP6DuidLlSetReply struct { Retval int32 } @@ -177,7 +165,7 @@ func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6PdReplyEvent represents VPP binary API message 'dhcp6_pd_reply_event': +// DHCP6PdReplyEvent represents VPP binary API message 'dhcp6_pd_reply_event'. type DHCP6PdReplyEvent struct { PID uint32 SwIfIndex uint32 @@ -202,7 +190,7 @@ func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCP6PdSendClientMessage represents VPP binary API message 'dhcp6_pd_send_client_message': +// DHCP6PdSendClientMessage represents VPP binary API message 'dhcp6_pd_send_client_message'. type DHCP6PdSendClientMessage struct { SwIfIndex uint32 ServerIndex uint32 @@ -228,7 +216,7 @@ func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6PdSendClientMessageReply represents VPP binary API message 'dhcp6_pd_send_client_message_reply': +// DHCP6PdSendClientMessageReply represents VPP binary API message 'dhcp6_pd_send_client_message_reply'. type DHCP6PdSendClientMessageReply struct { Retval int32 } @@ -243,7 +231,7 @@ func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6ReplyEvent represents VPP binary API message 'dhcp6_reply_event': +// DHCP6ReplyEvent represents VPP binary API message 'dhcp6_reply_event'. type DHCP6ReplyEvent struct { PID uint32 SwIfIndex uint32 @@ -268,7 +256,7 @@ func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCP6SendClientMessage represents VPP binary API message 'dhcp6_send_client_message': +// DHCP6SendClientMessage represents VPP binary API message 'dhcp6_send_client_message'. type DHCP6SendClientMessage struct { SwIfIndex uint32 ServerIndex uint32 @@ -294,7 +282,7 @@ func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6SendClientMessageReply represents VPP binary API message 'dhcp6_send_client_message_reply': +// DHCP6SendClientMessageReply represents VPP binary API message 'dhcp6_send_client_message_reply'. type DHCP6SendClientMessageReply struct { Retval int32 } @@ -309,7 +297,7 @@ func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientConfig represents VPP binary API message 'dhcp_client_config': +// DHCPClientConfig represents VPP binary API message 'dhcp_client_config'. type DHCPClientConfig struct { IsAdd uint8 Client DHCPClient @@ -325,7 +313,7 @@ func (*DHCPClientConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPClientConfigReply represents VPP binary API message 'dhcp_client_config_reply': +// DHCPClientConfigReply represents VPP binary API message 'dhcp_client_config_reply'. type DHCPClientConfigReply struct { Retval int32 } @@ -340,7 +328,7 @@ func (*DHCPClientConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientDetails represents VPP binary API message 'dhcp_client_details': +// DHCPClientDetails represents VPP binary API message 'dhcp_client_details'. type DHCPClientDetails struct { Client DHCPClient Lease DHCPLease @@ -356,7 +344,7 @@ func (*DHCPClientDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientDump represents VPP binary API message 'dhcp_client_dump': +// DHCPClientDump represents VPP binary API message 'dhcp_client_dump'. type DHCPClientDump struct{} func (*DHCPClientDump) GetMessageName() string { @@ -369,7 +357,7 @@ func (*DHCPClientDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPComplEvent represents VPP binary API message 'dhcp_compl_event': +// DHCPComplEvent represents VPP binary API message 'dhcp_compl_event'. type DHCPComplEvent struct { PID uint32 Lease DHCPLease @@ -385,7 +373,7 @@ func (*DHCPComplEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCPProxyConfig represents VPP binary API message 'dhcp_proxy_config': +// DHCPProxyConfig represents VPP binary API message 'dhcp_proxy_config'. type DHCPProxyConfig struct { RxVrfID uint32 ServerVrfID uint32 @@ -405,7 +393,7 @@ func (*DHCPProxyConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxyConfigReply represents VPP binary API message 'dhcp_proxy_config_reply': +// DHCPProxyConfigReply represents VPP binary API message 'dhcp_proxy_config_reply'. type DHCPProxyConfigReply struct { Retval int32 } @@ -420,7 +408,7 @@ func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPProxyDetails represents VPP binary API message 'dhcp_proxy_details': +// DHCPProxyDetails represents VPP binary API message 'dhcp_proxy_details'. type DHCPProxyDetails struct { RxVrfID uint32 VssOui uint32 @@ -443,7 +431,7 @@ func (*DHCPProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPProxyDump represents VPP binary API message 'dhcp_proxy_dump': +// DHCPProxyDump represents VPP binary API message 'dhcp_proxy_dump'. type DHCPProxyDump struct { IsIP6 uint8 } @@ -458,7 +446,7 @@ func (*DHCPProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxySetVss represents VPP binary API message 'dhcp_proxy_set_vss': +// DHCPProxySetVss represents VPP binary API message 'dhcp_proxy_set_vss'. type DHCPProxySetVss struct { TblID uint32 VssType uint8 @@ -479,7 +467,7 @@ func (*DHCPProxySetVss) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxySetVssReply represents VPP binary API message 'dhcp_proxy_set_vss_reply': +// DHCPProxySetVssReply represents VPP binary API message 'dhcp_proxy_set_vss_reply'. type DHCPProxySetVssReply struct { Retval int32 } @@ -494,7 +482,7 @@ func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantDHCP6PdReplyEvents represents VPP binary API message 'want_dhcp6_pd_reply_events': +// WantDHCP6PdReplyEvents represents VPP binary API message 'want_dhcp6_pd_reply_events'. type WantDHCP6PdReplyEvents struct { EnableDisable uint8 PID uint32 @@ -510,7 +498,7 @@ func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantDHCP6PdReplyEventsReply represents VPP binary API message 'want_dhcp6_pd_reply_events_reply': +// WantDHCP6PdReplyEventsReply represents VPP binary API message 'want_dhcp6_pd_reply_events_reply'. type WantDHCP6PdReplyEventsReply struct { Retval int32 } @@ -525,7 +513,7 @@ func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantDHCP6ReplyEvents represents VPP binary API message 'want_dhcp6_reply_events': +// WantDHCP6ReplyEvents represents VPP binary API message 'want_dhcp6_reply_events'. type WantDHCP6ReplyEvents struct { EnableDisable uint8 PID uint32 @@ -541,7 +529,7 @@ func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantDHCP6ReplyEventsReply represents VPP binary API message 'want_dhcp6_reply_events_reply': +// WantDHCP6ReplyEventsReply represents VPP binary API message 'want_dhcp6_reply_events_reply'. type WantDHCP6ReplyEventsReply struct { Retval int32 } @@ -584,30 +572,203 @@ func init() { api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "dhcp.WantDHCP6ReplyEventsReply") } -var Messages = []api.Message{ - (*DHCP6ClientsEnableDisable)(nil), - (*DHCP6ClientsEnableDisableReply)(nil), - (*DHCP6DuidLlSet)(nil), - (*DHCP6DuidLlSetReply)(nil), - (*DHCP6PdReplyEvent)(nil), - (*DHCP6PdSendClientMessage)(nil), - (*DHCP6PdSendClientMessageReply)(nil), - (*DHCP6ReplyEvent)(nil), - (*DHCP6SendClientMessage)(nil), - (*DHCP6SendClientMessageReply)(nil), - (*DHCPClientConfig)(nil), - (*DHCPClientConfigReply)(nil), - (*DHCPClientDetails)(nil), - (*DHCPClientDump)(nil), - (*DHCPComplEvent)(nil), - (*DHCPProxyConfig)(nil), - (*DHCPProxyConfigReply)(nil), - (*DHCPProxyDetails)(nil), - (*DHCPProxyDump)(nil), - (*DHCPProxySetVss)(nil), - (*DHCPProxySetVssReply)(nil), - (*WantDHCP6PdReplyEvents)(nil), - (*WantDHCP6PdReplyEventsReply)(nil), - (*WantDHCP6ReplyEvents)(nil), - (*WantDHCP6ReplyEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientsEnableDisable)(nil), + (*DHCP6ClientsEnableDisableReply)(nil), + (*DHCP6DuidLlSet)(nil), + (*DHCP6DuidLlSetReply)(nil), + (*DHCP6PdReplyEvent)(nil), + (*DHCP6PdSendClientMessage)(nil), + (*DHCP6PdSendClientMessageReply)(nil), + (*DHCP6ReplyEvent)(nil), + (*DHCP6SendClientMessage)(nil), + (*DHCP6SendClientMessageReply)(nil), + (*DHCPClientConfig)(nil), + (*DHCPClientConfigReply)(nil), + (*DHCPClientDetails)(nil), + (*DHCPClientDump)(nil), + (*DHCPComplEvent)(nil), + (*DHCPProxyConfig)(nil), + (*DHCPProxyConfigReply)(nil), + (*DHCPProxyDetails)(nil), + (*DHCPProxyDump)(nil), + (*DHCPProxySetVss)(nil), + (*DHCPProxySetVssReply)(nil), + (*WantDHCP6PdReplyEvents)(nil), + (*WantDHCP6PdReplyEventsReply)(nil), + (*WantDHCP6ReplyEvents)(nil), + (*WantDHCP6ReplyEventsReply)(nil), + } +} + +// RPCService represents RPC service API for dhcp module. +type RPCService interface { + DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) + DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) + DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) + DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) + DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) + DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) + DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) + DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) + DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) + WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) + WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPClientClient{stream} + return x, nil +} + +type RPCService_DumpDHCPClientClient interface { + Recv() (*DHCPClientDetails, error) +} + +type serviceClient_DumpDHCPClientClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPClientClient) Recv() (*DHCPClientDetails, error) { + m := new(DHCPClientDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPProxyClient{stream} + return x, nil +} + +type RPCService_DumpDHCPProxyClient interface { + Recv() (*DHCPProxyDetails, error) +} + +type serviceClient_DumpDHCPProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPProxyClient) Recv() (*DHCPProxyDetails, error) { + m := new(DHCPProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { + out := new(DHCP6ClientsEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { + out := new(DHCP6DuidLlSetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { + out := new(DHCP6PdSendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { + out := new(DHCP6SendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { + out := new(DHCPClientConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { + out := new(DHCPProxyConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { + out := new(DHCPProxySetVssReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { + out := new(WantDHCP6PdReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { + out := new(WantDHCP6ReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/gen.go b/plugins/vpp/binapi/vpp1901/gen.go new file mode 100644 index 0000000000..c8bf312c31 --- /dev/null +++ b/plugins/vpp/binapi/vpp1901/gen.go @@ -0,0 +1,40 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1901 + +//go:generate -command binapigen binapi-generator --output-dir=. + +//go:generate binapi-generator --input-file=/usr/share/vpp/api/abf.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/acl.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/af_packet.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/bfd.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/bond.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/dhcp.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/interface.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/ip.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/ipsec.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/l2.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/memclnt.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/memif.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/nat.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/punt.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/session.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/sr.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/stn.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/tap.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/tapv2.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/vmxnet3.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/vpe.api.json +//go:generate binapi-generator --input-file=/usr/share/vpp/api/vxlan.api.json diff --git a/plugins/vpp/binapi/vpp1901/interfaces/interfaces.ba.go b/plugins/vpp/binapi/vpp1901/interfaces/interfaces.ba.go index 9d44ad249a..71b99bda36 100644 --- a/plugins/vpp/binapi/vpp1901/interfaces/interfaces.ba.go +++ b/plugins/vpp/binapi/vpp1901/interfaces/interfaces.ba.go @@ -1,62 +1,36 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/interface.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/interface.api.json /* - Package interfaces is a generated from VPP binary API module 'interface'. +Package interfaces is a generated VPP binary API for 'interface' module. - It contains following objects: - 25 services +It consists of: 1 alias 51 messages + 25 services */ package interfaces -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterface(*SwInterfaceDump) ([]*SwInterfaceDetails, error) - DumpSwInterfaceRxPlacement(*SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) - CollectDetailedInterfaceStats(*CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(*CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(*CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(*CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(*CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(*DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(*DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(*HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(*InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(*SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceClearStats(*SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(*SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(*SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(*SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(*SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(*SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(*SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(*SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(*SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(*SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(*SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(*SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(*WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} - -/* Aliases */ - -// InterfaceIndex represents VPP binary API alias 'interface_index': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "interface" + // VersionCrc is the CRC of this module. + VersionCrc = 0x672de521 +) + +// InterfaceIndex represents VPP binary API alias 'interface_index'. type InterfaceIndex uint32 -/* Messages */ - -// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats': +// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. type CollectDetailedInterfaceStats struct { SwIfIndex uint32 EnableDisable uint8 @@ -72,7 +46,7 @@ func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } -// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply': +// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. type CollectDetailedInterfaceStatsReply struct { Retval int32 } @@ -87,7 +61,7 @@ func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateLoopback represents VPP binary API message 'create_loopback': +// CreateLoopback represents VPP binary API message 'create_loopback'. type CreateLoopback struct { MacAddress []byte `struc:"[6]byte"` } @@ -102,7 +76,7 @@ func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance': +// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. type CreateLoopbackInstance struct { MacAddress []byte `struc:"[6]byte"` IsSpecified uint8 @@ -119,7 +93,7 @@ func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply': +// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. type CreateLoopbackInstanceReply struct { Retval int32 SwIfIndex uint32 @@ -135,7 +109,7 @@ func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply': +// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. type CreateLoopbackReply struct { Retval int32 SwIfIndex uint32 @@ -151,7 +125,7 @@ func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateSubif represents VPP binary API message 'create_subif': +// CreateSubif represents VPP binary API message 'create_subif'. type CreateSubif struct { SwIfIndex uint32 SubID uint32 @@ -177,7 +151,7 @@ func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateSubifReply represents VPP binary API message 'create_subif_reply': +// CreateSubifReply represents VPP binary API message 'create_subif_reply'. type CreateSubifReply struct { Retval int32 SwIfIndex uint32 @@ -193,7 +167,7 @@ func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateVlanSubif represents VPP binary API message 'create_vlan_subif': +// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. type CreateVlanSubif struct { SwIfIndex uint32 VlanID uint32 @@ -209,7 +183,7 @@ func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply': +// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. type CreateVlanSubifReply struct { Retval int32 SwIfIndex uint32 @@ -225,7 +199,7 @@ func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DeleteLoopback represents VPP binary API message 'delete_loopback': +// DeleteLoopback represents VPP binary API message 'delete_loopback'. type DeleteLoopback struct { SwIfIndex uint32 } @@ -240,7 +214,7 @@ func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } -// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply': +// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. type DeleteLoopbackReply struct { Retval int32 } @@ -255,7 +229,7 @@ func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DeleteSubif represents VPP binary API message 'delete_subif': +// DeleteSubif represents VPP binary API message 'delete_subif'. type DeleteSubif struct { SwIfIndex uint32 } @@ -270,7 +244,7 @@ func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// DeleteSubifReply represents VPP binary API message 'delete_subif_reply': +// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. type DeleteSubifReply struct { Retval int32 } @@ -285,7 +259,7 @@ func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu': +// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. type HwInterfaceSetMtu struct { SwIfIndex uint32 Mtu uint16 @@ -301,7 +275,7 @@ func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } -// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply': +// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. type HwInterfaceSetMtuReply struct { Retval int32 } @@ -316,7 +290,7 @@ func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber': +// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. type InterfaceNameRenumber struct { SwIfIndex uint32 NewShowDevInstance uint32 @@ -332,7 +306,7 @@ func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } -// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply': +// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. type InterfaceNameRenumberReply struct { Retval int32 } @@ -347,7 +321,7 @@ func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address': +// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. type SwInterfaceAddDelAddress struct { SwIfIndex uint32 IsAdd uint8 @@ -367,7 +341,7 @@ func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply': +// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. type SwInterfaceAddDelAddressReply struct { Retval int32 } @@ -382,7 +356,7 @@ func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats': +// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. type SwInterfaceClearStats struct { SwIfIndex uint32 } @@ -397,7 +371,7 @@ func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply': +// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. type SwInterfaceClearStatsReply struct { Retval int32 } @@ -412,7 +386,7 @@ func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceDetails represents VPP binary API message 'sw_interface_details': +// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. type SwInterfaceDetails struct { SwIfIndex uint32 SupSwIfIndex uint32 @@ -457,7 +431,7 @@ func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceDump represents VPP binary API message 'sw_interface_dump': +// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. type SwInterfaceDump struct { NameFilterValid uint8 NameFilter []byte `struc:"[49]byte"` @@ -473,7 +447,7 @@ func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceEvent represents VPP binary API message 'sw_interface_event': +// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. type SwInterfaceEvent struct { PID uint32 SwIfIndex uint32 @@ -492,7 +466,7 @@ func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } -// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address': +// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. type SwInterfaceGetMacAddress struct { SwIfIndex uint32 } @@ -507,7 +481,7 @@ func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply': +// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. type SwInterfaceGetMacAddressReply struct { Retval int32 MacAddress []byte `struc:"[6]byte"` @@ -523,7 +497,7 @@ func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table': +// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. type SwInterfaceGetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -539,7 +513,7 @@ func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply': +// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. type SwInterfaceGetTableReply struct { Retval int32 VrfID uint32 @@ -555,7 +529,7 @@ func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details': +// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. type SwInterfaceRxPlacementDetails struct { SwIfIndex uint32 QueueID uint32 @@ -573,7 +547,7 @@ func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump': +// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. type SwInterfaceRxPlacementDump struct { SwIfIndex uint32 } @@ -588,7 +562,7 @@ func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags': +// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. type SwInterfaceSetFlags struct { SwIfIndex uint32 AdminUpDown uint8 @@ -604,7 +578,7 @@ func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply': +// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. type SwInterfaceSetFlagsReply struct { Retval int32 } @@ -619,7 +593,7 @@ func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast': +// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. type SwInterfaceSetIPDirectedBroadcast struct { SwIfIndex uint32 Enable uint8 @@ -635,7 +609,7 @@ func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply': +// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. type SwInterfaceSetIPDirectedBroadcastReply struct { Retval int32 } @@ -650,7 +624,7 @@ func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType return api.ReplyMessage } -// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address': +// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. type SwInterfaceSetMacAddress struct { SwIfIndex uint32 MacAddress []byte `struc:"[6]byte"` @@ -666,7 +640,7 @@ func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply': +// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. type SwInterfaceSetMacAddressReply struct { Retval int32 } @@ -681,7 +655,7 @@ func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu': +// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. type SwInterfaceSetMtu struct { SwIfIndex uint32 Mtu []uint32 `struc:"[4]uint32"` @@ -697,7 +671,7 @@ func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply': +// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. type SwInterfaceSetMtuReply struct { Retval int32 } @@ -712,7 +686,7 @@ func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode': +// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. type SwInterfaceSetRxMode struct { SwIfIndex uint32 QueueIDValid uint8 @@ -730,7 +704,7 @@ func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply': +// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. type SwInterfaceSetRxModeReply struct { Retval int32 } @@ -745,7 +719,7 @@ func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement': +// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. type SwInterfaceSetRxPlacement struct { SwIfIndex uint32 QueueID uint32 @@ -763,7 +737,7 @@ func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply': +// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. type SwInterfaceSetRxPlacementReply struct { Retval int32 } @@ -778,7 +752,7 @@ func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table': +// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. type SwInterfaceSetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -795,7 +769,7 @@ func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply': +// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. type SwInterfaceSetTableReply struct { Retval int32 } @@ -810,7 +784,7 @@ func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered': +// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. type SwInterfaceSetUnnumbered struct { SwIfIndex uint32 UnnumberedSwIfIndex uint32 @@ -827,7 +801,7 @@ func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply': +// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. type SwInterfaceSetUnnumberedReply struct { Retval int32 } @@ -842,7 +816,7 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del': +// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. type SwInterfaceTagAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -859,7 +833,7 @@ func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply': +// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. type SwInterfaceTagAddDelReply struct { Retval int32 } @@ -874,7 +848,7 @@ func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantInterfaceEvents represents VPP binary API message 'want_interface_events': +// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. type WantInterfaceEvents struct { EnableDisable uint32 PID uint32 @@ -890,7 +864,7 @@ func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply': +// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. type WantInterfaceEventsReply struct { Retval int32 } @@ -959,56 +933,369 @@ func init() { api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") } -var Messages = []api.Message{ - (*CollectDetailedInterfaceStats)(nil), - (*CollectDetailedInterfaceStatsReply)(nil), - (*CreateLoopback)(nil), - (*CreateLoopbackInstance)(nil), - (*CreateLoopbackInstanceReply)(nil), - (*CreateLoopbackReply)(nil), - (*CreateSubif)(nil), - (*CreateSubifReply)(nil), - (*CreateVlanSubif)(nil), - (*CreateVlanSubifReply)(nil), - (*DeleteLoopback)(nil), - (*DeleteLoopbackReply)(nil), - (*DeleteSubif)(nil), - (*DeleteSubifReply)(nil), - (*HwInterfaceSetMtu)(nil), - (*HwInterfaceSetMtuReply)(nil), - (*InterfaceNameRenumber)(nil), - (*InterfaceNameRenumberReply)(nil), - (*SwInterfaceAddDelAddress)(nil), - (*SwInterfaceAddDelAddressReply)(nil), - (*SwInterfaceClearStats)(nil), - (*SwInterfaceClearStatsReply)(nil), - (*SwInterfaceDetails)(nil), - (*SwInterfaceDump)(nil), - (*SwInterfaceEvent)(nil), - (*SwInterfaceGetMacAddress)(nil), - (*SwInterfaceGetMacAddressReply)(nil), - (*SwInterfaceGetTable)(nil), - (*SwInterfaceGetTableReply)(nil), - (*SwInterfaceRxPlacementDetails)(nil), - (*SwInterfaceRxPlacementDump)(nil), - (*SwInterfaceSetFlags)(nil), - (*SwInterfaceSetFlagsReply)(nil), - (*SwInterfaceSetIPDirectedBroadcast)(nil), - (*SwInterfaceSetIPDirectedBroadcastReply)(nil), - (*SwInterfaceSetMacAddress)(nil), - (*SwInterfaceSetMacAddressReply)(nil), - (*SwInterfaceSetMtu)(nil), - (*SwInterfaceSetMtuReply)(nil), - (*SwInterfaceSetRxMode)(nil), - (*SwInterfaceSetRxModeReply)(nil), - (*SwInterfaceSetRxPlacement)(nil), - (*SwInterfaceSetRxPlacementReply)(nil), - (*SwInterfaceSetTable)(nil), - (*SwInterfaceSetTableReply)(nil), - (*SwInterfaceSetUnnumbered)(nil), - (*SwInterfaceSetUnnumberedReply)(nil), - (*SwInterfaceTagAddDel)(nil), - (*SwInterfaceTagAddDelReply)(nil), - (*WantInterfaceEvents)(nil), - (*WantInterfaceEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/ip.patch b/plugins/vpp/binapi/vpp1901/ip.patch new file mode 100644 index 0000000000..78f2b08224 --- /dev/null +++ b/plugins/vpp/binapi/vpp1901/ip.patch @@ -0,0 +1,15 @@ +diff --git b/plugins/vpp/binapi/vpp1901/ip/ip.ba.go a/plugins/vpp/binapi/vpp1901/ip/ip.ba.go +index 6564081d..a68ca172 100644 +--- b/plugins/vpp/binapi/vpp1901/ip/ip.ba.go ++++ a/plugins/vpp/binapi/vpp1901/ip/ip.ba.go +@@ -340,8 +340,8 @@ type FibPath struct { + NextHopID uint32 + RpfID uint32 + ViaLabel uint32 +- NLabels uint8 +- LabelStack []FibMplsLabel `struc:"[16]FibMplsLabel"` ++ NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED, see https://jira.fd.io/browse/VPP-1261 ++ LabelStack []FibMplsLabel + } + +func (*FibPath) GetTypeName() string { \ No newline at end of file diff --git a/plugins/vpp/binapi/vpp1901/ip/ip.ba.go b/plugins/vpp/binapi/vpp1901/ip/ip.ba.go index 67f55a6d93..2c07235a64 100644 --- a/plugins/vpp/binapi/vpp1901/ip/ip.ba.go +++ b/plugins/vpp/binapi/vpp1901/ip/ip.ba.go @@ -1,79 +1,36 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/ip.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/ip.api.json /* - Package ip is a generated from VPP binary API module 'ip'. +Package ip is a generated VPP binary API for 'ip' module. - It contains following objects: - 44 services +It consists of: 1 enum 3 aliases 11 types 1 union 91 messages + 44 services */ package ip -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "ip" + // VersionCrc is the CRC of this module. + VersionCrc = 0xa3532a2f +) -// Services represents VPP binary API services: -type Services interface { - DumpIP6Fib(*IP6FibDump) ([]*IP6FibDetails, error) - DumpIP6Mfib(*IP6MfibDump) ([]*IP6MfibDetails, error) - DumpIP6ndProxy(*IP6ndProxyDump) ([]*IP6ndProxyDetails, error) - DumpIPAddress(*IPAddressDump) ([]*IPAddressDetails, error) - DumpIPContainerProxy(*IPContainerProxyDump) ([]*IPContainerProxyDetails, error) - DumpIP(*IPDump) ([]*IPDetails, error) - DumpIPFib(*IPFibDump) ([]*IPFibDetails, error) - DumpIPMfib(*IPMfibDump) ([]*IPMfibDetails, error) - DumpIPNeighbor(*IPNeighborDump) ([]*IPNeighborDetails, error) - DumpIPPuntRedirect(*IPPuntRedirectDump) ([]*IPPuntRedirectDetails, error) - DumpIPUnnumbered(*IPUnnumberedDump) ([]*IPUnnumberedDetails, error) - DumpMfibSignal(*MfibSignalDump) ([]*MfibSignalDetails, error) - DumpProxyArp(*ProxyArpDump) ([]*ProxyArpDetails, error) - DumpProxyArpIntfc(*ProxyArpIntfcDump) ([]*ProxyArpIntfcDetails, error) - IoamDisable(*IoamDisable) (*IoamDisableReply, error) - IoamEnable(*IoamEnable) (*IoamEnableReply, error) - IP6ndProxyAddDel(*IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) - IP6ndSendRouterSolicitation(*IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) - IPAddDelRoute(*IPAddDelRoute) (*IPAddDelRouteReply, error) - IPContainerProxyAddDel(*IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(*IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPNeighborAddDel(*IPNeighborAddDel) (*IPNeighborAddDelReply, error) - IPProbeNeighbor(*IPProbeNeighbor) (*IPProbeNeighborReply, error) - IPPuntPolice(*IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(*IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(*IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(*IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(*IPReassemblySet) (*IPReassemblySetReply, error) - IPScanNeighborEnableDisable(*IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) - IPSourceAndPortRangeCheckAddDel(*IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(*IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(*IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) - IPTableAddDel(*IPTableAddDel) (*IPTableAddDelReply, error) - ProxyArpAddDel(*ProxyArpAddDel) (*ProxyArpAddDelReply, error) - ProxyArpIntfcEnableDisable(*ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) - ResetFib(*ResetFib) (*ResetFibReply, error) - SetArpNeighborLimit(*SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) - SetIPFlowHash(*SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(*SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6ndRaConfig(*SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) - SwInterfaceIP6ndRaPrefix(*SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) - WantIP4ArpEvents(*WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) - WantIP6NdEvents(*WantIP6NdEvents) (*WantIP6NdEventsReply, error) - WantIP6RaEvents(*WantIP6RaEvents) (*WantIP6RaEventsReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -81,20 +38,34 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -/* Aliases */ +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} -// IP4Address represents VPP binary API alias 'ip4_address': +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -// MacAddress represents VPP binary API alias 'mac_address': +// MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -107,7 +78,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// FibMplsLabel represents VPP binary API type 'fib_mpls_label': +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { IsUniform uint8 Label uint32 @@ -122,7 +93,7 @@ func (*FibMplsLabel) GetCrcString() string { return "c93bf35c" } -// FibPath represents VPP binary API type 'fib_path': +// FibPath represents VPP binary API type 'fib_path'. type FibPath struct { SwIfIndex uint32 TableID uint32 @@ -154,7 +125,7 @@ func (*FibPath) GetCrcString() string { return "ba7a81f0" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -167,7 +138,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -180,7 +151,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info': +// IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info'. type IP6RaPrefixInfo struct { DstAddress []byte `struc:"[16]byte"` DstAddressLength uint8 @@ -196,7 +167,7 @@ func (*IP6RaPrefixInfo) GetCrcString() string { return "83d7c6e5" } -// MfibPath represents VPP binary API type 'mfib_path': +// MfibPath represents VPP binary API type 'mfib_path'. type MfibPath struct { Path FibPath ItfFlags uint32 @@ -209,7 +180,7 @@ func (*MfibPath) GetCrcString() string { return "4ba77d32" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -224,7 +195,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -237,7 +208,7 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -// ProxyArp represents VPP binary API type 'proxy_arp': +// ProxyArp represents VPP binary API type 'proxy_arp'. type ProxyArp struct { VrfID uint32 LowAddress []byte `struc:"[4]byte"` @@ -251,7 +222,7 @@ func (*ProxyArp) GetCrcString() string { return "6d88106e" } -// PuntRedirect represents VPP binary API type 'punt_redirect': +// PuntRedirect represents VPP binary API type 'punt_redirect'. type PuntRedirect struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -265,11 +236,9 @@ func (*PuntRedirect) GetCrcString() string { return "3e7a801f" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -288,10 +257,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -305,17 +274,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// IoamDisable represents VPP binary API message 'ioam_disable': +// IoamDisable represents VPP binary API message 'ioam_disable'. type IoamDisable struct { ID uint16 } @@ -330,7 +297,7 @@ func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IoamDisableReply represents VPP binary API message 'ioam_disable_reply': +// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. type IoamDisableReply struct { Retval int32 } @@ -345,7 +312,7 @@ func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IoamEnable represents VPP binary API message 'ioam_enable': +// IoamEnable represents VPP binary API message 'ioam_enable'. type IoamEnable struct { ID uint16 Seqno uint8 @@ -365,7 +332,7 @@ func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } -// IoamEnableReply represents VPP binary API message 'ioam_enable_reply': +// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. type IoamEnableReply struct { Retval int32 } @@ -380,7 +347,7 @@ func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP4ArpEvent represents VPP binary API message 'ip4_arp_event': +// IP4ArpEvent represents VPP binary API message 'ip4_arp_event'. type IP4ArpEvent struct { Address uint32 PID uint32 @@ -399,7 +366,7 @@ func (*IP4ArpEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6FibDetails represents VPP binary API message 'ip6_fib_details': +// IP6FibDetails represents VPP binary API message 'ip6_fib_details'. type IP6FibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -420,7 +387,7 @@ func (*IP6FibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6FibDump represents VPP binary API message 'ip6_fib_dump': +// IP6FibDump represents VPP binary API message 'ip6_fib_dump'. type IP6FibDump struct{} func (*IP6FibDump) GetMessageName() string { @@ -433,7 +400,7 @@ func (*IP6FibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6MfibDetails represents VPP binary API message 'ip6_mfib_details': +// IP6MfibDetails represents VPP binary API message 'ip6_mfib_details'. type IP6MfibDetails struct { TableID uint32 AddressLength uint8 @@ -453,7 +420,7 @@ func (*IP6MfibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6MfibDump represents VPP binary API message 'ip6_mfib_dump': +// IP6MfibDump represents VPP binary API message 'ip6_mfib_dump'. type IP6MfibDump struct{} func (*IP6MfibDump) GetMessageName() string { @@ -466,7 +433,7 @@ func (*IP6MfibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6NdEvent represents VPP binary API message 'ip6_nd_event': +// IP6NdEvent represents VPP binary API message 'ip6_nd_event'. type IP6NdEvent struct { PID uint32 SwIfIndex uint32 @@ -485,7 +452,7 @@ func (*IP6NdEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6RaEvent represents VPP binary API message 'ip6_ra_event': +// IP6RaEvent represents VPP binary API message 'ip6_ra_event'. type IP6RaEvent struct { PID uint32 SwIfIndex uint32 @@ -509,7 +476,7 @@ func (*IP6RaEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del': +// IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del'. type IP6ndProxyAddDel struct { SwIfIndex uint32 IsDel uint8 @@ -526,7 +493,7 @@ func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply': +// IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply'. type IP6ndProxyAddDelReply struct { Retval int32 } @@ -541,7 +508,7 @@ func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details': +// IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details'. type IP6ndProxyDetails struct { SwIfIndex uint32 Address []byte `struc:"[16]byte"` @@ -557,7 +524,7 @@ func (*IP6ndProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump': +// IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump'. type IP6ndProxyDump struct{} func (*IP6ndProxyDump) GetMessageName() string { @@ -570,7 +537,7 @@ func (*IP6ndProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation': +// IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation'. type IP6ndSendRouterSolicitation struct { Irt uint32 Mrt uint32 @@ -590,7 +557,7 @@ func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply': +// IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply'. type IP6ndSendRouterSolicitationReply struct { Retval int32 } @@ -605,7 +572,7 @@ func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddDelRoute represents VPP binary API message 'ip_add_del_route': +// IPAddDelRoute represents VPP binary API message 'ip_add_del_route'. type IPAddDelRoute struct { NextHopSwIfIndex uint32 TableID uint32 @@ -646,7 +613,7 @@ func (*IPAddDelRoute) GetMessageType() api.MessageType { return api.RequestMessage } -// IPAddDelRouteReply represents VPP binary API message 'ip_add_del_route_reply': +// IPAddDelRouteReply represents VPP binary API message 'ip_add_del_route_reply'. type IPAddDelRouteReply struct { Retval int32 StatsIndex uint32 @@ -662,7 +629,7 @@ func (*IPAddDelRouteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddressDetails represents VPP binary API message 'ip_address_details': +// IPAddressDetails represents VPP binary API message 'ip_address_details'. type IPAddressDetails struct { IP []byte `struc:"[16]byte"` PrefixLength uint8 @@ -680,7 +647,7 @@ func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddressDump represents VPP binary API message 'ip_address_dump': +// IPAddressDump represents VPP binary API message 'ip_address_dump'. type IPAddressDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -696,7 +663,7 @@ func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del': +// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. type IPContainerProxyAddDel struct { IP []byte `struc:"[16]byte"` IsIP4 uint8 @@ -715,7 +682,7 @@ func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply': +// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. type IPContainerProxyAddDelReply struct { Retval int32 } @@ -730,7 +697,7 @@ func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details': +// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. type IPContainerProxyDetails struct { SwIfIndex uint32 Prefix Prefix @@ -746,7 +713,7 @@ func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump': +// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. type IPContainerProxyDump struct{} func (*IPContainerProxyDump) GetMessageName() string { @@ -759,7 +726,7 @@ func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPDetails represents VPP binary API message 'ip_details': +// IPDetails represents VPP binary API message 'ip_details'. type IPDetails struct { SwIfIndex uint32 IsIPv6 uint8 @@ -775,7 +742,7 @@ func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPDump represents VPP binary API message 'ip_dump': +// IPDump represents VPP binary API message 'ip_dump'. type IPDump struct { IsIPv6 uint8 } @@ -790,7 +757,7 @@ func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPFibDetails represents VPP binary API message 'ip_fib_details': +// IPFibDetails represents VPP binary API message 'ip_fib_details'. type IPFibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -811,7 +778,7 @@ func (*IPFibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPFibDump represents VPP binary API message 'ip_fib_dump': +// IPFibDump represents VPP binary API message 'ip_fib_dump'. type IPFibDump struct{} func (*IPFibDump) GetMessageName() string { @@ -824,7 +791,7 @@ func (*IPFibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMfibDetails represents VPP binary API message 'ip_mfib_details': +// IPMfibDetails represents VPP binary API message 'ip_mfib_details'. type IPMfibDetails struct { TableID uint32 EntryFlags uint32 @@ -847,7 +814,7 @@ func (*IPMfibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPMfibDump represents VPP binary API message 'ip_mfib_dump': +// IPMfibDump represents VPP binary API message 'ip_mfib_dump'. type IPMfibDump struct{} func (*IPMfibDump) GetMessageName() string { @@ -860,7 +827,7 @@ func (*IPMfibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del': +// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. type IPMrouteAddDel struct { NextHopSwIfIndex uint32 TableID uint32 @@ -888,7 +855,7 @@ func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply': +// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. type IPMrouteAddDelReply struct { Retval int32 StatsIndex uint32 @@ -904,7 +871,7 @@ func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del': +// IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del'. type IPNeighborAddDel struct { SwIfIndex uint32 IsAdd uint8 @@ -925,7 +892,7 @@ func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply': +// IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply'. type IPNeighborAddDelReply struct { Retval int32 StatsIndex uint32 @@ -941,7 +908,7 @@ func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborDetails represents VPP binary API message 'ip_neighbor_details': +// IPNeighborDetails represents VPP binary API message 'ip_neighbor_details'. type IPNeighborDetails struct { SwIfIndex uint32 StatsIndex uint32 @@ -961,7 +928,7 @@ func (*IPNeighborDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborDump represents VPP binary API message 'ip_neighbor_dump': +// IPNeighborDump represents VPP binary API message 'ip_neighbor_dump'. type IPNeighborDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -977,7 +944,7 @@ func (*IPNeighborDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor': +// IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor'. type IPProbeNeighbor struct { SwIfIndex uint32 DstAddress []byte `struc:"[16]byte"` @@ -994,7 +961,7 @@ func (*IPProbeNeighbor) GetMessageType() api.MessageType { return api.RequestMessage } -// IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply': +// IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply'. type IPProbeNeighborReply struct { Retval int32 } @@ -1009,7 +976,7 @@ func (*IPProbeNeighborReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntPolice represents VPP binary API message 'ip_punt_police': +// IPPuntPolice represents VPP binary API message 'ip_punt_police'. type IPPuntPolice struct { PolicerIndex uint32 IsAdd uint8 @@ -1026,7 +993,7 @@ func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply': +// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. type IPPuntPoliceReply struct { Retval int32 } @@ -1041,7 +1008,7 @@ func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect': +// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. type IPPuntRedirect struct { Punt PuntRedirect IsAdd uint8 @@ -1057,7 +1024,7 @@ func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details': +// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. type IPPuntRedirectDetails struct { Punt PuntRedirect } @@ -1072,7 +1039,7 @@ func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump': +// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. type IPPuntRedirectDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -1088,7 +1055,7 @@ func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply': +// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. type IPPuntRedirectReply struct { Retval int32 } @@ -1103,7 +1070,7 @@ func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable': +// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. type IPReassemblyEnableDisable struct { SwIfIndex uint32 EnableIP4 uint8 @@ -1120,7 +1087,7 @@ func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply': +// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. type IPReassemblyEnableDisableReply struct { Retval int32 } @@ -1135,7 +1102,7 @@ func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get': +// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. type IPReassemblyGet struct { IsIP6 uint8 } @@ -1150,7 +1117,7 @@ func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply': +// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. type IPReassemblyGetReply struct { Retval int32 TimeoutMs uint32 @@ -1169,7 +1136,7 @@ func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblySet represents VPP binary API message 'ip_reassembly_set': +// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. type IPReassemblySet struct { TimeoutMs uint32 MaxReassemblies uint32 @@ -1187,7 +1154,7 @@ func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply': +// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. type IPReassemblySetReply struct { Retval int32 } @@ -1202,7 +1169,7 @@ func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable': +// IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable'. type IPScanNeighborEnableDisable struct { Mode uint8 ScanInterval uint8 @@ -1222,7 +1189,7 @@ func (*IPScanNeighborEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply': +// IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply'. type IPScanNeighborEnableDisableReply struct { Retval int32 } @@ -1237,7 +1204,7 @@ func (*IPScanNeighborEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del': +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. type IPSourceAndPortRangeCheckAddDel struct { IsIPv6 uint8 IsAdd uint8 @@ -1259,7 +1226,7 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply': +// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. type IPSourceAndPortRangeCheckAddDelReply struct { Retval int32 } @@ -1274,7 +1241,7 @@ func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del': +// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. type IPSourceAndPortRangeCheckInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -1294,7 +1261,7 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageTyp return api.RequestMessage } -// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply': +// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { Retval int32 } @@ -1309,7 +1276,7 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.Messa return api.ReplyMessage } -// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del': +// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. type IPSourceCheckInterfaceAddDel struct { IsAdd uint8 Loose uint8 @@ -1326,7 +1293,7 @@ func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply': +// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. type IPSourceCheckInterfaceAddDelReply struct { Retval int32 } @@ -1341,7 +1308,7 @@ func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPTableAddDel represents VPP binary API message 'ip_table_add_del': +// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. type IPTableAddDel struct { TableID uint32 IsIPv6 uint8 @@ -1359,7 +1326,7 @@ func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply': +// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. type IPTableAddDelReply struct { Retval int32 } @@ -1374,7 +1341,7 @@ func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details': +// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. type IPUnnumberedDetails struct { SwIfIndex uint32 IPSwIfIndex uint32 @@ -1390,7 +1357,7 @@ func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump': +// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. type IPUnnumberedDump struct { SwIfIndex uint32 } @@ -1405,7 +1372,7 @@ func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MfibSignalDetails represents VPP binary API message 'mfib_signal_details': +// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. type MfibSignalDetails struct { SwIfIndex uint32 TableID uint32 @@ -1426,7 +1393,7 @@ func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MfibSignalDump represents VPP binary API message 'mfib_signal_dump': +// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. type MfibSignalDump struct{} func (*MfibSignalDump) GetMessageName() string { @@ -1439,7 +1406,7 @@ func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del': +// ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del'. type ProxyArpAddDel struct { IsAdd uint8 Proxy ProxyArp @@ -1455,7 +1422,7 @@ func (*ProxyArpAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply': +// ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply'. type ProxyArpAddDelReply struct { Retval int32 } @@ -1470,7 +1437,7 @@ func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpDetails represents VPP binary API message 'proxy_arp_details': +// ProxyArpDetails represents VPP binary API message 'proxy_arp_details'. type ProxyArpDetails struct { Proxy ProxyArp } @@ -1485,7 +1452,7 @@ func (*ProxyArpDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpDump represents VPP binary API message 'proxy_arp_dump': +// ProxyArpDump represents VPP binary API message 'proxy_arp_dump'. type ProxyArpDump struct{} func (*ProxyArpDump) GetMessageName() string { @@ -1498,7 +1465,7 @@ func (*ProxyArpDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details': +// ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details'. type ProxyArpIntfcDetails struct { SwIfIndex uint32 } @@ -1513,7 +1480,7 @@ func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump': +// ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump'. type ProxyArpIntfcDump struct{} func (*ProxyArpIntfcDump) GetMessageName() string { @@ -1526,7 +1493,7 @@ func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable': +// ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable'. type ProxyArpIntfcEnableDisable struct { SwIfIndex uint32 EnableDisable uint8 @@ -1542,7 +1509,7 @@ func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply': +// ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply'. type ProxyArpIntfcEnableDisableReply struct { Retval int32 } @@ -1557,7 +1524,7 @@ func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ResetFib represents VPP binary API message 'reset_fib': +// ResetFib represents VPP binary API message 'reset_fib'. type ResetFib struct { VrfID uint32 IsIPv6 uint8 @@ -1573,7 +1540,7 @@ func (*ResetFib) GetMessageType() api.MessageType { return api.RequestMessage } -// ResetFibReply represents VPP binary API message 'reset_fib_reply': +// ResetFibReply represents VPP binary API message 'reset_fib_reply'. type ResetFibReply struct { Retval int32 } @@ -1588,7 +1555,7 @@ func (*ResetFibReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit': +// SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit'. type SetArpNeighborLimit struct { IsIPv6 uint8 ArpNeighborLimit uint32 @@ -1604,7 +1571,7 @@ func (*SetArpNeighborLimit) GetMessageType() api.MessageType { return api.RequestMessage } -// SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply': +// SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply'. type SetArpNeighborLimitReply struct { Retval int32 } @@ -1619,7 +1586,7 @@ func (*SetArpNeighborLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash': +// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. type SetIPFlowHash struct { VrfID uint32 IsIPv6 uint8 @@ -1642,7 +1609,7 @@ func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } -// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply': +// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. type SetIPFlowHashReply struct { Retval int32 } @@ -1657,7 +1624,7 @@ func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable': +// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. type SwInterfaceIP6EnableDisable struct { SwIfIndex uint32 Enable uint8 @@ -1673,7 +1640,7 @@ func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply': +// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. type SwInterfaceIP6EnableDisableReply struct { Retval int32 } @@ -1688,7 +1655,7 @@ func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config': +// SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config'. type SwInterfaceIP6ndRaConfig struct { SwIfIndex uint32 Suppress uint8 @@ -1716,7 +1683,7 @@ func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply': +// SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply'. type SwInterfaceIP6ndRaConfigReply struct { Retval int32 } @@ -1731,7 +1698,7 @@ func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix': +// SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix'. type SwInterfaceIP6ndRaPrefix struct { SwIfIndex uint32 Address []byte `struc:"[16]byte"` @@ -1756,7 +1723,7 @@ func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply': +// SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply'. type SwInterfaceIP6ndRaPrefixReply struct { Retval int32 } @@ -1771,7 +1738,7 @@ func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events': +// WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events'. type WantIP4ArpEvents struct { EnableDisable uint8 PID uint32 @@ -1788,7 +1755,7 @@ func (*WantIP4ArpEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply': +// WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply'. type WantIP4ArpEventsReply struct { Retval int32 } @@ -1803,7 +1770,7 @@ func (*WantIP4ArpEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events': +// WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events'. type WantIP6NdEvents struct { EnableDisable uint8 PID uint32 @@ -1820,7 +1787,7 @@ func (*WantIP6NdEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply': +// WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply'. type WantIP6NdEventsReply struct { Retval int32 } @@ -1835,7 +1802,7 @@ func (*WantIP6NdEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events': +// WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events'. type WantIP6RaEvents struct { EnableDisable uint8 PID uint32 @@ -1851,7 +1818,7 @@ func (*WantIP6RaEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply': +// WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply'. type WantIP6RaEventsReply struct { Retval int32 } @@ -1960,96 +1927,803 @@ func init() { api.RegisterMessage((*WantIP6RaEventsReply)(nil), "ip.WantIP6RaEventsReply") } -var Messages = []api.Message{ - (*IoamDisable)(nil), - (*IoamDisableReply)(nil), - (*IoamEnable)(nil), - (*IoamEnableReply)(nil), - (*IP4ArpEvent)(nil), - (*IP6FibDetails)(nil), - (*IP6FibDump)(nil), - (*IP6MfibDetails)(nil), - (*IP6MfibDump)(nil), - (*IP6NdEvent)(nil), - (*IP6RaEvent)(nil), - (*IP6ndProxyAddDel)(nil), - (*IP6ndProxyAddDelReply)(nil), - (*IP6ndProxyDetails)(nil), - (*IP6ndProxyDump)(nil), - (*IP6ndSendRouterSolicitation)(nil), - (*IP6ndSendRouterSolicitationReply)(nil), - (*IPAddDelRoute)(nil), - (*IPAddDelRouteReply)(nil), - (*IPAddressDetails)(nil), - (*IPAddressDump)(nil), - (*IPContainerProxyAddDel)(nil), - (*IPContainerProxyAddDelReply)(nil), - (*IPContainerProxyDetails)(nil), - (*IPContainerProxyDump)(nil), - (*IPDetails)(nil), - (*IPDump)(nil), - (*IPFibDetails)(nil), - (*IPFibDump)(nil), - (*IPMfibDetails)(nil), - (*IPMfibDump)(nil), - (*IPMrouteAddDel)(nil), - (*IPMrouteAddDelReply)(nil), - (*IPNeighborAddDel)(nil), - (*IPNeighborAddDelReply)(nil), - (*IPNeighborDetails)(nil), - (*IPNeighborDump)(nil), - (*IPProbeNeighbor)(nil), - (*IPProbeNeighborReply)(nil), - (*IPPuntPolice)(nil), - (*IPPuntPoliceReply)(nil), - (*IPPuntRedirect)(nil), - (*IPPuntRedirectDetails)(nil), - (*IPPuntRedirectDump)(nil), - (*IPPuntRedirectReply)(nil), - (*IPReassemblyEnableDisable)(nil), - (*IPReassemblyEnableDisableReply)(nil), - (*IPReassemblyGet)(nil), - (*IPReassemblyGetReply)(nil), - (*IPReassemblySet)(nil), - (*IPReassemblySetReply)(nil), - (*IPScanNeighborEnableDisable)(nil), - (*IPScanNeighborEnableDisableReply)(nil), - (*IPSourceAndPortRangeCheckAddDel)(nil), - (*IPSourceAndPortRangeCheckAddDelReply)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPSourceCheckInterfaceAddDel)(nil), - (*IPSourceCheckInterfaceAddDelReply)(nil), - (*IPTableAddDel)(nil), - (*IPTableAddDelReply)(nil), - (*IPUnnumberedDetails)(nil), - (*IPUnnumberedDump)(nil), - (*MfibSignalDetails)(nil), - (*MfibSignalDump)(nil), - (*ProxyArpAddDel)(nil), - (*ProxyArpAddDelReply)(nil), - (*ProxyArpDetails)(nil), - (*ProxyArpDump)(nil), - (*ProxyArpIntfcDetails)(nil), - (*ProxyArpIntfcDump)(nil), - (*ProxyArpIntfcEnableDisable)(nil), - (*ProxyArpIntfcEnableDisableReply)(nil), - (*ResetFib)(nil), - (*ResetFibReply)(nil), - (*SetArpNeighborLimit)(nil), - (*SetArpNeighborLimitReply)(nil), - (*SetIPFlowHash)(nil), - (*SetIPFlowHashReply)(nil), - (*SwInterfaceIP6EnableDisable)(nil), - (*SwInterfaceIP6EnableDisableReply)(nil), - (*SwInterfaceIP6ndRaConfig)(nil), - (*SwInterfaceIP6ndRaConfigReply)(nil), - (*SwInterfaceIP6ndRaPrefix)(nil), - (*SwInterfaceIP6ndRaPrefixReply)(nil), - (*WantIP4ArpEvents)(nil), - (*WantIP4ArpEventsReply)(nil), - (*WantIP6NdEvents)(nil), - (*WantIP6NdEventsReply)(nil), - (*WantIP6RaEvents)(nil), - (*WantIP6RaEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IP4ArpEvent)(nil), + (*IP6FibDetails)(nil), + (*IP6FibDump)(nil), + (*IP6MfibDetails)(nil), + (*IP6MfibDump)(nil), + (*IP6NdEvent)(nil), + (*IP6RaEvent)(nil), + (*IP6ndProxyAddDel)(nil), + (*IP6ndProxyAddDelReply)(nil), + (*IP6ndProxyDetails)(nil), + (*IP6ndProxyDump)(nil), + (*IP6ndSendRouterSolicitation)(nil), + (*IP6ndSendRouterSolicitationReply)(nil), + (*IPAddDelRoute)(nil), + (*IPAddDelRouteReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPFibDetails)(nil), + (*IPFibDump)(nil), + (*IPMfibDetails)(nil), + (*IPMfibDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPNeighborAddDel)(nil), + (*IPNeighborAddDelReply)(nil), + (*IPNeighborDetails)(nil), + (*IPNeighborDump)(nil), + (*IPProbeNeighbor)(nil), + (*IPProbeNeighborReply)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPScanNeighborEnableDisable)(nil), + (*IPScanNeighborEnableDisableReply)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + (*ResetFib)(nil), + (*ResetFibReply)(nil), + (*SetArpNeighborLimit)(nil), + (*SetArpNeighborLimitReply)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6ndRaConfig)(nil), + (*SwInterfaceIP6ndRaConfigReply)(nil), + (*SwInterfaceIP6ndRaPrefix)(nil), + (*SwInterfaceIP6ndRaPrefixReply)(nil), + (*WantIP4ArpEvents)(nil), + (*WantIP4ArpEventsReply)(nil), + (*WantIP6NdEvents)(nil), + (*WantIP6NdEventsReply)(nil), + (*WantIP6RaEvents)(nil), + (*WantIP6RaEventsReply)(nil), + } +} + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIP6Fib(ctx context.Context, in *IP6FibDump) (RPCService_DumpIP6FibClient, error) + DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) (RPCService_DumpIP6MfibClient, error) + DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPFib(ctx context.Context, in *IPFibDump) (RPCService_DumpIPFibClient, error) + DumpIPMfib(ctx context.Context, in *IPMfibDump) (RPCService_DumpIPMfibClient, error) + DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) + DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) + IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) + IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) + IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) + ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) + SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) + SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) + WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) + WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) + WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIP6Fib(ctx context.Context, in *IP6FibDump) (RPCService_DumpIP6FibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6FibClient{stream} + return x, nil +} + +type RPCService_DumpIP6FibClient interface { + Recv() (*IP6FibDetails, error) +} + +type serviceClient_DumpIP6FibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6FibClient) Recv() (*IP6FibDetails, error) { + m := new(IP6FibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) (RPCService_DumpIP6MfibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6MfibClient{stream} + return x, nil +} + +type RPCService_DumpIP6MfibClient interface { + Recv() (*IP6MfibDetails, error) +} + +type serviceClient_DumpIP6MfibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6MfibClient) Recv() (*IP6MfibDetails, error) { + m := new(IP6MfibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6ndProxyClient{stream} + return x, nil +} + +type RPCService_DumpIP6ndProxyClient interface { + Recv() (*IP6ndProxyDetails, error) +} + +type serviceClient_DumpIP6ndProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6ndProxyClient) Recv() (*IP6ndProxyDetails, error) { + m := new(IP6ndProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPFib(ctx context.Context, in *IPFibDump) (RPCService_DumpIPFibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPFibClient{stream} + return x, nil +} + +type RPCService_DumpIPFibClient interface { + Recv() (*IPFibDetails, error) +} + +type serviceClient_DumpIPFibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPFibClient) Recv() (*IPFibDetails, error) { + m := new(IPFibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMfib(ctx context.Context, in *IPMfibDump) (RPCService_DumpIPMfibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMfibClient{stream} + return x, nil +} + +type RPCService_DumpIPMfibClient interface { + Recv() (*IPMfibDetails, error) +} + +type serviceClient_DumpIPMfibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMfibClient) Recv() (*IPMfibDetails, error) { + m := new(IPMfibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPNeighborClient{stream} + return x, nil +} + +type RPCService_DumpIPNeighborClient interface { + Recv() (*IPNeighborDetails, error) +} + +type serviceClient_DumpIPNeighborClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPNeighborClient) Recv() (*IPNeighborDetails, error) { + m := new(IPNeighborDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil } + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpClient interface { + Recv() (*ProxyArpDetails, error) +} + +type serviceClient_DumpProxyArpClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpClient) Recv() (*ProxyArpDetails, error) { + m := new(ProxyArpDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpIntfcClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpIntfcClient interface { + Recv() (*ProxyArpIntfcDetails, error) +} + +type serviceClient_DumpProxyArpIntfcClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpIntfcClient) Recv() (*ProxyArpIntfcDetails, error) { + m := new(ProxyArpIntfcDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) { + out := new(IP6ndProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { + out := new(IP6ndSendRouterSolicitationReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) { + out := new(IPAddDelRouteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) { + out := new(IPNeighborAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) { + out := new(IPProbeNeighborReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) { + out := new(IPScanNeighborEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) { + out := new(ResetFibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) { + out := new(SetArpNeighborLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { + out := new(SwInterfaceIP6ndRaConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { + out := new(SwInterfaceIP6ndRaPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) { + out := new(WantIP4ArpEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) { + out := new(WantIP6NdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { + out := new(WantIP6RaEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/ipsec/ipsec.ba.go b/plugins/vpp/binapi/vpp1901/ipsec/ipsec.ba.go index 3297896260..ebf4a44025 100644 --- a/plugins/vpp/binapi/vpp1901/ipsec/ipsec.ba.go +++ b/plugins/vpp/binapi/vpp1901/ipsec/ipsec.ba.go @@ -1,58 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/ipsec.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/ipsec.api.json /* - Package ipsec is a generated from VPP binary API module 'ipsec'. +Package ipsec is a generated VPP binary API for 'ipsec' module. - It contains following objects: - 27 services +It consists of: 54 messages + 27 services */ package ipsec -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpIpsecBackend(*IpsecBackendDump) ([]*IpsecBackendDetails, error) - DumpIpsecSa(*IpsecSaDump) ([]*IpsecSaDetails, error) - DumpIpsecSpd(*IpsecSpdDump) ([]*IpsecSpdDetails, error) - DumpIpsecSpdInterface(*IpsecSpdInterfaceDump) ([]*IpsecSpdInterfaceDetails, error) - DumpIpsecSpds(*IpsecSpdsDump) ([]*IpsecSpdsDetails, error) - Ikev2InitiateDelChildSa(*Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) - Ikev2InitiateDelIkeSa(*Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) - Ikev2InitiateRekeyChildSa(*Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) - Ikev2InitiateSaInit(*Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) - Ikev2ProfileAddDel(*Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) - Ikev2ProfileSetAuth(*Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) - Ikev2ProfileSetID(*Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) - Ikev2ProfileSetTs(*Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) - Ikev2SetEspTransforms(*Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) - Ikev2SetIkeTransforms(*Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) - Ikev2SetLocalKey(*Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) - Ikev2SetResponder(*Ikev2SetResponder) (*Ikev2SetResponderReply, error) - Ikev2SetSaLifetime(*Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) - IpsecInterfaceAddDelSpd(*IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) - IpsecSaSetKey(*IpsecSaSetKey) (*IpsecSaSetKeyReply, error) - IpsecSadAddDelEntry(*IpsecSadAddDelEntry) (*IpsecSadAddDelEntryReply, error) - IpsecSelectBackend(*IpsecSelectBackend) (*IpsecSelectBackendReply, error) - IpsecSpdAddDel(*IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) - IpsecSpdAddDelEntry(*IpsecSpdAddDelEntry) (*IpsecSpdAddDelEntryReply, error) - IpsecTunnelIfAddDel(*IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) - IpsecTunnelIfSetKey(*IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) - IpsecTunnelIfSetSa(*IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) -} - -/* Messages */ - -// Ikev2InitiateDelChildSa represents VPP binary API message 'ikev2_initiate_del_child_sa': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "ipsec" + // VersionCrc is the CRC of this module. + VersionCrc = 0xd79c12fb +) + +// Ikev2InitiateDelChildSa represents VPP binary API message 'ikev2_initiate_del_child_sa'. type Ikev2InitiateDelChildSa struct { Ispi uint32 } @@ -67,7 +41,7 @@ func (*Ikev2InitiateDelChildSa) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2InitiateDelChildSaReply represents VPP binary API message 'ikev2_initiate_del_child_sa_reply': +// Ikev2InitiateDelChildSaReply represents VPP binary API message 'ikev2_initiate_del_child_sa_reply'. type Ikev2InitiateDelChildSaReply struct { Retval int32 } @@ -82,7 +56,7 @@ func (*Ikev2InitiateDelChildSaReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2InitiateDelIkeSa represents VPP binary API message 'ikev2_initiate_del_ike_sa': +// Ikev2InitiateDelIkeSa represents VPP binary API message 'ikev2_initiate_del_ike_sa'. type Ikev2InitiateDelIkeSa struct { Ispi uint64 } @@ -97,7 +71,7 @@ func (*Ikev2InitiateDelIkeSa) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2InitiateDelIkeSaReply represents VPP binary API message 'ikev2_initiate_del_ike_sa_reply': +// Ikev2InitiateDelIkeSaReply represents VPP binary API message 'ikev2_initiate_del_ike_sa_reply'. type Ikev2InitiateDelIkeSaReply struct { Retval int32 } @@ -112,7 +86,7 @@ func (*Ikev2InitiateDelIkeSaReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2InitiateRekeyChildSa represents VPP binary API message 'ikev2_initiate_rekey_child_sa': +// Ikev2InitiateRekeyChildSa represents VPP binary API message 'ikev2_initiate_rekey_child_sa'. type Ikev2InitiateRekeyChildSa struct { Ispi uint32 } @@ -127,7 +101,7 @@ func (*Ikev2InitiateRekeyChildSa) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2InitiateRekeyChildSaReply represents VPP binary API message 'ikev2_initiate_rekey_child_sa_reply': +// Ikev2InitiateRekeyChildSaReply represents VPP binary API message 'ikev2_initiate_rekey_child_sa_reply'. type Ikev2InitiateRekeyChildSaReply struct { Retval int32 } @@ -142,7 +116,7 @@ func (*Ikev2InitiateRekeyChildSaReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2InitiateSaInit represents VPP binary API message 'ikev2_initiate_sa_init': +// Ikev2InitiateSaInit represents VPP binary API message 'ikev2_initiate_sa_init'. type Ikev2InitiateSaInit struct { Name []byte `struc:"[64]byte"` } @@ -157,7 +131,7 @@ func (*Ikev2InitiateSaInit) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2InitiateSaInitReply represents VPP binary API message 'ikev2_initiate_sa_init_reply': +// Ikev2InitiateSaInitReply represents VPP binary API message 'ikev2_initiate_sa_init_reply'. type Ikev2InitiateSaInitReply struct { Retval int32 } @@ -172,7 +146,7 @@ func (*Ikev2InitiateSaInitReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2ProfileAddDel represents VPP binary API message 'ikev2_profile_add_del': +// Ikev2ProfileAddDel represents VPP binary API message 'ikev2_profile_add_del'. type Ikev2ProfileAddDel struct { Name []byte `struc:"[64]byte"` IsAdd uint8 @@ -188,7 +162,7 @@ func (*Ikev2ProfileAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2ProfileAddDelReply represents VPP binary API message 'ikev2_profile_add_del_reply': +// Ikev2ProfileAddDelReply represents VPP binary API message 'ikev2_profile_add_del_reply'. type Ikev2ProfileAddDelReply struct { Retval int32 } @@ -203,7 +177,7 @@ func (*Ikev2ProfileAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2ProfileSetAuth represents VPP binary API message 'ikev2_profile_set_auth': +// Ikev2ProfileSetAuth represents VPP binary API message 'ikev2_profile_set_auth'. type Ikev2ProfileSetAuth struct { Name []byte `struc:"[64]byte"` AuthMethod uint8 @@ -222,7 +196,7 @@ func (*Ikev2ProfileSetAuth) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2ProfileSetAuthReply represents VPP binary API message 'ikev2_profile_set_auth_reply': +// Ikev2ProfileSetAuthReply represents VPP binary API message 'ikev2_profile_set_auth_reply'. type Ikev2ProfileSetAuthReply struct { Retval int32 } @@ -237,7 +211,7 @@ func (*Ikev2ProfileSetAuthReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2ProfileSetID represents VPP binary API message 'ikev2_profile_set_id': +// Ikev2ProfileSetID represents VPP binary API message 'ikev2_profile_set_id'. type Ikev2ProfileSetID struct { Name []byte `struc:"[64]byte"` IsLocal uint8 @@ -256,7 +230,7 @@ func (*Ikev2ProfileSetID) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2ProfileSetIDReply represents VPP binary API message 'ikev2_profile_set_id_reply': +// Ikev2ProfileSetIDReply represents VPP binary API message 'ikev2_profile_set_id_reply'. type Ikev2ProfileSetIDReply struct { Retval int32 } @@ -271,7 +245,7 @@ func (*Ikev2ProfileSetIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2ProfileSetTs represents VPP binary API message 'ikev2_profile_set_ts': +// Ikev2ProfileSetTs represents VPP binary API message 'ikev2_profile_set_ts'. type Ikev2ProfileSetTs struct { Name []byte `struc:"[64]byte"` IsLocal uint8 @@ -292,7 +266,7 @@ func (*Ikev2ProfileSetTs) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2ProfileSetTsReply represents VPP binary API message 'ikev2_profile_set_ts_reply': +// Ikev2ProfileSetTsReply represents VPP binary API message 'ikev2_profile_set_ts_reply'. type Ikev2ProfileSetTsReply struct { Retval int32 } @@ -307,7 +281,7 @@ func (*Ikev2ProfileSetTsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2SetEspTransforms represents VPP binary API message 'ikev2_set_esp_transforms': +// Ikev2SetEspTransforms represents VPP binary API message 'ikev2_set_esp_transforms'. type Ikev2SetEspTransforms struct { Name []byte `struc:"[64]byte"` CryptoAlg uint32 @@ -326,7 +300,7 @@ func (*Ikev2SetEspTransforms) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2SetEspTransformsReply represents VPP binary API message 'ikev2_set_esp_transforms_reply': +// Ikev2SetEspTransformsReply represents VPP binary API message 'ikev2_set_esp_transforms_reply'. type Ikev2SetEspTransformsReply struct { Retval int32 } @@ -341,7 +315,7 @@ func (*Ikev2SetEspTransformsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2SetIkeTransforms represents VPP binary API message 'ikev2_set_ike_transforms': +// Ikev2SetIkeTransforms represents VPP binary API message 'ikev2_set_ike_transforms'. type Ikev2SetIkeTransforms struct { Name []byte `struc:"[64]byte"` CryptoAlg uint32 @@ -360,7 +334,7 @@ func (*Ikev2SetIkeTransforms) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2SetIkeTransformsReply represents VPP binary API message 'ikev2_set_ike_transforms_reply': +// Ikev2SetIkeTransformsReply represents VPP binary API message 'ikev2_set_ike_transforms_reply'. type Ikev2SetIkeTransformsReply struct { Retval int32 } @@ -375,7 +349,7 @@ func (*Ikev2SetIkeTransformsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2SetLocalKey represents VPP binary API message 'ikev2_set_local_key': +// Ikev2SetLocalKey represents VPP binary API message 'ikev2_set_local_key'. type Ikev2SetLocalKey struct { KeyFile []byte `struc:"[256]byte"` } @@ -390,7 +364,7 @@ func (*Ikev2SetLocalKey) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2SetLocalKeyReply represents VPP binary API message 'ikev2_set_local_key_reply': +// Ikev2SetLocalKeyReply represents VPP binary API message 'ikev2_set_local_key_reply'. type Ikev2SetLocalKeyReply struct { Retval int32 } @@ -405,7 +379,7 @@ func (*Ikev2SetLocalKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2SetResponder represents VPP binary API message 'ikev2_set_responder': +// Ikev2SetResponder represents VPP binary API message 'ikev2_set_responder'. type Ikev2SetResponder struct { Name []byte `struc:"[64]byte"` SwIfIndex uint32 @@ -422,7 +396,7 @@ func (*Ikev2SetResponder) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2SetResponderReply represents VPP binary API message 'ikev2_set_responder_reply': +// Ikev2SetResponderReply represents VPP binary API message 'ikev2_set_responder_reply'. type Ikev2SetResponderReply struct { Retval int32 } @@ -437,7 +411,7 @@ func (*Ikev2SetResponderReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Ikev2SetSaLifetime represents VPP binary API message 'ikev2_set_sa_lifetime': +// Ikev2SetSaLifetime represents VPP binary API message 'ikev2_set_sa_lifetime'. type Ikev2SetSaLifetime struct { Name []byte `struc:"[64]byte"` Lifetime uint64 @@ -456,7 +430,7 @@ func (*Ikev2SetSaLifetime) GetMessageType() api.MessageType { return api.RequestMessage } -// Ikev2SetSaLifetimeReply represents VPP binary API message 'ikev2_set_sa_lifetime_reply': +// Ikev2SetSaLifetimeReply represents VPP binary API message 'ikev2_set_sa_lifetime_reply'. type Ikev2SetSaLifetimeReply struct { Retval int32 } @@ -471,7 +445,7 @@ func (*Ikev2SetSaLifetimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecBackendDetails represents VPP binary API message 'ipsec_backend_details': +// IpsecBackendDetails represents VPP binary API message 'ipsec_backend_details'. type IpsecBackendDetails struct { Name []byte `struc:"[128]byte"` Protocol uint8 @@ -489,7 +463,7 @@ func (*IpsecBackendDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecBackendDump represents VPP binary API message 'ipsec_backend_dump': +// IpsecBackendDump represents VPP binary API message 'ipsec_backend_dump'. type IpsecBackendDump struct{} func (*IpsecBackendDump) GetMessageName() string { @@ -502,7 +476,7 @@ func (*IpsecBackendDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecInterfaceAddDelSpd represents VPP binary API message 'ipsec_interface_add_del_spd': +// IpsecInterfaceAddDelSpd represents VPP binary API message 'ipsec_interface_add_del_spd'. type IpsecInterfaceAddDelSpd struct { IsAdd uint8 SwIfIndex uint32 @@ -519,7 +493,7 @@ func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecInterfaceAddDelSpdReply represents VPP binary API message 'ipsec_interface_add_del_spd_reply': +// IpsecInterfaceAddDelSpdReply represents VPP binary API message 'ipsec_interface_add_del_spd_reply'. type IpsecInterfaceAddDelSpdReply struct { Retval int32 } @@ -534,7 +508,7 @@ func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSaDetails represents VPP binary API message 'ipsec_sa_details': +// IpsecSaDetails represents VPP binary API message 'ipsec_sa_details'. type IpsecSaDetails struct { SaID uint32 SwIfIndex uint32 @@ -571,7 +545,7 @@ func (*IpsecSaDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSaDump represents VPP binary API message 'ipsec_sa_dump': +// IpsecSaDump represents VPP binary API message 'ipsec_sa_dump'. type IpsecSaDump struct { SaID uint32 } @@ -586,7 +560,7 @@ func (*IpsecSaDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSaSetKey represents VPP binary API message 'ipsec_sa_set_key': +// IpsecSaSetKey represents VPP binary API message 'ipsec_sa_set_key'. type IpsecSaSetKey struct { SaID uint32 CryptoKeyLength uint8 @@ -605,7 +579,7 @@ func (*IpsecSaSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSaSetKeyReply represents VPP binary API message 'ipsec_sa_set_key_reply': +// IpsecSaSetKeyReply represents VPP binary API message 'ipsec_sa_set_key_reply'. type IpsecSaSetKeyReply struct { Retval int32 } @@ -620,7 +594,7 @@ func (*IpsecSaSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSadAddDelEntry represents VPP binary API message 'ipsec_sad_add_del_entry': +// IpsecSadAddDelEntry represents VPP binary API message 'ipsec_sad_add_del_entry'. type IpsecSadAddDelEntry struct { IsAdd uint8 SadID uint32 @@ -651,7 +625,7 @@ func (*IpsecSadAddDelEntry) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSadAddDelEntryReply represents VPP binary API message 'ipsec_sad_add_del_entry_reply': +// IpsecSadAddDelEntryReply represents VPP binary API message 'ipsec_sad_add_del_entry_reply'. type IpsecSadAddDelEntryReply struct { Retval int32 } @@ -666,7 +640,7 @@ func (*IpsecSadAddDelEntryReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSelectBackend represents VPP binary API message 'ipsec_select_backend': +// IpsecSelectBackend represents VPP binary API message 'ipsec_select_backend'. type IpsecSelectBackend struct { Protocol uint8 Index uint8 @@ -682,7 +656,7 @@ func (*IpsecSelectBackend) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSelectBackendReply represents VPP binary API message 'ipsec_select_backend_reply': +// IpsecSelectBackendReply represents VPP binary API message 'ipsec_select_backend_reply'. type IpsecSelectBackendReply struct { Retval int32 } @@ -697,7 +671,7 @@ func (*IpsecSelectBackendReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdAddDel represents VPP binary API message 'ipsec_spd_add_del': +// IpsecSpdAddDel represents VPP binary API message 'ipsec_spd_add_del'. type IpsecSpdAddDel struct { IsAdd uint8 SpdID uint32 @@ -713,7 +687,7 @@ func (*IpsecSpdAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdAddDelEntry represents VPP binary API message 'ipsec_spd_add_del_entry': +// IpsecSpdAddDelEntry represents VPP binary API message 'ipsec_spd_add_del_entry'. type IpsecSpdAddDelEntry struct { IsAdd uint8 SpdID uint32 @@ -744,7 +718,7 @@ func (*IpsecSpdAddDelEntry) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdAddDelEntryReply represents VPP binary API message 'ipsec_spd_add_del_entry_reply': +// IpsecSpdAddDelEntryReply represents VPP binary API message 'ipsec_spd_add_del_entry_reply'. type IpsecSpdAddDelEntryReply struct { Retval int32 } @@ -759,7 +733,7 @@ func (*IpsecSpdAddDelEntryReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdAddDelReply represents VPP binary API message 'ipsec_spd_add_del_reply': +// IpsecSpdAddDelReply represents VPP binary API message 'ipsec_spd_add_del_reply'. type IpsecSpdAddDelReply struct { Retval int32 } @@ -774,7 +748,7 @@ func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdDetails represents VPP binary API message 'ipsec_spd_details': +// IpsecSpdDetails represents VPP binary API message 'ipsec_spd_details'. type IpsecSpdDetails struct { SpdID uint32 Priority int32 @@ -805,7 +779,7 @@ func (*IpsecSpdDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdDump represents VPP binary API message 'ipsec_spd_dump': +// IpsecSpdDump represents VPP binary API message 'ipsec_spd_dump'. type IpsecSpdDump struct { SpdID uint32 SaID uint32 @@ -821,7 +795,7 @@ func (*IpsecSpdDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdInterfaceDetails represents VPP binary API message 'ipsec_spd_interface_details': +// IpsecSpdInterfaceDetails represents VPP binary API message 'ipsec_spd_interface_details'. type IpsecSpdInterfaceDetails struct { SpdIndex uint32 SwIfIndex uint32 @@ -837,7 +811,7 @@ func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdInterfaceDump represents VPP binary API message 'ipsec_spd_interface_dump': +// IpsecSpdInterfaceDump represents VPP binary API message 'ipsec_spd_interface_dump'. type IpsecSpdInterfaceDump struct { SpdIndex uint32 SpdIndexValid uint8 @@ -853,7 +827,7 @@ func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdsDetails represents VPP binary API message 'ipsec_spds_details': +// IpsecSpdsDetails represents VPP binary API message 'ipsec_spds_details'. type IpsecSpdsDetails struct { SpdID uint32 Npolicies uint32 @@ -869,7 +843,7 @@ func (*IpsecSpdsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdsDump represents VPP binary API message 'ipsec_spds_dump': +// IpsecSpdsDump represents VPP binary API message 'ipsec_spds_dump'. type IpsecSpdsDump struct{} func (*IpsecSpdsDump) GetMessageName() string { @@ -882,7 +856,7 @@ func (*IpsecSpdsDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfAddDel represents VPP binary API message 'ipsec_tunnel_if_add_del': +// IpsecTunnelIfAddDel represents VPP binary API message 'ipsec_tunnel_if_add_del'. type IpsecTunnelIfAddDel struct { IsAdd uint8 Esn uint8 @@ -917,7 +891,7 @@ func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfAddDelReply represents VPP binary API message 'ipsec_tunnel_if_add_del_reply': +// IpsecTunnelIfAddDelReply represents VPP binary API message 'ipsec_tunnel_if_add_del_reply'. type IpsecTunnelIfAddDelReply struct { Retval int32 SwIfIndex uint32 @@ -933,7 +907,7 @@ func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecTunnelIfSetKey represents VPP binary API message 'ipsec_tunnel_if_set_key': +// IpsecTunnelIfSetKey represents VPP binary API message 'ipsec_tunnel_if_set_key'. type IpsecTunnelIfSetKey struct { SwIfIndex uint32 KeyType uint8 @@ -952,7 +926,7 @@ func (*IpsecTunnelIfSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfSetKeyReply represents VPP binary API message 'ipsec_tunnel_if_set_key_reply': +// IpsecTunnelIfSetKeyReply represents VPP binary API message 'ipsec_tunnel_if_set_key_reply'. type IpsecTunnelIfSetKeyReply struct { Retval int32 } @@ -967,7 +941,7 @@ func (*IpsecTunnelIfSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecTunnelIfSetSa represents VPP binary API message 'ipsec_tunnel_if_set_sa': +// IpsecTunnelIfSetSa represents VPP binary API message 'ipsec_tunnel_if_set_sa'. type IpsecTunnelIfSetSa struct { SwIfIndex uint32 SaID uint32 @@ -984,7 +958,7 @@ func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfSetSaReply represents VPP binary API message 'ipsec_tunnel_if_set_sa_reply': +// IpsecTunnelIfSetSaReply represents VPP binary API message 'ipsec_tunnel_if_set_sa_reply'. type IpsecTunnelIfSetSaReply struct { Retval int32 } @@ -1056,59 +1030,443 @@ func init() { api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec.IpsecTunnelIfSetSaReply") } -var Messages = []api.Message{ - (*Ikev2InitiateDelChildSa)(nil), - (*Ikev2InitiateDelChildSaReply)(nil), - (*Ikev2InitiateDelIkeSa)(nil), - (*Ikev2InitiateDelIkeSaReply)(nil), - (*Ikev2InitiateRekeyChildSa)(nil), - (*Ikev2InitiateRekeyChildSaReply)(nil), - (*Ikev2InitiateSaInit)(nil), - (*Ikev2InitiateSaInitReply)(nil), - (*Ikev2ProfileAddDel)(nil), - (*Ikev2ProfileAddDelReply)(nil), - (*Ikev2ProfileSetAuth)(nil), - (*Ikev2ProfileSetAuthReply)(nil), - (*Ikev2ProfileSetID)(nil), - (*Ikev2ProfileSetIDReply)(nil), - (*Ikev2ProfileSetTs)(nil), - (*Ikev2ProfileSetTsReply)(nil), - (*Ikev2SetEspTransforms)(nil), - (*Ikev2SetEspTransformsReply)(nil), - (*Ikev2SetIkeTransforms)(nil), - (*Ikev2SetIkeTransformsReply)(nil), - (*Ikev2SetLocalKey)(nil), - (*Ikev2SetLocalKeyReply)(nil), - (*Ikev2SetResponder)(nil), - (*Ikev2SetResponderReply)(nil), - (*Ikev2SetSaLifetime)(nil), - (*Ikev2SetSaLifetimeReply)(nil), - (*IpsecBackendDetails)(nil), - (*IpsecBackendDump)(nil), - (*IpsecInterfaceAddDelSpd)(nil), - (*IpsecInterfaceAddDelSpdReply)(nil), - (*IpsecSaDetails)(nil), - (*IpsecSaDump)(nil), - (*IpsecSaSetKey)(nil), - (*IpsecSaSetKeyReply)(nil), - (*IpsecSadAddDelEntry)(nil), - (*IpsecSadAddDelEntryReply)(nil), - (*IpsecSelectBackend)(nil), - (*IpsecSelectBackendReply)(nil), - (*IpsecSpdAddDel)(nil), - (*IpsecSpdAddDelEntry)(nil), - (*IpsecSpdAddDelEntryReply)(nil), - (*IpsecSpdAddDelReply)(nil), - (*IpsecSpdDetails)(nil), - (*IpsecSpdDump)(nil), - (*IpsecSpdInterfaceDetails)(nil), - (*IpsecSpdInterfaceDump)(nil), - (*IpsecSpdsDetails)(nil), - (*IpsecSpdsDump)(nil), - (*IpsecTunnelIfAddDel)(nil), - (*IpsecTunnelIfAddDelReply)(nil), - (*IpsecTunnelIfSetKey)(nil), - (*IpsecTunnelIfSetKeyReply)(nil), - (*IpsecTunnelIfSetSa)(nil), - (*IpsecTunnelIfSetSaReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Ikev2InitiateDelChildSa)(nil), + (*Ikev2InitiateDelChildSaReply)(nil), + (*Ikev2InitiateDelIkeSa)(nil), + (*Ikev2InitiateDelIkeSaReply)(nil), + (*Ikev2InitiateRekeyChildSa)(nil), + (*Ikev2InitiateRekeyChildSaReply)(nil), + (*Ikev2InitiateSaInit)(nil), + (*Ikev2InitiateSaInitReply)(nil), + (*Ikev2ProfileAddDel)(nil), + (*Ikev2ProfileAddDelReply)(nil), + (*Ikev2ProfileSetAuth)(nil), + (*Ikev2ProfileSetAuthReply)(nil), + (*Ikev2ProfileSetID)(nil), + (*Ikev2ProfileSetIDReply)(nil), + (*Ikev2ProfileSetTs)(nil), + (*Ikev2ProfileSetTsReply)(nil), + (*Ikev2SetEspTransforms)(nil), + (*Ikev2SetEspTransformsReply)(nil), + (*Ikev2SetIkeTransforms)(nil), + (*Ikev2SetIkeTransformsReply)(nil), + (*Ikev2SetLocalKey)(nil), + (*Ikev2SetLocalKeyReply)(nil), + (*Ikev2SetResponder)(nil), + (*Ikev2SetResponderReply)(nil), + (*Ikev2SetSaLifetime)(nil), + (*Ikev2SetSaLifetimeReply)(nil), + (*IpsecBackendDetails)(nil), + (*IpsecBackendDump)(nil), + (*IpsecInterfaceAddDelSpd)(nil), + (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecSaDetails)(nil), + (*IpsecSaDump)(nil), + (*IpsecSaSetKey)(nil), + (*IpsecSaSetKeyReply)(nil), + (*IpsecSadAddDelEntry)(nil), + (*IpsecSadAddDelEntryReply)(nil), + (*IpsecSelectBackend)(nil), + (*IpsecSelectBackendReply)(nil), + (*IpsecSpdAddDel)(nil), + (*IpsecSpdAddDelEntry)(nil), + (*IpsecSpdAddDelEntryReply)(nil), + (*IpsecSpdAddDelReply)(nil), + (*IpsecSpdDetails)(nil), + (*IpsecSpdDump)(nil), + (*IpsecSpdInterfaceDetails)(nil), + (*IpsecSpdInterfaceDump)(nil), + (*IpsecSpdsDetails)(nil), + (*IpsecSpdsDump)(nil), + (*IpsecTunnelIfAddDel)(nil), + (*IpsecTunnelIfAddDelReply)(nil), + (*IpsecTunnelIfSetKey)(nil), + (*IpsecTunnelIfSetKeyReply)(nil), + (*IpsecTunnelIfSetSa)(nil), + (*IpsecTunnelIfSetSaReply)(nil), + } +} + +// RPCService represents RPC service API for ipsec module. +type RPCService interface { + DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) + DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) + DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) + DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) + DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) + Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) + Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) + Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) + Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) + Ikev2ProfileAddDel(ctx context.Context, in *Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) + Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) + Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) + Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) + Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) + Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) + Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) + Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) + Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) + IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecSaSetKey(ctx context.Context, in *IpsecSaSetKey) (*IpsecSaSetKeyReply, error) + IpsecSadAddDelEntry(ctx context.Context, in *IpsecSadAddDelEntry) (*IpsecSadAddDelEntryReply, error) + IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) + IpsecSpdAddDelEntry(ctx context.Context, in *IpsecSpdAddDelEntry) (*IpsecSpdAddDelEntryReply, error) + IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) + IpsecTunnelIfSetKey(ctx context.Context, in *IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) + IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecBackendClient{stream} + return x, nil +} + +type RPCService_DumpIpsecBackendClient interface { + Recv() (*IpsecBackendDetails, error) +} + +type serviceClient_DumpIpsecBackendClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecBackendClient) Recv() (*IpsecBackendDetails, error) { + m := new(IpsecBackendDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSaClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSaClient interface { + Recv() (*IpsecSaDetails, error) +} + +type serviceClient_DumpIpsecSaClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSaClient) Recv() (*IpsecSaDetails, error) { + m := new(IpsecSaDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdClient interface { + Recv() (*IpsecSpdDetails, error) +} + +type serviceClient_DumpIpsecSpdClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdClient) Recv() (*IpsecSpdDetails, error) { + m := new(IpsecSpdDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdInterfaceClient interface { + Recv() (*IpsecSpdInterfaceDetails, error) +} + +type serviceClient_DumpIpsecSpdInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdInterfaceClient) Recv() (*IpsecSpdInterfaceDetails, error) { + m := new(IpsecSpdInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdsClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdsClient interface { + Recv() (*IpsecSpdsDetails, error) +} + +type serviceClient_DumpIpsecSpdsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdsClient) Recv() (*IpsecSpdsDetails, error) { + m := new(IpsecSpdsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) { + out := new(Ikev2InitiateDelChildSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) { + out := new(Ikev2InitiateDelIkeSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) { + out := new(Ikev2InitiateRekeyChildSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) { + out := new(Ikev2InitiateSaInitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileAddDel(ctx context.Context, in *Ikev2ProfileAddDel) (*Ikev2ProfileAddDelReply, error) { + out := new(Ikev2ProfileAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) { + out := new(Ikev2ProfileSetAuthReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) { + out := new(Ikev2ProfileSetIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) { + out := new(Ikev2ProfileSetTsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) { + out := new(Ikev2SetEspTransformsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) { + out := new(Ikev2SetIkeTransformsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) { + out := new(Ikev2SetLocalKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) { + out := new(Ikev2SetResponderReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) { + out := new(Ikev2SetSaLifetimeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) { + out := new(IpsecInterfaceAddDelSpdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSaSetKey(ctx context.Context, in *IpsecSaSetKey) (*IpsecSaSetKeyReply, error) { + out := new(IpsecSaSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSadAddDelEntry(ctx context.Context, in *IpsecSadAddDelEntry) (*IpsecSadAddDelEntryReply, error) { + out := new(IpsecSadAddDelEntryReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { + out := new(IpsecSelectBackendReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { + out := new(IpsecSpdAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDelEntry(ctx context.Context, in *IpsecSpdAddDelEntry) (*IpsecSpdAddDelEntryReply, error) { + out := new(IpsecSpdAddDelEntryReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { + out := new(IpsecTunnelIfAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetKey(ctx context.Context, in *IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) { + out := new(IpsecTunnelIfSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { + out := new(IpsecTunnelIfSetSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/l2/l2.ba.go b/plugins/vpp/binapi/vpp1901/l2/l2.ba.go index 9e9275268f..8bf853bf98 100644 --- a/plugins/vpp/binapi/vpp1901/l2/l2.ba.go +++ b/plugins/vpp/binapi/vpp1901/l2/l2.ba.go @@ -1,58 +1,36 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/l2.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/l2.api.json /* - Package l2 is a generated from VPP binary API module 'l2'. +Package l2 is a generated VPP binary API for 'l2' module. - It contains following objects: - 23 services +It consists of: 3 enums 3 aliases 7 types 1 union 47 messages + 23 services */ package l2 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "l2" + // VersionCrc is the CRC of this module. + VersionCrc = 0x74bc81b6 +) -// Services represents VPP binary API services: -type Services interface { - DumpBdIPMac(*BdIPMacDump) ([]*BdIPMacDetails, error) - DumpBridgeDomain(*BridgeDomainDump) ([]*BridgeDomainDetails, error) - DumpL2FibTable(*L2FibTableDump) ([]*L2FibTableDetails, error) - DumpL2Xconnect(*L2XconnectDump) ([]*L2XconnectDetails, error) - BdIPMacAddDel(*BdIPMacAddDel) (*BdIPMacAddDelReply, error) - BdIPMacFlush(*BdIPMacFlush) (*BdIPMacFlushReply, error) - BridgeDomainAddDel(*BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) - BridgeDomainSetMacAge(*BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) - BridgeFlags(*BridgeFlags) (*BridgeFlagsReply, error) - L2FibClearTable(*L2FibClearTable) (*L2FibClearTableReply, error) - L2Flags(*L2Flags) (*L2FlagsReply, error) - L2InterfaceEfpFilter(*L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) - L2InterfacePbbTagRewrite(*L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) - L2InterfaceVlanTagRewrite(*L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) - L2PatchAddDel(*L2PatchAddDel) (*L2PatchAddDelReply, error) - L2fibAddDel(*L2fibAddDel) (*L2fibAddDelReply, error) - L2fibFlushAll(*L2fibFlushAll) (*L2fibFlushAllReply, error) - L2fibFlushBd(*L2fibFlushBd) (*L2fibFlushBdReply, error) - L2fibFlushInt(*L2fibFlushInt) (*L2fibFlushIntReply, error) - SwInterfaceSetL2Bridge(*SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) - SwInterfaceSetL2Xconnect(*SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) - SwInterfaceSetVpath(*SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) - WantL2MacsEvents(*WantL2MacsEvents) (*WantL2MacsEventsReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -60,7 +38,25 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -// BdFlags represents VPP binary API enum 'bd_flags': +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// BdFlags represents VPP binary API enum 'bd_flags'. type BdFlags uint32 const ( @@ -71,7 +67,31 @@ const ( BRIDGE_API_FLAG_ARP_TERM BdFlags = 16 ) -// L2PortType represents VPP binary API enum 'l2_port_type': +var BdFlags_name = map[uint32]string{ + 1: "BRIDGE_API_FLAG_LEARN", + 2: "BRIDGE_API_FLAG_FWD", + 4: "BRIDGE_API_FLAG_FLOOD", + 8: "BRIDGE_API_FLAG_UU_FLOOD", + 16: "BRIDGE_API_FLAG_ARP_TERM", +} + +var BdFlags_value = map[string]uint32{ + "BRIDGE_API_FLAG_LEARN": 1, + "BRIDGE_API_FLAG_FWD": 2, + "BRIDGE_API_FLAG_FLOOD": 4, + "BRIDGE_API_FLAG_UU_FLOOD": 8, + "BRIDGE_API_FLAG_ARP_TERM": 16, +} + +func (x BdFlags) String() string { + s, ok := BdFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// L2PortType represents VPP binary API enum 'l2_port_type'. type L2PortType uint32 const ( @@ -80,20 +100,36 @@ const ( L2_API_PORT_TYPE_UU_FWD L2PortType = 2 ) -/* Aliases */ +var L2PortType_name = map[uint32]string{ + 0: "L2_API_PORT_TYPE_NORMAL", + 1: "L2_API_PORT_TYPE_BVI", + 2: "L2_API_PORT_TYPE_UU_FWD", +} + +var L2PortType_value = map[string]uint32{ + "L2_API_PORT_TYPE_NORMAL": 0, + "L2_API_PORT_TYPE_BVI": 1, + "L2_API_PORT_TYPE_UU_FWD": 2, +} + +func (x L2PortType) String() string { + s, ok := L2PortType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} -// IP4Address represents VPP binary API alias 'ip4_address': +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -// MacAddress represents VPP binary API alias 'mac_address': +// MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -106,7 +142,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// BridgeDomainSwIf represents VPP binary API type 'bridge_domain_sw_if': +// BridgeDomainSwIf represents VPP binary API type 'bridge_domain_sw_if'. type BridgeDomainSwIf struct { Context uint32 SwIfIndex uint32 @@ -120,7 +156,7 @@ func (*BridgeDomainSwIf) GetCrcString() string { return "a06dd426" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -133,7 +169,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -146,7 +182,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// MacEntry represents VPP binary API type 'mac_entry': +// MacEntry represents VPP binary API type 'mac_entry'. type MacEntry struct { SwIfIndex uint32 MacAddr []byte `struc:"[6]byte"` @@ -161,7 +197,7 @@ func (*MacEntry) GetCrcString() string { return "971135b8" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -176,7 +212,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -189,11 +225,9 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -212,10 +246,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -229,17 +263,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// BdIPMacAddDel represents VPP binary API message 'bd_ip_mac_add_del': +// BdIPMacAddDel represents VPP binary API message 'bd_ip_mac_add_del'. type BdIPMacAddDel struct { BdID uint32 IsAdd uint8 @@ -257,7 +289,7 @@ func (*BdIPMacAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacAddDelReply represents VPP binary API message 'bd_ip_mac_add_del_reply': +// BdIPMacAddDelReply represents VPP binary API message 'bd_ip_mac_add_del_reply'. type BdIPMacAddDelReply struct { Retval int32 } @@ -272,7 +304,7 @@ func (*BdIPMacAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BdIPMacDetails represents VPP binary API message 'bd_ip_mac_details': +// BdIPMacDetails represents VPP binary API message 'bd_ip_mac_details'. type BdIPMacDetails struct { BdID uint32 IsIPv6 uint8 @@ -290,7 +322,7 @@ func (*BdIPMacDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BdIPMacDump represents VPP binary API message 'bd_ip_mac_dump': +// BdIPMacDump represents VPP binary API message 'bd_ip_mac_dump'. type BdIPMacDump struct { BdID uint32 } @@ -305,7 +337,7 @@ func (*BdIPMacDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacFlush represents VPP binary API message 'bd_ip_mac_flush': +// BdIPMacFlush represents VPP binary API message 'bd_ip_mac_flush'. type BdIPMacFlush struct { BdID uint32 } @@ -320,7 +352,7 @@ func (*BdIPMacFlush) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacFlushReply represents VPP binary API message 'bd_ip_mac_flush_reply': +// BdIPMacFlushReply represents VPP binary API message 'bd_ip_mac_flush_reply'. type BdIPMacFlushReply struct { Retval int32 } @@ -335,7 +367,7 @@ func (*BdIPMacFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainAddDel represents VPP binary API message 'bridge_domain_add_del': +// BridgeDomainAddDel represents VPP binary API message 'bridge_domain_add_del'. type BridgeDomainAddDel struct { BdID uint32 Flood uint8 @@ -358,7 +390,7 @@ func (*BridgeDomainAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainAddDelReply represents VPP binary API message 'bridge_domain_add_del_reply': +// BridgeDomainAddDelReply represents VPP binary API message 'bridge_domain_add_del_reply'. type BridgeDomainAddDelReply struct { Retval int32 } @@ -373,7 +405,7 @@ func (*BridgeDomainAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainDetails represents VPP binary API message 'bridge_domain_details': +// BridgeDomainDetails represents VPP binary API message 'bridge_domain_details'. type BridgeDomainDetails struct { BdID uint32 Flood uint8 @@ -399,7 +431,7 @@ func (*BridgeDomainDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainDump represents VPP binary API message 'bridge_domain_dump': +// BridgeDomainDump represents VPP binary API message 'bridge_domain_dump'. type BridgeDomainDump struct { BdID uint32 } @@ -414,7 +446,7 @@ func (*BridgeDomainDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainSetMacAge represents VPP binary API message 'bridge_domain_set_mac_age': +// BridgeDomainSetMacAge represents VPP binary API message 'bridge_domain_set_mac_age'. type BridgeDomainSetMacAge struct { BdID uint32 MacAge uint8 @@ -430,7 +462,7 @@ func (*BridgeDomainSetMacAge) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainSetMacAgeReply represents VPP binary API message 'bridge_domain_set_mac_age_reply': +// BridgeDomainSetMacAgeReply represents VPP binary API message 'bridge_domain_set_mac_age_reply'. type BridgeDomainSetMacAgeReply struct { Retval int32 } @@ -445,7 +477,7 @@ func (*BridgeDomainSetMacAgeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeFlags represents VPP binary API message 'bridge_flags': +// BridgeFlags represents VPP binary API message 'bridge_flags'. type BridgeFlags struct { BdID uint32 IsSet uint8 @@ -462,7 +494,7 @@ func (*BridgeFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeFlagsReply represents VPP binary API message 'bridge_flags_reply': +// BridgeFlagsReply represents VPP binary API message 'bridge_flags_reply'. type BridgeFlagsReply struct { Retval int32 ResultingFeatureBitmap uint32 @@ -478,7 +510,7 @@ func (*BridgeFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibClearTable represents VPP binary API message 'l2_fib_clear_table': +// L2FibClearTable represents VPP binary API message 'l2_fib_clear_table'. type L2FibClearTable struct{} func (*L2FibClearTable) GetMessageName() string { @@ -491,7 +523,7 @@ func (*L2FibClearTable) GetMessageType() api.MessageType { return api.RequestMessage } -// L2FibClearTableReply represents VPP binary API message 'l2_fib_clear_table_reply': +// L2FibClearTableReply represents VPP binary API message 'l2_fib_clear_table_reply'. type L2FibClearTableReply struct { Retval int32 } @@ -506,7 +538,7 @@ func (*L2FibClearTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibTableDetails represents VPP binary API message 'l2_fib_table_details': +// L2FibTableDetails represents VPP binary API message 'l2_fib_table_details'. type L2FibTableDetails struct { BdID uint32 Mac []byte `struc:"[6]byte"` @@ -526,7 +558,7 @@ func (*L2FibTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibTableDump represents VPP binary API message 'l2_fib_table_dump': +// L2FibTableDump represents VPP binary API message 'l2_fib_table_dump'. type L2FibTableDump struct { BdID uint32 } @@ -541,7 +573,7 @@ func (*L2FibTableDump) GetMessageType() api.MessageType { return api.RequestMessage } -// L2Flags represents VPP binary API message 'l2_flags': +// L2Flags represents VPP binary API message 'l2_flags'. type L2Flags struct { SwIfIndex uint32 IsSet uint8 @@ -558,7 +590,7 @@ func (*L2Flags) GetMessageType() api.MessageType { return api.RequestMessage } -// L2FlagsReply represents VPP binary API message 'l2_flags_reply': +// L2FlagsReply represents VPP binary API message 'l2_flags_reply'. type L2FlagsReply struct { Retval int32 ResultingFeatureBitmap uint32 @@ -574,7 +606,7 @@ func (*L2FlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfaceEfpFilter represents VPP binary API message 'l2_interface_efp_filter': +// L2InterfaceEfpFilter represents VPP binary API message 'l2_interface_efp_filter'. type L2InterfaceEfpFilter struct { SwIfIndex uint32 EnableDisable uint8 @@ -590,7 +622,7 @@ func (*L2InterfaceEfpFilter) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfaceEfpFilterReply represents VPP binary API message 'l2_interface_efp_filter_reply': +// L2InterfaceEfpFilterReply represents VPP binary API message 'l2_interface_efp_filter_reply'. type L2InterfaceEfpFilterReply struct { Retval int32 } @@ -605,7 +637,7 @@ func (*L2InterfaceEfpFilterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfacePbbTagRewrite represents VPP binary API message 'l2_interface_pbb_tag_rewrite': +// L2InterfacePbbTagRewrite represents VPP binary API message 'l2_interface_pbb_tag_rewrite'. type L2InterfacePbbTagRewrite struct { SwIfIndex uint32 VtrOp uint32 @@ -626,7 +658,7 @@ func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfacePbbTagRewriteReply represents VPP binary API message 'l2_interface_pbb_tag_rewrite_reply': +// L2InterfacePbbTagRewriteReply represents VPP binary API message 'l2_interface_pbb_tag_rewrite_reply'. type L2InterfacePbbTagRewriteReply struct { Retval int32 } @@ -641,7 +673,7 @@ func (*L2InterfacePbbTagRewriteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfaceVlanTagRewrite represents VPP binary API message 'l2_interface_vlan_tag_rewrite': +// L2InterfaceVlanTagRewrite represents VPP binary API message 'l2_interface_vlan_tag_rewrite'. type L2InterfaceVlanTagRewrite struct { SwIfIndex uint32 VtrOp uint32 @@ -660,7 +692,7 @@ func (*L2InterfaceVlanTagRewrite) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfaceVlanTagRewriteReply represents VPP binary API message 'l2_interface_vlan_tag_rewrite_reply': +// L2InterfaceVlanTagRewriteReply represents VPP binary API message 'l2_interface_vlan_tag_rewrite_reply'. type L2InterfaceVlanTagRewriteReply struct { Retval int32 } @@ -675,7 +707,7 @@ func (*L2InterfaceVlanTagRewriteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2MacsEvent represents VPP binary API message 'l2_macs_event': +// L2MacsEvent represents VPP binary API message 'l2_macs_event'. type L2MacsEvent struct { PID uint32 NMacs uint32 `struc:"sizeof=Mac"` @@ -692,7 +724,7 @@ func (*L2MacsEvent) GetMessageType() api.MessageType { return api.EventMessage } -// L2PatchAddDel represents VPP binary API message 'l2_patch_add_del': +// L2PatchAddDel represents VPP binary API message 'l2_patch_add_del'. type L2PatchAddDel struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -709,7 +741,7 @@ func (*L2PatchAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// L2PatchAddDelReply represents VPP binary API message 'l2_patch_add_del_reply': +// L2PatchAddDelReply represents VPP binary API message 'l2_patch_add_del_reply'. type L2PatchAddDelReply struct { Retval int32 } @@ -724,7 +756,7 @@ func (*L2PatchAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2XconnectDetails represents VPP binary API message 'l2_xconnect_details': +// L2XconnectDetails represents VPP binary API message 'l2_xconnect_details'. type L2XconnectDetails struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -740,7 +772,7 @@ func (*L2XconnectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2XconnectDump represents VPP binary API message 'l2_xconnect_dump': +// L2XconnectDump represents VPP binary API message 'l2_xconnect_dump'. type L2XconnectDump struct{} func (*L2XconnectDump) GetMessageName() string { @@ -753,7 +785,7 @@ func (*L2XconnectDump) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibAddDel represents VPP binary API message 'l2fib_add_del': +// L2fibAddDel represents VPP binary API message 'l2fib_add_del'. type L2fibAddDel struct { Mac []byte `struc:"[6]byte"` BdID uint32 @@ -774,7 +806,7 @@ func (*L2fibAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibAddDelReply represents VPP binary API message 'l2fib_add_del_reply': +// L2fibAddDelReply represents VPP binary API message 'l2fib_add_del_reply'. type L2fibAddDelReply struct { Retval int32 } @@ -789,7 +821,7 @@ func (*L2fibAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushAll represents VPP binary API message 'l2fib_flush_all': +// L2fibFlushAll represents VPP binary API message 'l2fib_flush_all'. type L2fibFlushAll struct{} func (*L2fibFlushAll) GetMessageName() string { @@ -802,7 +834,7 @@ func (*L2fibFlushAll) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushAllReply represents VPP binary API message 'l2fib_flush_all_reply': +// L2fibFlushAllReply represents VPP binary API message 'l2fib_flush_all_reply'. type L2fibFlushAllReply struct { Retval int32 } @@ -817,7 +849,7 @@ func (*L2fibFlushAllReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushBd represents VPP binary API message 'l2fib_flush_bd': +// L2fibFlushBd represents VPP binary API message 'l2fib_flush_bd'. type L2fibFlushBd struct { BdID uint32 } @@ -832,7 +864,7 @@ func (*L2fibFlushBd) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushBdReply represents VPP binary API message 'l2fib_flush_bd_reply': +// L2fibFlushBdReply represents VPP binary API message 'l2fib_flush_bd_reply'. type L2fibFlushBdReply struct { Retval int32 } @@ -847,7 +879,7 @@ func (*L2fibFlushBdReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushInt represents VPP binary API message 'l2fib_flush_int': +// L2fibFlushInt represents VPP binary API message 'l2fib_flush_int'. type L2fibFlushInt struct { SwIfIndex uint32 } @@ -862,7 +894,7 @@ func (*L2fibFlushInt) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushIntReply represents VPP binary API message 'l2fib_flush_int_reply': +// L2fibFlushIntReply represents VPP binary API message 'l2fib_flush_int_reply'. type L2fibFlushIntReply struct { Retval int32 } @@ -877,7 +909,7 @@ func (*L2fibFlushIntReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetL2Bridge represents VPP binary API message 'sw_interface_set_l2_bridge': +// SwInterfaceSetL2Bridge represents VPP binary API message 'sw_interface_set_l2_bridge'. type SwInterfaceSetL2Bridge struct { RxSwIfIndex uint32 BdID uint32 @@ -896,7 +928,7 @@ func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetL2BridgeReply represents VPP binary API message 'sw_interface_set_l2_bridge_reply': +// SwInterfaceSetL2BridgeReply represents VPP binary API message 'sw_interface_set_l2_bridge_reply'. type SwInterfaceSetL2BridgeReply struct { Retval int32 } @@ -911,7 +943,7 @@ func (*SwInterfaceSetL2BridgeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetL2Xconnect represents VPP binary API message 'sw_interface_set_l2_xconnect': +// SwInterfaceSetL2Xconnect represents VPP binary API message 'sw_interface_set_l2_xconnect'. type SwInterfaceSetL2Xconnect struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -928,7 +960,7 @@ func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetL2XconnectReply represents VPP binary API message 'sw_interface_set_l2_xconnect_reply': +// SwInterfaceSetL2XconnectReply represents VPP binary API message 'sw_interface_set_l2_xconnect_reply'. type SwInterfaceSetL2XconnectReply struct { Retval int32 } @@ -943,7 +975,7 @@ func (*SwInterfaceSetL2XconnectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetVpath represents VPP binary API message 'sw_interface_set_vpath': +// SwInterfaceSetVpath represents VPP binary API message 'sw_interface_set_vpath'. type SwInterfaceSetVpath struct { SwIfIndex uint32 Enable uint8 @@ -959,7 +991,7 @@ func (*SwInterfaceSetVpath) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetVpathReply represents VPP binary API message 'sw_interface_set_vpath_reply': +// SwInterfaceSetVpathReply represents VPP binary API message 'sw_interface_set_vpath_reply'. type SwInterfaceSetVpathReply struct { Retval int32 } @@ -974,7 +1006,7 @@ func (*SwInterfaceSetVpathReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantL2MacsEvents represents VPP binary API message 'want_l2_macs_events': +// WantL2MacsEvents represents VPP binary API message 'want_l2_macs_events'. type WantL2MacsEvents struct { LearnLimit uint32 ScanDelay uint8 @@ -993,7 +1025,7 @@ func (*WantL2MacsEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantL2MacsEventsReply represents VPP binary API message 'want_l2_macs_events_reply': +// WantL2MacsEventsReply represents VPP binary API message 'want_l2_macs_events_reply'. type WantL2MacsEventsReply struct { Retval int32 } @@ -1058,52 +1090,379 @@ func init() { api.RegisterMessage((*WantL2MacsEventsReply)(nil), "l2.WantL2MacsEventsReply") } -var Messages = []api.Message{ - (*BdIPMacAddDel)(nil), - (*BdIPMacAddDelReply)(nil), - (*BdIPMacDetails)(nil), - (*BdIPMacDump)(nil), - (*BdIPMacFlush)(nil), - (*BdIPMacFlushReply)(nil), - (*BridgeDomainAddDel)(nil), - (*BridgeDomainAddDelReply)(nil), - (*BridgeDomainDetails)(nil), - (*BridgeDomainDump)(nil), - (*BridgeDomainSetMacAge)(nil), - (*BridgeDomainSetMacAgeReply)(nil), - (*BridgeFlags)(nil), - (*BridgeFlagsReply)(nil), - (*L2FibClearTable)(nil), - (*L2FibClearTableReply)(nil), - (*L2FibTableDetails)(nil), - (*L2FibTableDump)(nil), - (*L2Flags)(nil), - (*L2FlagsReply)(nil), - (*L2InterfaceEfpFilter)(nil), - (*L2InterfaceEfpFilterReply)(nil), - (*L2InterfacePbbTagRewrite)(nil), - (*L2InterfacePbbTagRewriteReply)(nil), - (*L2InterfaceVlanTagRewrite)(nil), - (*L2InterfaceVlanTagRewriteReply)(nil), - (*L2MacsEvent)(nil), - (*L2PatchAddDel)(nil), - (*L2PatchAddDelReply)(nil), - (*L2XconnectDetails)(nil), - (*L2XconnectDump)(nil), - (*L2fibAddDel)(nil), - (*L2fibAddDelReply)(nil), - (*L2fibFlushAll)(nil), - (*L2fibFlushAllReply)(nil), - (*L2fibFlushBd)(nil), - (*L2fibFlushBdReply)(nil), - (*L2fibFlushInt)(nil), - (*L2fibFlushIntReply)(nil), - (*SwInterfaceSetL2Bridge)(nil), - (*SwInterfaceSetL2BridgeReply)(nil), - (*SwInterfaceSetL2Xconnect)(nil), - (*SwInterfaceSetL2XconnectReply)(nil), - (*SwInterfaceSetVpath)(nil), - (*SwInterfaceSetVpathReply)(nil), - (*WantL2MacsEvents)(nil), - (*WantL2MacsEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BdIPMacAddDel)(nil), + (*BdIPMacAddDelReply)(nil), + (*BdIPMacDetails)(nil), + (*BdIPMacDump)(nil), + (*BdIPMacFlush)(nil), + (*BdIPMacFlushReply)(nil), + (*BridgeDomainAddDel)(nil), + (*BridgeDomainAddDelReply)(nil), + (*BridgeDomainDetails)(nil), + (*BridgeDomainDump)(nil), + (*BridgeDomainSetMacAge)(nil), + (*BridgeDomainSetMacAgeReply)(nil), + (*BridgeFlags)(nil), + (*BridgeFlagsReply)(nil), + (*L2FibClearTable)(nil), + (*L2FibClearTableReply)(nil), + (*L2FibTableDetails)(nil), + (*L2FibTableDump)(nil), + (*L2Flags)(nil), + (*L2FlagsReply)(nil), + (*L2InterfaceEfpFilter)(nil), + (*L2InterfaceEfpFilterReply)(nil), + (*L2InterfacePbbTagRewrite)(nil), + (*L2InterfacePbbTagRewriteReply)(nil), + (*L2InterfaceVlanTagRewrite)(nil), + (*L2InterfaceVlanTagRewriteReply)(nil), + (*L2MacsEvent)(nil), + (*L2PatchAddDel)(nil), + (*L2PatchAddDelReply)(nil), + (*L2XconnectDetails)(nil), + (*L2XconnectDump)(nil), + (*L2fibAddDel)(nil), + (*L2fibAddDelReply)(nil), + (*L2fibFlushAll)(nil), + (*L2fibFlushAllReply)(nil), + (*L2fibFlushBd)(nil), + (*L2fibFlushBdReply)(nil), + (*L2fibFlushInt)(nil), + (*L2fibFlushIntReply)(nil), + (*SwInterfaceSetL2Bridge)(nil), + (*SwInterfaceSetL2BridgeReply)(nil), + (*SwInterfaceSetL2Xconnect)(nil), + (*SwInterfaceSetL2XconnectReply)(nil), + (*SwInterfaceSetVpath)(nil), + (*SwInterfaceSetVpathReply)(nil), + (*WantL2MacsEvents)(nil), + (*WantL2MacsEventsReply)(nil), + } +} + +// RPCService represents RPC service API for l2 module. +type RPCService interface { + DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) + DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) + DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) + DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) + BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) + BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) + BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) + BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) + BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) + L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) + L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) + L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) + L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) + L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) + L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) + L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) + L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) + L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) + L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) + SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) + SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) + SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) + WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBdIPMacClient{stream} + return x, nil +} + +type RPCService_DumpBdIPMacClient interface { + Recv() (*BdIPMacDetails, error) +} + +type serviceClient_DumpBdIPMacClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBdIPMacClient) Recv() (*BdIPMacDetails, error) { + m := new(BdIPMacDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBridgeDomainClient{stream} + return x, nil +} + +type RPCService_DumpBridgeDomainClient interface { + Recv() (*BridgeDomainDetails, error) +} + +type serviceClient_DumpBridgeDomainClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBridgeDomainClient) Recv() (*BridgeDomainDetails, error) { + m := new(BridgeDomainDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2FibTableClient{stream} + return x, nil +} + +type RPCService_DumpL2FibTableClient interface { + Recv() (*L2FibTableDetails, error) +} + +type serviceClient_DumpL2FibTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2FibTableClient) Recv() (*L2FibTableDetails, error) { + m := new(L2FibTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2XconnectClient{stream} + return x, nil } + +type RPCService_DumpL2XconnectClient interface { + Recv() (*L2XconnectDetails, error) +} + +type serviceClient_DumpL2XconnectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2XconnectClient) Recv() (*L2XconnectDetails, error) { + m := new(L2XconnectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) { + out := new(BdIPMacAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) { + out := new(BdIPMacFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { + out := new(BridgeDomainAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) { + out := new(BridgeDomainSetMacAgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { + out := new(BridgeFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { + out := new(L2FibClearTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) { + out := new(L2FlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { + out := new(L2InterfaceEfpFilterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { + out := new(L2InterfacePbbTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { + out := new(L2InterfaceVlanTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { + out := new(L2PatchAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) { + out := new(L2fibAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { + out := new(L2fibFlushAllReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { + out := new(L2fibFlushBdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { + out := new(L2fibFlushIntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { + out := new(SwInterfaceSetL2BridgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { + out := new(SwInterfaceSetL2XconnectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { + out := new(SwInterfaceSetVpathReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { + out := new(WantL2MacsEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/memclnt/memclnt.ba.go b/plugins/vpp/binapi/vpp1901/memclnt/memclnt.ba.go index 0c8785edf2..793e2f2fcc 100644 --- a/plugins/vpp/binapi/vpp1901/memclnt/memclnt.ba.go +++ b/plugins/vpp/binapi/vpp1901/memclnt/memclnt.ba.go @@ -1,45 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/memclnt.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/memclnt.api.json /* - Package memclnt is a generated from VPP binary API module 'memclnt'. +Package memclnt is a generated VPP binary API for 'memclnt' module. - It contains following objects: - 13 services +It consists of: 2 types 22 messages + 13 services */ package memclnt -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - APIVersions(*APIVersions) (*APIVersionsReply, error) - GetFirstMsgID(*GetFirstMsgID) (*GetFirstMsgIDReply, error) - MemclntCreate(*MemclntCreate) (*MemclntCreateReply, error) - MemclntDelete(*MemclntDelete) (*MemclntDeleteReply, error) - MemclntKeepalive(*MemclntKeepalive) (*MemclntKeepaliveReply, error) - MemclntReadTimeout(*MemclntReadTimeout) error - MemclntRxThreadSuspend(*MemclntRxThreadSuspend) error - RPCCall(*RPCCall) (*RPCCallReply, error) - RxThreadExit(*RxThreadExit) error - SockInitShm(*SockInitShm) (*SockInitShmReply, error) - SockclntCreate(*SockclntCreate) (*SockclntCreateReply, error) - SockclntDelete(*SockclntDelete) (*SockclntDeleteReply, error) - TracePluginMsgIds(*TracePluginMsgIds) error -} - -/* Types */ - -// MessageTableEntry represents VPP binary API type 'message_table_entry': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "memclnt" + // VersionCrc is the CRC of this module. + VersionCrc = 0xb619530 +) + +// MessageTableEntry represents VPP binary API type 'message_table_entry'. type MessageTableEntry struct { Index uint16 Name []byte `struc:"[64]byte"` @@ -52,7 +40,7 @@ func (*MessageTableEntry) GetCrcString() string { return "913bf1c6" } -// ModuleVersion represents VPP binary API type 'module_version': +// ModuleVersion represents VPP binary API type 'module_version'. type ModuleVersion struct { Major uint32 Minor uint32 @@ -67,9 +55,7 @@ func (*ModuleVersion) GetCrcString() string { return "4b6da11a" } -/* Messages */ - -// APIVersions represents VPP binary API message 'api_versions': +// APIVersions represents VPP binary API message 'api_versions'. type APIVersions struct{} func (*APIVersions) GetMessageName() string { @@ -82,7 +68,7 @@ func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } -// APIVersionsReply represents VPP binary API message 'api_versions_reply': +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. type APIVersionsReply struct { Retval int32 Count uint32 `struc:"sizeof=APIVersions"` @@ -99,7 +85,7 @@ func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetFirstMsgID represents VPP binary API message 'get_first_msg_id': +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. type GetFirstMsgID struct { Name []byte `struc:"[64]byte"` } @@ -114,7 +100,7 @@ func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } -// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply': +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. type GetFirstMsgIDReply struct { Retval int32 FirstMsgID uint16 @@ -130,7 +116,7 @@ func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreate represents VPP binary API message 'memclnt_create': +// MemclntCreate represents VPP binary API message 'memclnt_create'. type MemclntCreate struct { CtxQuota int32 InputQueue uint64 @@ -148,7 +134,7 @@ func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply': +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. type MemclntCreateReply struct { Response int32 Handle uint64 @@ -166,7 +152,7 @@ func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntDelete represents VPP binary API message 'memclnt_delete': +// MemclntDelete represents VPP binary API message 'memclnt_delete'. type MemclntDelete struct { Index uint32 Handle uint64 @@ -183,7 +169,7 @@ func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply': +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. type MemclntDeleteReply struct { Response int32 Handle uint64 @@ -199,7 +185,7 @@ func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive': +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. type MemclntKeepalive struct{} func (*MemclntKeepalive) GetMessageName() string { @@ -212,7 +198,7 @@ func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } -// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply': +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. type MemclntKeepaliveReply struct { Retval int32 } @@ -227,7 +213,7 @@ func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout': +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. type MemclntReadTimeout struct { Dummy uint8 } @@ -242,7 +228,7 @@ func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend': +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. type MemclntRxThreadSuspend struct { Dummy uint8 } @@ -257,7 +243,7 @@ func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } -// RPCCall represents VPP binary API message 'rpc_call': +// RPCCall represents VPP binary API message 'rpc_call'. type RPCCall struct { Function uint64 Multicast uint8 @@ -277,7 +263,7 @@ func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } -// RPCCallReply represents VPP binary API message 'rpc_call_reply': +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. type RPCCallReply struct { Retval int32 } @@ -292,7 +278,7 @@ func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// RxThreadExit represents VPP binary API message 'rx_thread_exit': +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. type RxThreadExit struct { Dummy uint8 } @@ -307,7 +293,7 @@ func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } -// SockInitShm represents VPP binary API message 'sock_init_shm': +// SockInitShm represents VPP binary API message 'sock_init_shm'. type SockInitShm struct { RequestedSize uint32 Nitems uint8 `struc:"sizeof=Configs"` @@ -324,7 +310,7 @@ func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } -// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply': +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. type SockInitShmReply struct { Retval int32 } @@ -339,7 +325,7 @@ func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreate represents VPP binary API message 'sockclnt_create': +// SockclntCreate represents VPP binary API message 'sockclnt_create'. type SockclntCreate struct { Name []byte `struc:"[64]byte"` } @@ -354,7 +340,7 @@ func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply': +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. type SockclntCreateReply struct { Response int32 Index uint32 @@ -372,7 +358,7 @@ func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDelete represents VPP binary API message 'sockclnt_delete': +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. type SockclntDelete struct { Index uint32 } @@ -387,7 +373,7 @@ func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply': +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. type SockclntDeleteReply struct { Response int32 } @@ -402,7 +388,7 @@ func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids': +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. type TracePluginMsgIds struct { PluginName []byte `struc:"[128]byte"` FirstMsgID uint16 @@ -444,27 +430,170 @@ func init() { api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") } -var Messages = []api.Message{ - (*APIVersions)(nil), - (*APIVersionsReply)(nil), - (*GetFirstMsgID)(nil), - (*GetFirstMsgIDReply)(nil), - (*MemclntCreate)(nil), - (*MemclntCreateReply)(nil), - (*MemclntDelete)(nil), - (*MemclntDeleteReply)(nil), - (*MemclntKeepalive)(nil), - (*MemclntKeepaliveReply)(nil), - (*MemclntReadTimeout)(nil), - (*MemclntRxThreadSuspend)(nil), - (*RPCCall)(nil), - (*RPCCallReply)(nil), - (*RxThreadExit)(nil), - (*SockInitShm)(nil), - (*SockInitShmReply)(nil), - (*SockclntCreate)(nil), - (*SockclntCreateReply)(nil), - (*SockclntDelete)(nil), - (*SockclntDeleteReply)(nil), - (*TracePluginMsgIds)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil } + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/memif/memif.ba.go b/plugins/vpp/binapi/vpp1901/memif/memif.ba.go index 6f1c027649..7f1238bfec 100644 --- a/plugins/vpp/binapi/vpp1901/memif/memif.ba.go +++ b/plugins/vpp/binapi/vpp1901/memif/memif.ba.go @@ -1,36 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/memif.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/memif.api.json /* - Package memif is a generated from VPP binary API module 'memif'. +Package memif is a generated VPP binary API for 'memif' module. - It contains following objects: - 5 services +It consists of: 10 messages + 5 services */ package memif -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "memif" + // VersionCrc is the CRC of this module. + VersionCrc = 0x31b42e17 +) -// Services represents VPP binary API services: -type Services interface { - DumpMemif(*MemifDump) ([]*MemifDetails, error) - DumpMemifSocketFilename(*MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) - MemifCreate(*MemifCreate) (*MemifCreateReply, error) - MemifDelete(*MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(*MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} - -/* Messages */ - -// MemifCreate represents VPP binary API message 'memif_create': +// MemifCreate represents VPP binary API message 'memif_create'. type MemifCreate struct { Role uint8 Mode uint8 @@ -54,7 +50,7 @@ func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifCreateReply represents VPP binary API message 'memif_create_reply': +// MemifCreateReply represents VPP binary API message 'memif_create_reply'. type MemifCreateReply struct { Retval int32 SwIfIndex uint32 @@ -70,7 +66,7 @@ func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDelete represents VPP binary API message 'memif_delete': +// MemifDelete represents VPP binary API message 'memif_delete'. type MemifDelete struct { SwIfIndex uint32 } @@ -85,7 +81,7 @@ func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifDeleteReply represents VPP binary API message 'memif_delete_reply': +// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. type MemifDeleteReply struct { Retval int32 } @@ -100,7 +96,7 @@ func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDetails represents VPP binary API message 'memif_details': +// MemifDetails represents VPP binary API message 'memif_details'. type MemifDetails struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` @@ -125,7 +121,7 @@ func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDump represents VPP binary API message 'memif_dump': +// MemifDump represents VPP binary API message 'memif_dump'. type MemifDump struct{} func (*MemifDump) GetMessageName() string { @@ -138,7 +134,7 @@ func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del': +// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. type MemifSocketFilenameAddDel struct { IsAdd uint8 SocketID uint32 @@ -155,7 +151,7 @@ func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply': +// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. type MemifSocketFilenameAddDelReply struct { Retval int32 } @@ -170,7 +166,7 @@ func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details': +// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. type MemifSocketFilenameDetails struct { SocketID uint32 SocketFilename []byte `struc:"[128]byte"` @@ -186,7 +182,7 @@ func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump': +// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. type MemifSocketFilenameDump struct{} func (*MemifSocketFilenameDump) GetMessageName() string { @@ -212,15 +208,128 @@ func init() { api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") } -var Messages = []api.Message{ - (*MemifCreate)(nil), - (*MemifCreateReply)(nil), - (*MemifDelete)(nil), - (*MemifDeleteReply)(nil), - (*MemifDetails)(nil), - (*MemifDump)(nil), - (*MemifSocketFilenameAddDel)(nil), - (*MemifSocketFilenameAddDelReply)(nil), - (*MemifSocketFilenameDetails)(nil), - (*MemifSocketFilenameDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) } + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/nat/nat.ba.go b/plugins/vpp/binapi/vpp1901/nat/nat.ba.go index b16dcb9fbc..6ab85dec90 100644 --- a/plugins/vpp/binapi/vpp1901/nat/nat.ba.go +++ b/plugins/vpp/binapi/vpp1901/nat/nat.ba.go @@ -1,93 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/nat.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/nat.api.json /* - Package nat is a generated from VPP binary API module 'nat'. +Package nat is a generated VPP binary API for 'nat' module. - It contains following objects: - 61 services +It consists of: 1 type 122 messages + 61 services */ package nat -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpDsliteAddress(*DsliteAddressDump) ([]*DsliteAddressDetails, error) - DumpNat44Address(*Nat44AddressDump) ([]*Nat44AddressDetails, error) - DumpNat44IdentityMapping(*Nat44IdentityMappingDump) ([]*Nat44IdentityMappingDetails, error) - DumpNat44InterfaceAddr(*Nat44InterfaceAddrDump) ([]*Nat44InterfaceAddrDetails, error) - DumpNat44Interface(*Nat44InterfaceDump) ([]*Nat44InterfaceDetails, error) - DumpNat44InterfaceOutputFeature(*Nat44InterfaceOutputFeatureDump) ([]*Nat44InterfaceOutputFeatureDetails, error) - DumpNat44LbStaticMapping(*Nat44LbStaticMappingDump) ([]*Nat44LbStaticMappingDetails, error) - DumpNat44StaticMapping(*Nat44StaticMappingDump) ([]*Nat44StaticMappingDetails, error) - DumpNat44User(*Nat44UserDump) ([]*Nat44UserDetails, error) - DumpNat44UserSession(*Nat44UserSessionDump) ([]*Nat44UserSessionDetails, error) - DumpNat64Bib(*Nat64BibDump) ([]*Nat64BibDetails, error) - DumpNat64Interface(*Nat64InterfaceDump) ([]*Nat64InterfaceDetails, error) - DumpNat64PoolAddr(*Nat64PoolAddrDump) ([]*Nat64PoolAddrDetails, error) - DumpNat64Prefix(*Nat64PrefixDump) ([]*Nat64PrefixDetails, error) - DumpNat64St(*Nat64StDump) ([]*Nat64StDetails, error) - DumpNat66Interface(*Nat66InterfaceDump) ([]*Nat66InterfaceDetails, error) - DumpNat66StaticMapping(*Nat66StaticMappingDump) ([]*Nat66StaticMappingDetails, error) - DumpNatDetMap(*NatDetMapDump) ([]*NatDetMapDetails, error) - DumpNatDetSession(*NatDetSessionDump) ([]*NatDetSessionDetails, error) - DumpNatReass(*NatReassDump) ([]*NatReassDetails, error) - DumpNatWorker(*NatWorkerDump) ([]*NatWorkerDetails, error) - DsliteAddDelPoolAddrRange(*DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) - DsliteGetAftrAddr(*DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) - DsliteGetB4Addr(*DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) - DsliteSetAftrAddr(*DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) - DsliteSetB4Addr(*DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) - Nat44AddDelAddressRange(*Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) - Nat44AddDelIdentityMapping(*Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) - Nat44AddDelInterfaceAddr(*Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) - Nat44AddDelLbStaticMapping(*Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) - Nat44AddDelStaticMapping(*Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) - Nat44DelSession(*Nat44DelSession) (*Nat44DelSessionReply, error) - Nat44ForwardingEnableDisable(*Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) - Nat44ForwardingIsEnabled(*Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) - Nat44InterfaceAddDelFeature(*Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) - Nat44InterfaceAddDelOutputFeature(*Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) - Nat44LbStaticMappingAddDelLocal(*Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) - Nat64AddDelInterface(*Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) - Nat64AddDelInterfaceAddr(*Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) - Nat64AddDelPoolAddrRange(*Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) - Nat64AddDelPrefix(*Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) - Nat64AddDelStaticBib(*Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) - Nat66AddDelInterface(*Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) - Nat66AddDelStaticMapping(*Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) - NatControlPing(*NatControlPing) (*NatControlPingReply, error) - NatDetAddDelMap(*NatDetAddDelMap) (*NatDetAddDelMapReply, error) - NatDetCloseSessionIn(*NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) - NatDetCloseSessionOut(*NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) - NatDetForward(*NatDetForward) (*NatDetForwardReply, error) - NatDetReverse(*NatDetReverse) (*NatDetReverseReply, error) - NatGetAddrAndPortAllocAlg(*NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) - NatGetMssClamping(*NatGetMssClamping) (*NatGetMssClampingReply, error) - NatGetReass(*NatGetReass) (*NatGetReassReply, error) - NatGetTimeouts(*NatGetTimeouts) (*NatGetTimeoutsReply, error) - NatIpfixEnableDisable(*NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) - NatSetAddrAndPortAllocAlg(*NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) - NatSetMssClamping(*NatSetMssClamping) (*NatSetMssClampingReply, error) - NatSetReass(*NatSetReass) (*NatSetReassReply, error) - NatSetTimeouts(*NatSetTimeouts) (*NatSetTimeoutsReply, error) - NatSetWorkers(*NatSetWorkers) (*NatSetWorkersReply, error) - NatShowConfig(*NatShowConfig) (*NatShowConfigReply, error) -} - -/* Types */ - -// Nat44LbAddrPort represents VPP binary API type 'nat44_lb_addr_port': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "nat" + // VersionCrc is the CRC of this module. + VersionCrc = 0x6e4a2494 +) + +// Nat44LbAddrPort represents VPP binary API type 'nat44_lb_addr_port'. type Nat44LbAddrPort struct { Addr []byte `struc:"[4]byte"` Port uint16 @@ -102,9 +42,7 @@ func (*Nat44LbAddrPort) GetCrcString() string { return "15ce9cd1" } -/* Messages */ - -// DsliteAddDelPoolAddrRange represents VPP binary API message 'dslite_add_del_pool_addr_range': +// DsliteAddDelPoolAddrRange represents VPP binary API message 'dslite_add_del_pool_addr_range'. type DsliteAddDelPoolAddrRange struct { StartAddr []byte `struc:"[4]byte"` EndAddr []byte `struc:"[4]byte"` @@ -121,7 +59,7 @@ func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteAddDelPoolAddrRangeReply represents VPP binary API message 'dslite_add_del_pool_addr_range_reply': +// DsliteAddDelPoolAddrRangeReply represents VPP binary API message 'dslite_add_del_pool_addr_range_reply'. type DsliteAddDelPoolAddrRangeReply struct { Retval int32 } @@ -136,7 +74,7 @@ func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteAddressDetails represents VPP binary API message 'dslite_address_details': +// DsliteAddressDetails represents VPP binary API message 'dslite_address_details'. type DsliteAddressDetails struct { IPAddress []byte `struc:"[4]byte"` } @@ -151,7 +89,7 @@ func (*DsliteAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteAddressDump represents VPP binary API message 'dslite_address_dump': +// DsliteAddressDump represents VPP binary API message 'dslite_address_dump'. type DsliteAddressDump struct{} func (*DsliteAddressDump) GetMessageName() string { @@ -164,7 +102,7 @@ func (*DsliteAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetAftrAddr represents VPP binary API message 'dslite_get_aftr_addr': +// DsliteGetAftrAddr represents VPP binary API message 'dslite_get_aftr_addr'. type DsliteGetAftrAddr struct{} func (*DsliteGetAftrAddr) GetMessageName() string { @@ -177,7 +115,7 @@ func (*DsliteGetAftrAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetAftrAddrReply represents VPP binary API message 'dslite_get_aftr_addr_reply': +// DsliteGetAftrAddrReply represents VPP binary API message 'dslite_get_aftr_addr_reply'. type DsliteGetAftrAddrReply struct { Retval int32 IP4Addr []byte `struc:"[4]byte"` @@ -194,7 +132,7 @@ func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteGetB4Addr represents VPP binary API message 'dslite_get_b4_addr': +// DsliteGetB4Addr represents VPP binary API message 'dslite_get_b4_addr'. type DsliteGetB4Addr struct{} func (*DsliteGetB4Addr) GetMessageName() string { @@ -207,7 +145,7 @@ func (*DsliteGetB4Addr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetB4AddrReply represents VPP binary API message 'dslite_get_b4_addr_reply': +// DsliteGetB4AddrReply represents VPP binary API message 'dslite_get_b4_addr_reply'. type DsliteGetB4AddrReply struct { Retval int32 IP4Addr []byte `struc:"[4]byte"` @@ -224,7 +162,7 @@ func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteSetAftrAddr represents VPP binary API message 'dslite_set_aftr_addr': +// DsliteSetAftrAddr represents VPP binary API message 'dslite_set_aftr_addr'. type DsliteSetAftrAddr struct { IP4Addr []byte `struc:"[4]byte"` IP6Addr []byte `struc:"[16]byte"` @@ -240,7 +178,7 @@ func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteSetAftrAddrReply represents VPP binary API message 'dslite_set_aftr_addr_reply': +// DsliteSetAftrAddrReply represents VPP binary API message 'dslite_set_aftr_addr_reply'. type DsliteSetAftrAddrReply struct { Retval int32 } @@ -255,7 +193,7 @@ func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteSetB4Addr represents VPP binary API message 'dslite_set_b4_addr': +// DsliteSetB4Addr represents VPP binary API message 'dslite_set_b4_addr'. type DsliteSetB4Addr struct { IP4Addr []byte `struc:"[4]byte"` IP6Addr []byte `struc:"[16]byte"` @@ -271,7 +209,7 @@ func (*DsliteSetB4Addr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteSetB4AddrReply represents VPP binary API message 'dslite_set_b4_addr_reply': +// DsliteSetB4AddrReply represents VPP binary API message 'dslite_set_b4_addr_reply'. type DsliteSetB4AddrReply struct { Retval int32 } @@ -286,7 +224,7 @@ func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelAddressRange represents VPP binary API message 'nat44_add_del_address_range': +// Nat44AddDelAddressRange represents VPP binary API message 'nat44_add_del_address_range'. type Nat44AddDelAddressRange struct { FirstIPAddress []byte `struc:"[4]byte"` LastIPAddress []byte `struc:"[4]byte"` @@ -305,7 +243,7 @@ func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelAddressRangeReply represents VPP binary API message 'nat44_add_del_address_range_reply': +// Nat44AddDelAddressRangeReply represents VPP binary API message 'nat44_add_del_address_range_reply'. type Nat44AddDelAddressRangeReply struct { Retval int32 } @@ -320,7 +258,7 @@ func (*Nat44AddDelAddressRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelIdentityMapping represents VPP binary API message 'nat44_add_del_identity_mapping': +// Nat44AddDelIdentityMapping represents VPP binary API message 'nat44_add_del_identity_mapping'. type Nat44AddDelIdentityMapping struct { IsAdd uint8 AddrOnly uint8 @@ -342,7 +280,7 @@ func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelIdentityMappingReply represents VPP binary API message 'nat44_add_del_identity_mapping_reply': +// Nat44AddDelIdentityMappingReply represents VPP binary API message 'nat44_add_del_identity_mapping_reply'. type Nat44AddDelIdentityMappingReply struct { Retval int32 } @@ -357,7 +295,7 @@ func (*Nat44AddDelIdentityMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelInterfaceAddr represents VPP binary API message 'nat44_add_del_interface_addr': +// Nat44AddDelInterfaceAddr represents VPP binary API message 'nat44_add_del_interface_addr'. type Nat44AddDelInterfaceAddr struct { IsAdd uint8 TwiceNat uint8 @@ -374,7 +312,7 @@ func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelInterfaceAddrReply represents VPP binary API message 'nat44_add_del_interface_addr_reply': +// Nat44AddDelInterfaceAddrReply represents VPP binary API message 'nat44_add_del_interface_addr_reply'. type Nat44AddDelInterfaceAddrReply struct { Retval int32 } @@ -389,7 +327,7 @@ func (*Nat44AddDelInterfaceAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelLbStaticMapping represents VPP binary API message 'nat44_add_del_lb_static_mapping': +// Nat44AddDelLbStaticMapping represents VPP binary API message 'nat44_add_del_lb_static_mapping'. type Nat44AddDelLbStaticMapping struct { IsAdd uint8 ExternalAddr []byte `struc:"[4]byte"` @@ -414,7 +352,7 @@ func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelLbStaticMappingReply represents VPP binary API message 'nat44_add_del_lb_static_mapping_reply': +// Nat44AddDelLbStaticMappingReply represents VPP binary API message 'nat44_add_del_lb_static_mapping_reply'. type Nat44AddDelLbStaticMappingReply struct { Retval int32 } @@ -429,7 +367,7 @@ func (*Nat44AddDelLbStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelStaticMapping represents VPP binary API message 'nat44_add_del_static_mapping': +// Nat44AddDelStaticMapping represents VPP binary API message 'nat44_add_del_static_mapping'. type Nat44AddDelStaticMapping struct { IsAdd uint8 AddrOnly uint8 @@ -456,7 +394,7 @@ func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelStaticMappingReply represents VPP binary API message 'nat44_add_del_static_mapping_reply': +// Nat44AddDelStaticMappingReply represents VPP binary API message 'nat44_add_del_static_mapping_reply'. type Nat44AddDelStaticMappingReply struct { Retval int32 } @@ -471,7 +409,7 @@ func (*Nat44AddDelStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddressDetails represents VPP binary API message 'nat44_address_details': +// Nat44AddressDetails represents VPP binary API message 'nat44_address_details'. type Nat44AddressDetails struct { IPAddress []byte `struc:"[4]byte"` TwiceNat uint8 @@ -488,7 +426,7 @@ func (*Nat44AddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddressDump represents VPP binary API message 'nat44_address_dump': +// Nat44AddressDump represents VPP binary API message 'nat44_address_dump'. type Nat44AddressDump struct{} func (*Nat44AddressDump) GetMessageName() string { @@ -501,7 +439,7 @@ func (*Nat44AddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44DelSession represents VPP binary API message 'nat44_del_session': +// Nat44DelSession represents VPP binary API message 'nat44_del_session'. type Nat44DelSession struct { IsIn uint8 Address []byte `struc:"[4]byte"` @@ -523,7 +461,7 @@ func (*Nat44DelSession) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44DelSessionReply represents VPP binary API message 'nat44_del_session_reply': +// Nat44DelSessionReply represents VPP binary API message 'nat44_del_session_reply'. type Nat44DelSessionReply struct { Retval int32 } @@ -538,7 +476,7 @@ func (*Nat44DelSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44ForwardingEnableDisable represents VPP binary API message 'nat44_forwarding_enable_disable': +// Nat44ForwardingEnableDisable represents VPP binary API message 'nat44_forwarding_enable_disable'. type Nat44ForwardingEnableDisable struct { Enable uint8 } @@ -553,7 +491,7 @@ func (*Nat44ForwardingEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44ForwardingEnableDisableReply represents VPP binary API message 'nat44_forwarding_enable_disable_reply': +// Nat44ForwardingEnableDisableReply represents VPP binary API message 'nat44_forwarding_enable_disable_reply'. type Nat44ForwardingEnableDisableReply struct { Retval int32 } @@ -568,7 +506,7 @@ func (*Nat44ForwardingEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44ForwardingIsEnabled represents VPP binary API message 'nat44_forwarding_is_enabled': +// Nat44ForwardingIsEnabled represents VPP binary API message 'nat44_forwarding_is_enabled'. type Nat44ForwardingIsEnabled struct{} func (*Nat44ForwardingIsEnabled) GetMessageName() string { @@ -581,7 +519,7 @@ func (*Nat44ForwardingIsEnabled) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44ForwardingIsEnabledReply represents VPP binary API message 'nat44_forwarding_is_enabled_reply': +// Nat44ForwardingIsEnabledReply represents VPP binary API message 'nat44_forwarding_is_enabled_reply'. type Nat44ForwardingIsEnabledReply struct { Enabled uint8 } @@ -596,7 +534,7 @@ func (*Nat44ForwardingIsEnabledReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44IdentityMappingDetails represents VPP binary API message 'nat44_identity_mapping_details': +// Nat44IdentityMappingDetails represents VPP binary API message 'nat44_identity_mapping_details'. type Nat44IdentityMappingDetails struct { AddrOnly uint8 IPAddress []byte `struc:"[4]byte"` @@ -617,7 +555,7 @@ func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44IdentityMappingDump represents VPP binary API message 'nat44_identity_mapping_dump': +// Nat44IdentityMappingDump represents VPP binary API message 'nat44_identity_mapping_dump'. type Nat44IdentityMappingDump struct{} func (*Nat44IdentityMappingDump) GetMessageName() string { @@ -630,7 +568,7 @@ func (*Nat44IdentityMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelFeature represents VPP binary API message 'nat44_interface_add_del_feature': +// Nat44InterfaceAddDelFeature represents VPP binary API message 'nat44_interface_add_del_feature'. type Nat44InterfaceAddDelFeature struct { IsAdd uint8 IsInside uint8 @@ -647,7 +585,7 @@ func (*Nat44InterfaceAddDelFeature) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelFeatureReply represents VPP binary API message 'nat44_interface_add_del_feature_reply': +// Nat44InterfaceAddDelFeatureReply represents VPP binary API message 'nat44_interface_add_del_feature_reply'. type Nat44InterfaceAddDelFeatureReply struct { Retval int32 } @@ -662,7 +600,7 @@ func (*Nat44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceAddDelOutputFeature represents VPP binary API message 'nat44_interface_add_del_output_feature': +// Nat44InterfaceAddDelOutputFeature represents VPP binary API message 'nat44_interface_add_del_output_feature'. type Nat44InterfaceAddDelOutputFeature struct { IsAdd uint8 IsInside uint8 @@ -679,7 +617,7 @@ func (*Nat44InterfaceAddDelOutputFeature) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelOutputFeatureReply represents VPP binary API message 'nat44_interface_add_del_output_feature_reply': +// Nat44InterfaceAddDelOutputFeatureReply represents VPP binary API message 'nat44_interface_add_del_output_feature_reply'. type Nat44InterfaceAddDelOutputFeatureReply struct { Retval int32 } @@ -694,7 +632,7 @@ func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType return api.ReplyMessage } -// Nat44InterfaceAddrDetails represents VPP binary API message 'nat44_interface_addr_details': +// Nat44InterfaceAddrDetails represents VPP binary API message 'nat44_interface_addr_details'. type Nat44InterfaceAddrDetails struct { SwIfIndex uint32 TwiceNat uint8 @@ -710,7 +648,7 @@ func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceAddrDump represents VPP binary API message 'nat44_interface_addr_dump': +// Nat44InterfaceAddrDump represents VPP binary API message 'nat44_interface_addr_dump'. type Nat44InterfaceAddrDump struct{} func (*Nat44InterfaceAddrDump) GetMessageName() string { @@ -723,7 +661,7 @@ func (*Nat44InterfaceAddrDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceDetails represents VPP binary API message 'nat44_interface_details': +// Nat44InterfaceDetails represents VPP binary API message 'nat44_interface_details'. type Nat44InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -739,7 +677,7 @@ func (*Nat44InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceDump represents VPP binary API message 'nat44_interface_dump': +// Nat44InterfaceDump represents VPP binary API message 'nat44_interface_dump'. type Nat44InterfaceDump struct{} func (*Nat44InterfaceDump) GetMessageName() string { @@ -752,7 +690,7 @@ func (*Nat44InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceOutputFeatureDetails represents VPP binary API message 'nat44_interface_output_feature_details': +// Nat44InterfaceOutputFeatureDetails represents VPP binary API message 'nat44_interface_output_feature_details'. type Nat44InterfaceOutputFeatureDetails struct { IsInside uint8 SwIfIndex uint32 @@ -768,7 +706,7 @@ func (*Nat44InterfaceOutputFeatureDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceOutputFeatureDump represents VPP binary API message 'nat44_interface_output_feature_dump': +// Nat44InterfaceOutputFeatureDump represents VPP binary API message 'nat44_interface_output_feature_dump'. type Nat44InterfaceOutputFeatureDump struct{} func (*Nat44InterfaceOutputFeatureDump) GetMessageName() string { @@ -781,7 +719,7 @@ func (*Nat44InterfaceOutputFeatureDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44LbStaticMappingAddDelLocal represents VPP binary API message 'nat44_lb_static_mapping_add_del_local': +// Nat44LbStaticMappingAddDelLocal represents VPP binary API message 'nat44_lb_static_mapping_add_del_local'. type Nat44LbStaticMappingAddDelLocal struct { IsAdd uint8 ExternalAddr []byte `struc:"[4]byte"` @@ -800,7 +738,7 @@ func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44LbStaticMappingAddDelLocalReply represents VPP binary API message 'nat44_lb_static_mapping_add_del_local_reply': +// Nat44LbStaticMappingAddDelLocalReply represents VPP binary API message 'nat44_lb_static_mapping_add_del_local_reply'. type Nat44LbStaticMappingAddDelLocalReply struct { Retval int32 } @@ -815,7 +753,7 @@ func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44LbStaticMappingDetails represents VPP binary API message 'nat44_lb_static_mapping_details': +// Nat44LbStaticMappingDetails represents VPP binary API message 'nat44_lb_static_mapping_details'. type Nat44LbStaticMappingDetails struct { ExternalAddr []byte `struc:"[4]byte"` ExternalPort uint16 @@ -839,7 +777,7 @@ func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44LbStaticMappingDump represents VPP binary API message 'nat44_lb_static_mapping_dump': +// Nat44LbStaticMappingDump represents VPP binary API message 'nat44_lb_static_mapping_dump'. type Nat44LbStaticMappingDump struct{} func (*Nat44LbStaticMappingDump) GetMessageName() string { @@ -852,7 +790,7 @@ func (*Nat44LbStaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44StaticMappingDetails represents VPP binary API message 'nat44_static_mapping_details': +// Nat44StaticMappingDetails represents VPP binary API message 'nat44_static_mapping_details'. type Nat44StaticMappingDetails struct { AddrOnly uint8 LocalIPAddress []byte `struc:"[4]byte"` @@ -878,7 +816,7 @@ func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44StaticMappingDump represents VPP binary API message 'nat44_static_mapping_dump': +// Nat44StaticMappingDump represents VPP binary API message 'nat44_static_mapping_dump'. type Nat44StaticMappingDump struct{} func (*Nat44StaticMappingDump) GetMessageName() string { @@ -891,7 +829,7 @@ func (*Nat44StaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44UserDetails represents VPP binary API message 'nat44_user_details': +// Nat44UserDetails represents VPP binary API message 'nat44_user_details'. type Nat44UserDetails struct { VrfID uint32 IPAddress []byte `struc:"[4]byte"` @@ -909,7 +847,7 @@ func (*Nat44UserDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44UserDump represents VPP binary API message 'nat44_user_dump': +// Nat44UserDump represents VPP binary API message 'nat44_user_dump'. type Nat44UserDump struct{} func (*Nat44UserDump) GetMessageName() string { @@ -922,7 +860,7 @@ func (*Nat44UserDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44UserSessionDetails represents VPP binary API message 'nat44_user_session_details': +// Nat44UserSessionDetails represents VPP binary API message 'nat44_user_session_details'. type Nat44UserSessionDetails struct { OutsideIPAddress []byte `struc:"[4]byte"` OutsidePort uint16 @@ -951,7 +889,7 @@ func (*Nat44UserSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44UserSessionDump represents VPP binary API message 'nat44_user_session_dump': +// Nat44UserSessionDump represents VPP binary API message 'nat44_user_session_dump'. type Nat44UserSessionDump struct { IPAddress []byte `struc:"[4]byte"` VrfID uint32 @@ -967,7 +905,7 @@ func (*Nat44UserSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterface represents VPP binary API message 'nat64_add_del_interface': +// Nat64AddDelInterface represents VPP binary API message 'nat64_add_del_interface'. type Nat64AddDelInterface struct { SwIfIndex uint32 IsInside uint8 @@ -984,7 +922,7 @@ func (*Nat64AddDelInterface) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterfaceAddr represents VPP binary API message 'nat64_add_del_interface_addr': +// Nat64AddDelInterfaceAddr represents VPP binary API message 'nat64_add_del_interface_addr'. type Nat64AddDelInterfaceAddr struct { IsAdd uint8 IsInside uint8 @@ -1001,7 +939,7 @@ func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterfaceAddrReply represents VPP binary API message 'nat64_add_del_interface_addr_reply': +// Nat64AddDelInterfaceAddrReply represents VPP binary API message 'nat64_add_del_interface_addr_reply'. type Nat64AddDelInterfaceAddrReply struct { Retval int32 } @@ -1016,7 +954,7 @@ func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelInterfaceReply represents VPP binary API message 'nat64_add_del_interface_reply': +// Nat64AddDelInterfaceReply represents VPP binary API message 'nat64_add_del_interface_reply'. type Nat64AddDelInterfaceReply struct { Retval int32 } @@ -1031,7 +969,7 @@ func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelPoolAddrRange represents VPP binary API message 'nat64_add_del_pool_addr_range': +// Nat64AddDelPoolAddrRange represents VPP binary API message 'nat64_add_del_pool_addr_range'. type Nat64AddDelPoolAddrRange struct { StartAddr []byte `struc:"[4]byte"` EndAddr []byte `struc:"[4]byte"` @@ -1049,7 +987,7 @@ func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelPoolAddrRangeReply represents VPP binary API message 'nat64_add_del_pool_addr_range_reply': +// Nat64AddDelPoolAddrRangeReply represents VPP binary API message 'nat64_add_del_pool_addr_range_reply'. type Nat64AddDelPoolAddrRangeReply struct { Retval int32 } @@ -1064,7 +1002,7 @@ func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelPrefix represents VPP binary API message 'nat64_add_del_prefix': +// Nat64AddDelPrefix represents VPP binary API message 'nat64_add_del_prefix'. type Nat64AddDelPrefix struct { Prefix []byte `struc:"[16]byte"` PrefixLen uint8 @@ -1082,7 +1020,7 @@ func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelPrefixReply represents VPP binary API message 'nat64_add_del_prefix_reply': +// Nat64AddDelPrefixReply represents VPP binary API message 'nat64_add_del_prefix_reply'. type Nat64AddDelPrefixReply struct { Retval int32 } @@ -1097,7 +1035,7 @@ func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelStaticBib represents VPP binary API message 'nat64_add_del_static_bib': +// Nat64AddDelStaticBib represents VPP binary API message 'nat64_add_del_static_bib'. type Nat64AddDelStaticBib struct { IAddr []byte `struc:"[16]byte"` OAddr []byte `struc:"[4]byte"` @@ -1118,7 +1056,7 @@ func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelStaticBibReply represents VPP binary API message 'nat64_add_del_static_bib_reply': +// Nat64AddDelStaticBibReply represents VPP binary API message 'nat64_add_del_static_bib_reply'. type Nat64AddDelStaticBibReply struct { Retval int32 } @@ -1133,7 +1071,7 @@ func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64BibDetails represents VPP binary API message 'nat64_bib_details': +// Nat64BibDetails represents VPP binary API message 'nat64_bib_details'. type Nat64BibDetails struct { IAddr []byte `struc:"[16]byte"` OAddr []byte `struc:"[4]byte"` @@ -1155,7 +1093,7 @@ func (*Nat64BibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64BibDump represents VPP binary API message 'nat64_bib_dump': +// Nat64BibDump represents VPP binary API message 'nat64_bib_dump'. type Nat64BibDump struct { Proto uint8 } @@ -1170,7 +1108,7 @@ func (*Nat64BibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64InterfaceDetails represents VPP binary API message 'nat64_interface_details': +// Nat64InterfaceDetails represents VPP binary API message 'nat64_interface_details'. type Nat64InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -1186,7 +1124,7 @@ func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64InterfaceDump represents VPP binary API message 'nat64_interface_dump': +// Nat64InterfaceDump represents VPP binary API message 'nat64_interface_dump'. type Nat64InterfaceDump struct{} func (*Nat64InterfaceDump) GetMessageName() string { @@ -1199,7 +1137,7 @@ func (*Nat64InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64PoolAddrDetails represents VPP binary API message 'nat64_pool_addr_details': +// Nat64PoolAddrDetails represents VPP binary API message 'nat64_pool_addr_details'. type Nat64PoolAddrDetails struct { Address []byte `struc:"[4]byte"` VrfID uint32 @@ -1215,7 +1153,7 @@ func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64PoolAddrDump represents VPP binary API message 'nat64_pool_addr_dump': +// Nat64PoolAddrDump represents VPP binary API message 'nat64_pool_addr_dump'. type Nat64PoolAddrDump struct{} func (*Nat64PoolAddrDump) GetMessageName() string { @@ -1228,7 +1166,7 @@ func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64PrefixDetails represents VPP binary API message 'nat64_prefix_details': +// Nat64PrefixDetails represents VPP binary API message 'nat64_prefix_details'. type Nat64PrefixDetails struct { Prefix []byte `struc:"[16]byte"` PrefixLen uint8 @@ -1245,7 +1183,7 @@ func (*Nat64PrefixDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64PrefixDump represents VPP binary API message 'nat64_prefix_dump': +// Nat64PrefixDump represents VPP binary API message 'nat64_prefix_dump'. type Nat64PrefixDump struct{} func (*Nat64PrefixDump) GetMessageName() string { @@ -1258,7 +1196,7 @@ func (*Nat64PrefixDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64StDetails represents VPP binary API message 'nat64_st_details': +// Nat64StDetails represents VPP binary API message 'nat64_st_details'. type Nat64StDetails struct { IlAddr []byte `struc:"[16]byte"` OlAddr []byte `struc:"[4]byte"` @@ -1281,7 +1219,7 @@ func (*Nat64StDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64StDump represents VPP binary API message 'nat64_st_dump': +// Nat64StDump represents VPP binary API message 'nat64_st_dump'. type Nat64StDump struct { Proto uint8 } @@ -1296,7 +1234,7 @@ func (*Nat64StDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelInterface represents VPP binary API message 'nat66_add_del_interface': +// Nat66AddDelInterface represents VPP binary API message 'nat66_add_del_interface'. type Nat66AddDelInterface struct { IsAdd uint8 IsInside uint8 @@ -1313,7 +1251,7 @@ func (*Nat66AddDelInterface) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelInterfaceReply represents VPP binary API message 'nat66_add_del_interface_reply': +// Nat66AddDelInterfaceReply represents VPP binary API message 'nat66_add_del_interface_reply'. type Nat66AddDelInterfaceReply struct { Retval int32 } @@ -1328,7 +1266,7 @@ func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66AddDelStaticMapping represents VPP binary API message 'nat66_add_del_static_mapping': +// Nat66AddDelStaticMapping represents VPP binary API message 'nat66_add_del_static_mapping'. type Nat66AddDelStaticMapping struct { IsAdd uint8 LocalIPAddress []byte `struc:"[16]byte"` @@ -1346,7 +1284,7 @@ func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelStaticMappingReply represents VPP binary API message 'nat66_add_del_static_mapping_reply': +// Nat66AddDelStaticMappingReply represents VPP binary API message 'nat66_add_del_static_mapping_reply'. type Nat66AddDelStaticMappingReply struct { Retval int32 } @@ -1361,7 +1299,7 @@ func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66InterfaceDetails represents VPP binary API message 'nat66_interface_details': +// Nat66InterfaceDetails represents VPP binary API message 'nat66_interface_details'. type Nat66InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -1377,7 +1315,7 @@ func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66InterfaceDump represents VPP binary API message 'nat66_interface_dump': +// Nat66InterfaceDump represents VPP binary API message 'nat66_interface_dump'. type Nat66InterfaceDump struct{} func (*Nat66InterfaceDump) GetMessageName() string { @@ -1390,7 +1328,7 @@ func (*Nat66InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66StaticMappingDetails represents VPP binary API message 'nat66_static_mapping_details': +// Nat66StaticMappingDetails represents VPP binary API message 'nat66_static_mapping_details'. type Nat66StaticMappingDetails struct { LocalIPAddress []byte `struc:"[16]byte"` ExternalIPAddress []byte `struc:"[16]byte"` @@ -1409,7 +1347,7 @@ func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66StaticMappingDump represents VPP binary API message 'nat66_static_mapping_dump': +// Nat66StaticMappingDump represents VPP binary API message 'nat66_static_mapping_dump'. type Nat66StaticMappingDump struct{} func (*Nat66StaticMappingDump) GetMessageName() string { @@ -1422,7 +1360,7 @@ func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatControlPing represents VPP binary API message 'nat_control_ping': +// NatControlPing represents VPP binary API message 'nat_control_ping'. type NatControlPing struct{} func (*NatControlPing) GetMessageName() string { @@ -1435,7 +1373,7 @@ func (*NatControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// NatControlPingReply represents VPP binary API message 'nat_control_ping_reply': +// NatControlPingReply represents VPP binary API message 'nat_control_ping_reply'. type NatControlPingReply struct { Retval int32 ClientIndex uint32 @@ -1452,7 +1390,7 @@ func (*NatControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetAddDelMap represents VPP binary API message 'nat_det_add_del_map': +// NatDetAddDelMap represents VPP binary API message 'nat_det_add_del_map'. type NatDetAddDelMap struct { IsAdd uint8 IsNat44 uint8 @@ -1473,7 +1411,7 @@ func (*NatDetAddDelMap) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetAddDelMapReply represents VPP binary API message 'nat_det_add_del_map_reply': +// NatDetAddDelMapReply represents VPP binary API message 'nat_det_add_del_map_reply'. type NatDetAddDelMapReply struct { Retval int32 } @@ -1488,7 +1426,7 @@ func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetCloseSessionIn represents VPP binary API message 'nat_det_close_session_in': +// NatDetCloseSessionIn represents VPP binary API message 'nat_det_close_session_in'. type NatDetCloseSessionIn struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1507,7 +1445,7 @@ func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetCloseSessionInReply represents VPP binary API message 'nat_det_close_session_in_reply': +// NatDetCloseSessionInReply represents VPP binary API message 'nat_det_close_session_in_reply'. type NatDetCloseSessionInReply struct { Retval int32 } @@ -1522,7 +1460,7 @@ func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetCloseSessionOut represents VPP binary API message 'nat_det_close_session_out': +// NatDetCloseSessionOut represents VPP binary API message 'nat_det_close_session_out'. type NatDetCloseSessionOut struct { OutAddr []byte `struc:"[4]byte"` OutPort uint16 @@ -1540,7 +1478,7 @@ func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetCloseSessionOutReply represents VPP binary API message 'nat_det_close_session_out_reply': +// NatDetCloseSessionOutReply represents VPP binary API message 'nat_det_close_session_out_reply'. type NatDetCloseSessionOutReply struct { Retval int32 } @@ -1555,7 +1493,7 @@ func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetForward represents VPP binary API message 'nat_det_forward': +// NatDetForward represents VPP binary API message 'nat_det_forward'. type NatDetForward struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1571,7 +1509,7 @@ func (*NatDetForward) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetForwardReply represents VPP binary API message 'nat_det_forward_reply': +// NatDetForwardReply represents VPP binary API message 'nat_det_forward_reply'. type NatDetForwardReply struct { Retval int32 OutPortLo uint16 @@ -1589,7 +1527,7 @@ func (*NatDetForwardReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetMapDetails represents VPP binary API message 'nat_det_map_details': +// NatDetMapDetails represents VPP binary API message 'nat_det_map_details'. type NatDetMapDetails struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1611,7 +1549,7 @@ func (*NatDetMapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetMapDump represents VPP binary API message 'nat_det_map_dump': +// NatDetMapDump represents VPP binary API message 'nat_det_map_dump'. type NatDetMapDump struct{} func (*NatDetMapDump) GetMessageName() string { @@ -1624,7 +1562,7 @@ func (*NatDetMapDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetReverse represents VPP binary API message 'nat_det_reverse': +// NatDetReverse represents VPP binary API message 'nat_det_reverse'. type NatDetReverse struct { OutPort uint16 OutAddr []byte `struc:"[4]byte"` @@ -1640,7 +1578,7 @@ func (*NatDetReverse) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetReverseReply represents VPP binary API message 'nat_det_reverse_reply': +// NatDetReverseReply represents VPP binary API message 'nat_det_reverse_reply'. type NatDetReverseReply struct { Retval int32 IsNat44 uint8 @@ -1657,7 +1595,7 @@ func (*NatDetReverseReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetSessionDetails represents VPP binary API message 'nat_det_session_details': +// NatDetSessionDetails represents VPP binary API message 'nat_det_session_details'. type NatDetSessionDetails struct { InPort uint16 ExtAddr []byte `struc:"[4]byte"` @@ -1677,7 +1615,7 @@ func (*NatDetSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetSessionDump represents VPP binary API message 'nat_det_session_dump': +// NatDetSessionDump represents VPP binary API message 'nat_det_session_dump'. type NatDetSessionDump struct { IsNat44 uint8 UserAddr []byte `struc:"[16]byte"` @@ -1693,7 +1631,7 @@ func (*NatDetSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetAddrAndPortAllocAlg represents VPP binary API message 'nat_get_addr_and_port_alloc_alg': +// NatGetAddrAndPortAllocAlg represents VPP binary API message 'nat_get_addr_and_port_alloc_alg'. type NatGetAddrAndPortAllocAlg struct{} func (*NatGetAddrAndPortAllocAlg) GetMessageName() string { @@ -1706,7 +1644,7 @@ func (*NatGetAddrAndPortAllocAlg) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_get_addr_and_port_alloc_alg_reply': +// NatGetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_get_addr_and_port_alloc_alg_reply'. type NatGetAddrAndPortAllocAlgReply struct { Retval int32 Alg uint8 @@ -1727,7 +1665,7 @@ func (*NatGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetMssClamping represents VPP binary API message 'nat_get_mss_clamping': +// NatGetMssClamping represents VPP binary API message 'nat_get_mss_clamping'. type NatGetMssClamping struct{} func (*NatGetMssClamping) GetMessageName() string { @@ -1740,7 +1678,7 @@ func (*NatGetMssClamping) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetMssClampingReply represents VPP binary API message 'nat_get_mss_clamping_reply': +// NatGetMssClampingReply represents VPP binary API message 'nat_get_mss_clamping_reply'. type NatGetMssClampingReply struct { Retval int32 MssValue uint16 @@ -1757,7 +1695,7 @@ func (*NatGetMssClampingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetReass represents VPP binary API message 'nat_get_reass': +// NatGetReass represents VPP binary API message 'nat_get_reass'. type NatGetReass struct{} func (*NatGetReass) GetMessageName() string { @@ -1770,7 +1708,7 @@ func (*NatGetReass) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetReassReply represents VPP binary API message 'nat_get_reass_reply': +// NatGetReassReply represents VPP binary API message 'nat_get_reass_reply'. type NatGetReassReply struct { Retval int32 IP4Timeout uint32 @@ -1793,7 +1731,7 @@ func (*NatGetReassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetTimeouts represents VPP binary API message 'nat_get_timeouts': +// NatGetTimeouts represents VPP binary API message 'nat_get_timeouts'. type NatGetTimeouts struct{} func (*NatGetTimeouts) GetMessageName() string { @@ -1806,7 +1744,7 @@ func (*NatGetTimeouts) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetTimeoutsReply represents VPP binary API message 'nat_get_timeouts_reply': +// NatGetTimeoutsReply represents VPP binary API message 'nat_get_timeouts_reply'. type NatGetTimeoutsReply struct { Retval int32 UDP uint32 @@ -1825,7 +1763,7 @@ func (*NatGetTimeoutsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatIpfixEnableDisable represents VPP binary API message 'nat_ipfix_enable_disable': +// NatIpfixEnableDisable represents VPP binary API message 'nat_ipfix_enable_disable'. type NatIpfixEnableDisable struct { DomainID uint32 SrcPort uint16 @@ -1842,7 +1780,7 @@ func (*NatIpfixEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// NatIpfixEnableDisableReply represents VPP binary API message 'nat_ipfix_enable_disable_reply': +// NatIpfixEnableDisableReply represents VPP binary API message 'nat_ipfix_enable_disable_reply'. type NatIpfixEnableDisableReply struct { Retval int32 } @@ -1857,7 +1795,7 @@ func (*NatIpfixEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatReassDetails represents VPP binary API message 'nat_reass_details': +// NatReassDetails represents VPP binary API message 'nat_reass_details'. type NatReassDetails struct { IsIP4 uint8 SrcAddr []byte `struc:"[16]byte"` @@ -1877,7 +1815,7 @@ func (*NatReassDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatReassDump represents VPP binary API message 'nat_reass_dump': +// NatReassDump represents VPP binary API message 'nat_reass_dump'. type NatReassDump struct{} func (*NatReassDump) GetMessageName() string { @@ -1890,7 +1828,7 @@ func (*NatReassDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetAddrAndPortAllocAlg represents VPP binary API message 'nat_set_addr_and_port_alloc_alg': +// NatSetAddrAndPortAllocAlg represents VPP binary API message 'nat_set_addr_and_port_alloc_alg'. type NatSetAddrAndPortAllocAlg struct { Alg uint8 PsidOffset uint8 @@ -1910,7 +1848,7 @@ func (*NatSetAddrAndPortAllocAlg) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_set_addr_and_port_alloc_alg_reply': +// NatSetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_set_addr_and_port_alloc_alg_reply'. type NatSetAddrAndPortAllocAlgReply struct { Retval int32 } @@ -1925,7 +1863,7 @@ func (*NatSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetMssClamping represents VPP binary API message 'nat_set_mss_clamping': +// NatSetMssClamping represents VPP binary API message 'nat_set_mss_clamping'. type NatSetMssClamping struct { MssValue uint16 Enable uint8 @@ -1941,7 +1879,7 @@ func (*NatSetMssClamping) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetMssClampingReply represents VPP binary API message 'nat_set_mss_clamping_reply': +// NatSetMssClampingReply represents VPP binary API message 'nat_set_mss_clamping_reply'. type NatSetMssClampingReply struct { Retval int32 } @@ -1956,7 +1894,7 @@ func (*NatSetMssClampingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetReass represents VPP binary API message 'nat_set_reass': +// NatSetReass represents VPP binary API message 'nat_set_reass'. type NatSetReass struct { Timeout uint32 MaxReass uint16 @@ -1975,7 +1913,7 @@ func (*NatSetReass) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetReassReply represents VPP binary API message 'nat_set_reass_reply': +// NatSetReassReply represents VPP binary API message 'nat_set_reass_reply'. type NatSetReassReply struct { Retval int32 } @@ -1990,7 +1928,7 @@ func (*NatSetReassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetTimeouts represents VPP binary API message 'nat_set_timeouts': +// NatSetTimeouts represents VPP binary API message 'nat_set_timeouts'. type NatSetTimeouts struct { UDP uint32 TCPEstablished uint32 @@ -2008,7 +1946,7 @@ func (*NatSetTimeouts) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetTimeoutsReply represents VPP binary API message 'nat_set_timeouts_reply': +// NatSetTimeoutsReply represents VPP binary API message 'nat_set_timeouts_reply'. type NatSetTimeoutsReply struct { Retval int32 } @@ -2023,7 +1961,7 @@ func (*NatSetTimeoutsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetWorkers represents VPP binary API message 'nat_set_workers': +// NatSetWorkers represents VPP binary API message 'nat_set_workers'. type NatSetWorkers struct { WorkerMask uint64 } @@ -2038,7 +1976,7 @@ func (*NatSetWorkers) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetWorkersReply represents VPP binary API message 'nat_set_workers_reply': +// NatSetWorkersReply represents VPP binary API message 'nat_set_workers_reply'. type NatSetWorkersReply struct { Retval int32 } @@ -2053,7 +1991,7 @@ func (*NatSetWorkersReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatShowConfig represents VPP binary API message 'nat_show_config': +// NatShowConfig represents VPP binary API message 'nat_show_config'. type NatShowConfig struct{} func (*NatShowConfig) GetMessageName() string { @@ -2066,7 +2004,7 @@ func (*NatShowConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// NatShowConfigReply represents VPP binary API message 'nat_show_config_reply': +// NatShowConfigReply represents VPP binary API message 'nat_show_config_reply'. type NatShowConfigReply struct { Retval int32 StaticMappingOnly uint8 @@ -2098,7 +2036,7 @@ func (*NatShowConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatWorkerDetails represents VPP binary API message 'nat_worker_details': +// NatWorkerDetails represents VPP binary API message 'nat_worker_details'. type NatWorkerDetails struct { WorkerIndex uint32 LcoreID uint32 @@ -2115,7 +2053,7 @@ func (*NatWorkerDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatWorkerDump represents VPP binary API message 'nat_worker_dump': +// NatWorkerDump represents VPP binary API message 'nat_worker_dump'. type NatWorkerDump struct{} func (*NatWorkerDump) GetMessageName() string { @@ -2253,127 +2191,1123 @@ func init() { api.RegisterMessage((*NatWorkerDump)(nil), "nat.NatWorkerDump") } -var Messages = []api.Message{ - (*DsliteAddDelPoolAddrRange)(nil), - (*DsliteAddDelPoolAddrRangeReply)(nil), - (*DsliteAddressDetails)(nil), - (*DsliteAddressDump)(nil), - (*DsliteGetAftrAddr)(nil), - (*DsliteGetAftrAddrReply)(nil), - (*DsliteGetB4Addr)(nil), - (*DsliteGetB4AddrReply)(nil), - (*DsliteSetAftrAddr)(nil), - (*DsliteSetAftrAddrReply)(nil), - (*DsliteSetB4Addr)(nil), - (*DsliteSetB4AddrReply)(nil), - (*Nat44AddDelAddressRange)(nil), - (*Nat44AddDelAddressRangeReply)(nil), - (*Nat44AddDelIdentityMapping)(nil), - (*Nat44AddDelIdentityMappingReply)(nil), - (*Nat44AddDelInterfaceAddr)(nil), - (*Nat44AddDelInterfaceAddrReply)(nil), - (*Nat44AddDelLbStaticMapping)(nil), - (*Nat44AddDelLbStaticMappingReply)(nil), - (*Nat44AddDelStaticMapping)(nil), - (*Nat44AddDelStaticMappingReply)(nil), - (*Nat44AddressDetails)(nil), - (*Nat44AddressDump)(nil), - (*Nat44DelSession)(nil), - (*Nat44DelSessionReply)(nil), - (*Nat44ForwardingEnableDisable)(nil), - (*Nat44ForwardingEnableDisableReply)(nil), - (*Nat44ForwardingIsEnabled)(nil), - (*Nat44ForwardingIsEnabledReply)(nil), - (*Nat44IdentityMappingDetails)(nil), - (*Nat44IdentityMappingDump)(nil), - (*Nat44InterfaceAddDelFeature)(nil), - (*Nat44InterfaceAddDelFeatureReply)(nil), - (*Nat44InterfaceAddDelOutputFeature)(nil), - (*Nat44InterfaceAddDelOutputFeatureReply)(nil), - (*Nat44InterfaceAddrDetails)(nil), - (*Nat44InterfaceAddrDump)(nil), - (*Nat44InterfaceDetails)(nil), - (*Nat44InterfaceDump)(nil), - (*Nat44InterfaceOutputFeatureDetails)(nil), - (*Nat44InterfaceOutputFeatureDump)(nil), - (*Nat44LbStaticMappingAddDelLocal)(nil), - (*Nat44LbStaticMappingAddDelLocalReply)(nil), - (*Nat44LbStaticMappingDetails)(nil), - (*Nat44LbStaticMappingDump)(nil), - (*Nat44StaticMappingDetails)(nil), - (*Nat44StaticMappingDump)(nil), - (*Nat44UserDetails)(nil), - (*Nat44UserDump)(nil), - (*Nat44UserSessionDetails)(nil), - (*Nat44UserSessionDump)(nil), - (*Nat64AddDelInterface)(nil), - (*Nat64AddDelInterfaceAddr)(nil), - (*Nat64AddDelInterfaceAddrReply)(nil), - (*Nat64AddDelInterfaceReply)(nil), - (*Nat64AddDelPoolAddrRange)(nil), - (*Nat64AddDelPoolAddrRangeReply)(nil), - (*Nat64AddDelPrefix)(nil), - (*Nat64AddDelPrefixReply)(nil), - (*Nat64AddDelStaticBib)(nil), - (*Nat64AddDelStaticBibReply)(nil), - (*Nat64BibDetails)(nil), - (*Nat64BibDump)(nil), - (*Nat64InterfaceDetails)(nil), - (*Nat64InterfaceDump)(nil), - (*Nat64PoolAddrDetails)(nil), - (*Nat64PoolAddrDump)(nil), - (*Nat64PrefixDetails)(nil), - (*Nat64PrefixDump)(nil), - (*Nat64StDetails)(nil), - (*Nat64StDump)(nil), - (*Nat66AddDelInterface)(nil), - (*Nat66AddDelInterfaceReply)(nil), - (*Nat66AddDelStaticMapping)(nil), - (*Nat66AddDelStaticMappingReply)(nil), - (*Nat66InterfaceDetails)(nil), - (*Nat66InterfaceDump)(nil), - (*Nat66StaticMappingDetails)(nil), - (*Nat66StaticMappingDump)(nil), - (*NatControlPing)(nil), - (*NatControlPingReply)(nil), - (*NatDetAddDelMap)(nil), - (*NatDetAddDelMapReply)(nil), - (*NatDetCloseSessionIn)(nil), - (*NatDetCloseSessionInReply)(nil), - (*NatDetCloseSessionOut)(nil), - (*NatDetCloseSessionOutReply)(nil), - (*NatDetForward)(nil), - (*NatDetForwardReply)(nil), - (*NatDetMapDetails)(nil), - (*NatDetMapDump)(nil), - (*NatDetReverse)(nil), - (*NatDetReverseReply)(nil), - (*NatDetSessionDetails)(nil), - (*NatDetSessionDump)(nil), - (*NatGetAddrAndPortAllocAlg)(nil), - (*NatGetAddrAndPortAllocAlgReply)(nil), - (*NatGetMssClamping)(nil), - (*NatGetMssClampingReply)(nil), - (*NatGetReass)(nil), - (*NatGetReassReply)(nil), - (*NatGetTimeouts)(nil), - (*NatGetTimeoutsReply)(nil), - (*NatIpfixEnableDisable)(nil), - (*NatIpfixEnableDisableReply)(nil), - (*NatReassDetails)(nil), - (*NatReassDump)(nil), - (*NatSetAddrAndPortAllocAlg)(nil), - (*NatSetAddrAndPortAllocAlgReply)(nil), - (*NatSetMssClamping)(nil), - (*NatSetMssClampingReply)(nil), - (*NatSetReass)(nil), - (*NatSetReassReply)(nil), - (*NatSetTimeouts)(nil), - (*NatSetTimeoutsReply)(nil), - (*NatSetWorkers)(nil), - (*NatSetWorkersReply)(nil), - (*NatShowConfig)(nil), - (*NatShowConfigReply)(nil), - (*NatWorkerDetails)(nil), - (*NatWorkerDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DsliteAddDelPoolAddrRange)(nil), + (*DsliteAddDelPoolAddrRangeReply)(nil), + (*DsliteAddressDetails)(nil), + (*DsliteAddressDump)(nil), + (*DsliteGetAftrAddr)(nil), + (*DsliteGetAftrAddrReply)(nil), + (*DsliteGetB4Addr)(nil), + (*DsliteGetB4AddrReply)(nil), + (*DsliteSetAftrAddr)(nil), + (*DsliteSetAftrAddrReply)(nil), + (*DsliteSetB4Addr)(nil), + (*DsliteSetB4AddrReply)(nil), + (*Nat44AddDelAddressRange)(nil), + (*Nat44AddDelAddressRangeReply)(nil), + (*Nat44AddDelIdentityMapping)(nil), + (*Nat44AddDelIdentityMappingReply)(nil), + (*Nat44AddDelInterfaceAddr)(nil), + (*Nat44AddDelInterfaceAddrReply)(nil), + (*Nat44AddDelLbStaticMapping)(nil), + (*Nat44AddDelLbStaticMappingReply)(nil), + (*Nat44AddDelStaticMapping)(nil), + (*Nat44AddDelStaticMappingReply)(nil), + (*Nat44AddressDetails)(nil), + (*Nat44AddressDump)(nil), + (*Nat44DelSession)(nil), + (*Nat44DelSessionReply)(nil), + (*Nat44ForwardingEnableDisable)(nil), + (*Nat44ForwardingEnableDisableReply)(nil), + (*Nat44ForwardingIsEnabled)(nil), + (*Nat44ForwardingIsEnabledReply)(nil), + (*Nat44IdentityMappingDetails)(nil), + (*Nat44IdentityMappingDump)(nil), + (*Nat44InterfaceAddDelFeature)(nil), + (*Nat44InterfaceAddDelFeatureReply)(nil), + (*Nat44InterfaceAddDelOutputFeature)(nil), + (*Nat44InterfaceAddDelOutputFeatureReply)(nil), + (*Nat44InterfaceAddrDetails)(nil), + (*Nat44InterfaceAddrDump)(nil), + (*Nat44InterfaceDetails)(nil), + (*Nat44InterfaceDump)(nil), + (*Nat44InterfaceOutputFeatureDetails)(nil), + (*Nat44InterfaceOutputFeatureDump)(nil), + (*Nat44LbStaticMappingAddDelLocal)(nil), + (*Nat44LbStaticMappingAddDelLocalReply)(nil), + (*Nat44LbStaticMappingDetails)(nil), + (*Nat44LbStaticMappingDump)(nil), + (*Nat44StaticMappingDetails)(nil), + (*Nat44StaticMappingDump)(nil), + (*Nat44UserDetails)(nil), + (*Nat44UserDump)(nil), + (*Nat44UserSessionDetails)(nil), + (*Nat44UserSessionDump)(nil), + (*Nat64AddDelInterface)(nil), + (*Nat64AddDelInterfaceAddr)(nil), + (*Nat64AddDelInterfaceAddrReply)(nil), + (*Nat64AddDelInterfaceReply)(nil), + (*Nat64AddDelPoolAddrRange)(nil), + (*Nat64AddDelPoolAddrRangeReply)(nil), + (*Nat64AddDelPrefix)(nil), + (*Nat64AddDelPrefixReply)(nil), + (*Nat64AddDelStaticBib)(nil), + (*Nat64AddDelStaticBibReply)(nil), + (*Nat64BibDetails)(nil), + (*Nat64BibDump)(nil), + (*Nat64InterfaceDetails)(nil), + (*Nat64InterfaceDump)(nil), + (*Nat64PoolAddrDetails)(nil), + (*Nat64PoolAddrDump)(nil), + (*Nat64PrefixDetails)(nil), + (*Nat64PrefixDump)(nil), + (*Nat64StDetails)(nil), + (*Nat64StDump)(nil), + (*Nat66AddDelInterface)(nil), + (*Nat66AddDelInterfaceReply)(nil), + (*Nat66AddDelStaticMapping)(nil), + (*Nat66AddDelStaticMappingReply)(nil), + (*Nat66InterfaceDetails)(nil), + (*Nat66InterfaceDump)(nil), + (*Nat66StaticMappingDetails)(nil), + (*Nat66StaticMappingDump)(nil), + (*NatControlPing)(nil), + (*NatControlPingReply)(nil), + (*NatDetAddDelMap)(nil), + (*NatDetAddDelMapReply)(nil), + (*NatDetCloseSessionIn)(nil), + (*NatDetCloseSessionInReply)(nil), + (*NatDetCloseSessionOut)(nil), + (*NatDetCloseSessionOutReply)(nil), + (*NatDetForward)(nil), + (*NatDetForwardReply)(nil), + (*NatDetMapDetails)(nil), + (*NatDetMapDump)(nil), + (*NatDetReverse)(nil), + (*NatDetReverseReply)(nil), + (*NatDetSessionDetails)(nil), + (*NatDetSessionDump)(nil), + (*NatGetAddrAndPortAllocAlg)(nil), + (*NatGetAddrAndPortAllocAlgReply)(nil), + (*NatGetMssClamping)(nil), + (*NatGetMssClampingReply)(nil), + (*NatGetReass)(nil), + (*NatGetReassReply)(nil), + (*NatGetTimeouts)(nil), + (*NatGetTimeoutsReply)(nil), + (*NatIpfixEnableDisable)(nil), + (*NatIpfixEnableDisableReply)(nil), + (*NatReassDetails)(nil), + (*NatReassDump)(nil), + (*NatSetAddrAndPortAllocAlg)(nil), + (*NatSetAddrAndPortAllocAlgReply)(nil), + (*NatSetMssClamping)(nil), + (*NatSetMssClampingReply)(nil), + (*NatSetReass)(nil), + (*NatSetReassReply)(nil), + (*NatSetTimeouts)(nil), + (*NatSetTimeoutsReply)(nil), + (*NatSetWorkers)(nil), + (*NatSetWorkersReply)(nil), + (*NatShowConfig)(nil), + (*NatShowConfigReply)(nil), + (*NatWorkerDetails)(nil), + (*NatWorkerDump)(nil), + } +} + +// RPCService represents RPC service API for nat module. +type RPCService interface { + DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) + DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) + DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) + DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) + DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) + DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) + DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) + DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) + DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) + DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) + DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) + DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) + DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) + DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) + DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) + DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) + DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) + DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) + DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) + DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) + DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) + DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) + DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) + DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) + DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) + DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) + Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) + Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) + Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) + Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) + Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) + Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) + Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) + Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) + Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) + Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) + Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) + Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) + Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) + Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) + Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) + Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) + Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) + Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) + NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) + NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) + NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) + NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) + NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) + NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) + NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) + NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) + NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) + NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) + NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) + NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) + NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) + NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) + NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) + NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) + NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDsliteAddressClient{stream} + return x, nil +} + +type RPCService_DumpDsliteAddressClient interface { + Recv() (*DsliteAddressDetails, error) +} + +type serviceClient_DumpDsliteAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDsliteAddressClient) Recv() (*DsliteAddressDetails, error) { + m := new(DsliteAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44AddressClient{stream} + return x, nil +} + +type RPCService_DumpNat44AddressClient interface { + Recv() (*Nat44AddressDetails, error) +} + +type serviceClient_DumpNat44AddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44AddressClient) Recv() (*Nat44AddressDetails, error) { + m := new(Nat44AddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44IdentityMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44IdentityMappingClient interface { + Recv() (*Nat44IdentityMappingDetails, error) +} + +type serviceClient_DumpNat44IdentityMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44IdentityMappingClient) Recv() (*Nat44IdentityMappingDetails, error) { + m := new(Nat44IdentityMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceAddrClient interface { + Recv() (*Nat44InterfaceAddrDetails, error) +} + +type serviceClient_DumpNat44InterfaceAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceAddrClient) Recv() (*Nat44InterfaceAddrDetails, error) { + m := new(Nat44InterfaceAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceClient interface { + Recv() (*Nat44InterfaceDetails, error) +} + +type serviceClient_DumpNat44InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceClient) Recv() (*Nat44InterfaceDetails, error) { + m := new(Nat44InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceOutputFeatureClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceOutputFeatureClient interface { + Recv() (*Nat44InterfaceOutputFeatureDetails, error) +} + +type serviceClient_DumpNat44InterfaceOutputFeatureClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceOutputFeatureClient) Recv() (*Nat44InterfaceOutputFeatureDetails, error) { + m := new(Nat44InterfaceOutputFeatureDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44LbStaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44LbStaticMappingClient interface { + Recv() (*Nat44LbStaticMappingDetails, error) +} + +type serviceClient_DumpNat44LbStaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44LbStaticMappingClient) Recv() (*Nat44LbStaticMappingDetails, error) { + m := new(Nat44LbStaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44StaticMappingClient interface { + Recv() (*Nat44StaticMappingDetails, error) +} + +type serviceClient_DumpNat44StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44StaticMappingClient) Recv() (*Nat44StaticMappingDetails, error) { + m := new(Nat44StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserClient interface { + Recv() (*Nat44UserDetails, error) +} + +type serviceClient_DumpNat44UserClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserClient) Recv() (*Nat44UserDetails, error) { + m := new(Nat44UserDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserSessionClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserSessionClient interface { + Recv() (*Nat44UserSessionDetails, error) +} + +type serviceClient_DumpNat44UserSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserSessionClient) Recv() (*Nat44UserSessionDetails, error) { + m := new(Nat44UserSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64BibClient{stream} + return x, nil +} + +type RPCService_DumpNat64BibClient interface { + Recv() (*Nat64BibDetails, error) +} + +type serviceClient_DumpNat64BibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64BibClient) Recv() (*Nat64BibDetails, error) { + m := new(Nat64BibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat64InterfaceClient interface { + Recv() (*Nat64InterfaceDetails, error) +} + +type serviceClient_DumpNat64InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64InterfaceClient) Recv() (*Nat64InterfaceDetails, error) { + m := new(Nat64InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PoolAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat64PoolAddrClient interface { + Recv() (*Nat64PoolAddrDetails, error) +} + +type serviceClient_DumpNat64PoolAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PoolAddrClient) Recv() (*Nat64PoolAddrDetails, error) { + m := new(Nat64PoolAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PrefixClient{stream} + return x, nil +} + +type RPCService_DumpNat64PrefixClient interface { + Recv() (*Nat64PrefixDetails, error) +} + +type serviceClient_DumpNat64PrefixClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PrefixClient) Recv() (*Nat64PrefixDetails, error) { + m := new(Nat64PrefixDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64StClient{stream} + return x, nil +} + +type RPCService_DumpNat64StClient interface { + Recv() (*Nat64StDetails, error) +} + +type serviceClient_DumpNat64StClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64StClient) Recv() (*Nat64StDetails, error) { + m := new(Nat64StDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat66InterfaceClient interface { + Recv() (*Nat66InterfaceDetails, error) +} + +type serviceClient_DumpNat66InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66InterfaceClient) Recv() (*Nat66InterfaceDetails, error) { + m := new(Nat66InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat66StaticMappingClient interface { + Recv() (*Nat66StaticMappingDetails, error) +} + +type serviceClient_DumpNat66StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66StaticMappingClient) Recv() (*Nat66StaticMappingDetails, error) { + m := new(Nat66StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetMapClient{stream} + return x, nil +} + +type RPCService_DumpNatDetMapClient interface { + Recv() (*NatDetMapDetails, error) } + +type serviceClient_DumpNatDetMapClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetMapClient) Recv() (*NatDetMapDetails, error) { + m := new(NatDetMapDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetSessionClient{stream} + return x, nil +} + +type RPCService_DumpNatDetSessionClient interface { + Recv() (*NatDetSessionDetails, error) +} + +type serviceClient_DumpNatDetSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetSessionClient) Recv() (*NatDetSessionDetails, error) { + m := new(NatDetSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatReassClient{stream} + return x, nil +} + +type RPCService_DumpNatReassClient interface { + Recv() (*NatReassDetails, error) +} + +type serviceClient_DumpNatReassClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatReassClient) Recv() (*NatReassDetails, error) { + m := new(NatReassDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatWorkerClient{stream} + return x, nil +} + +type RPCService_DumpNatWorkerClient interface { + Recv() (*NatWorkerDetails, error) +} + +type serviceClient_DumpNatWorkerClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatWorkerClient) Recv() (*NatWorkerDetails, error) { + m := new(NatWorkerDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) { + out := new(DsliteAddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) { + out := new(DsliteGetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { + out := new(DsliteGetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { + out := new(DsliteSetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { + out := new(DsliteSetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) { + out := new(Nat44AddDelAddressRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { + out := new(Nat44AddDelIdentityMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { + out := new(Nat44AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { + out := new(Nat44AddDelLbStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { + out := new(Nat44AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) { + out := new(Nat44DelSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { + out := new(Nat44ForwardingEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { + out := new(Nat44ForwardingIsEnabledReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) { + out := new(Nat44InterfaceAddDelFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { + out := new(Nat44InterfaceAddDelOutputFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) { + out := new(Nat44LbStaticMappingAddDelLocalReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { + out := new(Nat64AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { + out := new(Nat64AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { + out := new(Nat64AddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { + out := new(Nat64AddDelPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { + out := new(Nat64AddDelStaticBibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { + out := new(Nat66AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { + out := new(Nat66AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) { + out := new(NatControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { + out := new(NatDetAddDelMapReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { + out := new(NatDetCloseSessionInReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { + out := new(NatDetCloseSessionOutReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { + out := new(NatDetForwardReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { + out := new(NatDetReverseReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) { + out := new(NatGetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { + out := new(NatGetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) { + out := new(NatGetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { + out := new(NatGetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { + out := new(NatIpfixEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { + out := new(NatSetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { + out := new(NatSetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) { + out := new(NatSetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { + out := new(NatSetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { + out := new(NatSetWorkersReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { + out := new(NatShowConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/punt/punt.ba.go b/plugins/vpp/binapi/vpp1901/punt/punt.ba.go index edbc650cb2..729dbf1bf1 100644 --- a/plugins/vpp/binapi/vpp1901/punt/punt.ba.go +++ b/plugins/vpp/binapi/vpp1901/punt/punt.ba.go @@ -1,37 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/punt.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/punt.api.json /* - Package punt is a generated from VPP binary API module 'punt'. +Package punt is a generated VPP binary API for 'punt' module. - It contains following objects: - 5 services +It consists of: 1 type 10 messages + 5 services */ package punt -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "punt" + // VersionCrc is the CRC of this module. + VersionCrc = 0x1c487f2b +) -// Services represents VPP binary API services: -type Services interface { - DumpPunt(*PuntDump) ([]*PuntDetails, error) - DumpPuntSocket(*PuntSocketDump) ([]*PuntSocketDetails, error) - PuntSocketDeregister(*PuntSocketDeregister) (*PuntSocketDeregisterReply, error) - PuntSocketRegister(*PuntSocketRegister) (*PuntSocketRegisterReply, error) - SetPunt(*SetPunt) (*SetPuntReply, error) -} - -/* Types */ - -// Punt represents VPP binary API type 'punt': +// Punt represents VPP binary API type 'punt'. type Punt struct { IPv uint8 L4Protocol uint8 @@ -45,9 +41,7 @@ func (*Punt) GetCrcString() string { return "fe4f98ac" } -/* Messages */ - -// PuntDetails represents VPP binary API message 'punt_details': +// PuntDetails represents VPP binary API message 'punt_details'. type PuntDetails struct { Punt Punt } @@ -62,7 +56,7 @@ func (*PuntDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntDump represents VPP binary API message 'punt_dump': +// PuntDump represents VPP binary API message 'punt_dump'. type PuntDump struct { IsIPv6 uint8 } @@ -77,7 +71,7 @@ func (*PuntDump) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketDeregister represents VPP binary API message 'punt_socket_deregister': +// PuntSocketDeregister represents VPP binary API message 'punt_socket_deregister'. type PuntSocketDeregister struct { Punt Punt } @@ -92,7 +86,7 @@ func (*PuntSocketDeregister) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketDeregisterReply represents VPP binary API message 'punt_socket_deregister_reply': +// PuntSocketDeregisterReply represents VPP binary API message 'punt_socket_deregister_reply'. type PuntSocketDeregisterReply struct { Retval int32 } @@ -107,7 +101,7 @@ func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntSocketDetails represents VPP binary API message 'punt_socket_details': +// PuntSocketDetails represents VPP binary API message 'punt_socket_details'. type PuntSocketDetails struct { Punt Punt Pathname []byte `struc:"[108]byte"` @@ -123,7 +117,7 @@ func (*PuntSocketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntSocketDump represents VPP binary API message 'punt_socket_dump': +// PuntSocketDump represents VPP binary API message 'punt_socket_dump'. type PuntSocketDump struct { IsIPv6 uint8 } @@ -138,7 +132,7 @@ func (*PuntSocketDump) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketRegister represents VPP binary API message 'punt_socket_register': +// PuntSocketRegister represents VPP binary API message 'punt_socket_register'. type PuntSocketRegister struct { HeaderVersion uint32 Punt Punt @@ -155,7 +149,7 @@ func (*PuntSocketRegister) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketRegisterReply represents VPP binary API message 'punt_socket_register_reply': +// PuntSocketRegisterReply represents VPP binary API message 'punt_socket_register_reply'. type PuntSocketRegisterReply struct { Retval int32 Pathname []byte `struc:"[64]byte"` @@ -171,7 +165,7 @@ func (*PuntSocketRegisterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetPunt represents VPP binary API message 'set_punt': +// SetPunt represents VPP binary API message 'set_punt'. type SetPunt struct { IsAdd uint8 Punt Punt @@ -187,7 +181,7 @@ func (*SetPunt) GetMessageType() api.MessageType { return api.RequestMessage } -// SetPuntReply represents VPP binary API message 'set_punt_reply': +// SetPuntReply represents VPP binary API message 'set_punt_reply'. type SetPuntReply struct { Retval int32 } @@ -215,15 +209,128 @@ func init() { api.RegisterMessage((*SetPuntReply)(nil), "punt.SetPuntReply") } -var Messages = []api.Message{ - (*PuntDetails)(nil), - (*PuntDump)(nil), - (*PuntSocketDeregister)(nil), - (*PuntSocketDeregisterReply)(nil), - (*PuntSocketDetails)(nil), - (*PuntSocketDump)(nil), - (*PuntSocketRegister)(nil), - (*PuntSocketRegisterReply)(nil), - (*SetPunt)(nil), - (*SetPuntReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PuntDetails)(nil), + (*PuntDump)(nil), + (*PuntSocketDeregister)(nil), + (*PuntSocketDeregisterReply)(nil), + (*PuntSocketDetails)(nil), + (*PuntSocketDump)(nil), + (*PuntSocketRegister)(nil), + (*PuntSocketRegisterReply)(nil), + (*SetPunt)(nil), + (*SetPuntReply)(nil), + } +} + +// RPCService represents RPC service API for punt module. +type RPCService interface { + DumpPunt(ctx context.Context, in *PuntDump) (RPCService_DumpPuntClient, error) + DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) + PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) + PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) + SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpPunt(ctx context.Context, in *PuntDump) (RPCService_DumpPuntClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntClient{stream} + return x, nil +} + +type RPCService_DumpPuntClient interface { + Recv() (*PuntDetails, error) +} + +type serviceClient_DumpPuntClient struct { + api.MultiRequestCtx } + +func (c *serviceClient_DumpPuntClient) Recv() (*PuntDetails, error) { + m := new(PuntDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntSocketClient{stream} + return x, nil +} + +type RPCService_DumpPuntSocketClient interface { + Recv() (*PuntSocketDetails, error) +} + +type serviceClient_DumpPuntSocketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpPuntSocketClient) Recv() (*PuntSocketDetails, error) { + m := new(PuntSocketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) { + out := new(PuntSocketDeregisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) { + out := new(PuntSocketRegisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { + out := new(SetPuntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/session/session.ba.go b/plugins/vpp/binapi/vpp1901/session/session.ba.go index 452eff9e94..1222357d33 100644 --- a/plugins/vpp/binapi/vpp1901/session/session.ba.go +++ b/plugins/vpp/binapi/vpp1901/session/session.ba.go @@ -1,53 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/session.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/session.api.json /* - Package session is a generated from VPP binary API module 'session'. +Package session is a generated VPP binary API for 'session' module. - It contains following objects: - 22 services +It consists of: 44 messages + 22 services */ package session -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSessionRules(*SessionRulesDump) ([]*SessionRulesDetails, error) - AcceptSession(*AcceptSession) (*AcceptSessionReply, error) - AppCutThroughRegistrationAdd(*AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) - AppNamespaceAddDel(*AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) - AppWorkerAddDel(*AppWorkerAddDel) (*AppWorkerAddDelReply, error) - ApplicationAttach(*ApplicationAttach) (*ApplicationAttachReply, error) - ApplicationDetach(*ApplicationDetach) (*ApplicationDetachReply, error) - ApplicationTLSCertAdd(*ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) - ApplicationTLSKeyAdd(*ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) - BindSock(*BindSock) (*BindSockReply, error) - BindURI(*BindURI) (*BindURIReply, error) - ConnectSession(*ConnectSession) (*ConnectSessionReply, error) - ConnectSock(*ConnectSock) (*ConnectSockReply, error) - ConnectURI(*ConnectURI) (*ConnectURIReply, error) - DisconnectSession(*DisconnectSession) (*DisconnectSessionReply, error) - MapAnotherSegment(*MapAnotherSegment) (*MapAnotherSegmentReply, error) - ResetSession(*ResetSession) (*ResetSessionReply, error) - SessionEnableDisable(*SessionEnableDisable) (*SessionEnableDisableReply, error) - SessionRuleAddDel(*SessionRuleAddDel) (*SessionRuleAddDelReply, error) - UnbindSock(*UnbindSock) (*UnbindSockReply, error) - UnbindURI(*UnbindURI) (*UnbindURIReply, error) - UnmapSegment(*UnmapSegment) (*UnmapSegmentReply, error) -} - -/* Messages */ - -// AcceptSession represents VPP binary API message 'accept_session': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "session" + // VersionCrc is the CRC of this module. + VersionCrc = 0xb236ad61 +) + +// AcceptSession represents VPP binary API message 'accept_session'. type AcceptSession struct { ListenerHandle uint64 Handle uint64 @@ -70,7 +49,7 @@ func (*AcceptSession) GetMessageType() api.MessageType { return api.RequestMessage } -// AcceptSessionReply represents VPP binary API message 'accept_session_reply': +// AcceptSessionReply represents VPP binary API message 'accept_session_reply'. type AcceptSessionReply struct { Retval int32 Handle uint64 @@ -86,7 +65,7 @@ func (*AcceptSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AppCutThroughRegistrationAdd represents VPP binary API message 'app_cut_through_registration_add': +// AppCutThroughRegistrationAdd represents VPP binary API message 'app_cut_through_registration_add'. type AppCutThroughRegistrationAdd struct { EvtQAddress uint64 PeerEvtQAddress uint64 @@ -105,7 +84,7 @@ func (*AppCutThroughRegistrationAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// AppCutThroughRegistrationAddReply represents VPP binary API message 'app_cut_through_registration_add_reply': +// AppCutThroughRegistrationAddReply represents VPP binary API message 'app_cut_through_registration_add_reply'. type AppCutThroughRegistrationAddReply struct { Retval int32 } @@ -120,7 +99,7 @@ func (*AppCutThroughRegistrationAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AppNamespaceAddDel represents VPP binary API message 'app_namespace_add_del': +// AppNamespaceAddDel represents VPP binary API message 'app_namespace_add_del'. type AppNamespaceAddDel struct { Secret uint64 SwIfIndex uint32 @@ -140,7 +119,7 @@ func (*AppNamespaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AppNamespaceAddDelReply represents VPP binary API message 'app_namespace_add_del_reply': +// AppNamespaceAddDelReply represents VPP binary API message 'app_namespace_add_del_reply'. type AppNamespaceAddDelReply struct { Retval int32 AppnsIndex uint32 @@ -156,7 +135,7 @@ func (*AppNamespaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AppWorkerAddDel represents VPP binary API message 'app_worker_add_del': +// AppWorkerAddDel represents VPP binary API message 'app_worker_add_del'. type AppWorkerAddDel struct { AppIndex uint32 WrkIndex uint32 @@ -173,7 +152,7 @@ func (*AppWorkerAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AppWorkerAddDelReply represents VPP binary API message 'app_worker_add_del_reply': +// AppWorkerAddDelReply represents VPP binary API message 'app_worker_add_del_reply'. type AppWorkerAddDelReply struct { Retval int32 WrkIndex uint32 @@ -196,7 +175,7 @@ func (*AppWorkerAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationAttach represents VPP binary API message 'application_attach': +// ApplicationAttach represents VPP binary API message 'application_attach'. type ApplicationAttach struct { InitialSegmentSize uint32 Options []uint64 `struc:"[16]uint64"` @@ -214,7 +193,7 @@ func (*ApplicationAttach) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationAttachReply represents VPP binary API message 'application_attach_reply': +// ApplicationAttachReply represents VPP binary API message 'application_attach_reply'. type ApplicationAttachReply struct { Retval int32 AppEventQueueAddress uint64 @@ -237,7 +216,7 @@ func (*ApplicationAttachReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationDetach represents VPP binary API message 'application_detach': +// ApplicationDetach represents VPP binary API message 'application_detach'. type ApplicationDetach struct{} func (*ApplicationDetach) GetMessageName() string { @@ -250,7 +229,7 @@ func (*ApplicationDetach) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationDetachReply represents VPP binary API message 'application_detach_reply': +// ApplicationDetachReply represents VPP binary API message 'application_detach_reply'. type ApplicationDetachReply struct { Retval int32 } @@ -265,7 +244,7 @@ func (*ApplicationDetachReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationTLSCertAdd represents VPP binary API message 'application_tls_cert_add': +// ApplicationTLSCertAdd represents VPP binary API message 'application_tls_cert_add'. type ApplicationTLSCertAdd struct { AppIndex uint32 CertLen uint16 `struc:"sizeof=Cert"` @@ -282,7 +261,7 @@ func (*ApplicationTLSCertAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationTLSCertAddReply represents VPP binary API message 'application_tls_cert_add_reply': +// ApplicationTLSCertAddReply represents VPP binary API message 'application_tls_cert_add_reply'. type ApplicationTLSCertAddReply struct { Retval int32 } @@ -297,7 +276,7 @@ func (*ApplicationTLSCertAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationTLSKeyAdd represents VPP binary API message 'application_tls_key_add': +// ApplicationTLSKeyAdd represents VPP binary API message 'application_tls_key_add'. type ApplicationTLSKeyAdd struct { AppIndex uint32 KeyLen uint16 `struc:"sizeof=Key"` @@ -314,7 +293,7 @@ func (*ApplicationTLSKeyAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationTLSKeyAddReply represents VPP binary API message 'application_tls_key_add_reply': +// ApplicationTLSKeyAddReply represents VPP binary API message 'application_tls_key_add_reply'. type ApplicationTLSKeyAddReply struct { Retval int32 } @@ -329,7 +308,7 @@ func (*ApplicationTLSKeyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BindSock represents VPP binary API message 'bind_sock': +// BindSock represents VPP binary API message 'bind_sock'. type BindSock struct { WrkIndex uint32 Vrf uint32 @@ -350,7 +329,7 @@ func (*BindSock) GetMessageType() api.MessageType { return api.RequestMessage } -// BindSockReply represents VPP binary API message 'bind_sock_reply': +// BindSockReply represents VPP binary API message 'bind_sock_reply'. type BindSockReply struct { Handle uint64 Retval int32 @@ -375,7 +354,7 @@ func (*BindSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BindURI represents VPP binary API message 'bind_uri': +// BindURI represents VPP binary API message 'bind_uri'. type BindURI struct { AcceptCookie uint32 URI []byte `struc:"[128]byte"` @@ -391,7 +370,7 @@ func (*BindURI) GetMessageType() api.MessageType { return api.RequestMessage } -// BindURIReply represents VPP binary API message 'bind_uri_reply': +// BindURIReply represents VPP binary API message 'bind_uri_reply'. type BindURIReply struct { Handle uint64 Retval int32 @@ -413,7 +392,7 @@ func (*BindURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ConnectSession represents VPP binary API message 'connect_session': +// ConnectSession represents VPP binary API message 'connect_session'. type ConnectSession struct{} func (*ConnectSession) GetMessageName() string { @@ -426,7 +405,7 @@ func (*ConnectSession) GetMessageType() api.MessageType { return api.RequestMessage } -// ConnectSessionReply represents VPP binary API message 'connect_session_reply': +// ConnectSessionReply represents VPP binary API message 'connect_session_reply'. type ConnectSessionReply struct { Retval int32 Handle uint64 @@ -452,7 +431,7 @@ func (*ConnectSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ConnectSock represents VPP binary API message 'connect_sock': +// ConnectSock represents VPP binary API message 'connect_sock'. type ConnectSock struct { WrkIndex uint32 ClientQueueAddress uint64 @@ -476,7 +455,7 @@ func (*ConnectSock) GetMessageType() api.MessageType { return api.RequestMessage } -// ConnectSockReply represents VPP binary API message 'connect_sock_reply': +// ConnectSockReply represents VPP binary API message 'connect_sock_reply'. type ConnectSockReply struct { Retval int32 } @@ -491,7 +470,7 @@ func (*ConnectSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ConnectURI represents VPP binary API message 'connect_uri': +// ConnectURI represents VPP binary API message 'connect_uri'. type ConnectURI struct { ClientQueueAddress uint64 Options []uint64 `struc:"[16]uint64"` @@ -508,7 +487,7 @@ func (*ConnectURI) GetMessageType() api.MessageType { return api.RequestMessage } -// ConnectURIReply represents VPP binary API message 'connect_uri_reply': +// ConnectURIReply represents VPP binary API message 'connect_uri_reply'. type ConnectURIReply struct { Retval int32 } @@ -523,7 +502,7 @@ func (*ConnectURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DisconnectSession represents VPP binary API message 'disconnect_session': +// DisconnectSession represents VPP binary API message 'disconnect_session'. type DisconnectSession struct { Handle uint64 } @@ -538,7 +517,7 @@ func (*DisconnectSession) GetMessageType() api.MessageType { return api.RequestMessage } -// DisconnectSessionReply represents VPP binary API message 'disconnect_session_reply': +// DisconnectSessionReply represents VPP binary API message 'disconnect_session_reply'. type DisconnectSessionReply struct { Retval int32 Handle uint64 @@ -554,7 +533,7 @@ func (*DisconnectSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MapAnotherSegment represents VPP binary API message 'map_another_segment': +// MapAnotherSegment represents VPP binary API message 'map_another_segment'. type MapAnotherSegment struct { FdFlags uint8 SegmentSize uint32 @@ -572,7 +551,7 @@ func (*MapAnotherSegment) GetMessageType() api.MessageType { return api.RequestMessage } -// MapAnotherSegmentReply represents VPP binary API message 'map_another_segment_reply': +// MapAnotherSegmentReply represents VPP binary API message 'map_another_segment_reply'. type MapAnotherSegmentReply struct { Retval int32 } @@ -587,7 +566,7 @@ func (*MapAnotherSegmentReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ResetSession represents VPP binary API message 'reset_session': +// ResetSession represents VPP binary API message 'reset_session'. type ResetSession struct { Handle uint64 } @@ -602,7 +581,7 @@ func (*ResetSession) GetMessageType() api.MessageType { return api.RequestMessage } -// ResetSessionReply represents VPP binary API message 'reset_session_reply': +// ResetSessionReply represents VPP binary API message 'reset_session_reply'. type ResetSessionReply struct { Retval int32 Handle uint64 @@ -618,7 +597,7 @@ func (*ResetSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionEnableDisable represents VPP binary API message 'session_enable_disable': +// SessionEnableDisable represents VPP binary API message 'session_enable_disable'. type SessionEnableDisable struct { IsEnable uint8 } @@ -633,7 +612,7 @@ func (*SessionEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// SessionEnableDisableReply represents VPP binary API message 'session_enable_disable_reply': +// SessionEnableDisableReply represents VPP binary API message 'session_enable_disable_reply'. type SessionEnableDisableReply struct { Retval int32 } @@ -648,7 +627,7 @@ func (*SessionEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRuleAddDel represents VPP binary API message 'session_rule_add_del': +// SessionRuleAddDel represents VPP binary API message 'session_rule_add_del'. type SessionRuleAddDel struct { TransportProto uint8 IsIP4 uint8 @@ -675,7 +654,7 @@ func (*SessionRuleAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SessionRuleAddDelReply represents VPP binary API message 'session_rule_add_del_reply': +// SessionRuleAddDelReply represents VPP binary API message 'session_rule_add_del_reply'. type SessionRuleAddDelReply struct { Retval int32 } @@ -690,7 +669,7 @@ func (*SessionRuleAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRulesDetails represents VPP binary API message 'session_rules_details': +// SessionRulesDetails represents VPP binary API message 'session_rules_details'. type SessionRulesDetails struct { TransportProto uint8 IsIP4 uint8 @@ -716,7 +695,7 @@ func (*SessionRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRulesDump represents VPP binary API message 'session_rules_dump': +// SessionRulesDump represents VPP binary API message 'session_rules_dump'. type SessionRulesDump struct{} func (*SessionRulesDump) GetMessageName() string { @@ -729,7 +708,7 @@ func (*SessionRulesDump) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindSock represents VPP binary API message 'unbind_sock': +// UnbindSock represents VPP binary API message 'unbind_sock'. type UnbindSock struct { WrkIndex uint32 Handle uint64 @@ -745,7 +724,7 @@ func (*UnbindSock) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindSockReply represents VPP binary API message 'unbind_sock_reply': +// UnbindSockReply represents VPP binary API message 'unbind_sock_reply'. type UnbindSockReply struct { Retval int32 } @@ -760,7 +739,7 @@ func (*UnbindSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// UnbindURI represents VPP binary API message 'unbind_uri': +// UnbindURI represents VPP binary API message 'unbind_uri'. type UnbindURI struct { URI []byte `struc:"[128]byte"` } @@ -775,7 +754,7 @@ func (*UnbindURI) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindURIReply represents VPP binary API message 'unbind_uri_reply': +// UnbindURIReply represents VPP binary API message 'unbind_uri_reply'. type UnbindURIReply struct { Retval int32 } @@ -790,7 +769,7 @@ func (*UnbindURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// UnmapSegment represents VPP binary API message 'unmap_segment': +// UnmapSegment represents VPP binary API message 'unmap_segment'. type UnmapSegment struct { SegmentHandle uint64 } @@ -805,7 +784,7 @@ func (*UnmapSegment) GetMessageType() api.MessageType { return api.RequestMessage } -// UnmapSegmentReply represents VPP binary API message 'unmap_segment_reply': +// UnmapSegmentReply represents VPP binary API message 'unmap_segment_reply'. type UnmapSegmentReply struct { Retval int32 } @@ -867,49 +846,315 @@ func init() { api.RegisterMessage((*UnmapSegmentReply)(nil), "session.UnmapSegmentReply") } -var Messages = []api.Message{ - (*AcceptSession)(nil), - (*AcceptSessionReply)(nil), - (*AppCutThroughRegistrationAdd)(nil), - (*AppCutThroughRegistrationAddReply)(nil), - (*AppNamespaceAddDel)(nil), - (*AppNamespaceAddDelReply)(nil), - (*AppWorkerAddDel)(nil), - (*AppWorkerAddDelReply)(nil), - (*ApplicationAttach)(nil), - (*ApplicationAttachReply)(nil), - (*ApplicationDetach)(nil), - (*ApplicationDetachReply)(nil), - (*ApplicationTLSCertAdd)(nil), - (*ApplicationTLSCertAddReply)(nil), - (*ApplicationTLSKeyAdd)(nil), - (*ApplicationTLSKeyAddReply)(nil), - (*BindSock)(nil), - (*BindSockReply)(nil), - (*BindURI)(nil), - (*BindURIReply)(nil), - (*ConnectSession)(nil), - (*ConnectSessionReply)(nil), - (*ConnectSock)(nil), - (*ConnectSockReply)(nil), - (*ConnectURI)(nil), - (*ConnectURIReply)(nil), - (*DisconnectSession)(nil), - (*DisconnectSessionReply)(nil), - (*MapAnotherSegment)(nil), - (*MapAnotherSegmentReply)(nil), - (*ResetSession)(nil), - (*ResetSessionReply)(nil), - (*SessionEnableDisable)(nil), - (*SessionEnableDisableReply)(nil), - (*SessionRuleAddDel)(nil), - (*SessionRuleAddDelReply)(nil), - (*SessionRulesDetails)(nil), - (*SessionRulesDump)(nil), - (*UnbindSock)(nil), - (*UnbindSockReply)(nil), - (*UnbindURI)(nil), - (*UnbindURIReply)(nil), - (*UnmapSegment)(nil), - (*UnmapSegmentReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AcceptSession)(nil), + (*AcceptSessionReply)(nil), + (*AppCutThroughRegistrationAdd)(nil), + (*AppCutThroughRegistrationAddReply)(nil), + (*AppNamespaceAddDel)(nil), + (*AppNamespaceAddDelReply)(nil), + (*AppWorkerAddDel)(nil), + (*AppWorkerAddDelReply)(nil), + (*ApplicationAttach)(nil), + (*ApplicationAttachReply)(nil), + (*ApplicationDetach)(nil), + (*ApplicationDetachReply)(nil), + (*ApplicationTLSCertAdd)(nil), + (*ApplicationTLSCertAddReply)(nil), + (*ApplicationTLSKeyAdd)(nil), + (*ApplicationTLSKeyAddReply)(nil), + (*BindSock)(nil), + (*BindSockReply)(nil), + (*BindURI)(nil), + (*BindURIReply)(nil), + (*ConnectSession)(nil), + (*ConnectSessionReply)(nil), + (*ConnectSock)(nil), + (*ConnectSockReply)(nil), + (*ConnectURI)(nil), + (*ConnectURIReply)(nil), + (*DisconnectSession)(nil), + (*DisconnectSessionReply)(nil), + (*MapAnotherSegment)(nil), + (*MapAnotherSegmentReply)(nil), + (*ResetSession)(nil), + (*ResetSessionReply)(nil), + (*SessionEnableDisable)(nil), + (*SessionEnableDisableReply)(nil), + (*SessionRuleAddDel)(nil), + (*SessionRuleAddDelReply)(nil), + (*SessionRulesDetails)(nil), + (*SessionRulesDump)(nil), + (*UnbindSock)(nil), + (*UnbindSockReply)(nil), + (*UnbindURI)(nil), + (*UnbindURIReply)(nil), + (*UnmapSegment)(nil), + (*UnmapSegmentReply)(nil), + } +} + +// RPCService represents RPC service API for session module. +type RPCService interface { + DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) + AcceptSession(ctx context.Context, in *AcceptSession) (*AcceptSessionReply, error) + AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) + AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) + AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) + ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) + ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) + ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) + ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) + BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) + BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) + ConnectSession(ctx context.Context, in *ConnectSession) (*ConnectSessionReply, error) + ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) + ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) + DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) + MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) + ResetSession(ctx context.Context, in *ResetSession) (*ResetSessionReply, error) + SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) + SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) + UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) + UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) + UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSessionRulesClient{stream} + return x, nil +} + +type RPCService_DumpSessionRulesClient interface { + Recv() (*SessionRulesDetails, error) +} + +type serviceClient_DumpSessionRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSessionRulesClient) Recv() (*SessionRulesDetails, error) { + m := new(SessionRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AcceptSession(ctx context.Context, in *AcceptSession) (*AcceptSessionReply, error) { + out := new(AcceptSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) { + out := new(AppCutThroughRegistrationAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { + out := new(AppNamespaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { + out := new(AppWorkerAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) { + out := new(ApplicationAttachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { + out := new(ApplicationDetachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { + out := new(ApplicationTLSCertAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { + out := new(ApplicationTLSKeyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) { + out := new(BindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) { + out := new(BindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectSession(ctx context.Context, in *ConnectSession) (*ConnectSessionReply, error) { + out := new(ConnectSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) { + out := new(ConnectSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) { + out := new(ConnectURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) { + out := new(DisconnectSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) { + out := new(MapAnotherSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ResetSession(ctx context.Context, in *ResetSession) (*ResetSessionReply, error) { + out := new(ResetSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { + out := new(SessionEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { + out := new(SessionRuleAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) { + out := new(UnbindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) { + out := new(UnbindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) { + out := new(UnmapSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/sr.patch b/plugins/vpp/binapi/vpp1901/sr.patch new file mode 100644 index 0000000000..fce5dc5806 --- /dev/null +++ b/plugins/vpp/binapi/vpp1901/sr.patch @@ -0,0 +1,16 @@ +diff --git b/plugins/vpp/binapi/vpp1901/sr/sr.ba.go a/plugins/vpp/binapi/vpp1901/sr/sr.ba.go +index e7e0a021..42153a48 100644 +--- b/plugins/vpp/binapi/vpp1901/sr/sr.ba.go ++++ a/plugins/vpp/binapi/vpp1901/sr/sr.ba.go +@@ -70,9 +70,9 @@ func (*Srv6Sid) GetCrcString() string { + // } + // + type Srv6SidList struct { +- NumSids uint8 ++ NumSids uint8 `struc:"sizeof=Sids"` + Weight uint32 +- Sids []Srv6Sid `struc:"[16]Srv6Sid"` ++ Sids []Srv6Sid + } + +func (*Srv6SidList) GetTypeName() string { \ No newline at end of file diff --git a/plugins/vpp/binapi/vpp1901/sr/sr.ba.go b/plugins/vpp/binapi/vpp1901/sr/sr.ba.go index 5b69f158ea..1f69254fc1 100644 --- a/plugins/vpp/binapi/vpp1901/sr/sr.ba.go +++ b/plugins/vpp/binapi/vpp1901/sr/sr.ba.go @@ -1,41 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/sr.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/sr.api.json /* - Package sr is a generated from VPP binary API module 'sr'. +Package sr is a generated VPP binary API for 'sr' module. - It contains following objects: - 9 services +It consists of: 3 types 18 messages + 9 services */ package sr -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSrLocalsids(*SrLocalsidsDump) ([]*SrLocalsidsDetails, error) - DumpSrPolicies(*SrPoliciesDump) ([]*SrPoliciesDetails, error) - DumpSrSteeringPol(*SrSteeringPolDump) ([]*SrSteeringPolDetails, error) - SrLocalsidAddDel(*SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) - SrPolicyAdd(*SrPolicyAdd) (*SrPolicyAddReply, error) - SrPolicyDel(*SrPolicyDel) (*SrPolicyDelReply, error) - SrPolicyMod(*SrPolicyMod) (*SrPolicyModReply, error) - SrSetEncapSource(*SrSetEncapSource) (*SrSetEncapSourceReply, error) - SrSteeringAddDel(*SrSteeringAddDel) (*SrSteeringAddDelReply, error) -} - -/* Types */ - -// SrIP6Address represents VPP binary API type 'sr_ip6_address': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // VersionCrc is the CRC of this module. + VersionCrc = 0x9cb542fd +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. type SrIP6Address struct { Data []byte `struc:"[16]byte"` } @@ -47,7 +39,7 @@ func (*SrIP6Address) GetCrcString() string { return "bea0c5e6" } -// Srv6Sid represents VPP binary API type 'srv6_sid': +// Srv6Sid represents VPP binary API type 'srv6_sid'. type Srv6Sid struct { Addr []byte `struc:"[16]byte"` } @@ -59,7 +51,7 @@ func (*Srv6Sid) GetCrcString() string { return "6ee67284" } -// Srv6SidList represents VPP binary API type 'srv6_sid_list': +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. type Srv6SidList struct { NumSids uint8 `struc:"sizeof=Sids"` Weight uint32 @@ -73,9 +65,7 @@ func (*Srv6SidList) GetCrcString() string { return "4066af74" } -/* Messages */ - -// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del': +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. type SrLocalsidAddDel struct { IsDel uint8 Localsid Srv6Sid @@ -98,7 +88,7 @@ func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply': +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. type SrLocalsidAddDelReply struct { Retval int32 } @@ -113,7 +103,7 @@ func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details': +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. type SrLocalsidsDetails struct { Addr Srv6Sid EndPsp uint8 @@ -135,7 +125,7 @@ func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump': +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. type SrLocalsidsDump struct{} func (*SrLocalsidsDump) GetMessageName() string { @@ -148,7 +138,7 @@ func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPoliciesDetails represents VPP binary API message 'sr_policies_details': +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. type SrPoliciesDetails struct { Bsid Srv6Sid Type uint8 @@ -168,7 +158,7 @@ func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPoliciesDump represents VPP binary API message 'sr_policies_dump': +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. type SrPoliciesDump struct{} func (*SrPoliciesDump) GetMessageName() string { @@ -181,7 +171,7 @@ func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyAdd represents VPP binary API message 'sr_policy_add': +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. type SrPolicyAdd struct { BsidAddr []byte `struc:"[16]byte"` Weight uint32 @@ -201,7 +191,7 @@ func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply': +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. type SrPolicyAddReply struct { Retval int32 } @@ -216,7 +206,7 @@ func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPolicyDel represents VPP binary API message 'sr_policy_del': +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. type SrPolicyDel struct { BsidAddr Srv6Sid SrPolicyIndex uint32 @@ -232,7 +222,7 @@ func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply': +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. type SrPolicyDelReply struct { Retval int32 } @@ -247,7 +237,7 @@ func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPolicyMod represents VPP binary API message 'sr_policy_mod': +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. type SrPolicyMod struct { BsidAddr []byte `struc:"[16]byte"` SrPolicyIndex uint32 @@ -268,7 +258,7 @@ func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply': +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. type SrPolicyModReply struct { Retval int32 } @@ -283,7 +273,7 @@ func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source': +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. type SrSetEncapSource struct { EncapsSource []byte `struc:"[16]byte"` } @@ -298,7 +288,7 @@ func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } -// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply': +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. type SrSetEncapSourceReply struct { Retval int32 } @@ -313,7 +303,7 @@ func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del': +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. type SrSteeringAddDel struct { IsDel uint8 BsidAddr []byte `struc:"[16]byte"` @@ -335,7 +325,7 @@ func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply': +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. type SrSteeringAddDelReply struct { Retval int32 } @@ -350,7 +340,7 @@ func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details': +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. type SrSteeringPolDetails struct { TrafficType uint8 FibTable uint32 @@ -370,7 +360,7 @@ func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump': +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. type SrSteeringPolDump struct{} func (*SrSteeringPolDump) GetMessageName() string { @@ -404,23 +394,193 @@ func init() { api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") } -var Messages = []api.Message{ - (*SrLocalsidAddDel)(nil), - (*SrLocalsidAddDelReply)(nil), - (*SrLocalsidsDetails)(nil), - (*SrLocalsidsDump)(nil), - (*SrPoliciesDetails)(nil), - (*SrPoliciesDump)(nil), - (*SrPolicyAdd)(nil), - (*SrPolicyAddReply)(nil), - (*SrPolicyDel)(nil), - (*SrPolicyDelReply)(nil), - (*SrPolicyMod)(nil), - (*SrPolicyModReply)(nil), - (*SrSetEncapSource)(nil), - (*SrSetEncapSourceReply)(nil), - (*SrSteeringAddDel)(nil), - (*SrSteeringAddDelReply)(nil), - (*SrSteeringPolDetails)(nil), - (*SrSteeringPolDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) } + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/stn/stn.ba.go b/plugins/vpp/binapi/vpp1901/stn/stn.ba.go index acf5b26dfa..44053bab03 100644 --- a/plugins/vpp/binapi/vpp1901/stn/stn.ba.go +++ b/plugins/vpp/binapi/vpp1901/stn/stn.ba.go @@ -1,33 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/stn.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/stn.api.json /* - Package stn is a generated from VPP binary API module 'stn'. +Package stn is a generated VPP binary API for 'stn' module. - It contains following objects: - 2 services +It consists of: 4 messages + 2 services */ package stn -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpStnRules(*StnRulesDump) ([]*StnRulesDetails, error) - StnAddDelRule(*StnAddDelRule) (*StnAddDelRuleReply, error) -} - -/* Messages */ - -// StnAddDelRule represents VPP binary API message 'stn_add_del_rule': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "stn" + // VersionCrc is the CRC of this module. + VersionCrc = 0xc7404144 +) + +// StnAddDelRule represents VPP binary API message 'stn_add_del_rule'. type StnAddDelRule struct { IsIP4 uint8 IPAddress []byte `struc:"[16]byte"` @@ -45,7 +44,7 @@ func (*StnAddDelRule) GetMessageType() api.MessageType { return api.RequestMessage } -// StnAddDelRuleReply represents VPP binary API message 'stn_add_del_rule_reply': +// StnAddDelRuleReply represents VPP binary API message 'stn_add_del_rule_reply'. type StnAddDelRuleReply struct { Retval int32 } @@ -60,7 +59,7 @@ func (*StnAddDelRuleReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// StnRulesDetails represents VPP binary API message 'stn_rules_details': +// StnRulesDetails represents VPP binary API message 'stn_rules_details'. type StnRulesDetails struct { IsIP4 uint8 IPAddress []byte `struc:"[16]byte"` @@ -77,7 +76,7 @@ func (*StnRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// StnRulesDump represents VPP binary API message 'stn_rules_dump': +// StnRulesDump represents VPP binary API message 'stn_rules_dump'. type StnRulesDump struct{} func (*StnRulesDump) GetMessageName() string { @@ -97,9 +96,75 @@ func init() { api.RegisterMessage((*StnRulesDump)(nil), "stn.StnRulesDump") } -var Messages = []api.Message{ - (*StnAddDelRule)(nil), - (*StnAddDelRuleReply)(nil), - (*StnRulesDetails)(nil), - (*StnRulesDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*StnAddDelRule)(nil), + (*StnAddDelRuleReply)(nil), + (*StnRulesDetails)(nil), + (*StnRulesDump)(nil), + } +} + +// RPCService represents RPC service API for stn module. +type RPCService interface { + DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) + StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} } + +func (c *serviceClient) DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpStnRulesClient{stream} + return x, nil +} + +type RPCService_DumpStnRulesClient interface { + Recv() (*StnRulesDetails, error) +} + +type serviceClient_DumpStnRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpStnRulesClient) Recv() (*StnRulesDetails, error) { + m := new(StnRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) { + out := new(StnAddDelRuleReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/tap/tap.ba.go b/plugins/vpp/binapi/vpp1901/tap/tap.ba.go index fd6f55585f..637cbb3f96 100644 --- a/plugins/vpp/binapi/vpp1901/tap/tap.ba.go +++ b/plugins/vpp/binapi/vpp1901/tap/tap.ba.go @@ -1,35 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/tap.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/tap.api.json /* - Package tap is a generated from VPP binary API module 'tap'. +Package tap is a generated VPP binary API for 'tap' module. - It contains following objects: - 4 services +It consists of: 8 messages + 4 services */ package tap -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceTap(*SwInterfaceTapDump) ([]*SwInterfaceTapDetails, error) - TapConnect(*TapConnect) (*TapConnectReply, error) - TapDelete(*TapDelete) (*TapDeleteReply, error) - TapModify(*TapModify) (*TapModifyReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Messages */ +const ( + // ModuleName is the name of this module. + ModuleName = "tap" + // VersionCrc is the CRC of this module. + VersionCrc = 0xacec1ba1 +) -// SwInterfaceTapDetails represents VPP binary API message 'sw_interface_tap_details': +// SwInterfaceTapDetails represents VPP binary API message 'sw_interface_tap_details'. type SwInterfaceTapDetails struct { SwIfIndex uint32 DevName []byte `struc:"[64]byte"` @@ -45,7 +42,7 @@ func (*SwInterfaceTapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTapDump represents VPP binary API message 'sw_interface_tap_dump': +// SwInterfaceTapDump represents VPP binary API message 'sw_interface_tap_dump'. type SwInterfaceTapDump struct{} func (*SwInterfaceTapDump) GetMessageName() string { @@ -58,7 +55,7 @@ func (*SwInterfaceTapDump) GetMessageType() api.MessageType { return api.RequestMessage } -// TapConnect represents VPP binary API message 'tap_connect': +// TapConnect represents VPP binary API message 'tap_connect'. type TapConnect struct { UseRandomMac uint8 TapName []byte `struc:"[64]byte"` @@ -84,7 +81,7 @@ func (*TapConnect) GetMessageType() api.MessageType { return api.RequestMessage } -// TapConnectReply represents VPP binary API message 'tap_connect_reply': +// TapConnectReply represents VPP binary API message 'tap_connect_reply'. type TapConnectReply struct { Retval int32 SwIfIndex uint32 @@ -100,7 +97,7 @@ func (*TapConnectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapDelete represents VPP binary API message 'tap_delete': +// TapDelete represents VPP binary API message 'tap_delete'. type TapDelete struct { SwIfIndex uint32 } @@ -115,7 +112,7 @@ func (*TapDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// TapDeleteReply represents VPP binary API message 'tap_delete_reply': +// TapDeleteReply represents VPP binary API message 'tap_delete_reply'. type TapDeleteReply struct { Retval int32 } @@ -130,7 +127,7 @@ func (*TapDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapModify represents VPP binary API message 'tap_modify': +// TapModify represents VPP binary API message 'tap_modify'. type TapModify struct { SwIfIndex uint32 UseRandomMac uint8 @@ -150,7 +147,7 @@ func (*TapModify) GetMessageType() api.MessageType { return api.RequestMessage } -// TapModifyReply represents VPP binary API message 'tap_modify_reply': +// TapModifyReply represents VPP binary API message 'tap_modify_reply'. type TapModifyReply struct { Retval int32 SwIfIndex uint32 @@ -177,13 +174,99 @@ func init() { api.RegisterMessage((*TapModifyReply)(nil), "tap.TapModifyReply") } -var Messages = []api.Message{ - (*SwInterfaceTapDetails)(nil), - (*SwInterfaceTapDump)(nil), - (*TapConnect)(nil), - (*TapConnectReply)(nil), - (*TapDelete)(nil), - (*TapDeleteReply)(nil), - (*TapModify)(nil), - (*TapModifyReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceTapDetails)(nil), + (*SwInterfaceTapDump)(nil), + (*TapConnect)(nil), + (*TapConnectReply)(nil), + (*TapDelete)(nil), + (*TapDeleteReply)(nil), + (*TapModify)(nil), + (*TapModifyReply)(nil), + } } + +// RPCService represents RPC service API for tap module. +type RPCService interface { + DumpSwInterfaceTap(ctx context.Context, in *SwInterfaceTapDump) (RPCService_DumpSwInterfaceTapClient, error) + TapConnect(ctx context.Context, in *TapConnect) (*TapConnectReply, error) + TapDelete(ctx context.Context, in *TapDelete) (*TapDeleteReply, error) + TapModify(ctx context.Context, in *TapModify) (*TapModifyReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceTap(ctx context.Context, in *SwInterfaceTapDump) (RPCService_DumpSwInterfaceTapClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceTapClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceTapClient interface { + Recv() (*SwInterfaceTapDetails, error) +} + +type serviceClient_DumpSwInterfaceTapClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceTapClient) Recv() (*SwInterfaceTapDetails, error) { + m := new(SwInterfaceTapDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) TapConnect(ctx context.Context, in *TapConnect) (*TapConnectReply, error) { + out := new(TapConnectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapDelete(ctx context.Context, in *TapDelete) (*TapDeleteReply, error) { + out := new(TapDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapModify(ctx context.Context, in *TapModify) (*TapModifyReply, error) { + out := new(TapModifyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/tapv2/tapv2.ba.go b/plugins/vpp/binapi/vpp1901/tapv2/tapv2.ba.go index ab2cbde076..a041498672 100644 --- a/plugins/vpp/binapi/vpp1901/tapv2/tapv2.ba.go +++ b/plugins/vpp/binapi/vpp1901/tapv2/tapv2.ba.go @@ -1,34 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/tapv2.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/tapv2.api.json /* - Package tapv2 is a generated from VPP binary API module 'tapv2'. +Package tapv2 is a generated VPP binary API for 'tapv2' module. - It contains following objects: - 3 services +It consists of: 6 messages + 3 services */ package tapv2 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceTapV2(*SwInterfaceTapV2Dump) ([]*SwInterfaceTapV2Details, error) - TapCreateV2(*TapCreateV2) (*TapCreateV2Reply, error) - TapDeleteV2(*TapDeleteV2) (*TapDeleteV2Reply, error) -} - -/* Messages */ - -// SwInterfaceTapV2Details represents VPP binary API message 'sw_interface_tap_v2_details': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "tapv2" + // VersionCrc is the CRC of this module. + VersionCrc = 0xaebf5bff +) + +// SwInterfaceTapV2Details represents VPP binary API message 'sw_interface_tap_v2_details'. type SwInterfaceTapV2Details struct { SwIfIndex uint32 ID uint32 @@ -56,7 +54,7 @@ func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTapV2Dump represents VPP binary API message 'sw_interface_tap_v2_dump': +// SwInterfaceTapV2Dump represents VPP binary API message 'sw_interface_tap_v2_dump'. type SwInterfaceTapV2Dump struct{} func (*SwInterfaceTapV2Dump) GetMessageName() string { @@ -69,7 +67,7 @@ func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { return api.RequestMessage } -// TapCreateV2 represents VPP binary API message 'tap_create_v2': +// TapCreateV2 represents VPP binary API message 'tap_create_v2'. type TapCreateV2 struct { ID uint32 UseRandomMac uint8 @@ -108,7 +106,7 @@ func (*TapCreateV2) GetMessageType() api.MessageType { return api.RequestMessage } -// TapCreateV2Reply represents VPP binary API message 'tap_create_v2_reply': +// TapCreateV2Reply represents VPP binary API message 'tap_create_v2_reply'. type TapCreateV2Reply struct { Retval int32 SwIfIndex uint32 @@ -124,7 +122,7 @@ func (*TapCreateV2Reply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapDeleteV2 represents VPP binary API message 'tap_delete_v2': +// TapDeleteV2 represents VPP binary API message 'tap_delete_v2'. type TapDeleteV2 struct { SwIfIndex uint32 } @@ -139,7 +137,7 @@ func (*TapDeleteV2) GetMessageType() api.MessageType { return api.RequestMessage } -// TapDeleteV2Reply represents VPP binary API message 'tap_delete_v2_reply': +// TapDeleteV2Reply represents VPP binary API message 'tap_delete_v2_reply'. type TapDeleteV2Reply struct { Retval int32 } @@ -163,11 +161,87 @@ func init() { api.RegisterMessage((*TapDeleteV2Reply)(nil), "tapv2.TapDeleteV2Reply") } -var Messages = []api.Message{ - (*SwInterfaceTapV2Details)(nil), - (*SwInterfaceTapV2Dump)(nil), - (*TapCreateV2)(nil), - (*TapCreateV2Reply)(nil), - (*TapDeleteV2)(nil), - (*TapDeleteV2Reply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceTapV2Details)(nil), + (*SwInterfaceTapV2Dump)(nil), + (*TapCreateV2)(nil), + (*TapCreateV2Reply)(nil), + (*TapDeleteV2)(nil), + (*TapDeleteV2Reply)(nil), + } } + +// RPCService represents RPC service API for tapv2 module. +type RPCService interface { + DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) + TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) + TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceTapV2Client{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceTapV2Client interface { + Recv() (*SwInterfaceTapV2Details, error) +} + +type serviceClient_DumpSwInterfaceTapV2Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceTapV2Client) Recv() (*SwInterfaceTapV2Details, error) { + m := new(SwInterfaceTapV2Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) { + out := new(TapCreateV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { + out := new(TapDeleteV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/vmxnet3/vmxnet3.ba.go b/plugins/vpp/binapi/vpp1901/vmxnet3/vmxnet3.ba.go index 73b94a33bc..fa7885e8e0 100644 --- a/plugins/vpp/binapi/vpp1901/vmxnet3/vmxnet3.ba.go +++ b/plugins/vpp/binapi/vpp1901/vmxnet3/vmxnet3.ba.go @@ -1,34 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/vmxnet3.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/vmxnet3.api.json /* - Package vmxnet3 is a generated from VPP binary API module 'vmxnet3'. +Package vmxnet3 is a generated VPP binary API for 'vmxnet3' module. - It contains following objects: - 3 services +It consists of: 6 messages + 3 services */ package vmxnet3 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpVmxnet3(*Vmxnet3Dump) ([]*Vmxnet3Details, error) - Vmxnet3Create(*Vmxnet3Create) (*Vmxnet3CreateReply, error) - Vmxnet3Delete(*Vmxnet3Delete) (*Vmxnet3DeleteReply, error) -} - -/* Messages */ - -// Vmxnet3Create represents VPP binary API message 'vmxnet3_create': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vmxnet3" + // VersionCrc is the CRC of this module. + VersionCrc = 0xe6419b6b +) + +// Vmxnet3Create represents VPP binary API message 'vmxnet3_create'. type Vmxnet3Create struct { PciAddr uint32 EnableElog int32 @@ -46,7 +44,7 @@ func (*Vmxnet3Create) GetMessageType() api.MessageType { return api.RequestMessage } -// Vmxnet3CreateReply represents VPP binary API message 'vmxnet3_create_reply': +// Vmxnet3CreateReply represents VPP binary API message 'vmxnet3_create_reply'. type Vmxnet3CreateReply struct { Retval int32 SwIfIndex uint32 @@ -62,7 +60,7 @@ func (*Vmxnet3CreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Delete represents VPP binary API message 'vmxnet3_delete': +// Vmxnet3Delete represents VPP binary API message 'vmxnet3_delete'. type Vmxnet3Delete struct { SwIfIndex uint32 } @@ -77,7 +75,7 @@ func (*Vmxnet3Delete) GetMessageType() api.MessageType { return api.RequestMessage } -// Vmxnet3DeleteReply represents VPP binary API message 'vmxnet3_delete_reply': +// Vmxnet3DeleteReply represents VPP binary API message 'vmxnet3_delete_reply'. type Vmxnet3DeleteReply struct { Retval int32 } @@ -92,7 +90,7 @@ func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Details represents VPP binary API message 'vmxnet3_details': +// Vmxnet3Details represents VPP binary API message 'vmxnet3_details'. type Vmxnet3Details struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` @@ -123,7 +121,7 @@ func (*Vmxnet3Details) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Dump represents VPP binary API message 'vmxnet3_dump': +// Vmxnet3Dump represents VPP binary API message 'vmxnet3_dump'. type Vmxnet3Dump struct{} func (*Vmxnet3Dump) GetMessageName() string { @@ -145,11 +143,87 @@ func init() { api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3.Vmxnet3Dump") } -var Messages = []api.Message{ - (*Vmxnet3Create)(nil), - (*Vmxnet3CreateReply)(nil), - (*Vmxnet3Delete)(nil), - (*Vmxnet3DeleteReply)(nil), - (*Vmxnet3Details)(nil), - (*Vmxnet3Dump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Vmxnet3Create)(nil), + (*Vmxnet3CreateReply)(nil), + (*Vmxnet3Delete)(nil), + (*Vmxnet3DeleteReply)(nil), + (*Vmxnet3Details)(nil), + (*Vmxnet3Dump)(nil), + } } + +// RPCService represents RPC service API for vmxnet3 module. +type RPCService interface { + DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) + Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) + Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVmxnet3Client{stream} + return x, nil +} + +type RPCService_DumpVmxnet3Client interface { + Recv() (*Vmxnet3Details, error) +} + +type serviceClient_DumpVmxnet3Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVmxnet3Client) Recv() (*Vmxnet3Details, error) { + m := new(Vmxnet3Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) { + out := new(Vmxnet3CreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { + out := new(Vmxnet3DeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/vpe/vpe.ba.go b/plugins/vpp/binapi/vpp1901/vpe/vpe.ba.go index a87dea4e03..58098f44b1 100644 --- a/plugins/vpp/binapi/vpp1901/vpe/vpe.ba.go +++ b/plugins/vpp/binapi/vpp1901/vpe/vpe.ba.go @@ -1,41 +1,33 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/vpe.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/vpe.api.json /* - Package vpe is a generated from VPP binary API module 'vpe'. +Package vpe is a generated VPP binary API for 'vpe' module. - It contains following objects: - 9 services +It consists of: 1 type 18 messages + 9 services */ package vpe -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - AddNodeNext(*AddNodeNext) (*AddNodeNextReply, error) - Cli(*Cli) (*CliReply, error) - CliInband(*CliInband) (*CliInbandReply, error) - ControlPing(*ControlPing) (*ControlPingReply, error) - GetNextIndex(*GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(*GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(*GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(*ShowThreads) (*ShowThreadsReply, error) - ShowVersion(*ShowVersion) (*ShowVersionReply, error) -} - -/* Types */ - -// ThreadData represents VPP binary API type 'thread_data': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vpe" + // VersionCrc is the CRC of this module. + VersionCrc = 0x2cc8d629 +) + +// ThreadData represents VPP binary API type 'thread_data'. type ThreadData struct { ID uint32 Name []byte `struc:"[64]byte"` @@ -53,9 +45,7 @@ func (*ThreadData) GetCrcString() string { return "0f57094e" } -/* Messages */ - -// AddNodeNext represents VPP binary API message 'add_node_next': +// AddNodeNext represents VPP binary API message 'add_node_next'. type AddNodeNext struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -71,7 +61,7 @@ func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } -// AddNodeNextReply represents VPP binary API message 'add_node_next_reply': +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. type AddNodeNextReply struct { Retval int32 NextIndex uint32 @@ -87,7 +77,7 @@ func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Cli represents VPP binary API message 'cli': +// Cli represents VPP binary API message 'cli'. type Cli struct { CmdInShmem uint64 } @@ -102,7 +92,7 @@ func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInband represents VPP binary API message 'cli_inband': +// CliInband represents VPP binary API message 'cli_inband'. type CliInband struct { XXX_CmdLen uint32 `struc:"sizeof=Cmd"` Cmd string @@ -118,7 +108,7 @@ func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInbandReply represents VPP binary API message 'cli_inband_reply': +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. type CliInbandReply struct { Retval int32 XXX_ReplyLen uint32 `struc:"sizeof=Reply"` @@ -135,7 +125,7 @@ func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CliReply represents VPP binary API message 'cli_reply': +// CliReply represents VPP binary API message 'cli_reply'. type CliReply struct { Retval int32 ReplyInShmem uint64 @@ -151,7 +141,7 @@ func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ControlPing represents VPP binary API message 'control_ping': +// ControlPing represents VPP binary API message 'control_ping'. type ControlPing struct{} func (*ControlPing) GetMessageName() string { @@ -164,7 +154,7 @@ func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// ControlPingReply represents VPP binary API message 'control_ping_reply': +// ControlPingReply represents VPP binary API message 'control_ping_reply'. type ControlPingReply struct { Retval int32 ClientIndex uint32 @@ -181,7 +171,7 @@ func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNextIndex represents VPP binary API message 'get_next_index': +// GetNextIndex represents VPP binary API message 'get_next_index'. type GetNextIndex struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -197,7 +187,7 @@ func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNextIndexReply represents VPP binary API message 'get_next_index_reply': +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. type GetNextIndexReply struct { Retval int32 NextIndex uint32 @@ -213,7 +203,7 @@ func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeGraph represents VPP binary API message 'get_node_graph': +// GetNodeGraph represents VPP binary API message 'get_node_graph'. type GetNodeGraph struct{} func (*GetNodeGraph) GetMessageName() string { @@ -226,7 +216,7 @@ func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply': +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. type GetNodeGraphReply struct { Retval int32 ReplyInShmem uint64 @@ -242,7 +232,7 @@ func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeIndex represents VPP binary API message 'get_node_index': +// GetNodeIndex represents VPP binary API message 'get_node_index'. type GetNodeIndex struct { NodeName []byte `struc:"[64]byte"` } @@ -257,7 +247,7 @@ func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply': +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. type GetNodeIndexReply struct { Retval int32 NodeIndex uint32 @@ -273,7 +263,7 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowThreads represents VPP binary API message 'show_threads': +// ShowThreads represents VPP binary API message 'show_threads'. type ShowThreads struct{} func (*ShowThreads) GetMessageName() string { @@ -286,7 +276,7 @@ func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowThreadsReply represents VPP binary API message 'show_threads_reply': +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. type ShowThreadsReply struct { Retval int32 Count uint32 `struc:"sizeof=ThreadData"` @@ -303,7 +293,7 @@ func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowVersion represents VPP binary API message 'show_version': +// ShowVersion represents VPP binary API message 'show_version'. type ShowVersion struct{} func (*ShowVersion) GetMessageName() string { @@ -316,7 +306,7 @@ func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowVersionReply represents VPP binary API message 'show_version_reply': +// ShowVersionReply represents VPP binary API message 'show_version_reply'. type ShowVersionReply struct { Retval int32 XXX_ProgramLen uint32 `struc:"sizeof=Program"` @@ -360,23 +350,142 @@ func init() { api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") } -var Messages = []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), - (*ShowVersion)(nil), - (*ShowVersionReply)(nil), -} +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + } +} + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1901/vxlan/vxlan.ba.go b/plugins/vpp/binapi/vpp1901/vxlan/vxlan.ba.go index af953f03bc..485ce34227 100644 --- a/plugins/vpp/binapi/vpp1901/vxlan/vxlan.ba.go +++ b/plugins/vpp/binapi/vpp1901/vxlan/vxlan.ba.go @@ -1,35 +1,32 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/vxlan.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/vxlan.api.json /* - Package vxlan is a generated from VPP binary API module 'vxlan'. +Package vxlan is a generated VPP binary API for 'vxlan' module. - It contains following objects: - 4 services +It consists of: 8 messages + 4 services */ package vxlan -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpVxlanTunnel(*VxlanTunnelDump) ([]*VxlanTunnelDetails, error) - SwInterfaceSetVxlanBypass(*SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) - VxlanAddDelTunnel(*VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) - VxlanOffloadRx(*VxlanOffloadRx) (*VxlanOffloadRxReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Messages */ +const ( + // ModuleName is the name of this module. + ModuleName = "vxlan" + // VersionCrc is the CRC of this module. + VersionCrc = 0x38cd707d +) -// SwInterfaceSetVxlanBypass represents VPP binary API message 'sw_interface_set_vxlan_bypass': +// SwInterfaceSetVxlanBypass represents VPP binary API message 'sw_interface_set_vxlan_bypass'. type SwInterfaceSetVxlanBypass struct { SwIfIndex uint32 IsIPv6 uint8 @@ -46,7 +43,7 @@ func (*SwInterfaceSetVxlanBypass) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetVxlanBypassReply represents VPP binary API message 'sw_interface_set_vxlan_bypass_reply': +// SwInterfaceSetVxlanBypassReply represents VPP binary API message 'sw_interface_set_vxlan_bypass_reply'. type SwInterfaceSetVxlanBypassReply struct { Retval int32 } @@ -61,7 +58,7 @@ func (*SwInterfaceSetVxlanBypassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanAddDelTunnel represents VPP binary API message 'vxlan_add_del_tunnel': +// VxlanAddDelTunnel represents VPP binary API message 'vxlan_add_del_tunnel'. type VxlanAddDelTunnel struct { IsAdd uint8 IsIPv6 uint8 @@ -84,7 +81,7 @@ func (*VxlanAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } -// VxlanAddDelTunnelReply represents VPP binary API message 'vxlan_add_del_tunnel_reply': +// VxlanAddDelTunnelReply represents VPP binary API message 'vxlan_add_del_tunnel_reply'. type VxlanAddDelTunnelReply struct { Retval int32 SwIfIndex uint32 @@ -100,7 +97,7 @@ func (*VxlanAddDelTunnelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanOffloadRx represents VPP binary API message 'vxlan_offload_rx': +// VxlanOffloadRx represents VPP binary API message 'vxlan_offload_rx'. type VxlanOffloadRx struct { HwIfIndex uint32 SwIfIndex uint32 @@ -117,7 +114,7 @@ func (*VxlanOffloadRx) GetMessageType() api.MessageType { return api.RequestMessage } -// VxlanOffloadRxReply represents VPP binary API message 'vxlan_offload_rx_reply': +// VxlanOffloadRxReply represents VPP binary API message 'vxlan_offload_rx_reply'. type VxlanOffloadRxReply struct { Retval int32 } @@ -132,7 +129,7 @@ func (*VxlanOffloadRxReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanTunnelDetails represents VPP binary API message 'vxlan_tunnel_details': +// VxlanTunnelDetails represents VPP binary API message 'vxlan_tunnel_details'. type VxlanTunnelDetails struct { SwIfIndex uint32 Instance uint32 @@ -155,7 +152,7 @@ func (*VxlanTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanTunnelDump represents VPP binary API message 'vxlan_tunnel_dump': +// VxlanTunnelDump represents VPP binary API message 'vxlan_tunnel_dump'. type VxlanTunnelDump struct { SwIfIndex uint32 } @@ -181,13 +178,99 @@ func init() { api.RegisterMessage((*VxlanTunnelDump)(nil), "vxlan.VxlanTunnelDump") } -var Messages = []api.Message{ - (*SwInterfaceSetVxlanBypass)(nil), - (*SwInterfaceSetVxlanBypassReply)(nil), - (*VxlanAddDelTunnel)(nil), - (*VxlanAddDelTunnelReply)(nil), - (*VxlanOffloadRx)(nil), - (*VxlanOffloadRxReply)(nil), - (*VxlanTunnelDetails)(nil), - (*VxlanTunnelDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanBypass)(nil), + (*SwInterfaceSetVxlanBypassReply)(nil), + (*VxlanAddDelTunnel)(nil), + (*VxlanAddDelTunnelReply)(nil), + (*VxlanOffloadRx)(nil), + (*VxlanOffloadRxReply)(nil), + (*VxlanTunnelDetails)(nil), + (*VxlanTunnelDump)(nil), + } } + +// RPCService represents RPC service API for vxlan module. +type RPCService interface { + DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) + SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) + VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) + VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVxlanTunnelClient{stream} + return x, nil +} + +type RPCService_DumpVxlanTunnelClient interface { + Recv() (*VxlanTunnelDetails, error) +} + +type serviceClient_DumpVxlanTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVxlanTunnelClient) Recv() (*VxlanTunnelDetails, error) { + m := new(VxlanTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) { + out := new(SwInterfaceSetVxlanBypassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { + out := new(VxlanAddDelTunnelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { + out := new(VxlanOffloadRxReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/abf/abf.ba.go b/plugins/vpp/binapi/vpp1904/abf/abf.ba.go index 496fa44623..5518bed8a5 100644 --- a/plugins/vpp/binapi/vpp1904/abf/abf.ba.go +++ b/plugins/vpp/binapi/vpp1904/abf/abf.ba.go @@ -1,37 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/abf.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/abf.api.json /* - Package abf is a generated from VPP binary API module 'abf'. +Package abf is a generated VPP binary API for 'abf' module. - It contains following objects: - 5 services +It consists of: 4 types 10 messages + 5 services */ package abf -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpAbfItfAttach(*AbfItfAttachDump) ([]*AbfItfAttachDetails, error) - DumpAbfPolicy(*AbfPolicyDump) ([]*AbfPolicyDetails, error) - AbfItfAttachAddDel(*AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) - AbfPluginGetVersion(*AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) - AbfPolicyAddDel(*AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) -} - -/* Types */ - -// AbfItfAttach represents VPP binary API type 'abf_itf_attach': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "abf" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x3abf2f80 +) + +// AbfItfAttach represents VPP binary API type 'abf_itf_attach'. type AbfItfAttach struct { PolicyID uint32 SwIfIndex uint32 @@ -46,7 +44,7 @@ func (*AbfItfAttach) GetCrcString() string { return "aa3ea7fe" } -// AbfPolicy represents VPP binary API type 'abf_policy': +// AbfPolicy represents VPP binary API type 'abf_policy'. type AbfPolicy struct { PolicyID uint32 ACLIndex uint32 @@ -61,7 +59,7 @@ func (*AbfPolicy) GetCrcString() string { return "252c563e" } -// FibMplsLabel represents VPP binary API type 'fib_mpls_label': +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { IsUniform uint8 Label uint32 @@ -76,7 +74,7 @@ func (*FibMplsLabel) GetCrcString() string { return "c93bf35c" } -// FibPath represents VPP binary API type 'fib_path': +// FibPath represents VPP binary API type 'fib_path'. type FibPath struct { SwIfIndex uint32 TableID uint32 @@ -108,9 +106,7 @@ func (*FibPath) GetCrcString() string { return "ba7a81f0" } -/* Messages */ - -// AbfItfAttachAddDel represents VPP binary API message 'abf_itf_attach_add_del': +// AbfItfAttachAddDel represents VPP binary API message 'abf_itf_attach_add_del'. type AbfItfAttachAddDel struct { IsAdd uint8 Attach AbfItfAttach @@ -126,7 +122,7 @@ func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfItfAttachAddDelReply represents VPP binary API message 'abf_itf_attach_add_del_reply': +// AbfItfAttachAddDelReply represents VPP binary API message 'abf_itf_attach_add_del_reply'. type AbfItfAttachAddDelReply struct { Retval int32 } @@ -141,7 +137,7 @@ func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfItfAttachDetails represents VPP binary API message 'abf_itf_attach_details': +// AbfItfAttachDetails represents VPP binary API message 'abf_itf_attach_details'. type AbfItfAttachDetails struct { Attach AbfItfAttach } @@ -156,7 +152,7 @@ func (*AbfItfAttachDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfItfAttachDump represents VPP binary API message 'abf_itf_attach_dump': +// AbfItfAttachDump represents VPP binary API message 'abf_itf_attach_dump'. type AbfItfAttachDump struct{} func (*AbfItfAttachDump) GetMessageName() string { @@ -169,7 +165,7 @@ func (*AbfItfAttachDump) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPluginGetVersion represents VPP binary API message 'abf_plugin_get_version': +// AbfPluginGetVersion represents VPP binary API message 'abf_plugin_get_version'. type AbfPluginGetVersion struct{} func (*AbfPluginGetVersion) GetMessageName() string { @@ -182,7 +178,7 @@ func (*AbfPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPluginGetVersionReply represents VPP binary API message 'abf_plugin_get_version_reply': +// AbfPluginGetVersionReply represents VPP binary API message 'abf_plugin_get_version_reply'. type AbfPluginGetVersionReply struct { Major uint32 Minor uint32 @@ -198,7 +194,7 @@ func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyAddDel represents VPP binary API message 'abf_policy_add_del': +// AbfPolicyAddDel represents VPP binary API message 'abf_policy_add_del'. type AbfPolicyAddDel struct { IsAdd uint8 Policy AbfPolicy @@ -214,7 +210,7 @@ func (*AbfPolicyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AbfPolicyAddDelReply represents VPP binary API message 'abf_policy_add_del_reply': +// AbfPolicyAddDelReply represents VPP binary API message 'abf_policy_add_del_reply'. type AbfPolicyAddDelReply struct { Retval int32 } @@ -229,7 +225,7 @@ func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyDetails represents VPP binary API message 'abf_policy_details': +// AbfPolicyDetails represents VPP binary API message 'abf_policy_details'. type AbfPolicyDetails struct { Policy AbfPolicy } @@ -244,7 +240,7 @@ func (*AbfPolicyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AbfPolicyDump represents VPP binary API message 'abf_policy_dump': +// AbfPolicyDump represents VPP binary API message 'abf_policy_dump'. type AbfPolicyDump struct{} func (*AbfPolicyDump) GetMessageName() string { @@ -270,15 +266,128 @@ func init() { api.RegisterMessage((*AbfPolicyDump)(nil), "abf.AbfPolicyDump") } -var Messages = []api.Message{ - (*AbfItfAttachAddDel)(nil), - (*AbfItfAttachAddDelReply)(nil), - (*AbfItfAttachDetails)(nil), - (*AbfItfAttachDump)(nil), - (*AbfPluginGetVersion)(nil), - (*AbfPluginGetVersionReply)(nil), - (*AbfPolicyAddDel)(nil), - (*AbfPolicyAddDelReply)(nil), - (*AbfPolicyDetails)(nil), - (*AbfPolicyDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AbfItfAttachAddDel)(nil), + (*AbfItfAttachAddDelReply)(nil), + (*AbfItfAttachDetails)(nil), + (*AbfItfAttachDump)(nil), + (*AbfPluginGetVersion)(nil), + (*AbfPluginGetVersionReply)(nil), + (*AbfPolicyAddDel)(nil), + (*AbfPolicyAddDelReply)(nil), + (*AbfPolicyDetails)(nil), + (*AbfPolicyDump)(nil), + } +} + +// RPCService represents RPC service API for abf module. +type RPCService interface { + DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) + DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) + AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) + AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) + AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfItfAttachClient{stream} + return x, nil +} + +type RPCService_DumpAbfItfAttachClient interface { + Recv() (*AbfItfAttachDetails, error) +} + +type serviceClient_DumpAbfItfAttachClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAbfItfAttachClient) Recv() (*AbfItfAttachDetails, error) { + m := new(AbfItfAttachDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfPolicyClient{stream} + return x, nil +} + +type RPCService_DumpAbfPolicyClient interface { + Recv() (*AbfPolicyDetails, error) +} + +type serviceClient_DumpAbfPolicyClient struct { + api.MultiRequestCtx } + +func (c *serviceClient_DumpAbfPolicyClient) Recv() (*AbfPolicyDetails, error) { + m := new(AbfPolicyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) { + out := new(AbfItfAttachAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) { + out := new(AbfPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) { + out := new(AbfPolicyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/acl/acl.ba.go b/plugins/vpp/binapi/vpp1904/acl/acl.ba.go index f85c47f86e..1f9528e712 100644 --- a/plugins/vpp/binapi/vpp1904/acl/acl.ba.go +++ b/plugins/vpp/binapi/vpp1904/acl/acl.ba.go @@ -1,50 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/acl.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/acl.api.json /* - Package acl is a generated from VPP binary API module 'acl'. +Package acl is a generated VPP binary API for 'acl' module. - It contains following objects: - 18 services +It consists of: 2 types 36 messages + 18 services */ package acl -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpACL(*ACLDump) ([]*ACLDetails, error) - DumpACLInterfaceEtypeWhitelist(*ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) - DumpACLInterfaceList(*ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) - DumpMacipACL(*MacipACLDump) ([]*MacipACLDetails, error) - DumpMacipACLInterfaceList(*MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error) - ACLAddReplace(*ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(*ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(*ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(*ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(*ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(*ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(*ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(*ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - MacipACLAdd(*MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(*MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(*MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(*MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(*MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} - -/* Types */ - -// ACLRule represents VPP binary API type 'acl_rule': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "acl" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8ed22cb9 +) + +// ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -68,7 +53,7 @@ func (*ACLRule) GetCrcString() string { return "6f99bf4d" } -// MacipACLRule represents VPP binary API type 'macip_acl_rule': +// MacipACLRule represents VPP binary API type 'macip_acl_rule'. type MacipACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -85,9 +70,7 @@ func (*MacipACLRule) GetCrcString() string { return "70589f1e" } -/* Messages */ - -// ACLAddReplace represents VPP binary API message 'acl_add_replace': +// ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -105,7 +88,7 @@ func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply': +// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. type ACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -121,7 +104,7 @@ func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDel represents VPP binary API message 'acl_del': +// ACLDel represents VPP binary API message 'acl_del'. type ACLDel struct { ACLIndex uint32 } @@ -136,7 +119,7 @@ func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLDelReply represents VPP binary API message 'acl_del_reply': +// ACLDelReply represents VPP binary API message 'acl_del_reply'. type ACLDelReply struct { Retval int32 } @@ -151,7 +134,7 @@ func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDetails represents VPP binary API message 'acl_details': +// ACLDetails represents VPP binary API message 'acl_details'. type ACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -169,7 +152,7 @@ func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLDump represents VPP binary API message 'acl_dump': +// ACLDump represents VPP binary API message 'acl_dump'. type ACLDump struct { ACLIndex uint32 } @@ -184,7 +167,7 @@ func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del': +// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { IsAdd uint8 IsInput uint8 @@ -202,7 +185,7 @@ func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply': +// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. type ACLInterfaceAddDelReply struct { Retval int32 } @@ -217,7 +200,7 @@ func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details': +// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -235,7 +218,7 @@ func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump': +// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { SwIfIndex uint32 } @@ -250,7 +233,7 @@ func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details': +// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. type ACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -268,7 +251,7 @@ func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump': +// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { SwIfIndex uint32 } @@ -283,7 +266,7 @@ func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list': +// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. type ACLInterfaceSetACLList struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -301,7 +284,7 @@ func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply': +// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. type ACLInterfaceSetACLListReply struct { Retval int32 } @@ -316,7 +299,7 @@ func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist': +// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -334,7 +317,7 @@ func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply': +// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. type ACLInterfaceSetEtypeWhitelistReply struct { Retval int32 } @@ -349,7 +332,7 @@ func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping': +// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. type ACLPluginControlPing struct{} func (*ACLPluginControlPing) GetMessageName() string { @@ -362,7 +345,7 @@ func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply': +// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. type ACLPluginControlPingReply struct { Retval int32 ClientIndex uint32 @@ -379,7 +362,7 @@ func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries': +// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. type ACLPluginGetConnTableMaxEntries struct{} func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { @@ -392,7 +375,7 @@ func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply': +// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. type ACLPluginGetConnTableMaxEntriesReply struct { ConnTableMaxEntries uint64 } @@ -407,7 +390,7 @@ func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version': +// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. type ACLPluginGetVersion struct{} func (*ACLPluginGetVersion) GetMessageName() string { @@ -420,7 +403,7 @@ func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply': +// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. type ACLPluginGetVersionReply struct { Major uint32 Minor uint32 @@ -436,7 +419,7 @@ func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLAdd represents VPP binary API message 'macip_acl_add': +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. type MacipACLAdd struct { Tag []byte `struc:"[64]byte"` Count uint32 `struc:"sizeof=R"` @@ -453,7 +436,7 @@ func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace': +// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. type MacipACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -471,7 +454,7 @@ func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply': +// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. type MacipACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -487,7 +470,7 @@ func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply': +// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. type MacipACLAddReply struct { ACLIndex uint32 Retval int32 @@ -503,7 +486,7 @@ func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDel represents VPP binary API message 'macip_acl_del': +// MacipACLDel represents VPP binary API message 'macip_acl_del'. type MacipACLDel struct { ACLIndex uint32 } @@ -518,7 +501,7 @@ func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply': +// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. type MacipACLDelReply struct { Retval int32 } @@ -533,7 +516,7 @@ func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDetails represents VPP binary API message 'macip_acl_details': +// MacipACLDetails represents VPP binary API message 'macip_acl_details'. type MacipACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -551,7 +534,7 @@ func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLDump represents VPP binary API message 'macip_acl_dump': +// MacipACLDump represents VPP binary API message 'macip_acl_dump'. type MacipACLDump struct { ACLIndex uint32 } @@ -566,7 +549,7 @@ func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del': +// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -583,7 +566,7 @@ func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply': +// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. type MacipACLInterfaceAddDelReply struct { Retval int32 } @@ -598,7 +581,7 @@ func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get': +// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. type MacipACLInterfaceGet struct{} func (*MacipACLInterfaceGet) GetMessageName() string { @@ -611,7 +594,7 @@ func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } -// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply': +// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. type MacipACLInterfaceGetReply struct { Count uint32 `struc:"sizeof=Acls"` Acls []uint32 @@ -627,7 +610,7 @@ func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details': +// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -644,7 +627,7 @@ func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump': +// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { SwIfIndex uint32 } @@ -698,41 +681,335 @@ func init() { api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") } -var Messages = []api.Message{ - (*ACLAddReplace)(nil), - (*ACLAddReplaceReply)(nil), - (*ACLDel)(nil), - (*ACLDelReply)(nil), - (*ACLDetails)(nil), - (*ACLDump)(nil), - (*ACLInterfaceAddDel)(nil), - (*ACLInterfaceAddDelReply)(nil), - (*ACLInterfaceEtypeWhitelistDetails)(nil), - (*ACLInterfaceEtypeWhitelistDump)(nil), - (*ACLInterfaceListDetails)(nil), - (*ACLInterfaceListDump)(nil), - (*ACLInterfaceSetACLList)(nil), - (*ACLInterfaceSetACLListReply)(nil), - (*ACLInterfaceSetEtypeWhitelist)(nil), - (*ACLInterfaceSetEtypeWhitelistReply)(nil), - (*ACLPluginControlPing)(nil), - (*ACLPluginControlPingReply)(nil), - (*ACLPluginGetConnTableMaxEntries)(nil), - (*ACLPluginGetConnTableMaxEntriesReply)(nil), - (*ACLPluginGetVersion)(nil), - (*ACLPluginGetVersionReply)(nil), - (*MacipACLAdd)(nil), - (*MacipACLAddReplace)(nil), - (*MacipACLAddReplaceReply)(nil), - (*MacipACLAddReply)(nil), - (*MacipACLDel)(nil), - (*MacipACLDelReply)(nil), - (*MacipACLDetails)(nil), - (*MacipACLDump)(nil), - (*MacipACLInterfaceAddDel)(nil), - (*MacipACLInterfaceAddDelReply)(nil), - (*MacipACLInterfaceGet)(nil), - (*MacipACLInterfaceGetReply)(nil), - (*MacipACLInterfaceListDetails)(nil), - (*MacipACLInterfaceListDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/af_packet/af_packet.ba.go b/plugins/vpp/binapi/vpp1904/af_packet/af_packet.ba.go index 2aae36cd23..9533f98dd6 100644 --- a/plugins/vpp/binapi/vpp1904/af_packet/af_packet.ba.go +++ b/plugins/vpp/binapi/vpp1904/af_packet/af_packet.ba.go @@ -1,35 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/af_packet.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/af_packet.api.json /* - Package af_packet is a generated from VPP binary API module 'af_packet'. +Package af_packet is a generated VPP binary API for 'af_packet' module. - It contains following objects: - 4 services +It consists of: 8 messages + 4 services */ package af_packet -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpAfPacket(*AfPacketDump) ([]*AfPacketDetails, error) - AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(*AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(*AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Messages */ +const ( + // ModuleName is the name of this module. + ModuleName = "af_packet" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x206563c +) -// AfPacketCreate represents VPP binary API message 'af_packet_create': +// AfPacketCreate represents VPP binary API message 'af_packet_create'. type AfPacketCreate struct { HostIfName []byte `struc:"[64]byte"` HwAddr []byte `struc:"[6]byte"` @@ -46,7 +45,7 @@ func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply': +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. type AfPacketCreateReply struct { Retval int32 SwIfIndex uint32 @@ -62,7 +61,7 @@ func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDelete represents VPP binary API message 'af_packet_delete': +// AfPacketDelete represents VPP binary API message 'af_packet_delete'. type AfPacketDelete struct { HostIfName []byte `struc:"[64]byte"` } @@ -77,7 +76,7 @@ func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply': +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. type AfPacketDeleteReply struct { Retval int32 } @@ -92,7 +91,7 @@ func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDetails represents VPP binary API message 'af_packet_details': +// AfPacketDetails represents VPP binary API message 'af_packet_details'. type AfPacketDetails struct { SwIfIndex uint32 HostIfName []byte `struc:"[64]byte"` @@ -108,7 +107,7 @@ func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// AfPacketDump represents VPP binary API message 'af_packet_dump': +// AfPacketDump represents VPP binary API message 'af_packet_dump'. type AfPacketDump struct{} func (*AfPacketDump) GetMessageName() string { @@ -121,7 +120,7 @@ func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload': +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. type AfPacketSetL4CksumOffload struct { SwIfIndex uint8 Set uint8 @@ -137,7 +136,7 @@ func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } -// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply': +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. type AfPacketSetL4CksumOffloadReply struct { Retval int32 } @@ -163,13 +162,99 @@ func init() { api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") } -var Messages = []api.Message{ - (*AfPacketCreate)(nil), - (*AfPacketCreateReply)(nil), - (*AfPacketDelete)(nil), - (*AfPacketDeleteReply)(nil), - (*AfPacketDetails)(nil), - (*AfPacketDump)(nil), - (*AfPacketSetL4CksumOffload)(nil), - (*AfPacketSetL4CksumOffloadReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } } + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/bfd/bfd.ba.go b/plugins/vpp/binapi/vpp1904/bfd/bfd.ba.go index 2c1b3733da..1a5a6a3754 100644 --- a/plugins/vpp/binapi/vpp1904/bfd/bfd.ba.go +++ b/plugins/vpp/binapi/vpp1904/bfd/bfd.ba.go @@ -1,45 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/bfd.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/bfd.api.json /* - Package bfd is a generated from VPP binary API module 'bfd'. +Package bfd is a generated VPP binary API for 'bfd' module. - It contains following objects: - 14 services +It consists of: 28 messages + 14 services */ package bfd -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpBfdAuthKeys(*BfdAuthKeysDump) ([]*BfdAuthKeysDetails, error) - DumpBfdUDPSession(*BfdUDPSessionDump) ([]*BfdUDPSessionDetails, error) - BfdAuthDelKey(*BfdAuthDelKey) (*BfdAuthDelKeyReply, error) - BfdAuthSetKey(*BfdAuthSetKey) (*BfdAuthSetKeyReply, error) - BfdUDPAdd(*BfdUDPAdd) (*BfdUDPAddReply, error) - BfdUDPAuthActivate(*BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) - BfdUDPAuthDeactivate(*BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) - BfdUDPDel(*BfdUDPDel) (*BfdUDPDelReply, error) - BfdUDPDelEchoSource(*BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) - BfdUDPGetEchoSource(*BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) - BfdUDPMod(*BfdUDPMod) (*BfdUDPModReply, error) - BfdUDPSessionSetFlags(*BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) - BfdUDPSetEchoSource(*BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) - WantBfdEvents(*WantBfdEvents) (*WantBfdEventsReply, error) -} - -/* Messages */ - -// BfdAuthDelKey represents VPP binary API message 'bfd_auth_del_key': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bfd" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xa37bd695 +) + +// BfdAuthDelKey represents VPP binary API message 'bfd_auth_del_key'. type BfdAuthDelKey struct { ConfKeyID uint32 } @@ -54,7 +43,7 @@ func (*BfdAuthDelKey) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthDelKeyReply represents VPP binary API message 'bfd_auth_del_key_reply': +// BfdAuthDelKeyReply represents VPP binary API message 'bfd_auth_del_key_reply'. type BfdAuthDelKeyReply struct { Retval int32 } @@ -69,7 +58,7 @@ func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdAuthKeysDetails represents VPP binary API message 'bfd_auth_keys_details': +// BfdAuthKeysDetails represents VPP binary API message 'bfd_auth_keys_details'. type BfdAuthKeysDetails struct { ConfKeyID uint32 UseCount uint32 @@ -86,7 +75,7 @@ func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdAuthKeysDump represents VPP binary API message 'bfd_auth_keys_dump': +// BfdAuthKeysDump represents VPP binary API message 'bfd_auth_keys_dump'. type BfdAuthKeysDump struct{} func (*BfdAuthKeysDump) GetMessageName() string { @@ -99,7 +88,7 @@ func (*BfdAuthKeysDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthSetKey represents VPP binary API message 'bfd_auth_set_key': +// BfdAuthSetKey represents VPP binary API message 'bfd_auth_set_key'. type BfdAuthSetKey struct { ConfKeyID uint32 KeyLen uint8 @@ -117,7 +106,7 @@ func (*BfdAuthSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdAuthSetKeyReply represents VPP binary API message 'bfd_auth_set_key_reply': +// BfdAuthSetKeyReply represents VPP binary API message 'bfd_auth_set_key_reply'. type BfdAuthSetKeyReply struct { Retval int32 } @@ -132,7 +121,7 @@ func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAdd represents VPP binary API message 'bfd_udp_add': +// BfdUDPAdd represents VPP binary API message 'bfd_udp_add'. type BfdUDPAdd struct { SwIfIndex uint32 DesiredMinTx uint32 @@ -156,7 +145,7 @@ func (*BfdUDPAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAddReply represents VPP binary API message 'bfd_udp_add_reply': +// BfdUDPAddReply represents VPP binary API message 'bfd_udp_add_reply'. type BfdUDPAddReply struct { Retval int32 } @@ -171,7 +160,7 @@ func (*BfdUDPAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAuthActivate represents VPP binary API message 'bfd_udp_auth_activate': +// BfdUDPAuthActivate represents VPP binary API message 'bfd_udp_auth_activate'. type BfdUDPAuthActivate struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -192,7 +181,7 @@ func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAuthActivateReply represents VPP binary API message 'bfd_udp_auth_activate_reply': +// BfdUDPAuthActivateReply represents VPP binary API message 'bfd_udp_auth_activate_reply'. type BfdUDPAuthActivateReply struct { Retval int32 } @@ -207,7 +196,7 @@ func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPAuthDeactivate represents VPP binary API message 'bfd_udp_auth_deactivate': +// BfdUDPAuthDeactivate represents VPP binary API message 'bfd_udp_auth_deactivate'. type BfdUDPAuthDeactivate struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -226,7 +215,7 @@ func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPAuthDeactivateReply represents VPP binary API message 'bfd_udp_auth_deactivate_reply': +// BfdUDPAuthDeactivateReply represents VPP binary API message 'bfd_udp_auth_deactivate_reply'. type BfdUDPAuthDeactivateReply struct { Retval int32 } @@ -241,7 +230,7 @@ func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPDel represents VPP binary API message 'bfd_udp_del': +// BfdUDPDel represents VPP binary API message 'bfd_udp_del'. type BfdUDPDel struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -259,7 +248,7 @@ func (*BfdUDPDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPDelEchoSource represents VPP binary API message 'bfd_udp_del_echo_source': +// BfdUDPDelEchoSource represents VPP binary API message 'bfd_udp_del_echo_source'. type BfdUDPDelEchoSource struct{} func (*BfdUDPDelEchoSource) GetMessageName() string { @@ -272,7 +261,7 @@ func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPDelEchoSourceReply represents VPP binary API message 'bfd_udp_del_echo_source_reply': +// BfdUDPDelEchoSourceReply represents VPP binary API message 'bfd_udp_del_echo_source_reply'. type BfdUDPDelEchoSourceReply struct { Retval int32 } @@ -287,7 +276,7 @@ func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPDelReply represents VPP binary API message 'bfd_udp_del_reply': +// BfdUDPDelReply represents VPP binary API message 'bfd_udp_del_reply'. type BfdUDPDelReply struct { Retval int32 } @@ -302,7 +291,7 @@ func (*BfdUDPDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPGetEchoSource represents VPP binary API message 'bfd_udp_get_echo_source': +// BfdUDPGetEchoSource represents VPP binary API message 'bfd_udp_get_echo_source'. type BfdUDPGetEchoSource struct{} func (*BfdUDPGetEchoSource) GetMessageName() string { @@ -315,7 +304,7 @@ func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPGetEchoSourceReply represents VPP binary API message 'bfd_udp_get_echo_source_reply': +// BfdUDPGetEchoSourceReply represents VPP binary API message 'bfd_udp_get_echo_source_reply'. type BfdUDPGetEchoSourceReply struct { Retval int32 SwIfIndex uint32 @@ -336,7 +325,7 @@ func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPMod represents VPP binary API message 'bfd_udp_mod': +// BfdUDPMod represents VPP binary API message 'bfd_udp_mod'. type BfdUDPMod struct { SwIfIndex uint32 DesiredMinTx uint32 @@ -357,7 +346,7 @@ func (*BfdUDPMod) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPModReply represents VPP binary API message 'bfd_udp_mod_reply': +// BfdUDPModReply represents VPP binary API message 'bfd_udp_mod_reply'. type BfdUDPModReply struct { Retval int32 } @@ -372,7 +361,7 @@ func (*BfdUDPModReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSessionDetails represents VPP binary API message 'bfd_udp_session_details': +// BfdUDPSessionDetails represents VPP binary API message 'bfd_udp_session_details'. type BfdUDPSessionDetails struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -397,7 +386,7 @@ func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSessionDump represents VPP binary API message 'bfd_udp_session_dump': +// BfdUDPSessionDump represents VPP binary API message 'bfd_udp_session_dump'. type BfdUDPSessionDump struct{} func (*BfdUDPSessionDump) GetMessageName() string { @@ -410,7 +399,7 @@ func (*BfdUDPSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSessionSetFlags represents VPP binary API message 'bfd_udp_session_set_flags': +// BfdUDPSessionSetFlags represents VPP binary API message 'bfd_udp_session_set_flags'. type BfdUDPSessionSetFlags struct { SwIfIndex uint32 LocalAddr []byte `struc:"[16]byte"` @@ -429,7 +418,7 @@ func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSessionSetFlagsReply represents VPP binary API message 'bfd_udp_session_set_flags_reply': +// BfdUDPSessionSetFlagsReply represents VPP binary API message 'bfd_udp_session_set_flags_reply'. type BfdUDPSessionSetFlagsReply struct { Retval int32 } @@ -444,7 +433,7 @@ func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BfdUDPSetEchoSource represents VPP binary API message 'bfd_udp_set_echo_source': +// BfdUDPSetEchoSource represents VPP binary API message 'bfd_udp_set_echo_source'. type BfdUDPSetEchoSource struct { SwIfIndex uint32 } @@ -459,7 +448,7 @@ func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { return api.RequestMessage } -// BfdUDPSetEchoSourceReply represents VPP binary API message 'bfd_udp_set_echo_source_reply': +// BfdUDPSetEchoSourceReply represents VPP binary API message 'bfd_udp_set_echo_source_reply'. type BfdUDPSetEchoSourceReply struct { Retval int32 } @@ -474,7 +463,7 @@ func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantBfdEvents represents VPP binary API message 'want_bfd_events': +// WantBfdEvents represents VPP binary API message 'want_bfd_events'. type WantBfdEvents struct { EnableDisable uint32 PID uint32 @@ -490,7 +479,7 @@ func (*WantBfdEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantBfdEventsReply represents VPP binary API message 'want_bfd_events_reply': +// WantBfdEventsReply represents VPP binary API message 'want_bfd_events_reply'. type WantBfdEventsReply struct { Retval int32 } @@ -536,33 +525,236 @@ func init() { api.RegisterMessage((*WantBfdEventsReply)(nil), "bfd.WantBfdEventsReply") } -var Messages = []api.Message{ - (*BfdAuthDelKey)(nil), - (*BfdAuthDelKeyReply)(nil), - (*BfdAuthKeysDetails)(nil), - (*BfdAuthKeysDump)(nil), - (*BfdAuthSetKey)(nil), - (*BfdAuthSetKeyReply)(nil), - (*BfdUDPAdd)(nil), - (*BfdUDPAddReply)(nil), - (*BfdUDPAuthActivate)(nil), - (*BfdUDPAuthActivateReply)(nil), - (*BfdUDPAuthDeactivate)(nil), - (*BfdUDPAuthDeactivateReply)(nil), - (*BfdUDPDel)(nil), - (*BfdUDPDelEchoSource)(nil), - (*BfdUDPDelEchoSourceReply)(nil), - (*BfdUDPDelReply)(nil), - (*BfdUDPGetEchoSource)(nil), - (*BfdUDPGetEchoSourceReply)(nil), - (*BfdUDPMod)(nil), - (*BfdUDPModReply)(nil), - (*BfdUDPSessionDetails)(nil), - (*BfdUDPSessionDump)(nil), - (*BfdUDPSessionSetFlags)(nil), - (*BfdUDPSessionSetFlagsReply)(nil), - (*BfdUDPSetEchoSource)(nil), - (*BfdUDPSetEchoSourceReply)(nil), - (*WantBfdEvents)(nil), - (*WantBfdEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BfdAuthDelKey)(nil), + (*BfdAuthDelKeyReply)(nil), + (*BfdAuthKeysDetails)(nil), + (*BfdAuthKeysDump)(nil), + (*BfdAuthSetKey)(nil), + (*BfdAuthSetKeyReply)(nil), + (*BfdUDPAdd)(nil), + (*BfdUDPAddReply)(nil), + (*BfdUDPAuthActivate)(nil), + (*BfdUDPAuthActivateReply)(nil), + (*BfdUDPAuthDeactivate)(nil), + (*BfdUDPAuthDeactivateReply)(nil), + (*BfdUDPDel)(nil), + (*BfdUDPDelEchoSource)(nil), + (*BfdUDPDelEchoSourceReply)(nil), + (*BfdUDPDelReply)(nil), + (*BfdUDPGetEchoSource)(nil), + (*BfdUDPGetEchoSourceReply)(nil), + (*BfdUDPMod)(nil), + (*BfdUDPModReply)(nil), + (*BfdUDPSessionDetails)(nil), + (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionSetFlags)(nil), + (*BfdUDPSessionSetFlagsReply)(nil), + (*BfdUDPSetEchoSource)(nil), + (*BfdUDPSetEchoSourceReply)(nil), + (*WantBfdEvents)(nil), + (*WantBfdEventsReply)(nil), + } +} + +// RPCService represents RPC service API for bfd module. +type RPCService interface { + DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) + DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) + BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) + BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) + BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) + BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) + BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) + BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) + BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) + BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) + BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) + BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) + BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) + WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdAuthKeysClient{stream} + return x, nil +} + +type RPCService_DumpBfdAuthKeysClient interface { + Recv() (*BfdAuthKeysDetails, error) +} + +type serviceClient_DumpBfdAuthKeysClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdAuthKeysClient) Recv() (*BfdAuthKeysDetails, error) { + m := new(BfdAuthKeysDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdUDPSessionClient{stream} + return x, nil +} + +type RPCService_DumpBfdUDPSessionClient interface { + Recv() (*BfdUDPSessionDetails, error) +} + +type serviceClient_DumpBfdUDPSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdUDPSessionClient) Recv() (*BfdUDPSessionDetails, error) { + m := new(BfdUDPSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { + out := new(BfdAuthDelKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { + out := new(BfdAuthSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { + out := new(BfdUDPAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { + out := new(BfdUDPAuthActivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { + out := new(BfdUDPAuthDeactivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { + out := new(BfdUDPDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { + out := new(BfdUDPDelEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { + out := new(BfdUDPGetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { + out := new(BfdUDPModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { + out := new(BfdUDPSessionSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { + out := new(BfdUDPSetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { + out := new(WantBfdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/bond/bond.ba.go b/plugins/vpp/binapi/vpp1904/bond/bond.ba.go index fbe6701512..8408122b9d 100644 --- a/plugins/vpp/binapi/vpp1904/bond/bond.ba.go +++ b/plugins/vpp/binapi/vpp1904/bond/bond.ba.go @@ -1,37 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/bond.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/bond.api.json /* - Package bond is a generated from VPP binary API module 'bond'. +Package bond is a generated VPP binary API for 'bond' module. - It contains following objects: - 6 services +It consists of: 12 messages + 6 services */ package bond -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceBond(*SwInterfaceBondDump) ([]*SwInterfaceBondDetails, error) - DumpSwInterfaceSlave(*SwInterfaceSlaveDump) ([]*SwInterfaceSlaveDetails, error) - BondCreate(*BondCreate) (*BondCreateReply, error) - BondDelete(*BondDelete) (*BondDeleteReply, error) - BondDetachSlave(*BondDetachSlave) (*BondDetachSlaveReply, error) - BondEnslave(*BondEnslave) (*BondEnslaveReply, error) -} - -/* Messages */ - -// BondCreate represents VPP binary API message 'bond_create': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bond" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x33cb944c +) + +// BondCreate represents VPP binary API message 'bond_create'. type BondCreate struct { ID uint32 UseCustomMac uint8 @@ -50,7 +47,7 @@ func (*BondCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// BondCreateReply represents VPP binary API message 'bond_create_reply': +// BondCreateReply represents VPP binary API message 'bond_create_reply'. type BondCreateReply struct { Retval int32 SwIfIndex uint32 @@ -66,7 +63,7 @@ func (*BondCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondDelete represents VPP binary API message 'bond_delete': +// BondDelete represents VPP binary API message 'bond_delete'. type BondDelete struct { SwIfIndex uint32 } @@ -81,7 +78,7 @@ func (*BondDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// BondDeleteReply represents VPP binary API message 'bond_delete_reply': +// BondDeleteReply represents VPP binary API message 'bond_delete_reply'. type BondDeleteReply struct { Retval int32 } @@ -96,7 +93,7 @@ func (*BondDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondDetachSlave represents VPP binary API message 'bond_detach_slave': +// BondDetachSlave represents VPP binary API message 'bond_detach_slave'. type BondDetachSlave struct { SwIfIndex uint32 } @@ -111,7 +108,7 @@ func (*BondDetachSlave) GetMessageType() api.MessageType { return api.RequestMessage } -// BondDetachSlaveReply represents VPP binary API message 'bond_detach_slave_reply': +// BondDetachSlaveReply represents VPP binary API message 'bond_detach_slave_reply'. type BondDetachSlaveReply struct { Retval int32 } @@ -126,7 +123,7 @@ func (*BondDetachSlaveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BondEnslave represents VPP binary API message 'bond_enslave': +// BondEnslave represents VPP binary API message 'bond_enslave'. type BondEnslave struct { SwIfIndex uint32 BondSwIfIndex uint32 @@ -144,7 +141,7 @@ func (*BondEnslave) GetMessageType() api.MessageType { return api.RequestMessage } -// BondEnslaveReply represents VPP binary API message 'bond_enslave_reply': +// BondEnslaveReply represents VPP binary API message 'bond_enslave_reply'. type BondEnslaveReply struct { Retval int32 } @@ -159,7 +156,7 @@ func (*BondEnslaveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceBondDetails represents VPP binary API message 'sw_interface_bond_details': +// SwInterfaceBondDetails represents VPP binary API message 'sw_interface_bond_details'. type SwInterfaceBondDetails struct { SwIfIndex uint32 ID uint32 @@ -180,7 +177,7 @@ func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceBondDump represents VPP binary API message 'sw_interface_bond_dump': +// SwInterfaceBondDump represents VPP binary API message 'sw_interface_bond_dump'. type SwInterfaceBondDump struct{} func (*SwInterfaceBondDump) GetMessageName() string { @@ -193,7 +190,7 @@ func (*SwInterfaceBondDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSlaveDetails represents VPP binary API message 'sw_interface_slave_details': +// SwInterfaceSlaveDetails represents VPP binary API message 'sw_interface_slave_details'. type SwInterfaceSlaveDetails struct { SwIfIndex uint32 InterfaceName []byte `struc:"[64]byte"` @@ -211,7 +208,7 @@ func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSlaveDump represents VPP binary API message 'sw_interface_slave_dump': +// SwInterfaceSlaveDump represents VPP binary API message 'sw_interface_slave_dump'. type SwInterfaceSlaveDump struct { SwIfIndex uint32 } @@ -241,17 +238,140 @@ func init() { api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "bond.SwInterfaceSlaveDump") } -var Messages = []api.Message{ - (*BondCreate)(nil), - (*BondCreateReply)(nil), - (*BondDelete)(nil), - (*BondDeleteReply)(nil), - (*BondDetachSlave)(nil), - (*BondDetachSlaveReply)(nil), - (*BondEnslave)(nil), - (*BondEnslaveReply)(nil), - (*SwInterfaceBondDetails)(nil), - (*SwInterfaceBondDump)(nil), - (*SwInterfaceSlaveDetails)(nil), - (*SwInterfaceSlaveDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BondCreate)(nil), + (*BondCreateReply)(nil), + (*BondDelete)(nil), + (*BondDeleteReply)(nil), + (*BondDetachSlave)(nil), + (*BondDetachSlaveReply)(nil), + (*BondEnslave)(nil), + (*BondEnslaveReply)(nil), + (*SwInterfaceBondDetails)(nil), + (*SwInterfaceBondDump)(nil), + (*SwInterfaceSlaveDetails)(nil), + (*SwInterfaceSlaveDump)(nil), + } +} + +// RPCService represents RPC service API for bond module. +type RPCService interface { + DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) + DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) + BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) + BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceBondClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceBondClient interface { + Recv() (*SwInterfaceBondDetails, error) } + +type serviceClient_DumpSwInterfaceBondClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceBondClient) Recv() (*SwInterfaceBondDetails, error) { + m := new(SwInterfaceBondDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceSlaveClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceSlaveClient interface { + Recv() (*SwInterfaceSlaveDetails, error) +} + +type serviceClient_DumpSwInterfaceSlaveClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceSlaveClient) Recv() (*SwInterfaceSlaveDetails, error) { + m := new(SwInterfaceSlaveDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { + out := new(BondCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { + out := new(BondDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { + out := new(BondDetachSlaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { + out := new(BondEnslaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/dhcp/dhcp.ba.go b/plugins/vpp/binapi/vpp1904/dhcp/dhcp.ba.go index 12c89d9dc3..c2bb829998 100644 --- a/plugins/vpp/binapi/vpp1904/dhcp/dhcp.ba.go +++ b/plugins/vpp/binapi/vpp1904/dhcp/dhcp.ba.go @@ -1,43 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/dhcp.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/dhcp.api.json /* - Package dhcp is a generated from VPP binary API module 'dhcp'. +Package dhcp is a generated VPP binary API for 'dhcp' module. - It contains following objects: - 11 services +It consists of: 5 types 25 messages + 11 services */ package dhcp -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpDHCPClient(*DHCPClientDump) ([]*DHCPClientDetails, error) - DumpDHCPProxy(*DHCPProxyDump) ([]*DHCPProxyDetails, error) - DHCP6ClientsEnableDisable(*DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) - DHCP6DuidLlSet(*DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) - DHCP6PdSendClientMessage(*DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) - DHCP6SendClientMessage(*DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) - DHCPClientConfig(*DHCPClientConfig) (*DHCPClientConfigReply, error) - DHCPProxyConfig(*DHCPProxyConfig) (*DHCPProxyConfigReply, error) - DHCPProxySetVss(*DHCPProxySetVss) (*DHCPProxySetVssReply, error) - WantDHCP6PdReplyEvents(*WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) - WantDHCP6ReplyEvents(*WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) -} - -/* Types */ - -// DHCP6AddressInfo represents VPP binary API type 'dhcp6_address_info': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "dhcp" + // APIVersion is the API version of this module. + APIVersion = "2.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8c76d62a +) + +// DHCP6AddressInfo represents VPP binary API type 'dhcp6_address_info'. type DHCP6AddressInfo struct { Address []byte `struc:"[16]byte"` ValidTime uint32 @@ -51,7 +43,7 @@ func (*DHCP6AddressInfo) GetCrcString() string { return "f3d501e2" } -// DHCP6PdPrefixInfo represents VPP binary API type 'dhcp6_pd_prefix_info': +// DHCP6PdPrefixInfo represents VPP binary API type 'dhcp6_pd_prefix_info'. type DHCP6PdPrefixInfo struct { Prefix []byte `struc:"[16]byte"` PrefixLength uint8 @@ -66,7 +58,7 @@ func (*DHCP6PdPrefixInfo) GetCrcString() string { return "c459690e" } -// DHCPClient represents VPP binary API type 'dhcp_client': +// DHCPClient represents VPP binary API type 'dhcp_client'. type DHCPClient struct { SwIfIndex uint32 Hostname []byte `struc:"[64]byte"` @@ -83,7 +75,7 @@ func (*DHCPClient) GetCrcString() string { return "527f7935" } -// DHCPLease represents VPP binary API type 'dhcp_lease': +// DHCPLease represents VPP binary API type 'dhcp_lease'. type DHCPLease struct { SwIfIndex uint32 State uint8 @@ -102,7 +94,7 @@ func (*DHCPLease) GetCrcString() string { return "61090276" } -// DHCPServer represents VPP binary API type 'dhcp_server': +// DHCPServer represents VPP binary API type 'dhcp_server'. type DHCPServer struct { ServerVrfID uint32 DHCPServer []byte `struc:"[16]byte"` @@ -115,9 +107,7 @@ func (*DHCPServer) GetCrcString() string { return "f16506c4" } -/* Messages */ - -// DHCP6ClientsEnableDisable represents VPP binary API message 'dhcp6_clients_enable_disable': +// DHCP6ClientsEnableDisable represents VPP binary API message 'dhcp6_clients_enable_disable'. type DHCP6ClientsEnableDisable struct { Enable uint8 } @@ -132,7 +122,7 @@ func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6ClientsEnableDisableReply represents VPP binary API message 'dhcp6_clients_enable_disable_reply': +// DHCP6ClientsEnableDisableReply represents VPP binary API message 'dhcp6_clients_enable_disable_reply'. type DHCP6ClientsEnableDisableReply struct { Retval int32 } @@ -147,7 +137,7 @@ func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6DuidLlSet represents VPP binary API message 'dhcp6_duid_ll_set': +// DHCP6DuidLlSet represents VPP binary API message 'dhcp6_duid_ll_set'. type DHCP6DuidLlSet struct { DuidLl []byte `struc:"[10]byte"` } @@ -162,7 +152,7 @@ func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6DuidLlSetReply represents VPP binary API message 'dhcp6_duid_ll_set_reply': +// DHCP6DuidLlSetReply represents VPP binary API message 'dhcp6_duid_ll_set_reply'. type DHCP6DuidLlSetReply struct { Retval int32 } @@ -177,7 +167,7 @@ func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6PdReplyEvent represents VPP binary API message 'dhcp6_pd_reply_event': +// DHCP6PdReplyEvent represents VPP binary API message 'dhcp6_pd_reply_event'. type DHCP6PdReplyEvent struct { PID uint32 SwIfIndex uint32 @@ -202,7 +192,7 @@ func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCP6PdSendClientMessage represents VPP binary API message 'dhcp6_pd_send_client_message': +// DHCP6PdSendClientMessage represents VPP binary API message 'dhcp6_pd_send_client_message'. type DHCP6PdSendClientMessage struct { SwIfIndex uint32 ServerIndex uint32 @@ -228,7 +218,7 @@ func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6PdSendClientMessageReply represents VPP binary API message 'dhcp6_pd_send_client_message_reply': +// DHCP6PdSendClientMessageReply represents VPP binary API message 'dhcp6_pd_send_client_message_reply'. type DHCP6PdSendClientMessageReply struct { Retval int32 } @@ -243,7 +233,7 @@ func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCP6ReplyEvent represents VPP binary API message 'dhcp6_reply_event': +// DHCP6ReplyEvent represents VPP binary API message 'dhcp6_reply_event'. type DHCP6ReplyEvent struct { PID uint32 SwIfIndex uint32 @@ -268,7 +258,7 @@ func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCP6SendClientMessage represents VPP binary API message 'dhcp6_send_client_message': +// DHCP6SendClientMessage represents VPP binary API message 'dhcp6_send_client_message'. type DHCP6SendClientMessage struct { SwIfIndex uint32 ServerIndex uint32 @@ -294,7 +284,7 @@ func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCP6SendClientMessageReply represents VPP binary API message 'dhcp6_send_client_message_reply': +// DHCP6SendClientMessageReply represents VPP binary API message 'dhcp6_send_client_message_reply'. type DHCP6SendClientMessageReply struct { Retval int32 } @@ -309,7 +299,7 @@ func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientConfig represents VPP binary API message 'dhcp_client_config': +// DHCPClientConfig represents VPP binary API message 'dhcp_client_config'. type DHCPClientConfig struct { IsAdd uint8 Client DHCPClient @@ -325,7 +315,7 @@ func (*DHCPClientConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPClientConfigReply represents VPP binary API message 'dhcp_client_config_reply': +// DHCPClientConfigReply represents VPP binary API message 'dhcp_client_config_reply'. type DHCPClientConfigReply struct { Retval int32 } @@ -340,7 +330,7 @@ func (*DHCPClientConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientDetails represents VPP binary API message 'dhcp_client_details': +// DHCPClientDetails represents VPP binary API message 'dhcp_client_details'. type DHCPClientDetails struct { Client DHCPClient Lease DHCPLease @@ -356,7 +346,7 @@ func (*DHCPClientDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPClientDump represents VPP binary API message 'dhcp_client_dump': +// DHCPClientDump represents VPP binary API message 'dhcp_client_dump'. type DHCPClientDump struct{} func (*DHCPClientDump) GetMessageName() string { @@ -369,7 +359,7 @@ func (*DHCPClientDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPComplEvent represents VPP binary API message 'dhcp_compl_event': +// DHCPComplEvent represents VPP binary API message 'dhcp_compl_event'. type DHCPComplEvent struct { PID uint32 Lease DHCPLease @@ -385,7 +375,7 @@ func (*DHCPComplEvent) GetMessageType() api.MessageType { return api.EventMessage } -// DHCPProxyConfig represents VPP binary API message 'dhcp_proxy_config': +// DHCPProxyConfig represents VPP binary API message 'dhcp_proxy_config'. type DHCPProxyConfig struct { RxVrfID uint32 ServerVrfID uint32 @@ -405,7 +395,7 @@ func (*DHCPProxyConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxyConfigReply represents VPP binary API message 'dhcp_proxy_config_reply': +// DHCPProxyConfigReply represents VPP binary API message 'dhcp_proxy_config_reply'. type DHCPProxyConfigReply struct { Retval int32 } @@ -420,7 +410,7 @@ func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPProxyDetails represents VPP binary API message 'dhcp_proxy_details': +// DHCPProxyDetails represents VPP binary API message 'dhcp_proxy_details'. type DHCPProxyDetails struct { RxVrfID uint32 VssOui uint32 @@ -443,7 +433,7 @@ func (*DHCPProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DHCPProxyDump represents VPP binary API message 'dhcp_proxy_dump': +// DHCPProxyDump represents VPP binary API message 'dhcp_proxy_dump'. type DHCPProxyDump struct { IsIP6 uint8 } @@ -458,7 +448,7 @@ func (*DHCPProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxySetVss represents VPP binary API message 'dhcp_proxy_set_vss': +// DHCPProxySetVss represents VPP binary API message 'dhcp_proxy_set_vss'. type DHCPProxySetVss struct { TblID uint32 VssType uint8 @@ -479,7 +469,7 @@ func (*DHCPProxySetVss) GetMessageType() api.MessageType { return api.RequestMessage } -// DHCPProxySetVssReply represents VPP binary API message 'dhcp_proxy_set_vss_reply': +// DHCPProxySetVssReply represents VPP binary API message 'dhcp_proxy_set_vss_reply'. type DHCPProxySetVssReply struct { Retval int32 } @@ -494,7 +484,7 @@ func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantDHCP6PdReplyEvents represents VPP binary API message 'want_dhcp6_pd_reply_events': +// WantDHCP6PdReplyEvents represents VPP binary API message 'want_dhcp6_pd_reply_events'. type WantDHCP6PdReplyEvents struct { EnableDisable uint8 PID uint32 @@ -510,7 +500,7 @@ func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantDHCP6PdReplyEventsReply represents VPP binary API message 'want_dhcp6_pd_reply_events_reply': +// WantDHCP6PdReplyEventsReply represents VPP binary API message 'want_dhcp6_pd_reply_events_reply'. type WantDHCP6PdReplyEventsReply struct { Retval int32 } @@ -525,7 +515,7 @@ func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantDHCP6ReplyEvents represents VPP binary API message 'want_dhcp6_reply_events': +// WantDHCP6ReplyEvents represents VPP binary API message 'want_dhcp6_reply_events'. type WantDHCP6ReplyEvents struct { EnableDisable uint8 PID uint32 @@ -541,7 +531,7 @@ func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantDHCP6ReplyEventsReply represents VPP binary API message 'want_dhcp6_reply_events_reply': +// WantDHCP6ReplyEventsReply represents VPP binary API message 'want_dhcp6_reply_events_reply'. type WantDHCP6ReplyEventsReply struct { Retval int32 } @@ -584,30 +574,203 @@ func init() { api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "dhcp.WantDHCP6ReplyEventsReply") } -var Messages = []api.Message{ - (*DHCP6ClientsEnableDisable)(nil), - (*DHCP6ClientsEnableDisableReply)(nil), - (*DHCP6DuidLlSet)(nil), - (*DHCP6DuidLlSetReply)(nil), - (*DHCP6PdReplyEvent)(nil), - (*DHCP6PdSendClientMessage)(nil), - (*DHCP6PdSendClientMessageReply)(nil), - (*DHCP6ReplyEvent)(nil), - (*DHCP6SendClientMessage)(nil), - (*DHCP6SendClientMessageReply)(nil), - (*DHCPClientConfig)(nil), - (*DHCPClientConfigReply)(nil), - (*DHCPClientDetails)(nil), - (*DHCPClientDump)(nil), - (*DHCPComplEvent)(nil), - (*DHCPProxyConfig)(nil), - (*DHCPProxyConfigReply)(nil), - (*DHCPProxyDetails)(nil), - (*DHCPProxyDump)(nil), - (*DHCPProxySetVss)(nil), - (*DHCPProxySetVssReply)(nil), - (*WantDHCP6PdReplyEvents)(nil), - (*WantDHCP6PdReplyEventsReply)(nil), - (*WantDHCP6ReplyEvents)(nil), - (*WantDHCP6ReplyEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientsEnableDisable)(nil), + (*DHCP6ClientsEnableDisableReply)(nil), + (*DHCP6DuidLlSet)(nil), + (*DHCP6DuidLlSetReply)(nil), + (*DHCP6PdReplyEvent)(nil), + (*DHCP6PdSendClientMessage)(nil), + (*DHCP6PdSendClientMessageReply)(nil), + (*DHCP6ReplyEvent)(nil), + (*DHCP6SendClientMessage)(nil), + (*DHCP6SendClientMessageReply)(nil), + (*DHCPClientConfig)(nil), + (*DHCPClientConfigReply)(nil), + (*DHCPClientDetails)(nil), + (*DHCPClientDump)(nil), + (*DHCPComplEvent)(nil), + (*DHCPProxyConfig)(nil), + (*DHCPProxyConfigReply)(nil), + (*DHCPProxyDetails)(nil), + (*DHCPProxyDump)(nil), + (*DHCPProxySetVss)(nil), + (*DHCPProxySetVssReply)(nil), + (*WantDHCP6PdReplyEvents)(nil), + (*WantDHCP6PdReplyEventsReply)(nil), + (*WantDHCP6ReplyEvents)(nil), + (*WantDHCP6ReplyEventsReply)(nil), + } +} + +// RPCService represents RPC service API for dhcp module. +type RPCService interface { + DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) + DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) + DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) + DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) + DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) + DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) + DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) + DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) + DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) + WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) + WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPClientClient{stream} + return x, nil +} + +type RPCService_DumpDHCPClientClient interface { + Recv() (*DHCPClientDetails, error) +} + +type serviceClient_DumpDHCPClientClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPClientClient) Recv() (*DHCPClientDetails, error) { + m := new(DHCPClientDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPProxyClient{stream} + return x, nil +} + +type RPCService_DumpDHCPProxyClient interface { + Recv() (*DHCPProxyDetails, error) +} + +type serviceClient_DumpDHCPProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPProxyClient) Recv() (*DHCPProxyDetails, error) { + m := new(DHCPProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { + out := new(DHCP6ClientsEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { + out := new(DHCP6DuidLlSetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { + out := new(DHCP6PdSendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { + out := new(DHCP6SendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { + out := new(DHCPClientConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { + out := new(DHCPProxyConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { + out := new(DHCPProxySetVssReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { + out := new(WantDHCP6PdReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { + out := new(WantDHCP6ReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/gen.go b/plugins/vpp/binapi/vpp1904/gen.go index 1b6e3851df..d93d39f081 100644 --- a/plugins/vpp/binapi/vpp1904/gen.go +++ b/plugins/vpp/binapi/vpp1904/gen.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +package vpp1904 + //go:generate -command binapigen binapi-generator --output-dir=. //go:generate binapigen --input-file=/usr/share/vpp/api/core/af_packet.api.json @@ -35,5 +37,3 @@ //go:generate binapigen --input-file=/usr/share/vpp/api/plugins/nat.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/plugins/stn.api.json //go:generate binapigen --input-file=/usr/share/vpp/api/plugins/vmxnet3.api.json - -package vpp1904 diff --git a/plugins/vpp/binapi/vpp1904/interfaces/interfaces.ba.go b/plugins/vpp/binapi/vpp1904/interfaces/interfaces.ba.go index 41a0215204..958f78ef24 100644 --- a/plugins/vpp/binapi/vpp1904/interfaces/interfaces.ba.go +++ b/plugins/vpp/binapi/vpp1904/interfaces/interfaces.ba.go @@ -1,62 +1,38 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/interface.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/interface.api.json /* - Package interfaces is a generated from VPP binary API module 'interface'. +Package interfaces is a generated VPP binary API for 'interface' module. - It contains following objects: - 25 services +It consists of: 1 alias 51 messages + 25 services */ package interfaces -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterface(*SwInterfaceDump) ([]*SwInterfaceDetails, error) - DumpSwInterfaceRxPlacement(*SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) - CollectDetailedInterfaceStats(*CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(*CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(*CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(*CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(*CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(*DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(*DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(*HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(*InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(*SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceClearStats(*SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(*SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(*SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(*SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(*SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(*SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(*SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(*SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(*SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(*SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(*SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(*SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(*WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} - -/* Aliases */ - -// InterfaceIndex represents VPP binary API alias 'interface_index': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "interface" + // APIVersion is the API version of this module. + APIVersion = "2.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x672de521 +) + +// InterfaceIndex represents VPP binary API alias 'interface_index'. type InterfaceIndex uint32 -/* Messages */ - -// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats': +// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. type CollectDetailedInterfaceStats struct { SwIfIndex uint32 EnableDisable uint8 @@ -72,7 +48,7 @@ func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } -// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply': +// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. type CollectDetailedInterfaceStatsReply struct { Retval int32 } @@ -87,7 +63,7 @@ func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateLoopback represents VPP binary API message 'create_loopback': +// CreateLoopback represents VPP binary API message 'create_loopback'. type CreateLoopback struct { MacAddress []byte `struc:"[6]byte"` } @@ -102,7 +78,7 @@ func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance': +// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. type CreateLoopbackInstance struct { MacAddress []byte `struc:"[6]byte"` IsSpecified uint8 @@ -119,7 +95,7 @@ func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply': +// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. type CreateLoopbackInstanceReply struct { Retval int32 SwIfIndex uint32 @@ -135,7 +111,7 @@ func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply': +// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. type CreateLoopbackReply struct { Retval int32 SwIfIndex uint32 @@ -151,7 +127,7 @@ func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateSubif represents VPP binary API message 'create_subif': +// CreateSubif represents VPP binary API message 'create_subif'. type CreateSubif struct { SwIfIndex uint32 SubID uint32 @@ -177,7 +153,7 @@ func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateSubifReply represents VPP binary API message 'create_subif_reply': +// CreateSubifReply represents VPP binary API message 'create_subif_reply'. type CreateSubifReply struct { Retval int32 SwIfIndex uint32 @@ -193,7 +169,7 @@ func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CreateVlanSubif represents VPP binary API message 'create_vlan_subif': +// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. type CreateVlanSubif struct { SwIfIndex uint32 VlanID uint32 @@ -209,7 +185,7 @@ func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply': +// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. type CreateVlanSubifReply struct { Retval int32 SwIfIndex uint32 @@ -225,7 +201,7 @@ func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DeleteLoopback represents VPP binary API message 'delete_loopback': +// DeleteLoopback represents VPP binary API message 'delete_loopback'. type DeleteLoopback struct { SwIfIndex uint32 } @@ -240,7 +216,7 @@ func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } -// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply': +// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. type DeleteLoopbackReply struct { Retval int32 } @@ -255,7 +231,7 @@ func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DeleteSubif represents VPP binary API message 'delete_subif': +// DeleteSubif represents VPP binary API message 'delete_subif'. type DeleteSubif struct { SwIfIndex uint32 } @@ -270,7 +246,7 @@ func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } -// DeleteSubifReply represents VPP binary API message 'delete_subif_reply': +// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. type DeleteSubifReply struct { Retval int32 } @@ -285,7 +261,7 @@ func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu': +// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. type HwInterfaceSetMtu struct { SwIfIndex uint32 Mtu uint16 @@ -301,7 +277,7 @@ func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } -// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply': +// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. type HwInterfaceSetMtuReply struct { Retval int32 } @@ -316,7 +292,7 @@ func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber': +// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. type InterfaceNameRenumber struct { SwIfIndex uint32 NewShowDevInstance uint32 @@ -332,7 +308,7 @@ func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } -// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply': +// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. type InterfaceNameRenumberReply struct { Retval int32 } @@ -347,7 +323,7 @@ func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address': +// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. type SwInterfaceAddDelAddress struct { SwIfIndex uint32 IsAdd uint8 @@ -367,7 +343,7 @@ func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply': +// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. type SwInterfaceAddDelAddressReply struct { Retval int32 } @@ -382,7 +358,7 @@ func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats': +// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. type SwInterfaceClearStats struct { SwIfIndex uint32 } @@ -397,7 +373,7 @@ func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply': +// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. type SwInterfaceClearStatsReply struct { Retval int32 } @@ -412,7 +388,7 @@ func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceDetails represents VPP binary API message 'sw_interface_details': +// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. type SwInterfaceDetails struct { SwIfIndex uint32 SupSwIfIndex uint32 @@ -457,7 +433,7 @@ func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceDump represents VPP binary API message 'sw_interface_dump': +// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. type SwInterfaceDump struct { NameFilterValid uint8 NameFilter []byte `struc:"[49]byte"` @@ -473,7 +449,7 @@ func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceEvent represents VPP binary API message 'sw_interface_event': +// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. type SwInterfaceEvent struct { PID uint32 SwIfIndex uint32 @@ -492,7 +468,7 @@ func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } -// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address': +// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. type SwInterfaceGetMacAddress struct { SwIfIndex uint32 } @@ -507,7 +483,7 @@ func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply': +// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. type SwInterfaceGetMacAddressReply struct { Retval int32 MacAddress []byte `struc:"[6]byte"` @@ -523,7 +499,7 @@ func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table': +// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. type SwInterfaceGetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -539,7 +515,7 @@ func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply': +// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. type SwInterfaceGetTableReply struct { Retval int32 VrfID uint32 @@ -555,7 +531,7 @@ func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details': +// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. type SwInterfaceRxPlacementDetails struct { SwIfIndex uint32 QueueID uint32 @@ -573,7 +549,7 @@ func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump': +// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. type SwInterfaceRxPlacementDump struct { SwIfIndex uint32 } @@ -588,7 +564,7 @@ func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags': +// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. type SwInterfaceSetFlags struct { SwIfIndex uint32 AdminUpDown uint8 @@ -604,7 +580,7 @@ func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply': +// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. type SwInterfaceSetFlagsReply struct { Retval int32 } @@ -619,7 +595,7 @@ func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast': +// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. type SwInterfaceSetIPDirectedBroadcast struct { SwIfIndex uint32 Enable uint8 @@ -635,7 +611,7 @@ func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply': +// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. type SwInterfaceSetIPDirectedBroadcastReply struct { Retval int32 } @@ -650,7 +626,7 @@ func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType return api.ReplyMessage } -// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address': +// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. type SwInterfaceSetMacAddress struct { SwIfIndex uint32 MacAddress []byte `struc:"[6]byte"` @@ -666,7 +642,7 @@ func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply': +// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. type SwInterfaceSetMacAddressReply struct { Retval int32 } @@ -681,7 +657,7 @@ func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu': +// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. type SwInterfaceSetMtu struct { SwIfIndex uint32 Mtu []uint32 `struc:"[4]uint32"` @@ -697,7 +673,7 @@ func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply': +// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. type SwInterfaceSetMtuReply struct { Retval int32 } @@ -712,7 +688,7 @@ func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode': +// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. type SwInterfaceSetRxMode struct { SwIfIndex uint32 QueueIDValid uint8 @@ -730,7 +706,7 @@ func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply': +// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. type SwInterfaceSetRxModeReply struct { Retval int32 } @@ -745,7 +721,7 @@ func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement': +// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. type SwInterfaceSetRxPlacement struct { SwIfIndex uint32 QueueID uint32 @@ -763,7 +739,7 @@ func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply': +// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. type SwInterfaceSetRxPlacementReply struct { Retval int32 } @@ -778,7 +754,7 @@ func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table': +// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. type SwInterfaceSetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -795,7 +771,7 @@ func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply': +// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. type SwInterfaceSetTableReply struct { Retval int32 } @@ -810,7 +786,7 @@ func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered': +// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. type SwInterfaceSetUnnumbered struct { SwIfIndex uint32 UnnumberedSwIfIndex uint32 @@ -827,7 +803,7 @@ func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply': +// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. type SwInterfaceSetUnnumberedReply struct { Retval int32 } @@ -842,7 +818,7 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del': +// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. type SwInterfaceTagAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -859,7 +835,7 @@ func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply': +// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. type SwInterfaceTagAddDelReply struct { Retval int32 } @@ -874,7 +850,7 @@ func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantInterfaceEvents represents VPP binary API message 'want_interface_events': +// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. type WantInterfaceEvents struct { EnableDisable uint32 PID uint32 @@ -890,7 +866,7 @@ func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply': +// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. type WantInterfaceEventsReply struct { Retval int32 } @@ -959,56 +935,369 @@ func init() { api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") } -var Messages = []api.Message{ - (*CollectDetailedInterfaceStats)(nil), - (*CollectDetailedInterfaceStatsReply)(nil), - (*CreateLoopback)(nil), - (*CreateLoopbackInstance)(nil), - (*CreateLoopbackInstanceReply)(nil), - (*CreateLoopbackReply)(nil), - (*CreateSubif)(nil), - (*CreateSubifReply)(nil), - (*CreateVlanSubif)(nil), - (*CreateVlanSubifReply)(nil), - (*DeleteLoopback)(nil), - (*DeleteLoopbackReply)(nil), - (*DeleteSubif)(nil), - (*DeleteSubifReply)(nil), - (*HwInterfaceSetMtu)(nil), - (*HwInterfaceSetMtuReply)(nil), - (*InterfaceNameRenumber)(nil), - (*InterfaceNameRenumberReply)(nil), - (*SwInterfaceAddDelAddress)(nil), - (*SwInterfaceAddDelAddressReply)(nil), - (*SwInterfaceClearStats)(nil), - (*SwInterfaceClearStatsReply)(nil), - (*SwInterfaceDetails)(nil), - (*SwInterfaceDump)(nil), - (*SwInterfaceEvent)(nil), - (*SwInterfaceGetMacAddress)(nil), - (*SwInterfaceGetMacAddressReply)(nil), - (*SwInterfaceGetTable)(nil), - (*SwInterfaceGetTableReply)(nil), - (*SwInterfaceRxPlacementDetails)(nil), - (*SwInterfaceRxPlacementDump)(nil), - (*SwInterfaceSetFlags)(nil), - (*SwInterfaceSetFlagsReply)(nil), - (*SwInterfaceSetIPDirectedBroadcast)(nil), - (*SwInterfaceSetIPDirectedBroadcastReply)(nil), - (*SwInterfaceSetMacAddress)(nil), - (*SwInterfaceSetMacAddressReply)(nil), - (*SwInterfaceSetMtu)(nil), - (*SwInterfaceSetMtuReply)(nil), - (*SwInterfaceSetRxMode)(nil), - (*SwInterfaceSetRxModeReply)(nil), - (*SwInterfaceSetRxPlacement)(nil), - (*SwInterfaceSetRxPlacementReply)(nil), - (*SwInterfaceSetTable)(nil), - (*SwInterfaceSetTableReply)(nil), - (*SwInterfaceSetUnnumbered)(nil), - (*SwInterfaceSetUnnumberedReply)(nil), - (*SwInterfaceTagAddDel)(nil), - (*SwInterfaceTagAddDelReply)(nil), - (*WantInterfaceEvents)(nil), - (*WantInterfaceEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/ip/ip.ba.go b/plugins/vpp/binapi/vpp1904/ip/ip.ba.go index 0c46194d8c..5f18b8379e 100644 --- a/plugins/vpp/binapi/vpp1904/ip/ip.ba.go +++ b/plugins/vpp/binapi/vpp1904/ip/ip.ba.go @@ -1,79 +1,38 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/ip.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/ip.api.json /* - Package ip is a generated from VPP binary API module 'ip'. +Package ip is a generated VPP binary API for 'ip' module. - It contains following objects: - 44 services +It consists of: 2 enums 3 aliases 12 types 1 union 91 messages + 44 services */ package ip -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "ip" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x51ac4ce0 +) -// Services represents VPP binary API services: -type Services interface { - DumpIP6Fib(*IP6FibDump) ([]*IP6FibDetails, error) - DumpIP6Mfib(*IP6MfibDump) ([]*IP6MfibDetails, error) - DumpIP6ndProxy(*IP6ndProxyDump) ([]*IP6ndProxyDetails, error) - DumpIPAddress(*IPAddressDump) ([]*IPAddressDetails, error) - DumpIPContainerProxy(*IPContainerProxyDump) ([]*IPContainerProxyDetails, error) - DumpIP(*IPDump) ([]*IPDetails, error) - DumpIPFib(*IPFibDump) ([]*IPFibDetails, error) - DumpIPMfib(*IPMfibDump) ([]*IPMfibDetails, error) - DumpIPNeighbor(*IPNeighborDump) ([]*IPNeighborDetails, error) - DumpIPPuntRedirect(*IPPuntRedirectDump) ([]*IPPuntRedirectDetails, error) - DumpIPUnnumbered(*IPUnnumberedDump) ([]*IPUnnumberedDetails, error) - DumpMfibSignal(*MfibSignalDump) ([]*MfibSignalDetails, error) - DumpProxyArp(*ProxyArpDump) ([]*ProxyArpDetails, error) - DumpProxyArpIntfc(*ProxyArpIntfcDump) ([]*ProxyArpIntfcDetails, error) - IoamDisable(*IoamDisable) (*IoamDisableReply, error) - IoamEnable(*IoamEnable) (*IoamEnableReply, error) - IP6ndProxyAddDel(*IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) - IP6ndSendRouterSolicitation(*IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) - IPAddDelRoute(*IPAddDelRoute) (*IPAddDelRouteReply, error) - IPContainerProxyAddDel(*IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(*IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPNeighborAddDel(*IPNeighborAddDel) (*IPNeighborAddDelReply, error) - IPProbeNeighbor(*IPProbeNeighbor) (*IPProbeNeighborReply, error) - IPPuntPolice(*IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(*IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(*IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(*IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(*IPReassemblySet) (*IPReassemblySetReply, error) - IPScanNeighborEnableDisable(*IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) - IPSourceAndPortRangeCheckAddDel(*IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(*IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(*IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) - IPTableAddDel(*IPTableAddDel) (*IPTableAddDelReply, error) - ProxyArpAddDel(*ProxyArpAddDel) (*ProxyArpAddDelReply, error) - ProxyArpIntfcEnableDisable(*ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) - ResetFib(*ResetFib) (*ResetFibReply, error) - SetArpNeighborLimit(*SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) - SetIPFlowHash(*SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(*SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6ndRaConfig(*SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) - SwInterfaceIP6ndRaPrefix(*SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) - WantIP4ArpEvents(*WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) - WantIP6NdEvents(*WantIP6NdEvents) (*WantIP6NdEventsReply, error) - WantIP6RaEvents(*WantIP6RaEvents) (*WantIP6RaEventsReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -81,7 +40,25 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -// IPNeighborFlags represents VPP binary API enum 'ip_neighbor_flags': +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPNeighborFlags represents VPP binary API enum 'ip_neighbor_flags'. type IPNeighborFlags uint32 const ( @@ -90,20 +67,36 @@ const ( IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY IPNeighborFlags = 2 ) -/* Aliases */ +var IPNeighborFlags_name = map[uint32]string{ + 0: "IP_API_NEIGHBOR_FLAG_NONE", + 1: "IP_API_NEIGHBOR_FLAG_STATIC", + 2: "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY", +} + +var IPNeighborFlags_value = map[string]uint32{ + "IP_API_NEIGHBOR_FLAG_NONE": 0, + "IP_API_NEIGHBOR_FLAG_STATIC": 1, + "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY": 2, +} + +func (x IPNeighborFlags) String() string { + s, ok := IPNeighborFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} -// IP4Address represents VPP binary API alias 'ip4_address': +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -// MacAddress represents VPP binary API alias 'mac_address': +// MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -116,7 +109,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// FibMplsLabel represents VPP binary API type 'fib_mpls_label': +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { IsUniform uint8 Label uint32 @@ -131,7 +124,7 @@ func (*FibMplsLabel) GetCrcString() string { return "c93bf35c" } -// FibPath represents VPP binary API type 'fib_path': +// FibPath represents VPP binary API type 'fib_path'. type FibPath struct { SwIfIndex uint32 TableID uint32 @@ -163,7 +156,7 @@ func (*FibPath) GetCrcString() string { return "ba7a81f0" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -176,7 +169,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -189,7 +182,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info': +// IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info'. type IP6RaPrefixInfo struct { Prefix Prefix Flags uint8 @@ -204,7 +197,7 @@ func (*IP6RaPrefixInfo) GetCrcString() string { return "fa025b72" } -// IPNeighbor represents VPP binary API type 'ip_neighbor': +// IPNeighbor represents VPP binary API type 'ip_neighbor'. type IPNeighbor struct { SwIfIndex uint32 Flags IPNeighborFlags @@ -219,7 +212,7 @@ func (*IPNeighbor) GetCrcString() string { return "4bf82d5d" } -// MfibPath represents VPP binary API type 'mfib_path': +// MfibPath represents VPP binary API type 'mfib_path'. type MfibPath struct { Path FibPath ItfFlags uint32 @@ -232,7 +225,7 @@ func (*MfibPath) GetCrcString() string { return "4ba77d32" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -247,7 +240,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -260,7 +253,7 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -// ProxyArp represents VPP binary API type 'proxy_arp': +// ProxyArp represents VPP binary API type 'proxy_arp'. type ProxyArp struct { TableID uint32 Low IP4Address @@ -274,7 +267,7 @@ func (*ProxyArp) GetCrcString() string { return "e9067693" } -// PuntRedirect represents VPP binary API type 'punt_redirect': +// PuntRedirect represents VPP binary API type 'punt_redirect'. type PuntRedirect struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -288,11 +281,9 @@ func (*PuntRedirect) GetCrcString() string { return "3e7a801f" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -311,10 +302,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -328,17 +319,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// IoamDisable represents VPP binary API message 'ioam_disable': +// IoamDisable represents VPP binary API message 'ioam_disable'. type IoamDisable struct { ID uint16 } @@ -353,7 +342,7 @@ func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IoamDisableReply represents VPP binary API message 'ioam_disable_reply': +// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. type IoamDisableReply struct { Retval int32 } @@ -368,7 +357,7 @@ func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IoamEnable represents VPP binary API message 'ioam_enable': +// IoamEnable represents VPP binary API message 'ioam_enable'. type IoamEnable struct { ID uint16 Seqno uint8 @@ -388,7 +377,7 @@ func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } -// IoamEnableReply represents VPP binary API message 'ioam_enable_reply': +// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. type IoamEnableReply struct { Retval int32 } @@ -403,7 +392,7 @@ func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP4ArpEvent represents VPP binary API message 'ip4_arp_event': +// IP4ArpEvent represents VPP binary API message 'ip4_arp_event'. type IP4ArpEvent struct { IP IP4Address PID uint32 @@ -422,7 +411,7 @@ func (*IP4ArpEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6FibDetails represents VPP binary API message 'ip6_fib_details': +// IP6FibDetails represents VPP binary API message 'ip6_fib_details'. type IP6FibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -443,7 +432,7 @@ func (*IP6FibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6FibDump represents VPP binary API message 'ip6_fib_dump': +// IP6FibDump represents VPP binary API message 'ip6_fib_dump'. type IP6FibDump struct{} func (*IP6FibDump) GetMessageName() string { @@ -456,7 +445,7 @@ func (*IP6FibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6MfibDetails represents VPP binary API message 'ip6_mfib_details': +// IP6MfibDetails represents VPP binary API message 'ip6_mfib_details'. type IP6MfibDetails struct { TableID uint32 AddressLength uint8 @@ -476,7 +465,7 @@ func (*IP6MfibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6MfibDump represents VPP binary API message 'ip6_mfib_dump': +// IP6MfibDump represents VPP binary API message 'ip6_mfib_dump'. type IP6MfibDump struct{} func (*IP6MfibDump) GetMessageName() string { @@ -489,7 +478,7 @@ func (*IP6MfibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6NdEvent represents VPP binary API message 'ip6_nd_event': +// IP6NdEvent represents VPP binary API message 'ip6_nd_event'. type IP6NdEvent struct { PID uint32 SwIfIndex uint32 @@ -508,7 +497,7 @@ func (*IP6NdEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6RaEvent represents VPP binary API message 'ip6_ra_event': +// IP6RaEvent represents VPP binary API message 'ip6_ra_event'. type IP6RaEvent struct { PID uint32 SwIfIndex uint32 @@ -532,7 +521,7 @@ func (*IP6RaEvent) GetMessageType() api.MessageType { return api.EventMessage } -// IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del': +// IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del'. type IP6ndProxyAddDel struct { SwIfIndex uint32 IsDel uint8 @@ -549,7 +538,7 @@ func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply': +// IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply'. type IP6ndProxyAddDelReply struct { Retval int32 } @@ -564,7 +553,7 @@ func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details': +// IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details'. type IP6ndProxyDetails struct { SwIfIndex uint32 IP IP6Address @@ -580,7 +569,7 @@ func (*IP6ndProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump': +// IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump'. type IP6ndProxyDump struct{} func (*IP6ndProxyDump) GetMessageName() string { @@ -593,7 +582,7 @@ func (*IP6ndProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation': +// IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation'. type IP6ndSendRouterSolicitation struct { Irt uint32 Mrt uint32 @@ -613,7 +602,7 @@ func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType { return api.RequestMessage } -// IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply': +// IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply'. type IP6ndSendRouterSolicitationReply struct { Retval int32 } @@ -628,7 +617,7 @@ func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddDelRoute represents VPP binary API message 'ip_add_del_route': +// IPAddDelRoute represents VPP binary API message 'ip_add_del_route'. type IPAddDelRoute struct { NextHopSwIfIndex uint32 TableID uint32 @@ -669,7 +658,7 @@ func (*IPAddDelRoute) GetMessageType() api.MessageType { return api.RequestMessage } -// IPAddDelRouteReply represents VPP binary API message 'ip_add_del_route_reply': +// IPAddDelRouteReply represents VPP binary API message 'ip_add_del_route_reply'. type IPAddDelRouteReply struct { Retval int32 StatsIndex uint32 @@ -685,7 +674,7 @@ func (*IPAddDelRouteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddressDetails represents VPP binary API message 'ip_address_details': +// IPAddressDetails represents VPP binary API message 'ip_address_details'. type IPAddressDetails struct { IP []byte `struc:"[16]byte"` PrefixLength uint8 @@ -703,7 +692,7 @@ func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPAddressDump represents VPP binary API message 'ip_address_dump': +// IPAddressDump represents VPP binary API message 'ip_address_dump'. type IPAddressDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -719,7 +708,7 @@ func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del': +// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. type IPContainerProxyAddDel struct { Pfx Prefix SwIfIndex uint32 @@ -736,7 +725,7 @@ func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply': +// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. type IPContainerProxyAddDelReply struct { Retval int32 } @@ -751,7 +740,7 @@ func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details': +// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. type IPContainerProxyDetails struct { SwIfIndex uint32 Prefix Prefix @@ -767,7 +756,7 @@ func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump': +// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. type IPContainerProxyDump struct{} func (*IPContainerProxyDump) GetMessageName() string { @@ -780,7 +769,7 @@ func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPDetails represents VPP binary API message 'ip_details': +// IPDetails represents VPP binary API message 'ip_details'. type IPDetails struct { SwIfIndex uint32 IsIPv6 uint8 @@ -796,7 +785,7 @@ func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPDump represents VPP binary API message 'ip_dump': +// IPDump represents VPP binary API message 'ip_dump'. type IPDump struct { IsIPv6 uint8 } @@ -811,7 +800,7 @@ func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPFibDetails represents VPP binary API message 'ip_fib_details': +// IPFibDetails represents VPP binary API message 'ip_fib_details'. type IPFibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -832,7 +821,7 @@ func (*IPFibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPFibDump represents VPP binary API message 'ip_fib_dump': +// IPFibDump represents VPP binary API message 'ip_fib_dump'. type IPFibDump struct{} func (*IPFibDump) GetMessageName() string { @@ -845,7 +834,7 @@ func (*IPFibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMfibDetails represents VPP binary API message 'ip_mfib_details': +// IPMfibDetails represents VPP binary API message 'ip_mfib_details'. type IPMfibDetails struct { TableID uint32 EntryFlags uint32 @@ -868,7 +857,7 @@ func (*IPMfibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPMfibDump represents VPP binary API message 'ip_mfib_dump': +// IPMfibDump represents VPP binary API message 'ip_mfib_dump'. type IPMfibDump struct{} func (*IPMfibDump) GetMessageName() string { @@ -881,7 +870,7 @@ func (*IPMfibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del': +// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. type IPMrouteAddDel struct { NextHopSwIfIndex uint32 TableID uint32 @@ -909,7 +898,7 @@ func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply': +// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. type IPMrouteAddDelReply struct { Retval int32 StatsIndex uint32 @@ -925,7 +914,7 @@ func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del': +// IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del'. type IPNeighborAddDel struct { IsAdd uint8 Neighbor IPNeighbor @@ -941,7 +930,7 @@ func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply': +// IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply'. type IPNeighborAddDelReply struct { Retval int32 StatsIndex uint32 @@ -957,7 +946,7 @@ func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborDetails represents VPP binary API message 'ip_neighbor_details': +// IPNeighborDetails represents VPP binary API message 'ip_neighbor_details'. type IPNeighborDetails struct { Neighbor IPNeighbor } @@ -972,7 +961,7 @@ func (*IPNeighborDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPNeighborDump represents VPP binary API message 'ip_neighbor_dump': +// IPNeighborDump represents VPP binary API message 'ip_neighbor_dump'. type IPNeighborDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -988,7 +977,7 @@ func (*IPNeighborDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor': +// IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor'. type IPProbeNeighbor struct { SwIfIndex uint32 Dst Address @@ -1004,7 +993,7 @@ func (*IPProbeNeighbor) GetMessageType() api.MessageType { return api.RequestMessage } -// IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply': +// IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply'. type IPProbeNeighborReply struct { Retval int32 } @@ -1019,7 +1008,7 @@ func (*IPProbeNeighborReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntPolice represents VPP binary API message 'ip_punt_police': +// IPPuntPolice represents VPP binary API message 'ip_punt_police'. type IPPuntPolice struct { PolicerIndex uint32 IsAdd uint8 @@ -1036,7 +1025,7 @@ func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply': +// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. type IPPuntPoliceReply struct { Retval int32 } @@ -1051,7 +1040,7 @@ func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect': +// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. type IPPuntRedirect struct { Punt PuntRedirect IsAdd uint8 @@ -1067,7 +1056,7 @@ func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details': +// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. type IPPuntRedirectDetails struct { Punt PuntRedirect } @@ -1082,7 +1071,7 @@ func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump': +// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. type IPPuntRedirectDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -1098,7 +1087,7 @@ func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply': +// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. type IPPuntRedirectReply struct { Retval int32 } @@ -1113,7 +1102,7 @@ func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable': +// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. type IPReassemblyEnableDisable struct { SwIfIndex uint32 EnableIP4 uint8 @@ -1130,7 +1119,7 @@ func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply': +// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. type IPReassemblyEnableDisableReply struct { Retval int32 } @@ -1145,7 +1134,7 @@ func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get': +// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. type IPReassemblyGet struct { IsIP6 uint8 } @@ -1160,7 +1149,7 @@ func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply': +// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. type IPReassemblyGetReply struct { Retval int32 TimeoutMs uint32 @@ -1179,7 +1168,7 @@ func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPReassemblySet represents VPP binary API message 'ip_reassembly_set': +// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. type IPReassemblySet struct { TimeoutMs uint32 MaxReassemblies uint32 @@ -1197,7 +1186,7 @@ func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } -// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply': +// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. type IPReassemblySetReply struct { Retval int32 } @@ -1212,7 +1201,7 @@ func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable': +// IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable'. type IPScanNeighborEnableDisable struct { Mode uint8 ScanInterval uint8 @@ -1232,7 +1221,7 @@ func (*IPScanNeighborEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply': +// IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply'. type IPScanNeighborEnableDisableReply struct { Retval int32 } @@ -1247,7 +1236,7 @@ func (*IPScanNeighborEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del': +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. type IPSourceAndPortRangeCheckAddDel struct { IsAdd uint8 Prefix Prefix @@ -1267,7 +1256,7 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply': +// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. type IPSourceAndPortRangeCheckAddDelReply struct { Retval int32 } @@ -1282,7 +1271,7 @@ func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del': +// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. type IPSourceAndPortRangeCheckInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -1302,7 +1291,7 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageTyp return api.RequestMessage } -// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply': +// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { Retval int32 } @@ -1317,7 +1306,7 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.Messa return api.ReplyMessage } -// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del': +// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. type IPSourceCheckInterfaceAddDel struct { IsAdd uint8 Loose uint8 @@ -1334,7 +1323,7 @@ func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply': +// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. type IPSourceCheckInterfaceAddDelReply struct { Retval int32 } @@ -1349,7 +1338,7 @@ func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPTableAddDel represents VPP binary API message 'ip_table_add_del': +// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. type IPTableAddDel struct { TableID uint32 IsIPv6 uint8 @@ -1367,7 +1356,7 @@ func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply': +// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. type IPTableAddDelReply struct { Retval int32 } @@ -1382,7 +1371,7 @@ func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details': +// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. type IPUnnumberedDetails struct { SwIfIndex uint32 IPSwIfIndex uint32 @@ -1398,7 +1387,7 @@ func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump': +// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. type IPUnnumberedDump struct { SwIfIndex uint32 } @@ -1413,7 +1402,7 @@ func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MfibSignalDetails represents VPP binary API message 'mfib_signal_details': +// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. type MfibSignalDetails struct { SwIfIndex uint32 TableID uint32 @@ -1434,7 +1423,7 @@ func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MfibSignalDump represents VPP binary API message 'mfib_signal_dump': +// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. type MfibSignalDump struct{} func (*MfibSignalDump) GetMessageName() string { @@ -1447,7 +1436,7 @@ func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del': +// ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del'. type ProxyArpAddDel struct { IsAdd uint8 Proxy ProxyArp @@ -1463,7 +1452,7 @@ func (*ProxyArpAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply': +// ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply'. type ProxyArpAddDelReply struct { Retval int32 } @@ -1478,7 +1467,7 @@ func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpDetails represents VPP binary API message 'proxy_arp_details': +// ProxyArpDetails represents VPP binary API message 'proxy_arp_details'. type ProxyArpDetails struct { Proxy ProxyArp } @@ -1493,7 +1482,7 @@ func (*ProxyArpDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpDump represents VPP binary API message 'proxy_arp_dump': +// ProxyArpDump represents VPP binary API message 'proxy_arp_dump'. type ProxyArpDump struct{} func (*ProxyArpDump) GetMessageName() string { @@ -1506,7 +1495,7 @@ func (*ProxyArpDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details': +// ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details'. type ProxyArpIntfcDetails struct { SwIfIndex uint32 } @@ -1521,7 +1510,7 @@ func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump': +// ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump'. type ProxyArpIntfcDump struct{} func (*ProxyArpIntfcDump) GetMessageName() string { @@ -1534,7 +1523,7 @@ func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable': +// ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable'. type ProxyArpIntfcEnableDisable struct { SwIfIndex uint32 EnableDisable uint8 @@ -1550,7 +1539,7 @@ func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply': +// ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply'. type ProxyArpIntfcEnableDisableReply struct { Retval int32 } @@ -1565,7 +1554,7 @@ func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ResetFib represents VPP binary API message 'reset_fib': +// ResetFib represents VPP binary API message 'reset_fib'. type ResetFib struct { VrfID uint32 IsIPv6 uint8 @@ -1581,7 +1570,7 @@ func (*ResetFib) GetMessageType() api.MessageType { return api.RequestMessage } -// ResetFibReply represents VPP binary API message 'reset_fib_reply': +// ResetFibReply represents VPP binary API message 'reset_fib_reply'. type ResetFibReply struct { Retval int32 } @@ -1596,7 +1585,7 @@ func (*ResetFibReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit': +// SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit'. type SetArpNeighborLimit struct { IsIPv6 uint8 ArpNeighborLimit uint32 @@ -1612,7 +1601,7 @@ func (*SetArpNeighborLimit) GetMessageType() api.MessageType { return api.RequestMessage } -// SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply': +// SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply'. type SetArpNeighborLimitReply struct { Retval int32 } @@ -1627,7 +1616,7 @@ func (*SetArpNeighborLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash': +// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. type SetIPFlowHash struct { VrfID uint32 IsIPv6 uint8 @@ -1650,7 +1639,7 @@ func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } -// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply': +// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. type SetIPFlowHashReply struct { Retval int32 } @@ -1665,7 +1654,7 @@ func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable': +// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. type SwInterfaceIP6EnableDisable struct { SwIfIndex uint32 Enable uint8 @@ -1681,7 +1670,7 @@ func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply': +// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. type SwInterfaceIP6EnableDisableReply struct { Retval int32 } @@ -1696,7 +1685,7 @@ func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config': +// SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config'. type SwInterfaceIP6ndRaConfig struct { SwIfIndex uint32 Suppress uint8 @@ -1724,7 +1713,7 @@ func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply': +// SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply'. type SwInterfaceIP6ndRaConfigReply struct { Retval int32 } @@ -1739,7 +1728,7 @@ func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix': +// SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix'. type SwInterfaceIP6ndRaPrefix struct { SwIfIndex uint32 Prefix Prefix @@ -1763,7 +1752,7 @@ func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply': +// SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply'. type SwInterfaceIP6ndRaPrefixReply struct { Retval int32 } @@ -1778,7 +1767,7 @@ func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events': +// WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events'. type WantIP4ArpEvents struct { EnableDisable uint8 PID uint32 @@ -1795,7 +1784,7 @@ func (*WantIP4ArpEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply': +// WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply'. type WantIP4ArpEventsReply struct { Retval int32 } @@ -1810,7 +1799,7 @@ func (*WantIP4ArpEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events': +// WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events'. type WantIP6NdEvents struct { EnableDisable uint8 PID uint32 @@ -1827,7 +1816,7 @@ func (*WantIP6NdEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply': +// WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply'. type WantIP6NdEventsReply struct { Retval int32 } @@ -1842,7 +1831,7 @@ func (*WantIP6NdEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events': +// WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events'. type WantIP6RaEvents struct { EnableDisable uint8 PID uint32 @@ -1858,7 +1847,7 @@ func (*WantIP6RaEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply': +// WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply'. type WantIP6RaEventsReply struct { Retval int32 } @@ -1967,96 +1956,803 @@ func init() { api.RegisterMessage((*WantIP6RaEventsReply)(nil), "ip.WantIP6RaEventsReply") } -var Messages = []api.Message{ - (*IoamDisable)(nil), - (*IoamDisableReply)(nil), - (*IoamEnable)(nil), - (*IoamEnableReply)(nil), - (*IP4ArpEvent)(nil), - (*IP6FibDetails)(nil), - (*IP6FibDump)(nil), - (*IP6MfibDetails)(nil), - (*IP6MfibDump)(nil), - (*IP6NdEvent)(nil), - (*IP6RaEvent)(nil), - (*IP6ndProxyAddDel)(nil), - (*IP6ndProxyAddDelReply)(nil), - (*IP6ndProxyDetails)(nil), - (*IP6ndProxyDump)(nil), - (*IP6ndSendRouterSolicitation)(nil), - (*IP6ndSendRouterSolicitationReply)(nil), - (*IPAddDelRoute)(nil), - (*IPAddDelRouteReply)(nil), - (*IPAddressDetails)(nil), - (*IPAddressDump)(nil), - (*IPContainerProxyAddDel)(nil), - (*IPContainerProxyAddDelReply)(nil), - (*IPContainerProxyDetails)(nil), - (*IPContainerProxyDump)(nil), - (*IPDetails)(nil), - (*IPDump)(nil), - (*IPFibDetails)(nil), - (*IPFibDump)(nil), - (*IPMfibDetails)(nil), - (*IPMfibDump)(nil), - (*IPMrouteAddDel)(nil), - (*IPMrouteAddDelReply)(nil), - (*IPNeighborAddDel)(nil), - (*IPNeighborAddDelReply)(nil), - (*IPNeighborDetails)(nil), - (*IPNeighborDump)(nil), - (*IPProbeNeighbor)(nil), - (*IPProbeNeighborReply)(nil), - (*IPPuntPolice)(nil), - (*IPPuntPoliceReply)(nil), - (*IPPuntRedirect)(nil), - (*IPPuntRedirectDetails)(nil), - (*IPPuntRedirectDump)(nil), - (*IPPuntRedirectReply)(nil), - (*IPReassemblyEnableDisable)(nil), - (*IPReassemblyEnableDisableReply)(nil), - (*IPReassemblyGet)(nil), - (*IPReassemblyGetReply)(nil), - (*IPReassemblySet)(nil), - (*IPReassemblySetReply)(nil), - (*IPScanNeighborEnableDisable)(nil), - (*IPScanNeighborEnableDisableReply)(nil), - (*IPSourceAndPortRangeCheckAddDel)(nil), - (*IPSourceAndPortRangeCheckAddDelReply)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPSourceCheckInterfaceAddDel)(nil), - (*IPSourceCheckInterfaceAddDelReply)(nil), - (*IPTableAddDel)(nil), - (*IPTableAddDelReply)(nil), - (*IPUnnumberedDetails)(nil), - (*IPUnnumberedDump)(nil), - (*MfibSignalDetails)(nil), - (*MfibSignalDump)(nil), - (*ProxyArpAddDel)(nil), - (*ProxyArpAddDelReply)(nil), - (*ProxyArpDetails)(nil), - (*ProxyArpDump)(nil), - (*ProxyArpIntfcDetails)(nil), - (*ProxyArpIntfcDump)(nil), - (*ProxyArpIntfcEnableDisable)(nil), - (*ProxyArpIntfcEnableDisableReply)(nil), - (*ResetFib)(nil), - (*ResetFibReply)(nil), - (*SetArpNeighborLimit)(nil), - (*SetArpNeighborLimitReply)(nil), - (*SetIPFlowHash)(nil), - (*SetIPFlowHashReply)(nil), - (*SwInterfaceIP6EnableDisable)(nil), - (*SwInterfaceIP6EnableDisableReply)(nil), - (*SwInterfaceIP6ndRaConfig)(nil), - (*SwInterfaceIP6ndRaConfigReply)(nil), - (*SwInterfaceIP6ndRaPrefix)(nil), - (*SwInterfaceIP6ndRaPrefixReply)(nil), - (*WantIP4ArpEvents)(nil), - (*WantIP4ArpEventsReply)(nil), - (*WantIP6NdEvents)(nil), - (*WantIP6NdEventsReply)(nil), - (*WantIP6RaEvents)(nil), - (*WantIP6RaEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IP4ArpEvent)(nil), + (*IP6FibDetails)(nil), + (*IP6FibDump)(nil), + (*IP6MfibDetails)(nil), + (*IP6MfibDump)(nil), + (*IP6NdEvent)(nil), + (*IP6RaEvent)(nil), + (*IP6ndProxyAddDel)(nil), + (*IP6ndProxyAddDelReply)(nil), + (*IP6ndProxyDetails)(nil), + (*IP6ndProxyDump)(nil), + (*IP6ndSendRouterSolicitation)(nil), + (*IP6ndSendRouterSolicitationReply)(nil), + (*IPAddDelRoute)(nil), + (*IPAddDelRouteReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPFibDetails)(nil), + (*IPFibDump)(nil), + (*IPMfibDetails)(nil), + (*IPMfibDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPNeighborAddDel)(nil), + (*IPNeighborAddDelReply)(nil), + (*IPNeighborDetails)(nil), + (*IPNeighborDump)(nil), + (*IPProbeNeighbor)(nil), + (*IPProbeNeighborReply)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPScanNeighborEnableDisable)(nil), + (*IPScanNeighborEnableDisableReply)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + (*ResetFib)(nil), + (*ResetFibReply)(nil), + (*SetArpNeighborLimit)(nil), + (*SetArpNeighborLimitReply)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6ndRaConfig)(nil), + (*SwInterfaceIP6ndRaConfigReply)(nil), + (*SwInterfaceIP6ndRaPrefix)(nil), + (*SwInterfaceIP6ndRaPrefixReply)(nil), + (*WantIP4ArpEvents)(nil), + (*WantIP4ArpEventsReply)(nil), + (*WantIP6NdEvents)(nil), + (*WantIP6NdEventsReply)(nil), + (*WantIP6RaEvents)(nil), + (*WantIP6RaEventsReply)(nil), + } +} + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIP6Fib(ctx context.Context, in *IP6FibDump) (RPCService_DumpIP6FibClient, error) + DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) (RPCService_DumpIP6MfibClient, error) + DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPFib(ctx context.Context, in *IPFibDump) (RPCService_DumpIPFibClient, error) + DumpIPMfib(ctx context.Context, in *IPMfibDump) (RPCService_DumpIPMfibClient, error) + DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) + DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) + IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) + IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) + IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) + ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) + SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) + SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) + WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) + WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) + WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIP6Fib(ctx context.Context, in *IP6FibDump) (RPCService_DumpIP6FibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6FibClient{stream} + return x, nil +} + +type RPCService_DumpIP6FibClient interface { + Recv() (*IP6FibDetails, error) +} + +type serviceClient_DumpIP6FibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6FibClient) Recv() (*IP6FibDetails, error) { + m := new(IP6FibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP6Mfib(ctx context.Context, in *IP6MfibDump) (RPCService_DumpIP6MfibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6MfibClient{stream} + return x, nil +} + +type RPCService_DumpIP6MfibClient interface { + Recv() (*IP6MfibDetails, error) +} + +type serviceClient_DumpIP6MfibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6MfibClient) Recv() (*IP6MfibDetails, error) { + m := new(IP6MfibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6ndProxyClient{stream} + return x, nil +} + +type RPCService_DumpIP6ndProxyClient interface { + Recv() (*IP6ndProxyDetails, error) +} + +type serviceClient_DumpIP6ndProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6ndProxyClient) Recv() (*IP6ndProxyDetails, error) { + m := new(IP6ndProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPFib(ctx context.Context, in *IPFibDump) (RPCService_DumpIPFibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPFibClient{stream} + return x, nil +} + +type RPCService_DumpIPFibClient interface { + Recv() (*IPFibDetails, error) +} + +type serviceClient_DumpIPFibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPFibClient) Recv() (*IPFibDetails, error) { + m := new(IPFibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMfib(ctx context.Context, in *IPMfibDump) (RPCService_DumpIPMfibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMfibClient{stream} + return x, nil +} + +type RPCService_DumpIPMfibClient interface { + Recv() (*IPMfibDetails, error) +} + +type serviceClient_DumpIPMfibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMfibClient) Recv() (*IPMfibDetails, error) { + m := new(IPMfibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPNeighborClient{stream} + return x, nil +} + +type RPCService_DumpIPNeighborClient interface { + Recv() (*IPNeighborDetails, error) +} + +type serviceClient_DumpIPNeighborClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPNeighborClient) Recv() (*IPNeighborDetails, error) { + m := new(IPNeighborDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil +} + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpClient interface { + Recv() (*ProxyArpDetails, error) +} + +type serviceClient_DumpProxyArpClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpClient) Recv() (*ProxyArpDetails, error) { + m := new(ProxyArpDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpIntfcClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpIntfcClient interface { + Recv() (*ProxyArpIntfcDetails, error) +} + +type serviceClient_DumpProxyArpIntfcClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpIntfcClient) Recv() (*ProxyArpIntfcDetails, error) { + m := new(ProxyArpIntfcDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) { + out := new(IP6ndProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { + out := new(IP6ndSendRouterSolicitationReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPAddDelRoute(ctx context.Context, in *IPAddDelRoute) (*IPAddDelRouteReply, error) { + out := new(IPAddDelRouteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) { + out := new(IPNeighborAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) { + out := new(IPProbeNeighborReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) { + out := new(IPScanNeighborEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) { + out := new(ResetFibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) { + out := new(SetArpNeighborLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { + out := new(SwInterfaceIP6ndRaConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { + out := new(SwInterfaceIP6ndRaPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) { + out := new(WantIP4ArpEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) { + out := new(WantIP6NdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { + out := new(WantIP6RaEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/ipsec/ipsec.ba.go b/plugins/vpp/binapi/vpp1904/ipsec/ipsec.ba.go index dc22969a07..ae0108f9d5 100644 --- a/plugins/vpp/binapi/vpp1904/ipsec/ipsec.ba.go +++ b/plugins/vpp/binapi/vpp1904/ipsec/ipsec.ba.go @@ -1,49 +1,38 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/ipsec.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/ipsec.api.json /* - Package ipsec is a generated from VPP binary API module 'ipsec'. +Package ipsec is a generated VPP binary API for 'ipsec' module. - It contains following objects: - 14 services +It consists of: 6 enums 2 aliases 8 types 1 union 28 messages + 14 services */ package ipsec -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "ipsec" + // APIVersion is the API version of this module. + APIVersion = "3.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xdd4e73c8 +) -// Services represents VPP binary API services: -type Services interface { - DumpIpsecBackend(*IpsecBackendDump) ([]*IpsecBackendDetails, error) - DumpIpsecSa(*IpsecSaDump) ([]*IpsecSaDetails, error) - DumpIpsecSpd(*IpsecSpdDump) ([]*IpsecSpdDetails, error) - DumpIpsecSpdInterface(*IpsecSpdInterfaceDump) ([]*IpsecSpdInterfaceDetails, error) - DumpIpsecSpds(*IpsecSpdsDump) ([]*IpsecSpdsDetails, error) - IpsecInterfaceAddDelSpd(*IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) - IpsecSaSetKey(*IpsecSaSetKey) (*IpsecSaSetKeyReply, error) - IpsecSadEntryAddDel(*IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) - IpsecSelectBackend(*IpsecSelectBackend) (*IpsecSelectBackendReply, error) - IpsecSpdAddDel(*IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) - IpsecSpdEntryAddDel(*IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) - IpsecTunnelIfAddDel(*IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) - IpsecTunnelIfSetKey(*IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) - IpsecTunnelIfSetSa(*IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -51,7 +40,25 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -// IpsecCryptoAlg represents VPP binary API enum 'ipsec_crypto_alg': +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecCryptoAlg represents VPP binary API enum 'ipsec_crypto_alg'. type IpsecCryptoAlg uint32 const ( @@ -69,7 +76,45 @@ const ( IPSEC_API_CRYPTO_ALG_3DES_CBC IpsecCryptoAlg = 11 ) -// IpsecIntegAlg represents VPP binary API enum 'ipsec_integ_alg': +var IpsecCryptoAlg_name = map[uint32]string{ + 0: "IPSEC_API_CRYPTO_ALG_NONE", + 1: "IPSEC_API_CRYPTO_ALG_AES_CBC_128", + 2: "IPSEC_API_CRYPTO_ALG_AES_CBC_192", + 3: "IPSEC_API_CRYPTO_ALG_AES_CBC_256", + 4: "IPSEC_API_CRYPTO_ALG_AES_CTR_128", + 5: "IPSEC_API_CRYPTO_ALG_AES_CTR_192", + 6: "IPSEC_API_CRYPTO_ALG_AES_CTR_256", + 7: "IPSEC_API_CRYPTO_ALG_AES_GCM_128", + 8: "IPSEC_API_CRYPTO_ALG_AES_GCM_192", + 9: "IPSEC_API_CRYPTO_ALG_AES_GCM_256", + 10: "IPSEC_API_CRYPTO_ALG_DES_CBC", + 11: "IPSEC_API_CRYPTO_ALG_3DES_CBC", +} + +var IpsecCryptoAlg_value = map[string]uint32{ + "IPSEC_API_CRYPTO_ALG_NONE": 0, + "IPSEC_API_CRYPTO_ALG_AES_CBC_128": 1, + "IPSEC_API_CRYPTO_ALG_AES_CBC_192": 2, + "IPSEC_API_CRYPTO_ALG_AES_CBC_256": 3, + "IPSEC_API_CRYPTO_ALG_AES_CTR_128": 4, + "IPSEC_API_CRYPTO_ALG_AES_CTR_192": 5, + "IPSEC_API_CRYPTO_ALG_AES_CTR_256": 6, + "IPSEC_API_CRYPTO_ALG_AES_GCM_128": 7, + "IPSEC_API_CRYPTO_ALG_AES_GCM_192": 8, + "IPSEC_API_CRYPTO_ALG_AES_GCM_256": 9, + "IPSEC_API_CRYPTO_ALG_DES_CBC": 10, + "IPSEC_API_CRYPTO_ALG_3DES_CBC": 11, +} + +func (x IpsecCryptoAlg) String() string { + s, ok := IpsecCryptoAlg_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecIntegAlg represents VPP binary API enum 'ipsec_integ_alg'. type IpsecIntegAlg uint32 const ( @@ -82,7 +127,35 @@ const ( IPSEC_API_INTEG_ALG_SHA_512_256 IpsecIntegAlg = 6 ) -// IpsecProto represents VPP binary API enum 'ipsec_proto': +var IpsecIntegAlg_name = map[uint32]string{ + 0: "IPSEC_API_INTEG_ALG_NONE", + 1: "IPSEC_API_INTEG_ALG_MD5_96", + 2: "IPSEC_API_INTEG_ALG_SHA1_96", + 3: "IPSEC_API_INTEG_ALG_SHA_256_96", + 4: "IPSEC_API_INTEG_ALG_SHA_256_128", + 5: "IPSEC_API_INTEG_ALG_SHA_384_192", + 6: "IPSEC_API_INTEG_ALG_SHA_512_256", +} + +var IpsecIntegAlg_value = map[string]uint32{ + "IPSEC_API_INTEG_ALG_NONE": 0, + "IPSEC_API_INTEG_ALG_MD5_96": 1, + "IPSEC_API_INTEG_ALG_SHA1_96": 2, + "IPSEC_API_INTEG_ALG_SHA_256_96": 3, + "IPSEC_API_INTEG_ALG_SHA_256_128": 4, + "IPSEC_API_INTEG_ALG_SHA_384_192": 5, + "IPSEC_API_INTEG_ALG_SHA_512_256": 6, +} + +func (x IpsecIntegAlg) String() string { + s, ok := IpsecIntegAlg_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecProto represents VPP binary API enum 'ipsec_proto'. type IpsecProto uint32 const ( @@ -90,7 +163,25 @@ const ( IPSEC_API_PROTO_AH IpsecProto = 2 ) -// IpsecSadFlags represents VPP binary API enum 'ipsec_sad_flags': +var IpsecProto_name = map[uint32]string{ + 1: "IPSEC_API_PROTO_ESP", + 2: "IPSEC_API_PROTO_AH", +} + +var IpsecProto_value = map[string]uint32{ + "IPSEC_API_PROTO_ESP": 1, + "IPSEC_API_PROTO_AH": 2, +} + +func (x IpsecProto) String() string { + s, ok := IpsecProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecSadFlags represents VPP binary API enum 'ipsec_sad_flags'. type IpsecSadFlags uint32 const ( @@ -102,7 +193,33 @@ const ( IPSEC_API_SAD_FLAG_UDP_ENCAP IpsecSadFlags = 16 ) -// IpsecSpdAction represents VPP binary API enum 'ipsec_spd_action': +var IpsecSadFlags_name = map[uint32]string{ + 0: "IPSEC_API_SAD_FLAG_NONE", + 1: "IPSEC_API_SAD_FLAG_USE_ESN", + 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", + 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", + 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", + 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", +} + +var IpsecSadFlags_value = map[string]uint32{ + "IPSEC_API_SAD_FLAG_NONE": 0, + "IPSEC_API_SAD_FLAG_USE_ESN": 1, + "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY": 2, + "IPSEC_API_SAD_FLAG_IS_TUNNEL": 4, + "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6": 8, + "IPSEC_API_SAD_FLAG_UDP_ENCAP": 16, +} + +func (x IpsecSadFlags) String() string { + s, ok := IpsecSadFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecSpdAction represents VPP binary API enum 'ipsec_spd_action'. type IpsecSpdAction uint32 const ( @@ -112,17 +229,35 @@ const ( IPSEC_API_SPD_ACTION_PROTECT IpsecSpdAction = 3 ) -/* Aliases */ +var IpsecSpdAction_name = map[uint32]string{ + 0: "IPSEC_API_SPD_ACTION_BYPASS", + 1: "IPSEC_API_SPD_ACTION_DISCARD", + 2: "IPSEC_API_SPD_ACTION_RESOLVE", + 3: "IPSEC_API_SPD_ACTION_PROTECT", +} + +var IpsecSpdAction_value = map[string]uint32{ + "IPSEC_API_SPD_ACTION_BYPASS": 0, + "IPSEC_API_SPD_ACTION_DISCARD": 1, + "IPSEC_API_SPD_ACTION_RESOLVE": 2, + "IPSEC_API_SPD_ACTION_PROTECT": 3, +} -// IP4Address represents VPP binary API alias 'ip4_address': +func (x IpsecSpdAction) String() string { + s, ok := IpsecSpdAction_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -135,7 +270,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -148,7 +283,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -161,7 +296,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// IpsecSadEntry represents VPP binary API type 'ipsec_sad_entry': +// IpsecSadEntry represents VPP binary API type 'ipsec_sad_entry'. type IpsecSadEntry struct { SadID uint32 Spi uint32 @@ -183,7 +318,7 @@ func (*IpsecSadEntry) GetCrcString() string { return "ca3da05d" } -// IpsecSpdEntry represents VPP binary API type 'ipsec_spd_entry': +// IpsecSpdEntry represents VPP binary API type 'ipsec_spd_entry'. type IpsecSpdEntry struct { SpdID uint32 Priority int32 @@ -208,7 +343,7 @@ func (*IpsecSpdEntry) GetCrcString() string { return "876fdb2c" } -// Key represents VPP binary API type 'key': +// Key represents VPP binary API type 'key'. type Key struct { Length uint8 Data []byte `struc:"[128]byte"` @@ -221,7 +356,7 @@ func (*Key) GetCrcString() string { return "f3d0c4fd" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -236,7 +371,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -249,11 +384,9 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -272,10 +405,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -289,17 +422,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// IpsecBackendDetails represents VPP binary API message 'ipsec_backend_details': +// IpsecBackendDetails represents VPP binary API message 'ipsec_backend_details'. type IpsecBackendDetails struct { Name []byte `struc:"[128]byte"` Protocol IpsecProto @@ -317,7 +448,7 @@ func (*IpsecBackendDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecBackendDump represents VPP binary API message 'ipsec_backend_dump': +// IpsecBackendDump represents VPP binary API message 'ipsec_backend_dump'. type IpsecBackendDump struct{} func (*IpsecBackendDump) GetMessageName() string { @@ -330,7 +461,7 @@ func (*IpsecBackendDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecInterfaceAddDelSpd represents VPP binary API message 'ipsec_interface_add_del_spd': +// IpsecInterfaceAddDelSpd represents VPP binary API message 'ipsec_interface_add_del_spd'. type IpsecInterfaceAddDelSpd struct { IsAdd uint8 SwIfIndex uint32 @@ -347,7 +478,7 @@ func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecInterfaceAddDelSpdReply represents VPP binary API message 'ipsec_interface_add_del_spd_reply': +// IpsecInterfaceAddDelSpdReply represents VPP binary API message 'ipsec_interface_add_del_spd_reply'. type IpsecInterfaceAddDelSpdReply struct { Retval int32 } @@ -362,7 +493,7 @@ func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSaDetails represents VPP binary API message 'ipsec_sa_details': +// IpsecSaDetails represents VPP binary API message 'ipsec_sa_details'. type IpsecSaDetails struct { Entry IpsecSadEntry SwIfIndex uint32 @@ -383,7 +514,7 @@ func (*IpsecSaDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSaDump represents VPP binary API message 'ipsec_sa_dump': +// IpsecSaDump represents VPP binary API message 'ipsec_sa_dump'. type IpsecSaDump struct { SaID uint32 } @@ -398,7 +529,7 @@ func (*IpsecSaDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSaSetKey represents VPP binary API message 'ipsec_sa_set_key': +// IpsecSaSetKey represents VPP binary API message 'ipsec_sa_set_key'. type IpsecSaSetKey struct { SaID uint32 CryptoKey Key @@ -415,7 +546,7 @@ func (*IpsecSaSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSaSetKeyReply represents VPP binary API message 'ipsec_sa_set_key_reply': +// IpsecSaSetKeyReply represents VPP binary API message 'ipsec_sa_set_key_reply'. type IpsecSaSetKeyReply struct { Retval int32 } @@ -430,7 +561,7 @@ func (*IpsecSaSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSadEntryAddDel represents VPP binary API message 'ipsec_sad_entry_add_del': +// IpsecSadEntryAddDel represents VPP binary API message 'ipsec_sad_entry_add_del'. type IpsecSadEntryAddDel struct { IsAdd uint8 Entry IpsecSadEntry @@ -446,7 +577,7 @@ func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSadEntryAddDelReply represents VPP binary API message 'ipsec_sad_entry_add_del_reply': +// IpsecSadEntryAddDelReply represents VPP binary API message 'ipsec_sad_entry_add_del_reply'. type IpsecSadEntryAddDelReply struct { Retval int32 StatIndex uint32 @@ -462,7 +593,7 @@ func (*IpsecSadEntryAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSelectBackend represents VPP binary API message 'ipsec_select_backend': +// IpsecSelectBackend represents VPP binary API message 'ipsec_select_backend'. type IpsecSelectBackend struct { Protocol IpsecProto Index uint8 @@ -478,7 +609,7 @@ func (*IpsecSelectBackend) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSelectBackendReply represents VPP binary API message 'ipsec_select_backend_reply': +// IpsecSelectBackendReply represents VPP binary API message 'ipsec_select_backend_reply'. type IpsecSelectBackendReply struct { Retval int32 } @@ -493,7 +624,7 @@ func (*IpsecSelectBackendReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdAddDel represents VPP binary API message 'ipsec_spd_add_del': +// IpsecSpdAddDel represents VPP binary API message 'ipsec_spd_add_del'. type IpsecSpdAddDel struct { IsAdd uint8 SpdID uint32 @@ -509,7 +640,7 @@ func (*IpsecSpdAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdAddDelReply represents VPP binary API message 'ipsec_spd_add_del_reply': +// IpsecSpdAddDelReply represents VPP binary API message 'ipsec_spd_add_del_reply'. type IpsecSpdAddDelReply struct { Retval int32 } @@ -524,7 +655,7 @@ func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdDetails represents VPP binary API message 'ipsec_spd_details': +// IpsecSpdDetails represents VPP binary API message 'ipsec_spd_details'. type IpsecSpdDetails struct { Entry IpsecSpdEntry } @@ -539,7 +670,7 @@ func (*IpsecSpdDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdDump represents VPP binary API message 'ipsec_spd_dump': +// IpsecSpdDump represents VPP binary API message 'ipsec_spd_dump'. type IpsecSpdDump struct { SpdID uint32 SaID uint32 @@ -555,7 +686,7 @@ func (*IpsecSpdDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdEntryAddDel represents VPP binary API message 'ipsec_spd_entry_add_del': +// IpsecSpdEntryAddDel represents VPP binary API message 'ipsec_spd_entry_add_del'. type IpsecSpdEntryAddDel struct { IsAdd uint8 Entry IpsecSpdEntry @@ -571,7 +702,7 @@ func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdEntryAddDelReply represents VPP binary API message 'ipsec_spd_entry_add_del_reply': +// IpsecSpdEntryAddDelReply represents VPP binary API message 'ipsec_spd_entry_add_del_reply'. type IpsecSpdEntryAddDelReply struct { Retval int32 StatIndex uint32 @@ -587,7 +718,7 @@ func (*IpsecSpdEntryAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdInterfaceDetails represents VPP binary API message 'ipsec_spd_interface_details': +// IpsecSpdInterfaceDetails represents VPP binary API message 'ipsec_spd_interface_details'. type IpsecSpdInterfaceDetails struct { SpdIndex uint32 SwIfIndex uint32 @@ -603,7 +734,7 @@ func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdInterfaceDump represents VPP binary API message 'ipsec_spd_interface_dump': +// IpsecSpdInterfaceDump represents VPP binary API message 'ipsec_spd_interface_dump'. type IpsecSpdInterfaceDump struct { SpdIndex uint32 SpdIndexValid uint8 @@ -619,7 +750,7 @@ func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecSpdsDetails represents VPP binary API message 'ipsec_spds_details': +// IpsecSpdsDetails represents VPP binary API message 'ipsec_spds_details'. type IpsecSpdsDetails struct { SpdID uint32 Npolicies uint32 @@ -635,7 +766,7 @@ func (*IpsecSpdsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecSpdsDump represents VPP binary API message 'ipsec_spds_dump': +// IpsecSpdsDump represents VPP binary API message 'ipsec_spds_dump'. type IpsecSpdsDump struct{} func (*IpsecSpdsDump) GetMessageName() string { @@ -648,7 +779,7 @@ func (*IpsecSpdsDump) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfAddDel represents VPP binary API message 'ipsec_tunnel_if_add_del': +// IpsecTunnelIfAddDel represents VPP binary API message 'ipsec_tunnel_if_add_del'. type IpsecTunnelIfAddDel struct { IsAdd uint8 Esn uint8 @@ -683,7 +814,7 @@ func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfAddDelReply represents VPP binary API message 'ipsec_tunnel_if_add_del_reply': +// IpsecTunnelIfAddDelReply represents VPP binary API message 'ipsec_tunnel_if_add_del_reply'. type IpsecTunnelIfAddDelReply struct { Retval int32 SwIfIndex uint32 @@ -699,7 +830,7 @@ func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecTunnelIfSetKey represents VPP binary API message 'ipsec_tunnel_if_set_key': +// IpsecTunnelIfSetKey represents VPP binary API message 'ipsec_tunnel_if_set_key'. type IpsecTunnelIfSetKey struct { SwIfIndex uint32 KeyType uint8 @@ -718,7 +849,7 @@ func (*IpsecTunnelIfSetKey) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfSetKeyReply represents VPP binary API message 'ipsec_tunnel_if_set_key_reply': +// IpsecTunnelIfSetKeyReply represents VPP binary API message 'ipsec_tunnel_if_set_key_reply'. type IpsecTunnelIfSetKeyReply struct { Retval int32 } @@ -733,7 +864,7 @@ func (*IpsecTunnelIfSetKeyReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// IpsecTunnelIfSetSa represents VPP binary API message 'ipsec_tunnel_if_set_sa': +// IpsecTunnelIfSetSa represents VPP binary API message 'ipsec_tunnel_if_set_sa'. type IpsecTunnelIfSetSa struct { SwIfIndex uint32 SaID uint32 @@ -750,7 +881,7 @@ func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { return api.RequestMessage } -// IpsecTunnelIfSetSaReply represents VPP binary API message 'ipsec_tunnel_if_set_sa_reply': +// IpsecTunnelIfSetSaReply represents VPP binary API message 'ipsec_tunnel_if_set_sa_reply'. type IpsecTunnelIfSetSaReply struct { Retval int32 } @@ -796,33 +927,287 @@ func init() { api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec.IpsecTunnelIfSetSaReply") } -var Messages = []api.Message{ - (*IpsecBackendDetails)(nil), - (*IpsecBackendDump)(nil), - (*IpsecInterfaceAddDelSpd)(nil), - (*IpsecInterfaceAddDelSpdReply)(nil), - (*IpsecSaDetails)(nil), - (*IpsecSaDump)(nil), - (*IpsecSaSetKey)(nil), - (*IpsecSaSetKeyReply)(nil), - (*IpsecSadEntryAddDel)(nil), - (*IpsecSadEntryAddDelReply)(nil), - (*IpsecSelectBackend)(nil), - (*IpsecSelectBackendReply)(nil), - (*IpsecSpdAddDel)(nil), - (*IpsecSpdAddDelReply)(nil), - (*IpsecSpdDetails)(nil), - (*IpsecSpdDump)(nil), - (*IpsecSpdEntryAddDel)(nil), - (*IpsecSpdEntryAddDelReply)(nil), - (*IpsecSpdInterfaceDetails)(nil), - (*IpsecSpdInterfaceDump)(nil), - (*IpsecSpdsDetails)(nil), - (*IpsecSpdsDump)(nil), - (*IpsecTunnelIfAddDel)(nil), - (*IpsecTunnelIfAddDelReply)(nil), - (*IpsecTunnelIfSetKey)(nil), - (*IpsecTunnelIfSetKeyReply)(nil), - (*IpsecTunnelIfSetSa)(nil), - (*IpsecTunnelIfSetSaReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IpsecBackendDetails)(nil), + (*IpsecBackendDump)(nil), + (*IpsecInterfaceAddDelSpd)(nil), + (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecSaDetails)(nil), + (*IpsecSaDump)(nil), + (*IpsecSaSetKey)(nil), + (*IpsecSaSetKeyReply)(nil), + (*IpsecSadEntryAddDel)(nil), + (*IpsecSadEntryAddDelReply)(nil), + (*IpsecSelectBackend)(nil), + (*IpsecSelectBackendReply)(nil), + (*IpsecSpdAddDel)(nil), + (*IpsecSpdAddDelReply)(nil), + (*IpsecSpdDetails)(nil), + (*IpsecSpdDump)(nil), + (*IpsecSpdEntryAddDel)(nil), + (*IpsecSpdEntryAddDelReply)(nil), + (*IpsecSpdInterfaceDetails)(nil), + (*IpsecSpdInterfaceDump)(nil), + (*IpsecSpdsDetails)(nil), + (*IpsecSpdsDump)(nil), + (*IpsecTunnelIfAddDel)(nil), + (*IpsecTunnelIfAddDelReply)(nil), + (*IpsecTunnelIfSetKey)(nil), + (*IpsecTunnelIfSetKeyReply)(nil), + (*IpsecTunnelIfSetSa)(nil), + (*IpsecTunnelIfSetSaReply)(nil), + } +} + +// RPCService represents RPC service API for ipsec module. +type RPCService interface { + DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) + DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) + DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) + DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) + DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) + IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecSaSetKey(ctx context.Context, in *IpsecSaSetKey) (*IpsecSaSetKeyReply, error) + IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) + IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) + IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) + IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) + IpsecTunnelIfSetKey(ctx context.Context, in *IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) + IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecBackendClient{stream} + return x, nil +} + +type RPCService_DumpIpsecBackendClient interface { + Recv() (*IpsecBackendDetails, error) +} + +type serviceClient_DumpIpsecBackendClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecBackendClient) Recv() (*IpsecBackendDetails, error) { + m := new(IpsecBackendDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSaClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSaClient interface { + Recv() (*IpsecSaDetails, error) +} + +type serviceClient_DumpIpsecSaClient struct { + api.MultiRequestCtx } + +func (c *serviceClient_DumpIpsecSaClient) Recv() (*IpsecSaDetails, error) { + m := new(IpsecSaDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdClient interface { + Recv() (*IpsecSpdDetails, error) +} + +type serviceClient_DumpIpsecSpdClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdClient) Recv() (*IpsecSpdDetails, error) { + m := new(IpsecSpdDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdInterfaceClient interface { + Recv() (*IpsecSpdInterfaceDetails, error) +} + +type serviceClient_DumpIpsecSpdInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdInterfaceClient) Recv() (*IpsecSpdInterfaceDetails, error) { + m := new(IpsecSpdInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdsClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdsClient interface { + Recv() (*IpsecSpdsDetails, error) +} + +type serviceClient_DumpIpsecSpdsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdsClient) Recv() (*IpsecSpdsDetails, error) { + m := new(IpsecSpdsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) { + out := new(IpsecInterfaceAddDelSpdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSaSetKey(ctx context.Context, in *IpsecSaSetKey) (*IpsecSaSetKeyReply, error) { + out := new(IpsecSaSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) { + out := new(IpsecSadEntryAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { + out := new(IpsecSelectBackendReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { + out := new(IpsecSpdAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) { + out := new(IpsecSpdEntryAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { + out := new(IpsecTunnelIfAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetKey(ctx context.Context, in *IpsecTunnelIfSetKey) (*IpsecTunnelIfSetKeyReply, error) { + out := new(IpsecTunnelIfSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { + out := new(IpsecTunnelIfSetSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/l2/l2.ba.go b/plugins/vpp/binapi/vpp1904/l2/l2.ba.go index 11bb9ff84e..9ddcfab2ef 100644 --- a/plugins/vpp/binapi/vpp1904/l2/l2.ba.go +++ b/plugins/vpp/binapi/vpp1904/l2/l2.ba.go @@ -1,60 +1,38 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/l2.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/l2.api.json /* - Package l2 is a generated from VPP binary API module 'l2'. +Package l2 is a generated VPP binary API for 'l2' module. - It contains following objects: - 25 services +It consists of: 3 enums 3 aliases 7 types 1 union 51 messages + 25 services */ package l2 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "l2" + // APIVersion is the API version of this module. + APIVersion = "2.1.2" + // VersionCrc is the CRC of this module. + VersionCrc = 0xea7d9d39 +) -// Services represents VPP binary API services: -type Services interface { - DumpBdIPMac(*BdIPMacDump) ([]*BdIPMacDetails, error) - DumpBridgeDomain(*BridgeDomainDump) ([]*BridgeDomainDetails, error) - DumpL2FibTable(*L2FibTableDump) ([]*L2FibTableDetails, error) - DumpL2Xconnect(*L2XconnectDump) ([]*L2XconnectDetails, error) - BdIPMacAddDel(*BdIPMacAddDel) (*BdIPMacAddDelReply, error) - BdIPMacFlush(*BdIPMacFlush) (*BdIPMacFlushReply, error) - BridgeDomainAddDel(*BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) - BridgeDomainSetMacAge(*BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) - BridgeFlags(*BridgeFlags) (*BridgeFlagsReply, error) - BviCreate(*BviCreate) (*BviCreateReply, error) - BviDelete(*BviDelete) (*BviDeleteReply, error) - L2FibClearTable(*L2FibClearTable) (*L2FibClearTableReply, error) - L2Flags(*L2Flags) (*L2FlagsReply, error) - L2InterfaceEfpFilter(*L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) - L2InterfacePbbTagRewrite(*L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) - L2InterfaceVlanTagRewrite(*L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) - L2PatchAddDel(*L2PatchAddDel) (*L2PatchAddDelReply, error) - L2fibAddDel(*L2fibAddDel) (*L2fibAddDelReply, error) - L2fibFlushAll(*L2fibFlushAll) (*L2fibFlushAllReply, error) - L2fibFlushBd(*L2fibFlushBd) (*L2fibFlushBdReply, error) - L2fibFlushInt(*L2fibFlushInt) (*L2fibFlushIntReply, error) - SwInterfaceSetL2Bridge(*SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) - SwInterfaceSetL2Xconnect(*SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) - SwInterfaceSetVpath(*SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) - WantL2MacsEvents(*WantL2MacsEvents) (*WantL2MacsEventsReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -62,7 +40,25 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -// BdFlags represents VPP binary API enum 'bd_flags': +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// BdFlags represents VPP binary API enum 'bd_flags'. type BdFlags uint32 const ( @@ -74,7 +70,33 @@ const ( BRIDGE_API_FLAG_ARP_TERM BdFlags = 16 ) -// L2PortType represents VPP binary API enum 'l2_port_type': +var BdFlags_name = map[uint32]string{ + 0: "BRIDGE_API_FLAG_NONE", + 1: "BRIDGE_API_FLAG_LEARN", + 2: "BRIDGE_API_FLAG_FWD", + 4: "BRIDGE_API_FLAG_FLOOD", + 8: "BRIDGE_API_FLAG_UU_FLOOD", + 16: "BRIDGE_API_FLAG_ARP_TERM", +} + +var BdFlags_value = map[string]uint32{ + "BRIDGE_API_FLAG_NONE": 0, + "BRIDGE_API_FLAG_LEARN": 1, + "BRIDGE_API_FLAG_FWD": 2, + "BRIDGE_API_FLAG_FLOOD": 4, + "BRIDGE_API_FLAG_UU_FLOOD": 8, + "BRIDGE_API_FLAG_ARP_TERM": 16, +} + +func (x BdFlags) String() string { + s, ok := BdFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// L2PortType represents VPP binary API enum 'l2_port_type'. type L2PortType uint32 const ( @@ -83,20 +105,36 @@ const ( L2_API_PORT_TYPE_UU_FWD L2PortType = 2 ) -/* Aliases */ +var L2PortType_name = map[uint32]string{ + 0: "L2_API_PORT_TYPE_NORMAL", + 1: "L2_API_PORT_TYPE_BVI", + 2: "L2_API_PORT_TYPE_UU_FWD", +} + +var L2PortType_value = map[string]uint32{ + "L2_API_PORT_TYPE_NORMAL": 0, + "L2_API_PORT_TYPE_BVI": 1, + "L2_API_PORT_TYPE_UU_FWD": 2, +} + +func (x L2PortType) String() string { + s, ok := L2PortType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} -// IP4Address represents VPP binary API alias 'ip4_address': +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -// MacAddress represents VPP binary API alias 'mac_address': +// MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -109,7 +147,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// BridgeDomainSwIf represents VPP binary API type 'bridge_domain_sw_if': +// BridgeDomainSwIf represents VPP binary API type 'bridge_domain_sw_if'. type BridgeDomainSwIf struct { Context uint32 SwIfIndex uint32 @@ -123,7 +161,7 @@ func (*BridgeDomainSwIf) GetCrcString() string { return "a06dd426" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -136,7 +174,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -149,7 +187,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// MacEntry represents VPP binary API type 'mac_entry': +// MacEntry represents VPP binary API type 'mac_entry'. type MacEntry struct { SwIfIndex uint32 MacAddr []byte `struc:"[6]byte"` @@ -164,7 +202,7 @@ func (*MacEntry) GetCrcString() string { return "971135b8" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -179,7 +217,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -192,11 +230,9 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -215,10 +251,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -232,17 +268,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// BdIPMacAddDel represents VPP binary API message 'bd_ip_mac_add_del': +// BdIPMacAddDel represents VPP binary API message 'bd_ip_mac_add_del'. type BdIPMacAddDel struct { BdID uint32 IsAdd uint8 @@ -260,7 +294,7 @@ func (*BdIPMacAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacAddDelReply represents VPP binary API message 'bd_ip_mac_add_del_reply': +// BdIPMacAddDelReply represents VPP binary API message 'bd_ip_mac_add_del_reply'. type BdIPMacAddDelReply struct { Retval int32 } @@ -275,7 +309,7 @@ func (*BdIPMacAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BdIPMacDetails represents VPP binary API message 'bd_ip_mac_details': +// BdIPMacDetails represents VPP binary API message 'bd_ip_mac_details'. type BdIPMacDetails struct { BdID uint32 IsIPv6 uint8 @@ -293,7 +327,7 @@ func (*BdIPMacDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BdIPMacDump represents VPP binary API message 'bd_ip_mac_dump': +// BdIPMacDump represents VPP binary API message 'bd_ip_mac_dump'. type BdIPMacDump struct { BdID uint32 } @@ -308,7 +342,7 @@ func (*BdIPMacDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacFlush represents VPP binary API message 'bd_ip_mac_flush': +// BdIPMacFlush represents VPP binary API message 'bd_ip_mac_flush'. type BdIPMacFlush struct { BdID uint32 } @@ -323,7 +357,7 @@ func (*BdIPMacFlush) GetMessageType() api.MessageType { return api.RequestMessage } -// BdIPMacFlushReply represents VPP binary API message 'bd_ip_mac_flush_reply': +// BdIPMacFlushReply represents VPP binary API message 'bd_ip_mac_flush_reply'. type BdIPMacFlushReply struct { Retval int32 } @@ -338,7 +372,7 @@ func (*BdIPMacFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainAddDel represents VPP binary API message 'bridge_domain_add_del': +// BridgeDomainAddDel represents VPP binary API message 'bridge_domain_add_del'. type BridgeDomainAddDel struct { BdID uint32 Flood uint8 @@ -361,7 +395,7 @@ func (*BridgeDomainAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainAddDelReply represents VPP binary API message 'bridge_domain_add_del_reply': +// BridgeDomainAddDelReply represents VPP binary API message 'bridge_domain_add_del_reply'. type BridgeDomainAddDelReply struct { Retval int32 } @@ -376,7 +410,7 @@ func (*BridgeDomainAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainDetails represents VPP binary API message 'bridge_domain_details': +// BridgeDomainDetails represents VPP binary API message 'bridge_domain_details'. type BridgeDomainDetails struct { BdID uint32 Flood uint8 @@ -402,7 +436,7 @@ func (*BridgeDomainDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeDomainDump represents VPP binary API message 'bridge_domain_dump': +// BridgeDomainDump represents VPP binary API message 'bridge_domain_dump'. type BridgeDomainDump struct { BdID uint32 } @@ -417,7 +451,7 @@ func (*BridgeDomainDump) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainSetMacAge represents VPP binary API message 'bridge_domain_set_mac_age': +// BridgeDomainSetMacAge represents VPP binary API message 'bridge_domain_set_mac_age'. type BridgeDomainSetMacAge struct { BdID uint32 MacAge uint8 @@ -433,7 +467,7 @@ func (*BridgeDomainSetMacAge) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeDomainSetMacAgeReply represents VPP binary API message 'bridge_domain_set_mac_age_reply': +// BridgeDomainSetMacAgeReply represents VPP binary API message 'bridge_domain_set_mac_age_reply'. type BridgeDomainSetMacAgeReply struct { Retval int32 } @@ -448,7 +482,7 @@ func (*BridgeDomainSetMacAgeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BridgeFlags represents VPP binary API message 'bridge_flags': +// BridgeFlags represents VPP binary API message 'bridge_flags'. type BridgeFlags struct { BdID uint32 IsSet uint8 @@ -465,7 +499,7 @@ func (*BridgeFlags) GetMessageType() api.MessageType { return api.RequestMessage } -// BridgeFlagsReply represents VPP binary API message 'bridge_flags_reply': +// BridgeFlagsReply represents VPP binary API message 'bridge_flags_reply'. type BridgeFlagsReply struct { Retval int32 ResultingFeatureBitmap uint32 @@ -481,7 +515,7 @@ func (*BridgeFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BviCreate represents VPP binary API message 'bvi_create': +// BviCreate represents VPP binary API message 'bvi_create'. type BviCreate struct { Mac MacAddress UserInstance uint32 @@ -497,7 +531,7 @@ func (*BviCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// BviCreateReply represents VPP binary API message 'bvi_create_reply': +// BviCreateReply represents VPP binary API message 'bvi_create_reply'. type BviCreateReply struct { Retval int32 SwIfIndex uint32 @@ -513,7 +547,7 @@ func (*BviCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BviDelete represents VPP binary API message 'bvi_delete': +// BviDelete represents VPP binary API message 'bvi_delete'. type BviDelete struct { SwIfIndex uint32 } @@ -528,7 +562,7 @@ func (*BviDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// BviDeleteReply represents VPP binary API message 'bvi_delete_reply': +// BviDeleteReply represents VPP binary API message 'bvi_delete_reply'. type BviDeleteReply struct { Retval int32 } @@ -543,7 +577,7 @@ func (*BviDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibClearTable represents VPP binary API message 'l2_fib_clear_table': +// L2FibClearTable represents VPP binary API message 'l2_fib_clear_table'. type L2FibClearTable struct{} func (*L2FibClearTable) GetMessageName() string { @@ -556,7 +590,7 @@ func (*L2FibClearTable) GetMessageType() api.MessageType { return api.RequestMessage } -// L2FibClearTableReply represents VPP binary API message 'l2_fib_clear_table_reply': +// L2FibClearTableReply represents VPP binary API message 'l2_fib_clear_table_reply'. type L2FibClearTableReply struct { Retval int32 } @@ -571,7 +605,7 @@ func (*L2FibClearTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibTableDetails represents VPP binary API message 'l2_fib_table_details': +// L2FibTableDetails represents VPP binary API message 'l2_fib_table_details'. type L2FibTableDetails struct { BdID uint32 Mac []byte `struc:"[6]byte"` @@ -591,7 +625,7 @@ func (*L2FibTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2FibTableDump represents VPP binary API message 'l2_fib_table_dump': +// L2FibTableDump represents VPP binary API message 'l2_fib_table_dump'. type L2FibTableDump struct { BdID uint32 } @@ -606,7 +640,7 @@ func (*L2FibTableDump) GetMessageType() api.MessageType { return api.RequestMessage } -// L2Flags represents VPP binary API message 'l2_flags': +// L2Flags represents VPP binary API message 'l2_flags'. type L2Flags struct { SwIfIndex uint32 IsSet uint8 @@ -623,7 +657,7 @@ func (*L2Flags) GetMessageType() api.MessageType { return api.RequestMessage } -// L2FlagsReply represents VPP binary API message 'l2_flags_reply': +// L2FlagsReply represents VPP binary API message 'l2_flags_reply'. type L2FlagsReply struct { Retval int32 ResultingFeatureBitmap uint32 @@ -639,7 +673,7 @@ func (*L2FlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfaceEfpFilter represents VPP binary API message 'l2_interface_efp_filter': +// L2InterfaceEfpFilter represents VPP binary API message 'l2_interface_efp_filter'. type L2InterfaceEfpFilter struct { SwIfIndex uint32 EnableDisable uint8 @@ -655,7 +689,7 @@ func (*L2InterfaceEfpFilter) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfaceEfpFilterReply represents VPP binary API message 'l2_interface_efp_filter_reply': +// L2InterfaceEfpFilterReply represents VPP binary API message 'l2_interface_efp_filter_reply'. type L2InterfaceEfpFilterReply struct { Retval int32 } @@ -670,7 +704,7 @@ func (*L2InterfaceEfpFilterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfacePbbTagRewrite represents VPP binary API message 'l2_interface_pbb_tag_rewrite': +// L2InterfacePbbTagRewrite represents VPP binary API message 'l2_interface_pbb_tag_rewrite'. type L2InterfacePbbTagRewrite struct { SwIfIndex uint32 VtrOp uint32 @@ -691,7 +725,7 @@ func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfacePbbTagRewriteReply represents VPP binary API message 'l2_interface_pbb_tag_rewrite_reply': +// L2InterfacePbbTagRewriteReply represents VPP binary API message 'l2_interface_pbb_tag_rewrite_reply'. type L2InterfacePbbTagRewriteReply struct { Retval int32 } @@ -706,7 +740,7 @@ func (*L2InterfacePbbTagRewriteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2InterfaceVlanTagRewrite represents VPP binary API message 'l2_interface_vlan_tag_rewrite': +// L2InterfaceVlanTagRewrite represents VPP binary API message 'l2_interface_vlan_tag_rewrite'. type L2InterfaceVlanTagRewrite struct { SwIfIndex uint32 VtrOp uint32 @@ -725,7 +759,7 @@ func (*L2InterfaceVlanTagRewrite) GetMessageType() api.MessageType { return api.RequestMessage } -// L2InterfaceVlanTagRewriteReply represents VPP binary API message 'l2_interface_vlan_tag_rewrite_reply': +// L2InterfaceVlanTagRewriteReply represents VPP binary API message 'l2_interface_vlan_tag_rewrite_reply'. type L2InterfaceVlanTagRewriteReply struct { Retval int32 } @@ -740,7 +774,7 @@ func (*L2InterfaceVlanTagRewriteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2MacsEvent represents VPP binary API message 'l2_macs_event': +// L2MacsEvent represents VPP binary API message 'l2_macs_event'. type L2MacsEvent struct { PID uint32 NMacs uint32 `struc:"sizeof=Mac"` @@ -757,7 +791,7 @@ func (*L2MacsEvent) GetMessageType() api.MessageType { return api.EventMessage } -// L2PatchAddDel represents VPP binary API message 'l2_patch_add_del': +// L2PatchAddDel represents VPP binary API message 'l2_patch_add_del'. type L2PatchAddDel struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -774,7 +808,7 @@ func (*L2PatchAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// L2PatchAddDelReply represents VPP binary API message 'l2_patch_add_del_reply': +// L2PatchAddDelReply represents VPP binary API message 'l2_patch_add_del_reply'. type L2PatchAddDelReply struct { Retval int32 } @@ -789,7 +823,7 @@ func (*L2PatchAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2XconnectDetails represents VPP binary API message 'l2_xconnect_details': +// L2XconnectDetails represents VPP binary API message 'l2_xconnect_details'. type L2XconnectDetails struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -805,7 +839,7 @@ func (*L2XconnectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2XconnectDump represents VPP binary API message 'l2_xconnect_dump': +// L2XconnectDump represents VPP binary API message 'l2_xconnect_dump'. type L2XconnectDump struct{} func (*L2XconnectDump) GetMessageName() string { @@ -818,7 +852,7 @@ func (*L2XconnectDump) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibAddDel represents VPP binary API message 'l2fib_add_del': +// L2fibAddDel represents VPP binary API message 'l2fib_add_del'. type L2fibAddDel struct { Mac []byte `struc:"[6]byte"` BdID uint32 @@ -839,7 +873,7 @@ func (*L2fibAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibAddDelReply represents VPP binary API message 'l2fib_add_del_reply': +// L2fibAddDelReply represents VPP binary API message 'l2fib_add_del_reply'. type L2fibAddDelReply struct { Retval int32 } @@ -854,7 +888,7 @@ func (*L2fibAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushAll represents VPP binary API message 'l2fib_flush_all': +// L2fibFlushAll represents VPP binary API message 'l2fib_flush_all'. type L2fibFlushAll struct{} func (*L2fibFlushAll) GetMessageName() string { @@ -867,7 +901,7 @@ func (*L2fibFlushAll) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushAllReply represents VPP binary API message 'l2fib_flush_all_reply': +// L2fibFlushAllReply represents VPP binary API message 'l2fib_flush_all_reply'. type L2fibFlushAllReply struct { Retval int32 } @@ -882,7 +916,7 @@ func (*L2fibFlushAllReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushBd represents VPP binary API message 'l2fib_flush_bd': +// L2fibFlushBd represents VPP binary API message 'l2fib_flush_bd'. type L2fibFlushBd struct { BdID uint32 } @@ -897,7 +931,7 @@ func (*L2fibFlushBd) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushBdReply represents VPP binary API message 'l2fib_flush_bd_reply': +// L2fibFlushBdReply represents VPP binary API message 'l2fib_flush_bd_reply'. type L2fibFlushBdReply struct { Retval int32 } @@ -912,7 +946,7 @@ func (*L2fibFlushBdReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// L2fibFlushInt represents VPP binary API message 'l2fib_flush_int': +// L2fibFlushInt represents VPP binary API message 'l2fib_flush_int'. type L2fibFlushInt struct { SwIfIndex uint32 } @@ -927,7 +961,7 @@ func (*L2fibFlushInt) GetMessageType() api.MessageType { return api.RequestMessage } -// L2fibFlushIntReply represents VPP binary API message 'l2fib_flush_int_reply': +// L2fibFlushIntReply represents VPP binary API message 'l2fib_flush_int_reply'. type L2fibFlushIntReply struct { Retval int32 } @@ -942,7 +976,7 @@ func (*L2fibFlushIntReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetL2Bridge represents VPP binary API message 'sw_interface_set_l2_bridge': +// SwInterfaceSetL2Bridge represents VPP binary API message 'sw_interface_set_l2_bridge'. type SwInterfaceSetL2Bridge struct { RxSwIfIndex uint32 BdID uint32 @@ -961,7 +995,7 @@ func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetL2BridgeReply represents VPP binary API message 'sw_interface_set_l2_bridge_reply': +// SwInterfaceSetL2BridgeReply represents VPP binary API message 'sw_interface_set_l2_bridge_reply'. type SwInterfaceSetL2BridgeReply struct { Retval int32 } @@ -976,7 +1010,7 @@ func (*SwInterfaceSetL2BridgeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetL2Xconnect represents VPP binary API message 'sw_interface_set_l2_xconnect': +// SwInterfaceSetL2Xconnect represents VPP binary API message 'sw_interface_set_l2_xconnect'. type SwInterfaceSetL2Xconnect struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -993,7 +1027,7 @@ func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetL2XconnectReply represents VPP binary API message 'sw_interface_set_l2_xconnect_reply': +// SwInterfaceSetL2XconnectReply represents VPP binary API message 'sw_interface_set_l2_xconnect_reply'. type SwInterfaceSetL2XconnectReply struct { Retval int32 } @@ -1008,7 +1042,7 @@ func (*SwInterfaceSetL2XconnectReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceSetVpath represents VPP binary API message 'sw_interface_set_vpath': +// SwInterfaceSetVpath represents VPP binary API message 'sw_interface_set_vpath'. type SwInterfaceSetVpath struct { SwIfIndex uint32 Enable uint8 @@ -1024,7 +1058,7 @@ func (*SwInterfaceSetVpath) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetVpathReply represents VPP binary API message 'sw_interface_set_vpath_reply': +// SwInterfaceSetVpathReply represents VPP binary API message 'sw_interface_set_vpath_reply'. type SwInterfaceSetVpathReply struct { Retval int32 } @@ -1039,7 +1073,7 @@ func (*SwInterfaceSetVpathReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// WantL2MacsEvents represents VPP binary API message 'want_l2_macs_events': +// WantL2MacsEvents represents VPP binary API message 'want_l2_macs_events'. type WantL2MacsEvents struct { LearnLimit uint32 ScanDelay uint8 @@ -1058,7 +1092,7 @@ func (*WantL2MacsEvents) GetMessageType() api.MessageType { return api.RequestMessage } -// WantL2MacsEventsReply represents VPP binary API message 'want_l2_macs_events_reply': +// WantL2MacsEventsReply represents VPP binary API message 'want_l2_macs_events_reply'. type WantL2MacsEventsReply struct { Retval int32 } @@ -1127,56 +1161,403 @@ func init() { api.RegisterMessage((*WantL2MacsEventsReply)(nil), "l2.WantL2MacsEventsReply") } -var Messages = []api.Message{ - (*BdIPMacAddDel)(nil), - (*BdIPMacAddDelReply)(nil), - (*BdIPMacDetails)(nil), - (*BdIPMacDump)(nil), - (*BdIPMacFlush)(nil), - (*BdIPMacFlushReply)(nil), - (*BridgeDomainAddDel)(nil), - (*BridgeDomainAddDelReply)(nil), - (*BridgeDomainDetails)(nil), - (*BridgeDomainDump)(nil), - (*BridgeDomainSetMacAge)(nil), - (*BridgeDomainSetMacAgeReply)(nil), - (*BridgeFlags)(nil), - (*BridgeFlagsReply)(nil), - (*BviCreate)(nil), - (*BviCreateReply)(nil), - (*BviDelete)(nil), - (*BviDeleteReply)(nil), - (*L2FibClearTable)(nil), - (*L2FibClearTableReply)(nil), - (*L2FibTableDetails)(nil), - (*L2FibTableDump)(nil), - (*L2Flags)(nil), - (*L2FlagsReply)(nil), - (*L2InterfaceEfpFilter)(nil), - (*L2InterfaceEfpFilterReply)(nil), - (*L2InterfacePbbTagRewrite)(nil), - (*L2InterfacePbbTagRewriteReply)(nil), - (*L2InterfaceVlanTagRewrite)(nil), - (*L2InterfaceVlanTagRewriteReply)(nil), - (*L2MacsEvent)(nil), - (*L2PatchAddDel)(nil), - (*L2PatchAddDelReply)(nil), - (*L2XconnectDetails)(nil), - (*L2XconnectDump)(nil), - (*L2fibAddDel)(nil), - (*L2fibAddDelReply)(nil), - (*L2fibFlushAll)(nil), - (*L2fibFlushAllReply)(nil), - (*L2fibFlushBd)(nil), - (*L2fibFlushBdReply)(nil), - (*L2fibFlushInt)(nil), - (*L2fibFlushIntReply)(nil), - (*SwInterfaceSetL2Bridge)(nil), - (*SwInterfaceSetL2BridgeReply)(nil), - (*SwInterfaceSetL2Xconnect)(nil), - (*SwInterfaceSetL2XconnectReply)(nil), - (*SwInterfaceSetVpath)(nil), - (*SwInterfaceSetVpathReply)(nil), - (*WantL2MacsEvents)(nil), - (*WantL2MacsEventsReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BdIPMacAddDel)(nil), + (*BdIPMacAddDelReply)(nil), + (*BdIPMacDetails)(nil), + (*BdIPMacDump)(nil), + (*BdIPMacFlush)(nil), + (*BdIPMacFlushReply)(nil), + (*BridgeDomainAddDel)(nil), + (*BridgeDomainAddDelReply)(nil), + (*BridgeDomainDetails)(nil), + (*BridgeDomainDump)(nil), + (*BridgeDomainSetMacAge)(nil), + (*BridgeDomainSetMacAgeReply)(nil), + (*BridgeFlags)(nil), + (*BridgeFlagsReply)(nil), + (*BviCreate)(nil), + (*BviCreateReply)(nil), + (*BviDelete)(nil), + (*BviDeleteReply)(nil), + (*L2FibClearTable)(nil), + (*L2FibClearTableReply)(nil), + (*L2FibTableDetails)(nil), + (*L2FibTableDump)(nil), + (*L2Flags)(nil), + (*L2FlagsReply)(nil), + (*L2InterfaceEfpFilter)(nil), + (*L2InterfaceEfpFilterReply)(nil), + (*L2InterfacePbbTagRewrite)(nil), + (*L2InterfacePbbTagRewriteReply)(nil), + (*L2InterfaceVlanTagRewrite)(nil), + (*L2InterfaceVlanTagRewriteReply)(nil), + (*L2MacsEvent)(nil), + (*L2PatchAddDel)(nil), + (*L2PatchAddDelReply)(nil), + (*L2XconnectDetails)(nil), + (*L2XconnectDump)(nil), + (*L2fibAddDel)(nil), + (*L2fibAddDelReply)(nil), + (*L2fibFlushAll)(nil), + (*L2fibFlushAllReply)(nil), + (*L2fibFlushBd)(nil), + (*L2fibFlushBdReply)(nil), + (*L2fibFlushInt)(nil), + (*L2fibFlushIntReply)(nil), + (*SwInterfaceSetL2Bridge)(nil), + (*SwInterfaceSetL2BridgeReply)(nil), + (*SwInterfaceSetL2Xconnect)(nil), + (*SwInterfaceSetL2XconnectReply)(nil), + (*SwInterfaceSetVpath)(nil), + (*SwInterfaceSetVpathReply)(nil), + (*WantL2MacsEvents)(nil), + (*WantL2MacsEventsReply)(nil), + } +} + +// RPCService represents RPC service API for l2 module. +type RPCService interface { + DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) + DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) + DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) + DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) + BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) + BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) + BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) + BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) + BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) + BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) + BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) + L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) + L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) + L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) + L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) + L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) + L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) + L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) + L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) + L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) + L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) + SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) + SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) + SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) + WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBdIPMacClient{stream} + return x, nil +} + +type RPCService_DumpBdIPMacClient interface { + Recv() (*BdIPMacDetails, error) +} + +type serviceClient_DumpBdIPMacClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBdIPMacClient) Recv() (*BdIPMacDetails, error) { + m := new(BdIPMacDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBridgeDomainClient{stream} + return x, nil +} + +type RPCService_DumpBridgeDomainClient interface { + Recv() (*BridgeDomainDetails, error) +} + +type serviceClient_DumpBridgeDomainClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBridgeDomainClient) Recv() (*BridgeDomainDetails, error) { + m := new(BridgeDomainDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2FibTableClient{stream} + return x, nil +} + +type RPCService_DumpL2FibTableClient interface { + Recv() (*L2FibTableDetails, error) +} + +type serviceClient_DumpL2FibTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2FibTableClient) Recv() (*L2FibTableDetails, error) { + m := new(L2FibTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2XconnectClient{stream} + return x, nil +} + +type RPCService_DumpL2XconnectClient interface { + Recv() (*L2XconnectDetails, error) +} + +type serviceClient_DumpL2XconnectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2XconnectClient) Recv() (*L2XconnectDetails, error) { + m := new(L2XconnectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) { + out := new(BdIPMacAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) { + out := new(BdIPMacFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { + out := new(BridgeDomainAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) { + out := new(BridgeDomainSetMacAgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { + out := new(BridgeFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) { + out := new(BviCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) { + out := new(BviDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { + out := new(L2FibClearTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) { + out := new(L2FlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { + out := new(L2InterfaceEfpFilterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { + out := new(L2InterfacePbbTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { + out := new(L2InterfaceVlanTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { + out := new(L2PatchAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) { + out := new(L2fibAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { + out := new(L2fibFlushAllReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { + out := new(L2fibFlushBdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { + out := new(L2fibFlushIntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { + out := new(SwInterfaceSetL2BridgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { + out := new(SwInterfaceSetL2XconnectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { + out := new(SwInterfaceSetVpathReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { + out := new(WantL2MacsEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/memclnt/memclnt.ba.go b/plugins/vpp/binapi/vpp1904/memclnt/memclnt.ba.go index e1bfc9574d..d1ffe0324d 100644 --- a/plugins/vpp/binapi/vpp1904/memclnt/memclnt.ba.go +++ b/plugins/vpp/binapi/vpp1904/memclnt/memclnt.ba.go @@ -1,45 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/memclnt.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/memclnt.api.json /* - Package memclnt is a generated from VPP binary API module 'memclnt'. +Package memclnt is a generated VPP binary API for 'memclnt' module. - It contains following objects: - 13 services +It consists of: 2 types 22 messages + 13 services */ package memclnt -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - APIVersions(*APIVersions) (*APIVersionsReply, error) - GetFirstMsgID(*GetFirstMsgID) (*GetFirstMsgIDReply, error) - MemclntCreate(*MemclntCreate) (*MemclntCreateReply, error) - MemclntDelete(*MemclntDelete) (*MemclntDeleteReply, error) - MemclntKeepalive(*MemclntKeepalive) (*MemclntKeepaliveReply, error) - MemclntReadTimeout(*MemclntReadTimeout) error - MemclntRxThreadSuspend(*MemclntRxThreadSuspend) error - RPCCall(*RPCCall) (*RPCCallReply, error) - RxThreadExit(*RxThreadExit) error - SockInitShm(*SockInitShm) (*SockInitShmReply, error) - SockclntCreate(*SockclntCreate) (*SockclntCreateReply, error) - SockclntDelete(*SockclntDelete) (*SockclntDeleteReply, error) - TracePluginMsgIds(*TracePluginMsgIds) error -} - -/* Types */ - -// MessageTableEntry represents VPP binary API type 'message_table_entry': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "memclnt" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xb619530 +) + +// MessageTableEntry represents VPP binary API type 'message_table_entry'. type MessageTableEntry struct { Index uint16 Name []byte `struc:"[64]byte"` @@ -52,7 +42,7 @@ func (*MessageTableEntry) GetCrcString() string { return "913bf1c6" } -// ModuleVersion represents VPP binary API type 'module_version': +// ModuleVersion represents VPP binary API type 'module_version'. type ModuleVersion struct { Major uint32 Minor uint32 @@ -67,9 +57,7 @@ func (*ModuleVersion) GetCrcString() string { return "4b6da11a" } -/* Messages */ - -// APIVersions represents VPP binary API message 'api_versions': +// APIVersions represents VPP binary API message 'api_versions'. type APIVersions struct{} func (*APIVersions) GetMessageName() string { @@ -82,7 +70,7 @@ func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } -// APIVersionsReply represents VPP binary API message 'api_versions_reply': +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. type APIVersionsReply struct { Retval int32 Count uint32 `struc:"sizeof=APIVersions"` @@ -99,7 +87,7 @@ func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetFirstMsgID represents VPP binary API message 'get_first_msg_id': +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. type GetFirstMsgID struct { Name []byte `struc:"[64]byte"` } @@ -114,7 +102,7 @@ func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } -// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply': +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. type GetFirstMsgIDReply struct { Retval int32 FirstMsgID uint16 @@ -130,7 +118,7 @@ func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreate represents VPP binary API message 'memclnt_create': +// MemclntCreate represents VPP binary API message 'memclnt_create'. type MemclntCreate struct { CtxQuota int32 InputQueue uint64 @@ -148,7 +136,7 @@ func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply': +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. type MemclntCreateReply struct { Response int32 Handle uint64 @@ -166,7 +154,7 @@ func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntDelete represents VPP binary API message 'memclnt_delete': +// MemclntDelete represents VPP binary API message 'memclnt_delete'. type MemclntDelete struct { Index uint32 Handle uint64 @@ -183,7 +171,7 @@ func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply': +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. type MemclntDeleteReply struct { Response int32 Handle uint64 @@ -199,7 +187,7 @@ func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive': +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. type MemclntKeepalive struct{} func (*MemclntKeepalive) GetMessageName() string { @@ -212,7 +200,7 @@ func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } -// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply': +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. type MemclntKeepaliveReply struct { Retval int32 } @@ -227,7 +215,7 @@ func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout': +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. type MemclntReadTimeout struct { Dummy uint8 } @@ -242,7 +230,7 @@ func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend': +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. type MemclntRxThreadSuspend struct { Dummy uint8 } @@ -257,7 +245,7 @@ func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } -// RPCCall represents VPP binary API message 'rpc_call': +// RPCCall represents VPP binary API message 'rpc_call'. type RPCCall struct { Function uint64 Multicast uint8 @@ -277,7 +265,7 @@ func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } -// RPCCallReply represents VPP binary API message 'rpc_call_reply': +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. type RPCCallReply struct { Retval int32 } @@ -292,7 +280,7 @@ func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// RxThreadExit represents VPP binary API message 'rx_thread_exit': +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. type RxThreadExit struct { Dummy uint8 } @@ -307,7 +295,7 @@ func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } -// SockInitShm represents VPP binary API message 'sock_init_shm': +// SockInitShm represents VPP binary API message 'sock_init_shm'. type SockInitShm struct { RequestedSize uint32 Nitems uint8 `struc:"sizeof=Configs"` @@ -324,7 +312,7 @@ func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } -// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply': +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. type SockInitShmReply struct { Retval int32 } @@ -339,7 +327,7 @@ func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreate represents VPP binary API message 'sockclnt_create': +// SockclntCreate represents VPP binary API message 'sockclnt_create'. type SockclntCreate struct { Name []byte `struc:"[64]byte"` } @@ -354,7 +342,7 @@ func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply': +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. type SockclntCreateReply struct { Response int32 Index uint32 @@ -372,7 +360,7 @@ func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDelete represents VPP binary API message 'sockclnt_delete': +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. type SockclntDelete struct { Index uint32 } @@ -387,7 +375,7 @@ func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply': +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. type SockclntDeleteReply struct { Response int32 } @@ -402,7 +390,7 @@ func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids': +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. type TracePluginMsgIds struct { PluginName []byte `struc:"[128]byte"` FirstMsgID uint16 @@ -444,27 +432,170 @@ func init() { api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") } -var Messages = []api.Message{ - (*APIVersions)(nil), - (*APIVersionsReply)(nil), - (*GetFirstMsgID)(nil), - (*GetFirstMsgIDReply)(nil), - (*MemclntCreate)(nil), - (*MemclntCreateReply)(nil), - (*MemclntDelete)(nil), - (*MemclntDeleteReply)(nil), - (*MemclntKeepalive)(nil), - (*MemclntKeepaliveReply)(nil), - (*MemclntReadTimeout)(nil), - (*MemclntRxThreadSuspend)(nil), - (*RPCCall)(nil), - (*RPCCallReply)(nil), - (*RxThreadExit)(nil), - (*SockInitShm)(nil), - (*SockInitShmReply)(nil), - (*SockclntCreate)(nil), - (*SockclntCreateReply)(nil), - (*SockclntDelete)(nil), - (*SockclntDeleteReply)(nil), - (*TracePluginMsgIds)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil } + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/memif/memif.ba.go b/plugins/vpp/binapi/vpp1904/memif/memif.ba.go index e3dff9926e..8d239869f3 100644 --- a/plugins/vpp/binapi/vpp1904/memif/memif.ba.go +++ b/plugins/vpp/binapi/vpp1904/memif/memif.ba.go @@ -1,36 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/memif.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/memif.api.json /* - Package memif is a generated from VPP binary API module 'memif'. +Package memif is a generated VPP binary API for 'memif' module. - It contains following objects: - 5 services +It consists of: 10 messages + 5 services */ package memif -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "memif" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x31b42e17 +) -// Services represents VPP binary API services: -type Services interface { - DumpMemif(*MemifDump) ([]*MemifDetails, error) - DumpMemifSocketFilename(*MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) - MemifCreate(*MemifCreate) (*MemifCreateReply, error) - MemifDelete(*MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(*MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} - -/* Messages */ - -// MemifCreate represents VPP binary API message 'memif_create': +// MemifCreate represents VPP binary API message 'memif_create'. type MemifCreate struct { Role uint8 Mode uint8 @@ -54,7 +52,7 @@ func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifCreateReply represents VPP binary API message 'memif_create_reply': +// MemifCreateReply represents VPP binary API message 'memif_create_reply'. type MemifCreateReply struct { Retval int32 SwIfIndex uint32 @@ -70,7 +68,7 @@ func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDelete represents VPP binary API message 'memif_delete': +// MemifDelete represents VPP binary API message 'memif_delete'. type MemifDelete struct { SwIfIndex uint32 } @@ -85,7 +83,7 @@ func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifDeleteReply represents VPP binary API message 'memif_delete_reply': +// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. type MemifDeleteReply struct { Retval int32 } @@ -100,7 +98,7 @@ func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDetails represents VPP binary API message 'memif_details': +// MemifDetails represents VPP binary API message 'memif_details'. type MemifDetails struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` @@ -125,7 +123,7 @@ func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifDump represents VPP binary API message 'memif_dump': +// MemifDump represents VPP binary API message 'memif_dump'. type MemifDump struct{} func (*MemifDump) GetMessageName() string { @@ -138,7 +136,7 @@ func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del': +// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. type MemifSocketFilenameAddDel struct { IsAdd uint8 SocketID uint32 @@ -155,7 +153,7 @@ func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply': +// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. type MemifSocketFilenameAddDelReply struct { Retval int32 } @@ -170,7 +168,7 @@ func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details': +// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. type MemifSocketFilenameDetails struct { SocketID uint32 SocketFilename []byte `struc:"[128]byte"` @@ -186,7 +184,7 @@ func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump': +// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. type MemifSocketFilenameDump struct{} func (*MemifSocketFilenameDump) GetMessageName() string { @@ -212,15 +210,128 @@ func init() { api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") } -var Messages = []api.Message{ - (*MemifCreate)(nil), - (*MemifCreateReply)(nil), - (*MemifDelete)(nil), - (*MemifDeleteReply)(nil), - (*MemifDetails)(nil), - (*MemifDump)(nil), - (*MemifSocketFilenameAddDel)(nil), - (*MemifSocketFilenameAddDelReply)(nil), - (*MemifSocketFilenameDetails)(nil), - (*MemifSocketFilenameDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) } + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/nat/nat.ba.go b/plugins/vpp/binapi/vpp1904/nat/nat.ba.go index b9f5b6192c..71b8e63115 100644 --- a/plugins/vpp/binapi/vpp1904/nat/nat.ba.go +++ b/plugins/vpp/binapi/vpp1904/nat/nat.ba.go @@ -1,102 +1,38 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/nat.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/nat.api.json /* - Package nat is a generated from VPP binary API module 'nat'. +Package nat is a generated VPP binary API for 'nat' module. - It contains following objects: - 67 services +It consists of: 1 enum 2 aliases 6 types 1 union 135 messages + 67 services */ package nat -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "nat" + // APIVersion is the API version of this module. + APIVersion = "4.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbd7848fc +) -// Services represents VPP binary API services: -type Services interface { - DumpDsliteAddress(*DsliteAddressDump) ([]*DsliteAddressDetails, error) - DumpNat44Address(*Nat44AddressDump) ([]*Nat44AddressDetails, error) - DumpNat44IdentityMapping(*Nat44IdentityMappingDump) ([]*Nat44IdentityMappingDetails, error) - DumpNat44InterfaceAddr(*Nat44InterfaceAddrDump) ([]*Nat44InterfaceAddrDetails, error) - DumpNat44Interface(*Nat44InterfaceDump) ([]*Nat44InterfaceDetails, error) - DumpNat44InterfaceOutputFeature(*Nat44InterfaceOutputFeatureDump) ([]*Nat44InterfaceOutputFeatureDetails, error) - DumpNat44LbStaticMapping(*Nat44LbStaticMappingDump) ([]*Nat44LbStaticMappingDetails, error) - DumpNat44StaticMapping(*Nat44StaticMappingDump) ([]*Nat44StaticMappingDetails, error) - DumpNat44User(*Nat44UserDump) ([]*Nat44UserDetails, error) - DumpNat44UserSession(*Nat44UserSessionDump) ([]*Nat44UserSessionDetails, error) - DumpNat64Bib(*Nat64BibDump) ([]*Nat64BibDetails, error) - DumpNat64Interface(*Nat64InterfaceDump) ([]*Nat64InterfaceDetails, error) - DumpNat64PoolAddr(*Nat64PoolAddrDump) ([]*Nat64PoolAddrDetails, error) - DumpNat64Prefix(*Nat64PrefixDump) ([]*Nat64PrefixDetails, error) - DumpNat64St(*Nat64StDump) ([]*Nat64StDetails, error) - DumpNat66Interface(*Nat66InterfaceDump) ([]*Nat66InterfaceDetails, error) - DumpNat66StaticMapping(*Nat66StaticMappingDump) ([]*Nat66StaticMappingDetails, error) - DumpNatDetMap(*NatDetMapDump) ([]*NatDetMapDetails, error) - DumpNatDetSession(*NatDetSessionDump) ([]*NatDetSessionDetails, error) - DumpNatReass(*NatReassDump) ([]*NatReassDetails, error) - DumpNatWorker(*NatWorkerDump) ([]*NatWorkerDetails, error) - DsliteAddDelPoolAddrRange(*DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) - DsliteGetAftrAddr(*DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) - DsliteGetB4Addr(*DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) - DsliteSetAftrAddr(*DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) - DsliteSetB4Addr(*DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) - Nat44AddDelAddressRange(*Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) - Nat44AddDelIdentityMapping(*Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) - Nat44AddDelInterfaceAddr(*Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) - Nat44AddDelLbStaticMapping(*Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) - Nat44AddDelStaticMapping(*Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) - Nat44DelSession(*Nat44DelSession) (*Nat44DelSessionReply, error) - Nat44ForwardingEnableDisable(*Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) - Nat44ForwardingIsEnabled(*Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) - Nat44InterfaceAddDelFeature(*Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) - Nat44InterfaceAddDelOutputFeature(*Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) - Nat44LbStaticMappingAddDelLocal(*Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) - Nat64AddDelInterface(*Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) - Nat64AddDelInterfaceAddr(*Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) - Nat64AddDelPoolAddrRange(*Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) - Nat64AddDelPrefix(*Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) - Nat64AddDelStaticBib(*Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) - Nat66AddDelInterface(*Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) - Nat66AddDelStaticMapping(*Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) - NatControlPing(*NatControlPing) (*NatControlPingReply, error) - NatDetAddDelMap(*NatDetAddDelMap) (*NatDetAddDelMapReply, error) - NatDetCloseSessionIn(*NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) - NatDetCloseSessionOut(*NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) - NatDetForward(*NatDetForward) (*NatDetForwardReply, error) - NatDetReverse(*NatDetReverse) (*NatDetReverseReply, error) - NatGetAddrAndPortAllocAlg(*NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) - NatGetMssClamping(*NatGetMssClamping) (*NatGetMssClampingReply, error) - NatGetReass(*NatGetReass) (*NatGetReassReply, error) - NatGetTimeouts(*NatGetTimeouts) (*NatGetTimeoutsReply, error) - NatHaFlush(*NatHaFlush) (*NatHaFlushReply, error) - NatHaGetFailover(*NatHaGetFailover) (*NatHaGetFailoverReply, error) - NatHaGetListener(*NatHaGetListener) (*NatHaGetListenerReply, error) - NatHaResync(*NatHaResync) (*NatHaResyncReply, error) - NatHaSetFailover(*NatHaSetFailover) (*NatHaSetFailoverReply, error) - NatHaSetListener(*NatHaSetListener) (*NatHaSetListenerReply, error) - NatIpfixEnableDisable(*NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) - NatSetAddrAndPortAllocAlg(*NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) - NatSetMssClamping(*NatSetMssClamping) (*NatSetMssClampingReply, error) - NatSetReass(*NatSetReass) (*NatSetReassReply, error) - NatSetTimeouts(*NatSetTimeouts) (*NatSetTimeoutsReply, error) - NatSetWorkers(*NatSetWorkers) (*NatSetWorkersReply, error) - NatShowConfig(*NatShowConfig) (*NatShowConfigReply, error) -} - -/* Enums */ - -// AddressFamily represents VPP binary API enum 'address_family': +// AddressFamily represents VPP binary API enum 'address_family'. type AddressFamily uint32 const ( @@ -104,17 +40,31 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -/* Aliases */ +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} -// IP4Address represents VPP binary API alias 'ip4_address': +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 -// IP6Address represents VPP binary API alias 'ip6_address': +// IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 -/* Types */ - -// Address represents VPP binary API type 'address': +// Address represents VPP binary API type 'address'. type Address struct { Af AddressFamily Un AddressUnion @@ -127,7 +77,7 @@ func (*Address) GetCrcString() string { return "09f11671" } -// IP4Prefix represents VPP binary API type 'ip4_prefix': +// IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -140,7 +90,7 @@ func (*IP4Prefix) GetCrcString() string { return "ea8dc11d" } -// IP6Prefix represents VPP binary API type 'ip6_prefix': +// IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -153,7 +103,7 @@ func (*IP6Prefix) GetCrcString() string { return "779fd64f" } -// Mprefix represents VPP binary API type 'mprefix': +// Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -168,7 +118,7 @@ func (*Mprefix) GetCrcString() string { return "1c4cba05" } -// Nat44LbAddrPort represents VPP binary API type 'nat44_lb_addr_port': +// Nat44LbAddrPort represents VPP binary API type 'nat44_lb_addr_port'. type Nat44LbAddrPort struct { Addr []byte `struc:"[4]byte"` Port uint16 @@ -183,7 +133,7 @@ func (*Nat44LbAddrPort) GetCrcString() string { return "15ce9cd1" } -// Prefix represents VPP binary API type 'prefix': +// Prefix represents VPP binary API type 'prefix'. type Prefix struct { Address Address AddressLength uint8 @@ -196,11 +146,9 @@ func (*Prefix) GetCrcString() string { return "0403aebc" } -/* Unions */ - -// AddressUnion represents VPP binary API union 'address_union': +// AddressUnion represents VPP binary API union 'address_union'. type AddressUnion struct { - Union_data [16]byte + XXX_UnionData [16]byte } func (*AddressUnion) GetTypeName() string { @@ -219,10 +167,10 @@ func (u *AddressUnion) SetIP4(a IP4Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } @@ -236,17 +184,15 @@ func (u *AddressUnion) SetIP6(a IP6Address) { if err := struc.Pack(b, &a); err != nil { return } - copy(u.Union_data[:], b.Bytes()) + copy(u.XXX_UnionData[:], b.Bytes()) } func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.Union_data[:]) + var b = bytes.NewReader(u.XXX_UnionData[:]) struc.Unpack(b, &a) return } -/* Messages */ - -// DsliteAddDelPoolAddrRange represents VPP binary API message 'dslite_add_del_pool_addr_range': +// DsliteAddDelPoolAddrRange represents VPP binary API message 'dslite_add_del_pool_addr_range'. type DsliteAddDelPoolAddrRange struct { StartAddr []byte `struc:"[4]byte"` EndAddr []byte `struc:"[4]byte"` @@ -263,7 +209,7 @@ func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteAddDelPoolAddrRangeReply represents VPP binary API message 'dslite_add_del_pool_addr_range_reply': +// DsliteAddDelPoolAddrRangeReply represents VPP binary API message 'dslite_add_del_pool_addr_range_reply'. type DsliteAddDelPoolAddrRangeReply struct { Retval int32 } @@ -278,7 +224,7 @@ func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteAddressDetails represents VPP binary API message 'dslite_address_details': +// DsliteAddressDetails represents VPP binary API message 'dslite_address_details'. type DsliteAddressDetails struct { IPAddress []byte `struc:"[4]byte"` } @@ -293,7 +239,7 @@ func (*DsliteAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteAddressDump represents VPP binary API message 'dslite_address_dump': +// DsliteAddressDump represents VPP binary API message 'dslite_address_dump'. type DsliteAddressDump struct{} func (*DsliteAddressDump) GetMessageName() string { @@ -306,7 +252,7 @@ func (*DsliteAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetAftrAddr represents VPP binary API message 'dslite_get_aftr_addr': +// DsliteGetAftrAddr represents VPP binary API message 'dslite_get_aftr_addr'. type DsliteGetAftrAddr struct{} func (*DsliteGetAftrAddr) GetMessageName() string { @@ -319,7 +265,7 @@ func (*DsliteGetAftrAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetAftrAddrReply represents VPP binary API message 'dslite_get_aftr_addr_reply': +// DsliteGetAftrAddrReply represents VPP binary API message 'dslite_get_aftr_addr_reply'. type DsliteGetAftrAddrReply struct { Retval int32 IP4Addr []byte `struc:"[4]byte"` @@ -336,7 +282,7 @@ func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteGetB4Addr represents VPP binary API message 'dslite_get_b4_addr': +// DsliteGetB4Addr represents VPP binary API message 'dslite_get_b4_addr'. type DsliteGetB4Addr struct{} func (*DsliteGetB4Addr) GetMessageName() string { @@ -349,7 +295,7 @@ func (*DsliteGetB4Addr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteGetB4AddrReply represents VPP binary API message 'dslite_get_b4_addr_reply': +// DsliteGetB4AddrReply represents VPP binary API message 'dslite_get_b4_addr_reply'. type DsliteGetB4AddrReply struct { Retval int32 IP4Addr []byte `struc:"[4]byte"` @@ -366,7 +312,7 @@ func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteSetAftrAddr represents VPP binary API message 'dslite_set_aftr_addr': +// DsliteSetAftrAddr represents VPP binary API message 'dslite_set_aftr_addr'. type DsliteSetAftrAddr struct { IP4Addr []byte `struc:"[4]byte"` IP6Addr []byte `struc:"[16]byte"` @@ -382,7 +328,7 @@ func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteSetAftrAddrReply represents VPP binary API message 'dslite_set_aftr_addr_reply': +// DsliteSetAftrAddrReply represents VPP binary API message 'dslite_set_aftr_addr_reply'. type DsliteSetAftrAddrReply struct { Retval int32 } @@ -397,7 +343,7 @@ func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DsliteSetB4Addr represents VPP binary API message 'dslite_set_b4_addr': +// DsliteSetB4Addr represents VPP binary API message 'dslite_set_b4_addr'. type DsliteSetB4Addr struct { IP4Addr []byte `struc:"[4]byte"` IP6Addr []byte `struc:"[16]byte"` @@ -413,7 +359,7 @@ func (*DsliteSetB4Addr) GetMessageType() api.MessageType { return api.RequestMessage } -// DsliteSetB4AddrReply represents VPP binary API message 'dslite_set_b4_addr_reply': +// DsliteSetB4AddrReply represents VPP binary API message 'dslite_set_b4_addr_reply'. type DsliteSetB4AddrReply struct { Retval int32 } @@ -428,7 +374,7 @@ func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelAddressRange represents VPP binary API message 'nat44_add_del_address_range': +// Nat44AddDelAddressRange represents VPP binary API message 'nat44_add_del_address_range'. type Nat44AddDelAddressRange struct { FirstIPAddress []byte `struc:"[4]byte"` LastIPAddress []byte `struc:"[4]byte"` @@ -447,7 +393,7 @@ func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelAddressRangeReply represents VPP binary API message 'nat44_add_del_address_range_reply': +// Nat44AddDelAddressRangeReply represents VPP binary API message 'nat44_add_del_address_range_reply'. type Nat44AddDelAddressRangeReply struct { Retval int32 } @@ -462,7 +408,7 @@ func (*Nat44AddDelAddressRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelIdentityMapping represents VPP binary API message 'nat44_add_del_identity_mapping': +// Nat44AddDelIdentityMapping represents VPP binary API message 'nat44_add_del_identity_mapping'. type Nat44AddDelIdentityMapping struct { IsAdd uint8 AddrOnly uint8 @@ -484,7 +430,7 @@ func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelIdentityMappingReply represents VPP binary API message 'nat44_add_del_identity_mapping_reply': +// Nat44AddDelIdentityMappingReply represents VPP binary API message 'nat44_add_del_identity_mapping_reply'. type Nat44AddDelIdentityMappingReply struct { Retval int32 } @@ -499,7 +445,7 @@ func (*Nat44AddDelIdentityMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelInterfaceAddr represents VPP binary API message 'nat44_add_del_interface_addr': +// Nat44AddDelInterfaceAddr represents VPP binary API message 'nat44_add_del_interface_addr'. type Nat44AddDelInterfaceAddr struct { IsAdd uint8 TwiceNat uint8 @@ -516,7 +462,7 @@ func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelInterfaceAddrReply represents VPP binary API message 'nat44_add_del_interface_addr_reply': +// Nat44AddDelInterfaceAddrReply represents VPP binary API message 'nat44_add_del_interface_addr_reply'. type Nat44AddDelInterfaceAddrReply struct { Retval int32 } @@ -531,7 +477,7 @@ func (*Nat44AddDelInterfaceAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelLbStaticMapping represents VPP binary API message 'nat44_add_del_lb_static_mapping': +// Nat44AddDelLbStaticMapping represents VPP binary API message 'nat44_add_del_lb_static_mapping'. type Nat44AddDelLbStaticMapping struct { IsAdd uint8 ExternalAddr []byte `struc:"[4]byte"` @@ -556,7 +502,7 @@ func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelLbStaticMappingReply represents VPP binary API message 'nat44_add_del_lb_static_mapping_reply': +// Nat44AddDelLbStaticMappingReply represents VPP binary API message 'nat44_add_del_lb_static_mapping_reply'. type Nat44AddDelLbStaticMappingReply struct { Retval int32 } @@ -571,7 +517,7 @@ func (*Nat44AddDelLbStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddDelStaticMapping represents VPP binary API message 'nat44_add_del_static_mapping': +// Nat44AddDelStaticMapping represents VPP binary API message 'nat44_add_del_static_mapping'. type Nat44AddDelStaticMapping struct { IsAdd uint8 AddrOnly uint8 @@ -598,7 +544,7 @@ func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44AddDelStaticMappingReply represents VPP binary API message 'nat44_add_del_static_mapping_reply': +// Nat44AddDelStaticMappingReply represents VPP binary API message 'nat44_add_del_static_mapping_reply'. type Nat44AddDelStaticMappingReply struct { Retval int32 } @@ -613,7 +559,7 @@ func (*Nat44AddDelStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddressDetails represents VPP binary API message 'nat44_address_details': +// Nat44AddressDetails represents VPP binary API message 'nat44_address_details'. type Nat44AddressDetails struct { IPAddress []byte `struc:"[4]byte"` TwiceNat uint8 @@ -630,7 +576,7 @@ func (*Nat44AddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44AddressDump represents VPP binary API message 'nat44_address_dump': +// Nat44AddressDump represents VPP binary API message 'nat44_address_dump'. type Nat44AddressDump struct{} func (*Nat44AddressDump) GetMessageName() string { @@ -643,7 +589,7 @@ func (*Nat44AddressDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44DelSession represents VPP binary API message 'nat44_del_session': +// Nat44DelSession represents VPP binary API message 'nat44_del_session'. type Nat44DelSession struct { IsIn uint8 Address []byte `struc:"[4]byte"` @@ -665,7 +611,7 @@ func (*Nat44DelSession) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44DelSessionReply represents VPP binary API message 'nat44_del_session_reply': +// Nat44DelSessionReply represents VPP binary API message 'nat44_del_session_reply'. type Nat44DelSessionReply struct { Retval int32 } @@ -680,7 +626,7 @@ func (*Nat44DelSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44ForwardingEnableDisable represents VPP binary API message 'nat44_forwarding_enable_disable': +// Nat44ForwardingEnableDisable represents VPP binary API message 'nat44_forwarding_enable_disable'. type Nat44ForwardingEnableDisable struct { Enable uint8 } @@ -695,7 +641,7 @@ func (*Nat44ForwardingEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44ForwardingEnableDisableReply represents VPP binary API message 'nat44_forwarding_enable_disable_reply': +// Nat44ForwardingEnableDisableReply represents VPP binary API message 'nat44_forwarding_enable_disable_reply'. type Nat44ForwardingEnableDisableReply struct { Retval int32 } @@ -710,7 +656,7 @@ func (*Nat44ForwardingEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44ForwardingIsEnabled represents VPP binary API message 'nat44_forwarding_is_enabled': +// Nat44ForwardingIsEnabled represents VPP binary API message 'nat44_forwarding_is_enabled'. type Nat44ForwardingIsEnabled struct{} func (*Nat44ForwardingIsEnabled) GetMessageName() string { @@ -723,7 +669,7 @@ func (*Nat44ForwardingIsEnabled) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44ForwardingIsEnabledReply represents VPP binary API message 'nat44_forwarding_is_enabled_reply': +// Nat44ForwardingIsEnabledReply represents VPP binary API message 'nat44_forwarding_is_enabled_reply'. type Nat44ForwardingIsEnabledReply struct { Enabled uint8 } @@ -738,7 +684,7 @@ func (*Nat44ForwardingIsEnabledReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44IdentityMappingDetails represents VPP binary API message 'nat44_identity_mapping_details': +// Nat44IdentityMappingDetails represents VPP binary API message 'nat44_identity_mapping_details'. type Nat44IdentityMappingDetails struct { AddrOnly uint8 IPAddress []byte `struc:"[4]byte"` @@ -759,7 +705,7 @@ func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44IdentityMappingDump represents VPP binary API message 'nat44_identity_mapping_dump': +// Nat44IdentityMappingDump represents VPP binary API message 'nat44_identity_mapping_dump'. type Nat44IdentityMappingDump struct{} func (*Nat44IdentityMappingDump) GetMessageName() string { @@ -772,7 +718,7 @@ func (*Nat44IdentityMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelFeature represents VPP binary API message 'nat44_interface_add_del_feature': +// Nat44InterfaceAddDelFeature represents VPP binary API message 'nat44_interface_add_del_feature'. type Nat44InterfaceAddDelFeature struct { IsAdd uint8 IsInside uint8 @@ -789,7 +735,7 @@ func (*Nat44InterfaceAddDelFeature) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelFeatureReply represents VPP binary API message 'nat44_interface_add_del_feature_reply': +// Nat44InterfaceAddDelFeatureReply represents VPP binary API message 'nat44_interface_add_del_feature_reply'. type Nat44InterfaceAddDelFeatureReply struct { Retval int32 } @@ -804,7 +750,7 @@ func (*Nat44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceAddDelOutputFeature represents VPP binary API message 'nat44_interface_add_del_output_feature': +// Nat44InterfaceAddDelOutputFeature represents VPP binary API message 'nat44_interface_add_del_output_feature'. type Nat44InterfaceAddDelOutputFeature struct { IsAdd uint8 IsInside uint8 @@ -821,7 +767,7 @@ func (*Nat44InterfaceAddDelOutputFeature) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceAddDelOutputFeatureReply represents VPP binary API message 'nat44_interface_add_del_output_feature_reply': +// Nat44InterfaceAddDelOutputFeatureReply represents VPP binary API message 'nat44_interface_add_del_output_feature_reply'. type Nat44InterfaceAddDelOutputFeatureReply struct { Retval int32 } @@ -836,7 +782,7 @@ func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType return api.ReplyMessage } -// Nat44InterfaceAddrDetails represents VPP binary API message 'nat44_interface_addr_details': +// Nat44InterfaceAddrDetails represents VPP binary API message 'nat44_interface_addr_details'. type Nat44InterfaceAddrDetails struct { SwIfIndex uint32 TwiceNat uint8 @@ -852,7 +798,7 @@ func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceAddrDump represents VPP binary API message 'nat44_interface_addr_dump': +// Nat44InterfaceAddrDump represents VPP binary API message 'nat44_interface_addr_dump'. type Nat44InterfaceAddrDump struct{} func (*Nat44InterfaceAddrDump) GetMessageName() string { @@ -865,7 +811,7 @@ func (*Nat44InterfaceAddrDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceDetails represents VPP binary API message 'nat44_interface_details': +// Nat44InterfaceDetails represents VPP binary API message 'nat44_interface_details'. type Nat44InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -881,7 +827,7 @@ func (*Nat44InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceDump represents VPP binary API message 'nat44_interface_dump': +// Nat44InterfaceDump represents VPP binary API message 'nat44_interface_dump'. type Nat44InterfaceDump struct{} func (*Nat44InterfaceDump) GetMessageName() string { @@ -894,7 +840,7 @@ func (*Nat44InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44InterfaceOutputFeatureDetails represents VPP binary API message 'nat44_interface_output_feature_details': +// Nat44InterfaceOutputFeatureDetails represents VPP binary API message 'nat44_interface_output_feature_details'. type Nat44InterfaceOutputFeatureDetails struct { IsInside uint8 SwIfIndex uint32 @@ -910,7 +856,7 @@ func (*Nat44InterfaceOutputFeatureDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44InterfaceOutputFeatureDump represents VPP binary API message 'nat44_interface_output_feature_dump': +// Nat44InterfaceOutputFeatureDump represents VPP binary API message 'nat44_interface_output_feature_dump'. type Nat44InterfaceOutputFeatureDump struct{} func (*Nat44InterfaceOutputFeatureDump) GetMessageName() string { @@ -923,7 +869,7 @@ func (*Nat44InterfaceOutputFeatureDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44LbStaticMappingAddDelLocal represents VPP binary API message 'nat44_lb_static_mapping_add_del_local': +// Nat44LbStaticMappingAddDelLocal represents VPP binary API message 'nat44_lb_static_mapping_add_del_local'. type Nat44LbStaticMappingAddDelLocal struct { IsAdd uint8 ExternalAddr []byte `struc:"[4]byte"` @@ -942,7 +888,7 @@ func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44LbStaticMappingAddDelLocalReply represents VPP binary API message 'nat44_lb_static_mapping_add_del_local_reply': +// Nat44LbStaticMappingAddDelLocalReply represents VPP binary API message 'nat44_lb_static_mapping_add_del_local_reply'. type Nat44LbStaticMappingAddDelLocalReply struct { Retval int32 } @@ -957,7 +903,7 @@ func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44LbStaticMappingDetails represents VPP binary API message 'nat44_lb_static_mapping_details': +// Nat44LbStaticMappingDetails represents VPP binary API message 'nat44_lb_static_mapping_details'. type Nat44LbStaticMappingDetails struct { ExternalAddr []byte `struc:"[4]byte"` ExternalPort uint16 @@ -981,7 +927,7 @@ func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44LbStaticMappingDump represents VPP binary API message 'nat44_lb_static_mapping_dump': +// Nat44LbStaticMappingDump represents VPP binary API message 'nat44_lb_static_mapping_dump'. type Nat44LbStaticMappingDump struct{} func (*Nat44LbStaticMappingDump) GetMessageName() string { @@ -994,7 +940,7 @@ func (*Nat44LbStaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44StaticMappingDetails represents VPP binary API message 'nat44_static_mapping_details': +// Nat44StaticMappingDetails represents VPP binary API message 'nat44_static_mapping_details'. type Nat44StaticMappingDetails struct { AddrOnly uint8 LocalIPAddress []byte `struc:"[4]byte"` @@ -1020,7 +966,7 @@ func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44StaticMappingDump represents VPP binary API message 'nat44_static_mapping_dump': +// Nat44StaticMappingDump represents VPP binary API message 'nat44_static_mapping_dump'. type Nat44StaticMappingDump struct{} func (*Nat44StaticMappingDump) GetMessageName() string { @@ -1033,7 +979,7 @@ func (*Nat44StaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44UserDetails represents VPP binary API message 'nat44_user_details': +// Nat44UserDetails represents VPP binary API message 'nat44_user_details'. type Nat44UserDetails struct { VrfID uint32 IPAddress []byte `struc:"[4]byte"` @@ -1051,7 +997,7 @@ func (*Nat44UserDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44UserDump represents VPP binary API message 'nat44_user_dump': +// Nat44UserDump represents VPP binary API message 'nat44_user_dump'. type Nat44UserDump struct{} func (*Nat44UserDump) GetMessageName() string { @@ -1064,7 +1010,7 @@ func (*Nat44UserDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat44UserSessionDetails represents VPP binary API message 'nat44_user_session_details': +// Nat44UserSessionDetails represents VPP binary API message 'nat44_user_session_details'. type Nat44UserSessionDetails struct { OutsideIPAddress []byte `struc:"[4]byte"` OutsidePort uint16 @@ -1093,7 +1039,7 @@ func (*Nat44UserSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat44UserSessionDump represents VPP binary API message 'nat44_user_session_dump': +// Nat44UserSessionDump represents VPP binary API message 'nat44_user_session_dump'. type Nat44UserSessionDump struct { IPAddress []byte `struc:"[4]byte"` VrfID uint32 @@ -1109,7 +1055,7 @@ func (*Nat44UserSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterface represents VPP binary API message 'nat64_add_del_interface': +// Nat64AddDelInterface represents VPP binary API message 'nat64_add_del_interface'. type Nat64AddDelInterface struct { SwIfIndex uint32 IsInside uint8 @@ -1126,7 +1072,7 @@ func (*Nat64AddDelInterface) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterfaceAddr represents VPP binary API message 'nat64_add_del_interface_addr': +// Nat64AddDelInterfaceAddr represents VPP binary API message 'nat64_add_del_interface_addr'. type Nat64AddDelInterfaceAddr struct { IsAdd uint8 IsInside uint8 @@ -1143,7 +1089,7 @@ func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelInterfaceAddrReply represents VPP binary API message 'nat64_add_del_interface_addr_reply': +// Nat64AddDelInterfaceAddrReply represents VPP binary API message 'nat64_add_del_interface_addr_reply'. type Nat64AddDelInterfaceAddrReply struct { Retval int32 } @@ -1158,7 +1104,7 @@ func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelInterfaceReply represents VPP binary API message 'nat64_add_del_interface_reply': +// Nat64AddDelInterfaceReply represents VPP binary API message 'nat64_add_del_interface_reply'. type Nat64AddDelInterfaceReply struct { Retval int32 } @@ -1173,7 +1119,7 @@ func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelPoolAddrRange represents VPP binary API message 'nat64_add_del_pool_addr_range': +// Nat64AddDelPoolAddrRange represents VPP binary API message 'nat64_add_del_pool_addr_range'. type Nat64AddDelPoolAddrRange struct { StartAddr []byte `struc:"[4]byte"` EndAddr []byte `struc:"[4]byte"` @@ -1191,7 +1137,7 @@ func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelPoolAddrRangeReply represents VPP binary API message 'nat64_add_del_pool_addr_range_reply': +// Nat64AddDelPoolAddrRangeReply represents VPP binary API message 'nat64_add_del_pool_addr_range_reply'. type Nat64AddDelPoolAddrRangeReply struct { Retval int32 } @@ -1206,7 +1152,7 @@ func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelPrefix represents VPP binary API message 'nat64_add_del_prefix': +// Nat64AddDelPrefix represents VPP binary API message 'nat64_add_del_prefix'. type Nat64AddDelPrefix struct { Prefix []byte `struc:"[16]byte"` PrefixLen uint8 @@ -1224,7 +1170,7 @@ func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelPrefixReply represents VPP binary API message 'nat64_add_del_prefix_reply': +// Nat64AddDelPrefixReply represents VPP binary API message 'nat64_add_del_prefix_reply'. type Nat64AddDelPrefixReply struct { Retval int32 } @@ -1239,7 +1185,7 @@ func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64AddDelStaticBib represents VPP binary API message 'nat64_add_del_static_bib': +// Nat64AddDelStaticBib represents VPP binary API message 'nat64_add_del_static_bib'. type Nat64AddDelStaticBib struct { IAddr []byte `struc:"[16]byte"` OAddr []byte `struc:"[4]byte"` @@ -1260,7 +1206,7 @@ func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64AddDelStaticBibReply represents VPP binary API message 'nat64_add_del_static_bib_reply': +// Nat64AddDelStaticBibReply represents VPP binary API message 'nat64_add_del_static_bib_reply'. type Nat64AddDelStaticBibReply struct { Retval int32 } @@ -1275,7 +1221,7 @@ func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64BibDetails represents VPP binary API message 'nat64_bib_details': +// Nat64BibDetails represents VPP binary API message 'nat64_bib_details'. type Nat64BibDetails struct { IAddr []byte `struc:"[16]byte"` OAddr []byte `struc:"[4]byte"` @@ -1297,7 +1243,7 @@ func (*Nat64BibDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64BibDump represents VPP binary API message 'nat64_bib_dump': +// Nat64BibDump represents VPP binary API message 'nat64_bib_dump'. type Nat64BibDump struct { Proto uint8 } @@ -1312,7 +1258,7 @@ func (*Nat64BibDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64InterfaceDetails represents VPP binary API message 'nat64_interface_details': +// Nat64InterfaceDetails represents VPP binary API message 'nat64_interface_details'. type Nat64InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -1328,7 +1274,7 @@ func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64InterfaceDump represents VPP binary API message 'nat64_interface_dump': +// Nat64InterfaceDump represents VPP binary API message 'nat64_interface_dump'. type Nat64InterfaceDump struct{} func (*Nat64InterfaceDump) GetMessageName() string { @@ -1341,7 +1287,7 @@ func (*Nat64InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64PoolAddrDetails represents VPP binary API message 'nat64_pool_addr_details': +// Nat64PoolAddrDetails represents VPP binary API message 'nat64_pool_addr_details'. type Nat64PoolAddrDetails struct { Address []byte `struc:"[4]byte"` VrfID uint32 @@ -1357,7 +1303,7 @@ func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64PoolAddrDump represents VPP binary API message 'nat64_pool_addr_dump': +// Nat64PoolAddrDump represents VPP binary API message 'nat64_pool_addr_dump'. type Nat64PoolAddrDump struct{} func (*Nat64PoolAddrDump) GetMessageName() string { @@ -1370,7 +1316,7 @@ func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64PrefixDetails represents VPP binary API message 'nat64_prefix_details': +// Nat64PrefixDetails represents VPP binary API message 'nat64_prefix_details'. type Nat64PrefixDetails struct { Prefix []byte `struc:"[16]byte"` PrefixLen uint8 @@ -1387,7 +1333,7 @@ func (*Nat64PrefixDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64PrefixDump represents VPP binary API message 'nat64_prefix_dump': +// Nat64PrefixDump represents VPP binary API message 'nat64_prefix_dump'. type Nat64PrefixDump struct{} func (*Nat64PrefixDump) GetMessageName() string { @@ -1400,7 +1346,7 @@ func (*Nat64PrefixDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat64StDetails represents VPP binary API message 'nat64_st_details': +// Nat64StDetails represents VPP binary API message 'nat64_st_details'. type Nat64StDetails struct { IlAddr []byte `struc:"[16]byte"` OlAddr []byte `struc:"[4]byte"` @@ -1423,7 +1369,7 @@ func (*Nat64StDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat64StDump represents VPP binary API message 'nat64_st_dump': +// Nat64StDump represents VPP binary API message 'nat64_st_dump'. type Nat64StDump struct { Proto uint8 } @@ -1438,7 +1384,7 @@ func (*Nat64StDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelInterface represents VPP binary API message 'nat66_add_del_interface': +// Nat66AddDelInterface represents VPP binary API message 'nat66_add_del_interface'. type Nat66AddDelInterface struct { IsAdd uint8 IsInside uint8 @@ -1455,7 +1401,7 @@ func (*Nat66AddDelInterface) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelInterfaceReply represents VPP binary API message 'nat66_add_del_interface_reply': +// Nat66AddDelInterfaceReply represents VPP binary API message 'nat66_add_del_interface_reply'. type Nat66AddDelInterfaceReply struct { Retval int32 } @@ -1470,7 +1416,7 @@ func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66AddDelStaticMapping represents VPP binary API message 'nat66_add_del_static_mapping': +// Nat66AddDelStaticMapping represents VPP binary API message 'nat66_add_del_static_mapping'. type Nat66AddDelStaticMapping struct { IsAdd uint8 LocalIPAddress []byte `struc:"[16]byte"` @@ -1488,7 +1434,7 @@ func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66AddDelStaticMappingReply represents VPP binary API message 'nat66_add_del_static_mapping_reply': +// Nat66AddDelStaticMappingReply represents VPP binary API message 'nat66_add_del_static_mapping_reply'. type Nat66AddDelStaticMappingReply struct { Retval int32 } @@ -1503,7 +1449,7 @@ func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66InterfaceDetails represents VPP binary API message 'nat66_interface_details': +// Nat66InterfaceDetails represents VPP binary API message 'nat66_interface_details'. type Nat66InterfaceDetails struct { IsInside uint8 SwIfIndex uint32 @@ -1519,7 +1465,7 @@ func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66InterfaceDump represents VPP binary API message 'nat66_interface_dump': +// Nat66InterfaceDump represents VPP binary API message 'nat66_interface_dump'. type Nat66InterfaceDump struct{} func (*Nat66InterfaceDump) GetMessageName() string { @@ -1532,7 +1478,7 @@ func (*Nat66InterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } -// Nat66StaticMappingDetails represents VPP binary API message 'nat66_static_mapping_details': +// Nat66StaticMappingDetails represents VPP binary API message 'nat66_static_mapping_details'. type Nat66StaticMappingDetails struct { LocalIPAddress []byte `struc:"[16]byte"` ExternalIPAddress []byte `struc:"[16]byte"` @@ -1551,7 +1497,7 @@ func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// Nat66StaticMappingDump represents VPP binary API message 'nat66_static_mapping_dump': +// Nat66StaticMappingDump represents VPP binary API message 'nat66_static_mapping_dump'. type Nat66StaticMappingDump struct{} func (*Nat66StaticMappingDump) GetMessageName() string { @@ -1564,7 +1510,7 @@ func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatControlPing represents VPP binary API message 'nat_control_ping': +// NatControlPing represents VPP binary API message 'nat_control_ping'. type NatControlPing struct{} func (*NatControlPing) GetMessageName() string { @@ -1577,7 +1523,7 @@ func (*NatControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// NatControlPingReply represents VPP binary API message 'nat_control_ping_reply': +// NatControlPingReply represents VPP binary API message 'nat_control_ping_reply'. type NatControlPingReply struct { Retval int32 ClientIndex uint32 @@ -1594,7 +1540,7 @@ func (*NatControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetAddDelMap represents VPP binary API message 'nat_det_add_del_map': +// NatDetAddDelMap represents VPP binary API message 'nat_det_add_del_map'. type NatDetAddDelMap struct { IsAdd uint8 IsNat44 uint8 @@ -1615,7 +1561,7 @@ func (*NatDetAddDelMap) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetAddDelMapReply represents VPP binary API message 'nat_det_add_del_map_reply': +// NatDetAddDelMapReply represents VPP binary API message 'nat_det_add_del_map_reply'. type NatDetAddDelMapReply struct { Retval int32 } @@ -1630,7 +1576,7 @@ func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetCloseSessionIn represents VPP binary API message 'nat_det_close_session_in': +// NatDetCloseSessionIn represents VPP binary API message 'nat_det_close_session_in'. type NatDetCloseSessionIn struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1649,7 +1595,7 @@ func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetCloseSessionInReply represents VPP binary API message 'nat_det_close_session_in_reply': +// NatDetCloseSessionInReply represents VPP binary API message 'nat_det_close_session_in_reply'. type NatDetCloseSessionInReply struct { Retval int32 } @@ -1664,7 +1610,7 @@ func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetCloseSessionOut represents VPP binary API message 'nat_det_close_session_out': +// NatDetCloseSessionOut represents VPP binary API message 'nat_det_close_session_out'. type NatDetCloseSessionOut struct { OutAddr []byte `struc:"[4]byte"` OutPort uint16 @@ -1682,7 +1628,7 @@ func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetCloseSessionOutReply represents VPP binary API message 'nat_det_close_session_out_reply': +// NatDetCloseSessionOutReply represents VPP binary API message 'nat_det_close_session_out_reply'. type NatDetCloseSessionOutReply struct { Retval int32 } @@ -1697,7 +1643,7 @@ func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetForward represents VPP binary API message 'nat_det_forward': +// NatDetForward represents VPP binary API message 'nat_det_forward'. type NatDetForward struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1713,7 +1659,7 @@ func (*NatDetForward) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetForwardReply represents VPP binary API message 'nat_det_forward_reply': +// NatDetForwardReply represents VPP binary API message 'nat_det_forward_reply'. type NatDetForwardReply struct { Retval int32 OutPortLo uint16 @@ -1731,7 +1677,7 @@ func (*NatDetForwardReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetMapDetails represents VPP binary API message 'nat_det_map_details': +// NatDetMapDetails represents VPP binary API message 'nat_det_map_details'. type NatDetMapDetails struct { IsNat44 uint8 InAddr []byte `struc:"[16]byte"` @@ -1753,7 +1699,7 @@ func (*NatDetMapDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetMapDump represents VPP binary API message 'nat_det_map_dump': +// NatDetMapDump represents VPP binary API message 'nat_det_map_dump'. type NatDetMapDump struct{} func (*NatDetMapDump) GetMessageName() string { @@ -1766,7 +1712,7 @@ func (*NatDetMapDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetReverse represents VPP binary API message 'nat_det_reverse': +// NatDetReverse represents VPP binary API message 'nat_det_reverse'. type NatDetReverse struct { OutPort uint16 OutAddr []byte `struc:"[4]byte"` @@ -1782,7 +1728,7 @@ func (*NatDetReverse) GetMessageType() api.MessageType { return api.RequestMessage } -// NatDetReverseReply represents VPP binary API message 'nat_det_reverse_reply': +// NatDetReverseReply represents VPP binary API message 'nat_det_reverse_reply'. type NatDetReverseReply struct { Retval int32 IsNat44 uint8 @@ -1799,7 +1745,7 @@ func (*NatDetReverseReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetSessionDetails represents VPP binary API message 'nat_det_session_details': +// NatDetSessionDetails represents VPP binary API message 'nat_det_session_details'. type NatDetSessionDetails struct { InPort uint16 ExtAddr []byte `struc:"[4]byte"` @@ -1819,7 +1765,7 @@ func (*NatDetSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatDetSessionDump represents VPP binary API message 'nat_det_session_dump': +// NatDetSessionDump represents VPP binary API message 'nat_det_session_dump'. type NatDetSessionDump struct { IsNat44 uint8 UserAddr []byte `struc:"[16]byte"` @@ -1835,7 +1781,7 @@ func (*NatDetSessionDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetAddrAndPortAllocAlg represents VPP binary API message 'nat_get_addr_and_port_alloc_alg': +// NatGetAddrAndPortAllocAlg represents VPP binary API message 'nat_get_addr_and_port_alloc_alg'. type NatGetAddrAndPortAllocAlg struct{} func (*NatGetAddrAndPortAllocAlg) GetMessageName() string { @@ -1848,7 +1794,7 @@ func (*NatGetAddrAndPortAllocAlg) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_get_addr_and_port_alloc_alg_reply': +// NatGetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_get_addr_and_port_alloc_alg_reply'. type NatGetAddrAndPortAllocAlgReply struct { Retval int32 Alg uint8 @@ -1869,7 +1815,7 @@ func (*NatGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetMssClamping represents VPP binary API message 'nat_get_mss_clamping': +// NatGetMssClamping represents VPP binary API message 'nat_get_mss_clamping'. type NatGetMssClamping struct{} func (*NatGetMssClamping) GetMessageName() string { @@ -1882,7 +1828,7 @@ func (*NatGetMssClamping) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetMssClampingReply represents VPP binary API message 'nat_get_mss_clamping_reply': +// NatGetMssClampingReply represents VPP binary API message 'nat_get_mss_clamping_reply'. type NatGetMssClampingReply struct { Retval int32 MssValue uint16 @@ -1899,7 +1845,7 @@ func (*NatGetMssClampingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetReass represents VPP binary API message 'nat_get_reass': +// NatGetReass represents VPP binary API message 'nat_get_reass'. type NatGetReass struct{} func (*NatGetReass) GetMessageName() string { @@ -1912,7 +1858,7 @@ func (*NatGetReass) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetReassReply represents VPP binary API message 'nat_get_reass_reply': +// NatGetReassReply represents VPP binary API message 'nat_get_reass_reply'. type NatGetReassReply struct { Retval int32 IP4Timeout uint32 @@ -1935,7 +1881,7 @@ func (*NatGetReassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatGetTimeouts represents VPP binary API message 'nat_get_timeouts': +// NatGetTimeouts represents VPP binary API message 'nat_get_timeouts'. type NatGetTimeouts struct{} func (*NatGetTimeouts) GetMessageName() string { @@ -1948,7 +1894,7 @@ func (*NatGetTimeouts) GetMessageType() api.MessageType { return api.RequestMessage } -// NatGetTimeoutsReply represents VPP binary API message 'nat_get_timeouts_reply': +// NatGetTimeoutsReply represents VPP binary API message 'nat_get_timeouts_reply'. type NatGetTimeoutsReply struct { Retval int32 UDP uint32 @@ -1967,7 +1913,7 @@ func (*NatGetTimeoutsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaFlush represents VPP binary API message 'nat_ha_flush': +// NatHaFlush represents VPP binary API message 'nat_ha_flush'. type NatHaFlush struct{} func (*NatHaFlush) GetMessageName() string { @@ -1980,7 +1926,7 @@ func (*NatHaFlush) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaFlushReply represents VPP binary API message 'nat_ha_flush_reply': +// NatHaFlushReply represents VPP binary API message 'nat_ha_flush_reply'. type NatHaFlushReply struct { Retval int32 } @@ -1995,7 +1941,7 @@ func (*NatHaFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaGetFailover represents VPP binary API message 'nat_ha_get_failover': +// NatHaGetFailover represents VPP binary API message 'nat_ha_get_failover'. type NatHaGetFailover struct{} func (*NatHaGetFailover) GetMessageName() string { @@ -2008,7 +1954,7 @@ func (*NatHaGetFailover) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaGetFailoverReply represents VPP binary API message 'nat_ha_get_failover_reply': +// NatHaGetFailoverReply represents VPP binary API message 'nat_ha_get_failover_reply'. type NatHaGetFailoverReply struct { Retval int32 IPAddress IP4Address @@ -2026,7 +1972,7 @@ func (*NatHaGetFailoverReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaGetListener represents VPP binary API message 'nat_ha_get_listener': +// NatHaGetListener represents VPP binary API message 'nat_ha_get_listener'. type NatHaGetListener struct{} func (*NatHaGetListener) GetMessageName() string { @@ -2039,7 +1985,7 @@ func (*NatHaGetListener) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaGetListenerReply represents VPP binary API message 'nat_ha_get_listener_reply': +// NatHaGetListenerReply represents VPP binary API message 'nat_ha_get_listener_reply'. type NatHaGetListenerReply struct { Retval int32 IPAddress IP4Address @@ -2057,7 +2003,7 @@ func (*NatHaGetListenerReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaResync represents VPP binary API message 'nat_ha_resync': +// NatHaResync represents VPP binary API message 'nat_ha_resync'. type NatHaResync struct { WantResyncEvent uint8 PID uint32 @@ -2073,7 +2019,7 @@ func (*NatHaResync) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaResyncCompletedEvent represents VPP binary API message 'nat_ha_resync_completed_event': +// NatHaResyncCompletedEvent represents VPP binary API message 'nat_ha_resync_completed_event'. type NatHaResyncCompletedEvent struct { PID uint32 MissedCount uint32 @@ -2089,7 +2035,7 @@ func (*NatHaResyncCompletedEvent) GetMessageType() api.MessageType { return api.EventMessage } -// NatHaResyncReply represents VPP binary API message 'nat_ha_resync_reply': +// NatHaResyncReply represents VPP binary API message 'nat_ha_resync_reply'. type NatHaResyncReply struct { Retval int32 } @@ -2104,7 +2050,7 @@ func (*NatHaResyncReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaSetFailover represents VPP binary API message 'nat_ha_set_failover': +// NatHaSetFailover represents VPP binary API message 'nat_ha_set_failover'. type NatHaSetFailover struct { IPAddress IP4Address Port uint16 @@ -2121,7 +2067,7 @@ func (*NatHaSetFailover) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaSetFailoverReply represents VPP binary API message 'nat_ha_set_failover_reply': +// NatHaSetFailoverReply represents VPP binary API message 'nat_ha_set_failover_reply'. type NatHaSetFailoverReply struct { Retval int32 } @@ -2136,7 +2082,7 @@ func (*NatHaSetFailoverReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatHaSetListener represents VPP binary API message 'nat_ha_set_listener': +// NatHaSetListener represents VPP binary API message 'nat_ha_set_listener'. type NatHaSetListener struct { IPAddress IP4Address Port uint16 @@ -2153,7 +2099,7 @@ func (*NatHaSetListener) GetMessageType() api.MessageType { return api.RequestMessage } -// NatHaSetListenerReply represents VPP binary API message 'nat_ha_set_listener_reply': +// NatHaSetListenerReply represents VPP binary API message 'nat_ha_set_listener_reply'. type NatHaSetListenerReply struct { Retval int32 } @@ -2168,7 +2114,7 @@ func (*NatHaSetListenerReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatIpfixEnableDisable represents VPP binary API message 'nat_ipfix_enable_disable': +// NatIpfixEnableDisable represents VPP binary API message 'nat_ipfix_enable_disable'. type NatIpfixEnableDisable struct { DomainID uint32 SrcPort uint16 @@ -2185,7 +2131,7 @@ func (*NatIpfixEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// NatIpfixEnableDisableReply represents VPP binary API message 'nat_ipfix_enable_disable_reply': +// NatIpfixEnableDisableReply represents VPP binary API message 'nat_ipfix_enable_disable_reply'. type NatIpfixEnableDisableReply struct { Retval int32 } @@ -2200,7 +2146,7 @@ func (*NatIpfixEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatReassDetails represents VPP binary API message 'nat_reass_details': +// NatReassDetails represents VPP binary API message 'nat_reass_details'. type NatReassDetails struct { IsIP4 uint8 SrcAddr []byte `struc:"[16]byte"` @@ -2220,7 +2166,7 @@ func (*NatReassDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatReassDump represents VPP binary API message 'nat_reass_dump': +// NatReassDump represents VPP binary API message 'nat_reass_dump'. type NatReassDump struct{} func (*NatReassDump) GetMessageName() string { @@ -2233,7 +2179,7 @@ func (*NatReassDump) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetAddrAndPortAllocAlg represents VPP binary API message 'nat_set_addr_and_port_alloc_alg': +// NatSetAddrAndPortAllocAlg represents VPP binary API message 'nat_set_addr_and_port_alloc_alg'. type NatSetAddrAndPortAllocAlg struct { Alg uint8 PsidOffset uint8 @@ -2253,7 +2199,7 @@ func (*NatSetAddrAndPortAllocAlg) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_set_addr_and_port_alloc_alg_reply': +// NatSetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_set_addr_and_port_alloc_alg_reply'. type NatSetAddrAndPortAllocAlgReply struct { Retval int32 } @@ -2268,7 +2214,7 @@ func (*NatSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetMssClamping represents VPP binary API message 'nat_set_mss_clamping': +// NatSetMssClamping represents VPP binary API message 'nat_set_mss_clamping'. type NatSetMssClamping struct { MssValue uint16 Enable uint8 @@ -2284,7 +2230,7 @@ func (*NatSetMssClamping) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetMssClampingReply represents VPP binary API message 'nat_set_mss_clamping_reply': +// NatSetMssClampingReply represents VPP binary API message 'nat_set_mss_clamping_reply'. type NatSetMssClampingReply struct { Retval int32 } @@ -2299,7 +2245,7 @@ func (*NatSetMssClampingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetReass represents VPP binary API message 'nat_set_reass': +// NatSetReass represents VPP binary API message 'nat_set_reass'. type NatSetReass struct { Timeout uint32 MaxReass uint16 @@ -2318,7 +2264,7 @@ func (*NatSetReass) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetReassReply represents VPP binary API message 'nat_set_reass_reply': +// NatSetReassReply represents VPP binary API message 'nat_set_reass_reply'. type NatSetReassReply struct { Retval int32 } @@ -2333,7 +2279,7 @@ func (*NatSetReassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetTimeouts represents VPP binary API message 'nat_set_timeouts': +// NatSetTimeouts represents VPP binary API message 'nat_set_timeouts'. type NatSetTimeouts struct { UDP uint32 TCPEstablished uint32 @@ -2351,7 +2297,7 @@ func (*NatSetTimeouts) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetTimeoutsReply represents VPP binary API message 'nat_set_timeouts_reply': +// NatSetTimeoutsReply represents VPP binary API message 'nat_set_timeouts_reply'. type NatSetTimeoutsReply struct { Retval int32 } @@ -2366,7 +2312,7 @@ func (*NatSetTimeoutsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatSetWorkers represents VPP binary API message 'nat_set_workers': +// NatSetWorkers represents VPP binary API message 'nat_set_workers'. type NatSetWorkers struct { WorkerMask uint64 } @@ -2381,7 +2327,7 @@ func (*NatSetWorkers) GetMessageType() api.MessageType { return api.RequestMessage } -// NatSetWorkersReply represents VPP binary API message 'nat_set_workers_reply': +// NatSetWorkersReply represents VPP binary API message 'nat_set_workers_reply'. type NatSetWorkersReply struct { Retval int32 } @@ -2396,7 +2342,7 @@ func (*NatSetWorkersReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatShowConfig represents VPP binary API message 'nat_show_config': +// NatShowConfig represents VPP binary API message 'nat_show_config'. type NatShowConfig struct{} func (*NatShowConfig) GetMessageName() string { @@ -2409,7 +2355,7 @@ func (*NatShowConfig) GetMessageType() api.MessageType { return api.RequestMessage } -// NatShowConfigReply represents VPP binary API message 'nat_show_config_reply': +// NatShowConfigReply represents VPP binary API message 'nat_show_config_reply'. type NatShowConfigReply struct { Retval int32 StaticMappingOnly uint8 @@ -2441,7 +2387,7 @@ func (*NatShowConfigReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatWorkerDetails represents VPP binary API message 'nat_worker_details': +// NatWorkerDetails represents VPP binary API message 'nat_worker_details'. type NatWorkerDetails struct { WorkerIndex uint32 LcoreID uint32 @@ -2458,7 +2404,7 @@ func (*NatWorkerDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// NatWorkerDump represents VPP binary API message 'nat_worker_dump': +// NatWorkerDump represents VPP binary API message 'nat_worker_dump'. type NatWorkerDump struct{} func (*NatWorkerDump) GetMessageName() string { @@ -2609,140 +2555,1196 @@ func init() { api.RegisterMessage((*NatWorkerDump)(nil), "nat.NatWorkerDump") } -var Messages = []api.Message{ - (*DsliteAddDelPoolAddrRange)(nil), - (*DsliteAddDelPoolAddrRangeReply)(nil), - (*DsliteAddressDetails)(nil), - (*DsliteAddressDump)(nil), - (*DsliteGetAftrAddr)(nil), - (*DsliteGetAftrAddrReply)(nil), - (*DsliteGetB4Addr)(nil), - (*DsliteGetB4AddrReply)(nil), - (*DsliteSetAftrAddr)(nil), - (*DsliteSetAftrAddrReply)(nil), - (*DsliteSetB4Addr)(nil), - (*DsliteSetB4AddrReply)(nil), - (*Nat44AddDelAddressRange)(nil), - (*Nat44AddDelAddressRangeReply)(nil), - (*Nat44AddDelIdentityMapping)(nil), - (*Nat44AddDelIdentityMappingReply)(nil), - (*Nat44AddDelInterfaceAddr)(nil), - (*Nat44AddDelInterfaceAddrReply)(nil), - (*Nat44AddDelLbStaticMapping)(nil), - (*Nat44AddDelLbStaticMappingReply)(nil), - (*Nat44AddDelStaticMapping)(nil), - (*Nat44AddDelStaticMappingReply)(nil), - (*Nat44AddressDetails)(nil), - (*Nat44AddressDump)(nil), - (*Nat44DelSession)(nil), - (*Nat44DelSessionReply)(nil), - (*Nat44ForwardingEnableDisable)(nil), - (*Nat44ForwardingEnableDisableReply)(nil), - (*Nat44ForwardingIsEnabled)(nil), - (*Nat44ForwardingIsEnabledReply)(nil), - (*Nat44IdentityMappingDetails)(nil), - (*Nat44IdentityMappingDump)(nil), - (*Nat44InterfaceAddDelFeature)(nil), - (*Nat44InterfaceAddDelFeatureReply)(nil), - (*Nat44InterfaceAddDelOutputFeature)(nil), - (*Nat44InterfaceAddDelOutputFeatureReply)(nil), - (*Nat44InterfaceAddrDetails)(nil), - (*Nat44InterfaceAddrDump)(nil), - (*Nat44InterfaceDetails)(nil), - (*Nat44InterfaceDump)(nil), - (*Nat44InterfaceOutputFeatureDetails)(nil), - (*Nat44InterfaceOutputFeatureDump)(nil), - (*Nat44LbStaticMappingAddDelLocal)(nil), - (*Nat44LbStaticMappingAddDelLocalReply)(nil), - (*Nat44LbStaticMappingDetails)(nil), - (*Nat44LbStaticMappingDump)(nil), - (*Nat44StaticMappingDetails)(nil), - (*Nat44StaticMappingDump)(nil), - (*Nat44UserDetails)(nil), - (*Nat44UserDump)(nil), - (*Nat44UserSessionDetails)(nil), - (*Nat44UserSessionDump)(nil), - (*Nat64AddDelInterface)(nil), - (*Nat64AddDelInterfaceAddr)(nil), - (*Nat64AddDelInterfaceAddrReply)(nil), - (*Nat64AddDelInterfaceReply)(nil), - (*Nat64AddDelPoolAddrRange)(nil), - (*Nat64AddDelPoolAddrRangeReply)(nil), - (*Nat64AddDelPrefix)(nil), - (*Nat64AddDelPrefixReply)(nil), - (*Nat64AddDelStaticBib)(nil), - (*Nat64AddDelStaticBibReply)(nil), - (*Nat64BibDetails)(nil), - (*Nat64BibDump)(nil), - (*Nat64InterfaceDetails)(nil), - (*Nat64InterfaceDump)(nil), - (*Nat64PoolAddrDetails)(nil), - (*Nat64PoolAddrDump)(nil), - (*Nat64PrefixDetails)(nil), - (*Nat64PrefixDump)(nil), - (*Nat64StDetails)(nil), - (*Nat64StDump)(nil), - (*Nat66AddDelInterface)(nil), - (*Nat66AddDelInterfaceReply)(nil), - (*Nat66AddDelStaticMapping)(nil), - (*Nat66AddDelStaticMappingReply)(nil), - (*Nat66InterfaceDetails)(nil), - (*Nat66InterfaceDump)(nil), - (*Nat66StaticMappingDetails)(nil), - (*Nat66StaticMappingDump)(nil), - (*NatControlPing)(nil), - (*NatControlPingReply)(nil), - (*NatDetAddDelMap)(nil), - (*NatDetAddDelMapReply)(nil), - (*NatDetCloseSessionIn)(nil), - (*NatDetCloseSessionInReply)(nil), - (*NatDetCloseSessionOut)(nil), - (*NatDetCloseSessionOutReply)(nil), - (*NatDetForward)(nil), - (*NatDetForwardReply)(nil), - (*NatDetMapDetails)(nil), - (*NatDetMapDump)(nil), - (*NatDetReverse)(nil), - (*NatDetReverseReply)(nil), - (*NatDetSessionDetails)(nil), - (*NatDetSessionDump)(nil), - (*NatGetAddrAndPortAllocAlg)(nil), - (*NatGetAddrAndPortAllocAlgReply)(nil), - (*NatGetMssClamping)(nil), - (*NatGetMssClampingReply)(nil), - (*NatGetReass)(nil), - (*NatGetReassReply)(nil), - (*NatGetTimeouts)(nil), - (*NatGetTimeoutsReply)(nil), - (*NatHaFlush)(nil), - (*NatHaFlushReply)(nil), - (*NatHaGetFailover)(nil), - (*NatHaGetFailoverReply)(nil), - (*NatHaGetListener)(nil), - (*NatHaGetListenerReply)(nil), - (*NatHaResync)(nil), - (*NatHaResyncCompletedEvent)(nil), - (*NatHaResyncReply)(nil), - (*NatHaSetFailover)(nil), - (*NatHaSetFailoverReply)(nil), - (*NatHaSetListener)(nil), - (*NatHaSetListenerReply)(nil), - (*NatIpfixEnableDisable)(nil), - (*NatIpfixEnableDisableReply)(nil), - (*NatReassDetails)(nil), - (*NatReassDump)(nil), - (*NatSetAddrAndPortAllocAlg)(nil), - (*NatSetAddrAndPortAllocAlgReply)(nil), - (*NatSetMssClamping)(nil), - (*NatSetMssClampingReply)(nil), - (*NatSetReass)(nil), - (*NatSetReassReply)(nil), - (*NatSetTimeouts)(nil), - (*NatSetTimeoutsReply)(nil), - (*NatSetWorkers)(nil), - (*NatSetWorkersReply)(nil), - (*NatShowConfig)(nil), - (*NatShowConfigReply)(nil), - (*NatWorkerDetails)(nil), - (*NatWorkerDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DsliteAddDelPoolAddrRange)(nil), + (*DsliteAddDelPoolAddrRangeReply)(nil), + (*DsliteAddressDetails)(nil), + (*DsliteAddressDump)(nil), + (*DsliteGetAftrAddr)(nil), + (*DsliteGetAftrAddrReply)(nil), + (*DsliteGetB4Addr)(nil), + (*DsliteGetB4AddrReply)(nil), + (*DsliteSetAftrAddr)(nil), + (*DsliteSetAftrAddrReply)(nil), + (*DsliteSetB4Addr)(nil), + (*DsliteSetB4AddrReply)(nil), + (*Nat44AddDelAddressRange)(nil), + (*Nat44AddDelAddressRangeReply)(nil), + (*Nat44AddDelIdentityMapping)(nil), + (*Nat44AddDelIdentityMappingReply)(nil), + (*Nat44AddDelInterfaceAddr)(nil), + (*Nat44AddDelInterfaceAddrReply)(nil), + (*Nat44AddDelLbStaticMapping)(nil), + (*Nat44AddDelLbStaticMappingReply)(nil), + (*Nat44AddDelStaticMapping)(nil), + (*Nat44AddDelStaticMappingReply)(nil), + (*Nat44AddressDetails)(nil), + (*Nat44AddressDump)(nil), + (*Nat44DelSession)(nil), + (*Nat44DelSessionReply)(nil), + (*Nat44ForwardingEnableDisable)(nil), + (*Nat44ForwardingEnableDisableReply)(nil), + (*Nat44ForwardingIsEnabled)(nil), + (*Nat44ForwardingIsEnabledReply)(nil), + (*Nat44IdentityMappingDetails)(nil), + (*Nat44IdentityMappingDump)(nil), + (*Nat44InterfaceAddDelFeature)(nil), + (*Nat44InterfaceAddDelFeatureReply)(nil), + (*Nat44InterfaceAddDelOutputFeature)(nil), + (*Nat44InterfaceAddDelOutputFeatureReply)(nil), + (*Nat44InterfaceAddrDetails)(nil), + (*Nat44InterfaceAddrDump)(nil), + (*Nat44InterfaceDetails)(nil), + (*Nat44InterfaceDump)(nil), + (*Nat44InterfaceOutputFeatureDetails)(nil), + (*Nat44InterfaceOutputFeatureDump)(nil), + (*Nat44LbStaticMappingAddDelLocal)(nil), + (*Nat44LbStaticMappingAddDelLocalReply)(nil), + (*Nat44LbStaticMappingDetails)(nil), + (*Nat44LbStaticMappingDump)(nil), + (*Nat44StaticMappingDetails)(nil), + (*Nat44StaticMappingDump)(nil), + (*Nat44UserDetails)(nil), + (*Nat44UserDump)(nil), + (*Nat44UserSessionDetails)(nil), + (*Nat44UserSessionDump)(nil), + (*Nat64AddDelInterface)(nil), + (*Nat64AddDelInterfaceAddr)(nil), + (*Nat64AddDelInterfaceAddrReply)(nil), + (*Nat64AddDelInterfaceReply)(nil), + (*Nat64AddDelPoolAddrRange)(nil), + (*Nat64AddDelPoolAddrRangeReply)(nil), + (*Nat64AddDelPrefix)(nil), + (*Nat64AddDelPrefixReply)(nil), + (*Nat64AddDelStaticBib)(nil), + (*Nat64AddDelStaticBibReply)(nil), + (*Nat64BibDetails)(nil), + (*Nat64BibDump)(nil), + (*Nat64InterfaceDetails)(nil), + (*Nat64InterfaceDump)(nil), + (*Nat64PoolAddrDetails)(nil), + (*Nat64PoolAddrDump)(nil), + (*Nat64PrefixDetails)(nil), + (*Nat64PrefixDump)(nil), + (*Nat64StDetails)(nil), + (*Nat64StDump)(nil), + (*Nat66AddDelInterface)(nil), + (*Nat66AddDelInterfaceReply)(nil), + (*Nat66AddDelStaticMapping)(nil), + (*Nat66AddDelStaticMappingReply)(nil), + (*Nat66InterfaceDetails)(nil), + (*Nat66InterfaceDump)(nil), + (*Nat66StaticMappingDetails)(nil), + (*Nat66StaticMappingDump)(nil), + (*NatControlPing)(nil), + (*NatControlPingReply)(nil), + (*NatDetAddDelMap)(nil), + (*NatDetAddDelMapReply)(nil), + (*NatDetCloseSessionIn)(nil), + (*NatDetCloseSessionInReply)(nil), + (*NatDetCloseSessionOut)(nil), + (*NatDetCloseSessionOutReply)(nil), + (*NatDetForward)(nil), + (*NatDetForwardReply)(nil), + (*NatDetMapDetails)(nil), + (*NatDetMapDump)(nil), + (*NatDetReverse)(nil), + (*NatDetReverseReply)(nil), + (*NatDetSessionDetails)(nil), + (*NatDetSessionDump)(nil), + (*NatGetAddrAndPortAllocAlg)(nil), + (*NatGetAddrAndPortAllocAlgReply)(nil), + (*NatGetMssClamping)(nil), + (*NatGetMssClampingReply)(nil), + (*NatGetReass)(nil), + (*NatGetReassReply)(nil), + (*NatGetTimeouts)(nil), + (*NatGetTimeoutsReply)(nil), + (*NatHaFlush)(nil), + (*NatHaFlushReply)(nil), + (*NatHaGetFailover)(nil), + (*NatHaGetFailoverReply)(nil), + (*NatHaGetListener)(nil), + (*NatHaGetListenerReply)(nil), + (*NatHaResync)(nil), + (*NatHaResyncCompletedEvent)(nil), + (*NatHaResyncReply)(nil), + (*NatHaSetFailover)(nil), + (*NatHaSetFailoverReply)(nil), + (*NatHaSetListener)(nil), + (*NatHaSetListenerReply)(nil), + (*NatIpfixEnableDisable)(nil), + (*NatIpfixEnableDisableReply)(nil), + (*NatReassDetails)(nil), + (*NatReassDump)(nil), + (*NatSetAddrAndPortAllocAlg)(nil), + (*NatSetAddrAndPortAllocAlgReply)(nil), + (*NatSetMssClamping)(nil), + (*NatSetMssClampingReply)(nil), + (*NatSetReass)(nil), + (*NatSetReassReply)(nil), + (*NatSetTimeouts)(nil), + (*NatSetTimeoutsReply)(nil), + (*NatSetWorkers)(nil), + (*NatSetWorkersReply)(nil), + (*NatShowConfig)(nil), + (*NatShowConfigReply)(nil), + (*NatWorkerDetails)(nil), + (*NatWorkerDump)(nil), + } +} + +// RPCService represents RPC service API for nat module. +type RPCService interface { + DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) + DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) + DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) + DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) + DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) + DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) + DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) + DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) + DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) + DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) + DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) + DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) + DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) + DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) + DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) + DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) + DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) + DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) + DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) + DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) + DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) + DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) + DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) + DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) + DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) + DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) + Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) + Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) + Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) + Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) + Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) + Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) + Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) + Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) + Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) + Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) + Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) + Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) + Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) + Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) + Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) + Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) + Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) + Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) + NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) + NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) + NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) + NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) + NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) + NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) + NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) + NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) + NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) + NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) + NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) + NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) + NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) + NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) + NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) + NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) + NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) + NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) + NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) + NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) + NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) + NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) + NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDsliteAddressClient{stream} + return x, nil +} + +type RPCService_DumpDsliteAddressClient interface { + Recv() (*DsliteAddressDetails, error) +} + +type serviceClient_DumpDsliteAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDsliteAddressClient) Recv() (*DsliteAddressDetails, error) { + m := new(DsliteAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44AddressClient{stream} + return x, nil +} + +type RPCService_DumpNat44AddressClient interface { + Recv() (*Nat44AddressDetails, error) +} + +type serviceClient_DumpNat44AddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44AddressClient) Recv() (*Nat44AddressDetails, error) { + m := new(Nat44AddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44IdentityMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44IdentityMappingClient interface { + Recv() (*Nat44IdentityMappingDetails, error) +} + +type serviceClient_DumpNat44IdentityMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44IdentityMappingClient) Recv() (*Nat44IdentityMappingDetails, error) { + m := new(Nat44IdentityMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceAddrClient interface { + Recv() (*Nat44InterfaceAddrDetails, error) +} + +type serviceClient_DumpNat44InterfaceAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceAddrClient) Recv() (*Nat44InterfaceAddrDetails, error) { + m := new(Nat44InterfaceAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceClient interface { + Recv() (*Nat44InterfaceDetails, error) +} + +type serviceClient_DumpNat44InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceClient) Recv() (*Nat44InterfaceDetails, error) { + m := new(Nat44InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceOutputFeatureClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceOutputFeatureClient interface { + Recv() (*Nat44InterfaceOutputFeatureDetails, error) +} + +type serviceClient_DumpNat44InterfaceOutputFeatureClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceOutputFeatureClient) Recv() (*Nat44InterfaceOutputFeatureDetails, error) { + m := new(Nat44InterfaceOutputFeatureDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44LbStaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44LbStaticMappingClient interface { + Recv() (*Nat44LbStaticMappingDetails, error) +} + +type serviceClient_DumpNat44LbStaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44LbStaticMappingClient) Recv() (*Nat44LbStaticMappingDetails, error) { + m := new(Nat44LbStaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44StaticMappingClient interface { + Recv() (*Nat44StaticMappingDetails, error) +} + +type serviceClient_DumpNat44StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44StaticMappingClient) Recv() (*Nat44StaticMappingDetails, error) { + m := new(Nat44StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserClient interface { + Recv() (*Nat44UserDetails, error) +} + +type serviceClient_DumpNat44UserClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserClient) Recv() (*Nat44UserDetails, error) { + m := new(Nat44UserDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserSessionClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserSessionClient interface { + Recv() (*Nat44UserSessionDetails, error) +} + +type serviceClient_DumpNat44UserSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserSessionClient) Recv() (*Nat44UserSessionDetails, error) { + m := new(Nat44UserSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64BibClient{stream} + return x, nil +} + +type RPCService_DumpNat64BibClient interface { + Recv() (*Nat64BibDetails, error) +} + +type serviceClient_DumpNat64BibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64BibClient) Recv() (*Nat64BibDetails, error) { + m := new(Nat64BibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat64InterfaceClient interface { + Recv() (*Nat64InterfaceDetails, error) +} + +type serviceClient_DumpNat64InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64InterfaceClient) Recv() (*Nat64InterfaceDetails, error) { + m := new(Nat64InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PoolAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat64PoolAddrClient interface { + Recv() (*Nat64PoolAddrDetails, error) +} + +type serviceClient_DumpNat64PoolAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PoolAddrClient) Recv() (*Nat64PoolAddrDetails, error) { + m := new(Nat64PoolAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PrefixClient{stream} + return x, nil +} + +type RPCService_DumpNat64PrefixClient interface { + Recv() (*Nat64PrefixDetails, error) +} + +type serviceClient_DumpNat64PrefixClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PrefixClient) Recv() (*Nat64PrefixDetails, error) { + m := new(Nat64PrefixDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64StClient{stream} + return x, nil +} + +type RPCService_DumpNat64StClient interface { + Recv() (*Nat64StDetails, error) +} + +type serviceClient_DumpNat64StClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64StClient) Recv() (*Nat64StDetails, error) { + m := new(Nat64StDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat66InterfaceClient interface { + Recv() (*Nat66InterfaceDetails, error) +} + +type serviceClient_DumpNat66InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66InterfaceClient) Recv() (*Nat66InterfaceDetails, error) { + m := new(Nat66InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil } + +func (c *serviceClient) DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat66StaticMappingClient interface { + Recv() (*Nat66StaticMappingDetails, error) +} + +type serviceClient_DumpNat66StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66StaticMappingClient) Recv() (*Nat66StaticMappingDetails, error) { + m := new(Nat66StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetMapClient{stream} + return x, nil +} + +type RPCService_DumpNatDetMapClient interface { + Recv() (*NatDetMapDetails, error) +} + +type serviceClient_DumpNatDetMapClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetMapClient) Recv() (*NatDetMapDetails, error) { + m := new(NatDetMapDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetSessionClient{stream} + return x, nil +} + +type RPCService_DumpNatDetSessionClient interface { + Recv() (*NatDetSessionDetails, error) +} + +type serviceClient_DumpNatDetSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetSessionClient) Recv() (*NatDetSessionDetails, error) { + m := new(NatDetSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatReassClient{stream} + return x, nil +} + +type RPCService_DumpNatReassClient interface { + Recv() (*NatReassDetails, error) +} + +type serviceClient_DumpNatReassClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatReassClient) Recv() (*NatReassDetails, error) { + m := new(NatReassDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatWorkerClient{stream} + return x, nil +} + +type RPCService_DumpNatWorkerClient interface { + Recv() (*NatWorkerDetails, error) +} + +type serviceClient_DumpNatWorkerClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatWorkerClient) Recv() (*NatWorkerDetails, error) { + m := new(NatWorkerDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) { + out := new(DsliteAddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) { + out := new(DsliteGetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { + out := new(DsliteGetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { + out := new(DsliteSetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { + out := new(DsliteSetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) { + out := new(Nat44AddDelAddressRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { + out := new(Nat44AddDelIdentityMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { + out := new(Nat44AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { + out := new(Nat44AddDelLbStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { + out := new(Nat44AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) { + out := new(Nat44DelSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { + out := new(Nat44ForwardingEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { + out := new(Nat44ForwardingIsEnabledReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) { + out := new(Nat44InterfaceAddDelFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { + out := new(Nat44InterfaceAddDelOutputFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) { + out := new(Nat44LbStaticMappingAddDelLocalReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { + out := new(Nat64AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { + out := new(Nat64AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { + out := new(Nat64AddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { + out := new(Nat64AddDelPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { + out := new(Nat64AddDelStaticBibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { + out := new(Nat66AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { + out := new(Nat66AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) { + out := new(NatControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { + out := new(NatDetAddDelMapReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { + out := new(NatDetCloseSessionInReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { + out := new(NatDetCloseSessionOutReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { + out := new(NatDetForwardReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { + out := new(NatDetReverseReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) { + out := new(NatGetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { + out := new(NatGetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) { + out := new(NatGetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { + out := new(NatGetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) { + out := new(NatHaFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) { + out := new(NatHaGetFailoverReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) { + out := new(NatHaGetListenerReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) { + out := new(NatHaResyncReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) { + out := new(NatHaSetFailoverReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) { + out := new(NatHaSetListenerReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { + out := new(NatIpfixEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { + out := new(NatSetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { + out := new(NatSetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) { + out := new(NatSetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { + out := new(NatSetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { + out := new(NatSetWorkersReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { + out := new(NatShowConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/punt/punt.ba.go b/plugins/vpp/binapi/vpp1904/punt/punt.ba.go index 30103d63cd..fd1a68ae61 100644 --- a/plugins/vpp/binapi/vpp1904/punt/punt.ba.go +++ b/plugins/vpp/binapi/vpp1904/punt/punt.ba.go @@ -1,37 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/punt.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/punt.api.json /* - Package punt is a generated from VPP binary API module 'punt'. +Package punt is a generated VPP binary API for 'punt' module. - It contains following objects: - 5 services +It consists of: 1 type 10 messages + 5 services */ package punt -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer +const ( + // ModuleName is the name of this module. + ModuleName = "punt" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x1c487f2b +) -// Services represents VPP binary API services: -type Services interface { - DumpPunt(*PuntDump) ([]*PuntDetails, error) - DumpPuntSocket(*PuntSocketDump) ([]*PuntSocketDetails, error) - PuntSocketDeregister(*PuntSocketDeregister) (*PuntSocketDeregisterReply, error) - PuntSocketRegister(*PuntSocketRegister) (*PuntSocketRegisterReply, error) - SetPunt(*SetPunt) (*SetPuntReply, error) -} - -/* Types */ - -// Punt represents VPP binary API type 'punt': +// Punt represents VPP binary API type 'punt'. type Punt struct { IPv uint8 L4Protocol uint8 @@ -45,9 +43,7 @@ func (*Punt) GetCrcString() string { return "fe4f98ac" } -/* Messages */ - -// PuntDetails represents VPP binary API message 'punt_details': +// PuntDetails represents VPP binary API message 'punt_details'. type PuntDetails struct { Punt Punt } @@ -62,7 +58,7 @@ func (*PuntDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntDump represents VPP binary API message 'punt_dump': +// PuntDump represents VPP binary API message 'punt_dump'. type PuntDump struct { IsIPv6 uint8 } @@ -77,7 +73,7 @@ func (*PuntDump) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketDeregister represents VPP binary API message 'punt_socket_deregister': +// PuntSocketDeregister represents VPP binary API message 'punt_socket_deregister'. type PuntSocketDeregister struct { Punt Punt } @@ -92,7 +88,7 @@ func (*PuntSocketDeregister) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketDeregisterReply represents VPP binary API message 'punt_socket_deregister_reply': +// PuntSocketDeregisterReply represents VPP binary API message 'punt_socket_deregister_reply'. type PuntSocketDeregisterReply struct { Retval int32 } @@ -107,7 +103,7 @@ func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntSocketDetails represents VPP binary API message 'punt_socket_details': +// PuntSocketDetails represents VPP binary API message 'punt_socket_details'. type PuntSocketDetails struct { Punt Punt Pathname []byte `struc:"[108]byte"` @@ -123,7 +119,7 @@ func (*PuntSocketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// PuntSocketDump represents VPP binary API message 'punt_socket_dump': +// PuntSocketDump represents VPP binary API message 'punt_socket_dump'. type PuntSocketDump struct { IsIPv6 uint8 } @@ -138,7 +134,7 @@ func (*PuntSocketDump) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketRegister represents VPP binary API message 'punt_socket_register': +// PuntSocketRegister represents VPP binary API message 'punt_socket_register'. type PuntSocketRegister struct { HeaderVersion uint32 Punt Punt @@ -155,7 +151,7 @@ func (*PuntSocketRegister) GetMessageType() api.MessageType { return api.RequestMessage } -// PuntSocketRegisterReply represents VPP binary API message 'punt_socket_register_reply': +// PuntSocketRegisterReply represents VPP binary API message 'punt_socket_register_reply'. type PuntSocketRegisterReply struct { Retval int32 Pathname []byte `struc:"[64]byte"` @@ -171,7 +167,7 @@ func (*PuntSocketRegisterReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SetPunt represents VPP binary API message 'set_punt': +// SetPunt represents VPP binary API message 'set_punt'. type SetPunt struct { IsAdd uint8 Punt Punt @@ -187,7 +183,7 @@ func (*SetPunt) GetMessageType() api.MessageType { return api.RequestMessage } -// SetPuntReply represents VPP binary API message 'set_punt_reply': +// SetPuntReply represents VPP binary API message 'set_punt_reply'. type SetPuntReply struct { Retval int32 } @@ -215,15 +211,128 @@ func init() { api.RegisterMessage((*SetPuntReply)(nil), "punt.SetPuntReply") } -var Messages = []api.Message{ - (*PuntDetails)(nil), - (*PuntDump)(nil), - (*PuntSocketDeregister)(nil), - (*PuntSocketDeregisterReply)(nil), - (*PuntSocketDetails)(nil), - (*PuntSocketDump)(nil), - (*PuntSocketRegister)(nil), - (*PuntSocketRegisterReply)(nil), - (*SetPunt)(nil), - (*SetPuntReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PuntDetails)(nil), + (*PuntDump)(nil), + (*PuntSocketDeregister)(nil), + (*PuntSocketDeregisterReply)(nil), + (*PuntSocketDetails)(nil), + (*PuntSocketDump)(nil), + (*PuntSocketRegister)(nil), + (*PuntSocketRegisterReply)(nil), + (*SetPunt)(nil), + (*SetPuntReply)(nil), + } +} + +// RPCService represents RPC service API for punt module. +type RPCService interface { + DumpPunt(ctx context.Context, in *PuntDump) (RPCService_DumpPuntClient, error) + DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) + PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) + PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) + SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpPunt(ctx context.Context, in *PuntDump) (RPCService_DumpPuntClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntClient{stream} + return x, nil +} + +type RPCService_DumpPuntClient interface { + Recv() (*PuntDetails, error) +} + +type serviceClient_DumpPuntClient struct { + api.MultiRequestCtx } + +func (c *serviceClient_DumpPuntClient) Recv() (*PuntDetails, error) { + m := new(PuntDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntSocketClient{stream} + return x, nil +} + +type RPCService_DumpPuntSocketClient interface { + Recv() (*PuntSocketDetails, error) +} + +type serviceClient_DumpPuntSocketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpPuntSocketClient) Recv() (*PuntSocketDetails, error) { + m := new(PuntSocketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) { + out := new(PuntSocketDeregisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) { + out := new(PuntSocketRegisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { + out := new(SetPuntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/session/session.ba.go b/plugins/vpp/binapi/vpp1904/session/session.ba.go index c722bf849a..a2f8c566ee 100644 --- a/plugins/vpp/binapi/vpp1904/session/session.ba.go +++ b/plugins/vpp/binapi/vpp1904/session/session.ba.go @@ -1,50 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/session.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/session.api.json /* - Package session is a generated from VPP binary API module 'session'. +Package session is a generated VPP binary API for 'session' module. - It contains following objects: - 19 services +It consists of: 38 messages + 19 services */ package session -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSessionRules(*SessionRulesDump) ([]*SessionRulesDetails, error) - AppCutThroughRegistrationAdd(*AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) - AppNamespaceAddDel(*AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) - AppWorkerAddDel(*AppWorkerAddDel) (*AppWorkerAddDelReply, error) - ApplicationAttach(*ApplicationAttach) (*ApplicationAttachReply, error) - ApplicationDetach(*ApplicationDetach) (*ApplicationDetachReply, error) - ApplicationTLSCertAdd(*ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) - ApplicationTLSKeyAdd(*ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) - BindSock(*BindSock) (*BindSockReply, error) - BindURI(*BindURI) (*BindURIReply, error) - ConnectSock(*ConnectSock) (*ConnectSockReply, error) - ConnectURI(*ConnectURI) (*ConnectURIReply, error) - DisconnectSession(*DisconnectSession) (*DisconnectSessionReply, error) - MapAnotherSegment(*MapAnotherSegment) (*MapAnotherSegmentReply, error) - SessionEnableDisable(*SessionEnableDisable) (*SessionEnableDisableReply, error) - SessionRuleAddDel(*SessionRuleAddDel) (*SessionRuleAddDelReply, error) - UnbindSock(*UnbindSock) (*UnbindSockReply, error) - UnbindURI(*UnbindURI) (*UnbindURIReply, error) - UnmapSegment(*UnmapSegment) (*UnmapSegmentReply, error) -} - -/* Messages */ - -// AppCutThroughRegistrationAdd represents VPP binary API message 'app_cut_through_registration_add': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "session" + // APIVersion is the API version of this module. + APIVersion = "1.6.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x299f3131 +) + +// AppCutThroughRegistrationAdd represents VPP binary API message 'app_cut_through_registration_add'. type AppCutThroughRegistrationAdd struct { EvtQAddress uint64 PeerEvtQAddress uint64 @@ -63,7 +47,7 @@ func (*AppCutThroughRegistrationAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// AppCutThroughRegistrationAddReply represents VPP binary API message 'app_cut_through_registration_add_reply': +// AppCutThroughRegistrationAddReply represents VPP binary API message 'app_cut_through_registration_add_reply'. type AppCutThroughRegistrationAddReply struct { Retval int32 } @@ -78,7 +62,7 @@ func (*AppCutThroughRegistrationAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AppNamespaceAddDel represents VPP binary API message 'app_namespace_add_del': +// AppNamespaceAddDel represents VPP binary API message 'app_namespace_add_del'. type AppNamespaceAddDel struct { Secret uint64 SwIfIndex uint32 @@ -98,7 +82,7 @@ func (*AppNamespaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AppNamespaceAddDelReply represents VPP binary API message 'app_namespace_add_del_reply': +// AppNamespaceAddDelReply represents VPP binary API message 'app_namespace_add_del_reply'. type AppNamespaceAddDelReply struct { Retval int32 AppnsIndex uint32 @@ -114,7 +98,7 @@ func (*AppNamespaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// AppWorkerAddDel represents VPP binary API message 'app_worker_add_del': +// AppWorkerAddDel represents VPP binary API message 'app_worker_add_del'. type AppWorkerAddDel struct { AppIndex uint32 WrkIndex uint32 @@ -131,7 +115,7 @@ func (*AppWorkerAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// AppWorkerAddDelReply represents VPP binary API message 'app_worker_add_del_reply': +// AppWorkerAddDelReply represents VPP binary API message 'app_worker_add_del_reply'. type AppWorkerAddDelReply struct { Retval int32 WrkIndex uint32 @@ -154,7 +138,7 @@ func (*AppWorkerAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationAttach represents VPP binary API message 'application_attach': +// ApplicationAttach represents VPP binary API message 'application_attach'. type ApplicationAttach struct { InitialSegmentSize uint32 Options []uint64 `struc:"[16]uint64"` @@ -172,7 +156,7 @@ func (*ApplicationAttach) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationAttachReply represents VPP binary API message 'application_attach_reply': +// ApplicationAttachReply represents VPP binary API message 'application_attach_reply'. type ApplicationAttachReply struct { Retval int32 AppEventQueueAddress uint64 @@ -195,7 +179,7 @@ func (*ApplicationAttachReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationDetach represents VPP binary API message 'application_detach': +// ApplicationDetach represents VPP binary API message 'application_detach'. type ApplicationDetach struct{} func (*ApplicationDetach) GetMessageName() string { @@ -208,7 +192,7 @@ func (*ApplicationDetach) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationDetachReply represents VPP binary API message 'application_detach_reply': +// ApplicationDetachReply represents VPP binary API message 'application_detach_reply'. type ApplicationDetachReply struct { Retval int32 } @@ -223,7 +207,7 @@ func (*ApplicationDetachReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationTLSCertAdd represents VPP binary API message 'application_tls_cert_add': +// ApplicationTLSCertAdd represents VPP binary API message 'application_tls_cert_add'. type ApplicationTLSCertAdd struct { AppIndex uint32 CertLen uint16 `struc:"sizeof=Cert"` @@ -240,7 +224,7 @@ func (*ApplicationTLSCertAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationTLSCertAddReply represents VPP binary API message 'application_tls_cert_add_reply': +// ApplicationTLSCertAddReply represents VPP binary API message 'application_tls_cert_add_reply'. type ApplicationTLSCertAddReply struct { Retval int32 } @@ -255,7 +239,7 @@ func (*ApplicationTLSCertAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ApplicationTLSKeyAdd represents VPP binary API message 'application_tls_key_add': +// ApplicationTLSKeyAdd represents VPP binary API message 'application_tls_key_add'. type ApplicationTLSKeyAdd struct { AppIndex uint32 KeyLen uint16 `struc:"sizeof=Key"` @@ -272,7 +256,7 @@ func (*ApplicationTLSKeyAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// ApplicationTLSKeyAddReply represents VPP binary API message 'application_tls_key_add_reply': +// ApplicationTLSKeyAddReply represents VPP binary API message 'application_tls_key_add_reply'. type ApplicationTLSKeyAddReply struct { Retval int32 } @@ -287,7 +271,7 @@ func (*ApplicationTLSKeyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BindSock represents VPP binary API message 'bind_sock': +// BindSock represents VPP binary API message 'bind_sock'. type BindSock struct { WrkIndex uint32 Vrf uint32 @@ -308,7 +292,7 @@ func (*BindSock) GetMessageType() api.MessageType { return api.RequestMessage } -// BindSockReply represents VPP binary API message 'bind_sock_reply': +// BindSockReply represents VPP binary API message 'bind_sock_reply'. type BindSockReply struct { Retval int32 } @@ -323,7 +307,7 @@ func (*BindSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// BindURI represents VPP binary API message 'bind_uri': +// BindURI represents VPP binary API message 'bind_uri'. type BindURI struct { AcceptCookie uint32 URI []byte `struc:"[128]byte"` @@ -339,7 +323,7 @@ func (*BindURI) GetMessageType() api.MessageType { return api.RequestMessage } -// BindURIReply represents VPP binary API message 'bind_uri_reply': +// BindURIReply represents VPP binary API message 'bind_uri_reply'. type BindURIReply struct { Retval int32 } @@ -354,7 +338,7 @@ func (*BindURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ConnectSock represents VPP binary API message 'connect_sock': +// ConnectSock represents VPP binary API message 'connect_sock'. type ConnectSock struct { WrkIndex uint32 ClientQueueAddress uint64 @@ -378,7 +362,7 @@ func (*ConnectSock) GetMessageType() api.MessageType { return api.RequestMessage } -// ConnectSockReply represents VPP binary API message 'connect_sock_reply': +// ConnectSockReply represents VPP binary API message 'connect_sock_reply'. type ConnectSockReply struct { Retval int32 } @@ -393,7 +377,7 @@ func (*ConnectSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ConnectURI represents VPP binary API message 'connect_uri': +// ConnectURI represents VPP binary API message 'connect_uri'. type ConnectURI struct { ClientQueueAddress uint64 Options []uint64 `struc:"[16]uint64"` @@ -410,7 +394,7 @@ func (*ConnectURI) GetMessageType() api.MessageType { return api.RequestMessage } -// ConnectURIReply represents VPP binary API message 'connect_uri_reply': +// ConnectURIReply represents VPP binary API message 'connect_uri_reply'. type ConnectURIReply struct { Retval int32 } @@ -425,7 +409,7 @@ func (*ConnectURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// DisconnectSession represents VPP binary API message 'disconnect_session': +// DisconnectSession represents VPP binary API message 'disconnect_session'. type DisconnectSession struct { Handle uint64 } @@ -440,7 +424,7 @@ func (*DisconnectSession) GetMessageType() api.MessageType { return api.RequestMessage } -// DisconnectSessionReply represents VPP binary API message 'disconnect_session_reply': +// DisconnectSessionReply represents VPP binary API message 'disconnect_session_reply'. type DisconnectSessionReply struct { Retval int32 Handle uint64 @@ -456,7 +440,7 @@ func (*DisconnectSessionReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MapAnotherSegment represents VPP binary API message 'map_another_segment': +// MapAnotherSegment represents VPP binary API message 'map_another_segment'. type MapAnotherSegment struct { FdFlags uint8 SegmentSize uint32 @@ -474,7 +458,7 @@ func (*MapAnotherSegment) GetMessageType() api.MessageType { return api.RequestMessage } -// MapAnotherSegmentReply represents VPP binary API message 'map_another_segment_reply': +// MapAnotherSegmentReply represents VPP binary API message 'map_another_segment_reply'. type MapAnotherSegmentReply struct { Retval int32 } @@ -489,7 +473,7 @@ func (*MapAnotherSegmentReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionEnableDisable represents VPP binary API message 'session_enable_disable': +// SessionEnableDisable represents VPP binary API message 'session_enable_disable'. type SessionEnableDisable struct { IsEnable uint8 } @@ -504,7 +488,7 @@ func (*SessionEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -// SessionEnableDisableReply represents VPP binary API message 'session_enable_disable_reply': +// SessionEnableDisableReply represents VPP binary API message 'session_enable_disable_reply'. type SessionEnableDisableReply struct { Retval int32 } @@ -519,7 +503,7 @@ func (*SessionEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRuleAddDel represents VPP binary API message 'session_rule_add_del': +// SessionRuleAddDel represents VPP binary API message 'session_rule_add_del'. type SessionRuleAddDel struct { TransportProto uint8 IsIP4 uint8 @@ -546,7 +530,7 @@ func (*SessionRuleAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SessionRuleAddDelReply represents VPP binary API message 'session_rule_add_del_reply': +// SessionRuleAddDelReply represents VPP binary API message 'session_rule_add_del_reply'. type SessionRuleAddDelReply struct { Retval int32 } @@ -561,7 +545,7 @@ func (*SessionRuleAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRulesDetails represents VPP binary API message 'session_rules_details': +// SessionRulesDetails represents VPP binary API message 'session_rules_details'. type SessionRulesDetails struct { TransportProto uint8 IsIP4 uint8 @@ -587,7 +571,7 @@ func (*SessionRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SessionRulesDump represents VPP binary API message 'session_rules_dump': +// SessionRulesDump represents VPP binary API message 'session_rules_dump'. type SessionRulesDump struct{} func (*SessionRulesDump) GetMessageName() string { @@ -600,7 +584,7 @@ func (*SessionRulesDump) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindSock represents VPP binary API message 'unbind_sock': +// UnbindSock represents VPP binary API message 'unbind_sock'. type UnbindSock struct { WrkIndex uint32 Handle uint64 @@ -616,7 +600,7 @@ func (*UnbindSock) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindSockReply represents VPP binary API message 'unbind_sock_reply': +// UnbindSockReply represents VPP binary API message 'unbind_sock_reply'. type UnbindSockReply struct { Retval int32 } @@ -631,7 +615,7 @@ func (*UnbindSockReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// UnbindURI represents VPP binary API message 'unbind_uri': +// UnbindURI represents VPP binary API message 'unbind_uri'. type UnbindURI struct { URI []byte `struc:"[128]byte"` } @@ -646,7 +630,7 @@ func (*UnbindURI) GetMessageType() api.MessageType { return api.RequestMessage } -// UnbindURIReply represents VPP binary API message 'unbind_uri_reply': +// UnbindURIReply represents VPP binary API message 'unbind_uri_reply'. type UnbindURIReply struct { Retval int32 } @@ -661,7 +645,7 @@ func (*UnbindURIReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// UnmapSegment represents VPP binary API message 'unmap_segment': +// UnmapSegment represents VPP binary API message 'unmap_segment'. type UnmapSegment struct { SegmentHandle uint64 } @@ -676,7 +660,7 @@ func (*UnmapSegment) GetMessageType() api.MessageType { return api.RequestMessage } -// UnmapSegmentReply represents VPP binary API message 'unmap_segment_reply': +// UnmapSegmentReply represents VPP binary API message 'unmap_segment_reply'. type UnmapSegmentReply struct { Retval int32 } @@ -732,43 +716,279 @@ func init() { api.RegisterMessage((*UnmapSegmentReply)(nil), "session.UnmapSegmentReply") } -var Messages = []api.Message{ - (*AppCutThroughRegistrationAdd)(nil), - (*AppCutThroughRegistrationAddReply)(nil), - (*AppNamespaceAddDel)(nil), - (*AppNamespaceAddDelReply)(nil), - (*AppWorkerAddDel)(nil), - (*AppWorkerAddDelReply)(nil), - (*ApplicationAttach)(nil), - (*ApplicationAttachReply)(nil), - (*ApplicationDetach)(nil), - (*ApplicationDetachReply)(nil), - (*ApplicationTLSCertAdd)(nil), - (*ApplicationTLSCertAddReply)(nil), - (*ApplicationTLSKeyAdd)(nil), - (*ApplicationTLSKeyAddReply)(nil), - (*BindSock)(nil), - (*BindSockReply)(nil), - (*BindURI)(nil), - (*BindURIReply)(nil), - (*ConnectSock)(nil), - (*ConnectSockReply)(nil), - (*ConnectURI)(nil), - (*ConnectURIReply)(nil), - (*DisconnectSession)(nil), - (*DisconnectSessionReply)(nil), - (*MapAnotherSegment)(nil), - (*MapAnotherSegmentReply)(nil), - (*SessionEnableDisable)(nil), - (*SessionEnableDisableReply)(nil), - (*SessionRuleAddDel)(nil), - (*SessionRuleAddDelReply)(nil), - (*SessionRulesDetails)(nil), - (*SessionRulesDump)(nil), - (*UnbindSock)(nil), - (*UnbindSockReply)(nil), - (*UnbindURI)(nil), - (*UnbindURIReply)(nil), - (*UnmapSegment)(nil), - (*UnmapSegmentReply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AppCutThroughRegistrationAdd)(nil), + (*AppCutThroughRegistrationAddReply)(nil), + (*AppNamespaceAddDel)(nil), + (*AppNamespaceAddDelReply)(nil), + (*AppWorkerAddDel)(nil), + (*AppWorkerAddDelReply)(nil), + (*ApplicationAttach)(nil), + (*ApplicationAttachReply)(nil), + (*ApplicationDetach)(nil), + (*ApplicationDetachReply)(nil), + (*ApplicationTLSCertAdd)(nil), + (*ApplicationTLSCertAddReply)(nil), + (*ApplicationTLSKeyAdd)(nil), + (*ApplicationTLSKeyAddReply)(nil), + (*BindSock)(nil), + (*BindSockReply)(nil), + (*BindURI)(nil), + (*BindURIReply)(nil), + (*ConnectSock)(nil), + (*ConnectSockReply)(nil), + (*ConnectURI)(nil), + (*ConnectURIReply)(nil), + (*DisconnectSession)(nil), + (*DisconnectSessionReply)(nil), + (*MapAnotherSegment)(nil), + (*MapAnotherSegmentReply)(nil), + (*SessionEnableDisable)(nil), + (*SessionEnableDisableReply)(nil), + (*SessionRuleAddDel)(nil), + (*SessionRuleAddDelReply)(nil), + (*SessionRulesDetails)(nil), + (*SessionRulesDump)(nil), + (*UnbindSock)(nil), + (*UnbindSockReply)(nil), + (*UnbindURI)(nil), + (*UnbindURIReply)(nil), + (*UnmapSegment)(nil), + (*UnmapSegmentReply)(nil), + } +} + +// RPCService represents RPC service API for session module. +type RPCService interface { + DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) + AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) + AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) + AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) + ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) + ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) + ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) + ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) + BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) + BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) + ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) + ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) + DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) + MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) + SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) + SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) + UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) + UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) + UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSessionRulesClient{stream} + return x, nil +} + +type RPCService_DumpSessionRulesClient interface { + Recv() (*SessionRulesDetails, error) +} + +type serviceClient_DumpSessionRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSessionRulesClient) Recv() (*SessionRulesDetails, error) { + m := new(SessionRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) { + out := new(AppCutThroughRegistrationAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { + out := new(AppNamespaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { + out := new(AppWorkerAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) { + out := new(ApplicationAttachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { + out := new(ApplicationDetachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { + out := new(ApplicationTLSCertAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { + out := new(ApplicationTLSKeyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) { + out := new(BindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) { + out := new(BindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) { + out := new(ConnectSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) { + out := new(ConnectURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) { + out := new(DisconnectSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) { + out := new(MapAnotherSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { + out := new(SessionEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { + out := new(SessionRuleAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) { + out := new(UnbindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) { + out := new(UnbindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) { + out := new(UnmapSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/sr/sr.ba.go b/plugins/vpp/binapi/vpp1904/sr/sr.ba.go index 1193e3e2f7..d767da4f85 100644 --- a/plugins/vpp/binapi/vpp1904/sr/sr.ba.go +++ b/plugins/vpp/binapi/vpp1904/sr/sr.ba.go @@ -1,41 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/sr.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/sr.api.json /* - Package sr is a generated from VPP binary API module 'sr'. +Package sr is a generated VPP binary API for 'sr' module. - It contains following objects: - 9 services +It consists of: 3 types 18 messages + 9 services */ package sr -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSrLocalsids(*SrLocalsidsDump) ([]*SrLocalsidsDetails, error) - DumpSrPolicies(*SrPoliciesDump) ([]*SrPoliciesDetails, error) - DumpSrSteeringPol(*SrSteeringPolDump) ([]*SrSteeringPolDetails, error) - SrLocalsidAddDel(*SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) - SrPolicyAdd(*SrPolicyAdd) (*SrPolicyAddReply, error) - SrPolicyDel(*SrPolicyDel) (*SrPolicyDelReply, error) - SrPolicyMod(*SrPolicyMod) (*SrPolicyModReply, error) - SrSetEncapSource(*SrSetEncapSource) (*SrSetEncapSourceReply, error) - SrSteeringAddDel(*SrSteeringAddDel) (*SrSteeringAddDelReply, error) -} - -/* Types */ - -// SrIP6Address represents VPP binary API type 'sr_ip6_address': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x9cb542fd +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. type SrIP6Address struct { Data []byte `struc:"[16]byte"` } @@ -47,7 +41,7 @@ func (*SrIP6Address) GetCrcString() string { return "bea0c5e6" } -// Srv6Sid represents VPP binary API type 'srv6_sid': +// Srv6Sid represents VPP binary API type 'srv6_sid'. type Srv6Sid struct { Addr []byte `struc:"[16]byte"` } @@ -59,7 +53,7 @@ func (*Srv6Sid) GetCrcString() string { return "6ee67284" } -// Srv6SidList represents VPP binary API type 'srv6_sid_list': +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. type Srv6SidList struct { NumSids uint8 `struc:"sizeof=Sids"` Weight uint32 @@ -73,9 +67,7 @@ func (*Srv6SidList) GetCrcString() string { return "4066af74" } -/* Messages */ - -// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del': +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. type SrLocalsidAddDel struct { IsDel uint8 Localsid Srv6Sid @@ -98,7 +90,7 @@ func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply': +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. type SrLocalsidAddDelReply struct { Retval int32 } @@ -113,7 +105,7 @@ func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details': +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. type SrLocalsidsDetails struct { Addr Srv6Sid EndPsp uint8 @@ -135,7 +127,7 @@ func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump': +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. type SrLocalsidsDump struct{} func (*SrLocalsidsDump) GetMessageName() string { @@ -148,7 +140,7 @@ func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPoliciesDetails represents VPP binary API message 'sr_policies_details': +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. type SrPoliciesDetails struct { Bsid Srv6Sid Type uint8 @@ -168,7 +160,7 @@ func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPoliciesDump represents VPP binary API message 'sr_policies_dump': +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. type SrPoliciesDump struct{} func (*SrPoliciesDump) GetMessageName() string { @@ -181,7 +173,7 @@ func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyAdd represents VPP binary API message 'sr_policy_add': +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. type SrPolicyAdd struct { BsidAddr []byte `struc:"[16]byte"` Weight uint32 @@ -201,7 +193,7 @@ func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply': +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. type SrPolicyAddReply struct { Retval int32 } @@ -216,7 +208,7 @@ func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPolicyDel represents VPP binary API message 'sr_policy_del': +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. type SrPolicyDel struct { BsidAddr Srv6Sid SrPolicyIndex uint32 @@ -232,7 +224,7 @@ func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply': +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. type SrPolicyDelReply struct { Retval int32 } @@ -247,7 +239,7 @@ func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrPolicyMod represents VPP binary API message 'sr_policy_mod': +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. type SrPolicyMod struct { BsidAddr []byte `struc:"[16]byte"` SrPolicyIndex uint32 @@ -268,7 +260,7 @@ func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } -// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply': +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. type SrPolicyModReply struct { Retval int32 } @@ -283,7 +275,7 @@ func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source': +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. type SrSetEncapSource struct { EncapsSource []byte `struc:"[16]byte"` } @@ -298,7 +290,7 @@ func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } -// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply': +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. type SrSetEncapSourceReply struct { Retval int32 } @@ -313,7 +305,7 @@ func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del': +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. type SrSteeringAddDel struct { IsDel uint8 BsidAddr []byte `struc:"[16]byte"` @@ -335,7 +327,7 @@ func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } -// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply': +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. type SrSteeringAddDelReply struct { Retval int32 } @@ -350,7 +342,7 @@ func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details': +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. type SrSteeringPolDetails struct { TrafficType uint8 FibTable uint32 @@ -370,7 +362,7 @@ func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump': +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. type SrSteeringPolDump struct{} func (*SrSteeringPolDump) GetMessageName() string { @@ -404,23 +396,193 @@ func init() { api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") } -var Messages = []api.Message{ - (*SrLocalsidAddDel)(nil), - (*SrLocalsidAddDelReply)(nil), - (*SrLocalsidsDetails)(nil), - (*SrLocalsidsDump)(nil), - (*SrPoliciesDetails)(nil), - (*SrPoliciesDump)(nil), - (*SrPolicyAdd)(nil), - (*SrPolicyAddReply)(nil), - (*SrPolicyDel)(nil), - (*SrPolicyDelReply)(nil), - (*SrPolicyMod)(nil), - (*SrPolicyModReply)(nil), - (*SrSetEncapSource)(nil), - (*SrSetEncapSourceReply)(nil), - (*SrSteeringAddDel)(nil), - (*SrSteeringAddDelReply)(nil), - (*SrSteeringPolDetails)(nil), - (*SrSteeringPolDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) } + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/stn/stn.ba.go b/plugins/vpp/binapi/vpp1904/stn/stn.ba.go index cc6aa5c7ed..cd1b842db9 100644 --- a/plugins/vpp/binapi/vpp1904/stn/stn.ba.go +++ b/plugins/vpp/binapi/vpp1904/stn/stn.ba.go @@ -1,33 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/stn.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/stn.api.json /* - Package stn is a generated from VPP binary API module 'stn'. +Package stn is a generated VPP binary API for 'stn' module. - It contains following objects: - 2 services +It consists of: 4 messages + 2 services */ package stn -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpStnRules(*StnRulesDump) ([]*StnRulesDetails, error) - StnAddDelRule(*StnAddDelRule) (*StnAddDelRuleReply, error) -} - -/* Messages */ - -// StnAddDelRule represents VPP binary API message 'stn_add_del_rule': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "stn" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xc7404144 +) + +// StnAddDelRule represents VPP binary API message 'stn_add_del_rule'. type StnAddDelRule struct { IsIP4 uint8 IPAddress []byte `struc:"[16]byte"` @@ -45,7 +46,7 @@ func (*StnAddDelRule) GetMessageType() api.MessageType { return api.RequestMessage } -// StnAddDelRuleReply represents VPP binary API message 'stn_add_del_rule_reply': +// StnAddDelRuleReply represents VPP binary API message 'stn_add_del_rule_reply'. type StnAddDelRuleReply struct { Retval int32 } @@ -60,7 +61,7 @@ func (*StnAddDelRuleReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// StnRulesDetails represents VPP binary API message 'stn_rules_details': +// StnRulesDetails represents VPP binary API message 'stn_rules_details'. type StnRulesDetails struct { IsIP4 uint8 IPAddress []byte `struc:"[16]byte"` @@ -77,7 +78,7 @@ func (*StnRulesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// StnRulesDump represents VPP binary API message 'stn_rules_dump': +// StnRulesDump represents VPP binary API message 'stn_rules_dump'. type StnRulesDump struct{} func (*StnRulesDump) GetMessageName() string { @@ -97,9 +98,75 @@ func init() { api.RegisterMessage((*StnRulesDump)(nil), "stn.StnRulesDump") } -var Messages = []api.Message{ - (*StnAddDelRule)(nil), - (*StnAddDelRuleReply)(nil), - (*StnRulesDetails)(nil), - (*StnRulesDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*StnAddDelRule)(nil), + (*StnAddDelRuleReply)(nil), + (*StnRulesDetails)(nil), + (*StnRulesDump)(nil), + } +} + +// RPCService represents RPC service API for stn module. +type RPCService interface { + DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) + StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} } + +func (c *serviceClient) DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpStnRulesClient{stream} + return x, nil +} + +type RPCService_DumpStnRulesClient interface { + Recv() (*StnRulesDetails, error) +} + +type serviceClient_DumpStnRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpStnRulesClient) Recv() (*StnRulesDetails, error) { + m := new(StnRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) { + out := new(StnAddDelRuleReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/tapv2/tapv2.ba.go b/plugins/vpp/binapi/vpp1904/tapv2/tapv2.ba.go index 1c1aa92a9e..0338ce173c 100644 --- a/plugins/vpp/binapi/vpp1904/tapv2/tapv2.ba.go +++ b/plugins/vpp/binapi/vpp1904/tapv2/tapv2.ba.go @@ -1,34 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/tapv2.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/tapv2.api.json /* - Package tapv2 is a generated from VPP binary API module 'tapv2'. +Package tapv2 is a generated VPP binary API for 'tapv2' module. - It contains following objects: - 3 services +It consists of: 6 messages + 3 services */ package tapv2 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpSwInterfaceTapV2(*SwInterfaceTapV2Dump) ([]*SwInterfaceTapV2Details, error) - TapCreateV2(*TapCreateV2) (*TapCreateV2Reply, error) - TapDeleteV2(*TapDeleteV2) (*TapDeleteV2Reply, error) -} - -/* Messages */ - -// SwInterfaceTapV2Details represents VPP binary API message 'sw_interface_tap_v2_details': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "tapv2" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xaebf5bff +) + +// SwInterfaceTapV2Details represents VPP binary API message 'sw_interface_tap_v2_details'. type SwInterfaceTapV2Details struct { SwIfIndex uint32 ID uint32 @@ -56,7 +56,7 @@ func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { return api.ReplyMessage } -// SwInterfaceTapV2Dump represents VPP binary API message 'sw_interface_tap_v2_dump': +// SwInterfaceTapV2Dump represents VPP binary API message 'sw_interface_tap_v2_dump'. type SwInterfaceTapV2Dump struct{} func (*SwInterfaceTapV2Dump) GetMessageName() string { @@ -69,7 +69,7 @@ func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { return api.RequestMessage } -// TapCreateV2 represents VPP binary API message 'tap_create_v2': +// TapCreateV2 represents VPP binary API message 'tap_create_v2'. type TapCreateV2 struct { ID uint32 UseRandomMac uint8 @@ -108,7 +108,7 @@ func (*TapCreateV2) GetMessageType() api.MessageType { return api.RequestMessage } -// TapCreateV2Reply represents VPP binary API message 'tap_create_v2_reply': +// TapCreateV2Reply represents VPP binary API message 'tap_create_v2_reply'. type TapCreateV2Reply struct { Retval int32 SwIfIndex uint32 @@ -124,7 +124,7 @@ func (*TapCreateV2Reply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TapDeleteV2 represents VPP binary API message 'tap_delete_v2': +// TapDeleteV2 represents VPP binary API message 'tap_delete_v2'. type TapDeleteV2 struct { SwIfIndex uint32 } @@ -139,7 +139,7 @@ func (*TapDeleteV2) GetMessageType() api.MessageType { return api.RequestMessage } -// TapDeleteV2Reply represents VPP binary API message 'tap_delete_v2_reply': +// TapDeleteV2Reply represents VPP binary API message 'tap_delete_v2_reply'. type TapDeleteV2Reply struct { Retval int32 } @@ -163,11 +163,87 @@ func init() { api.RegisterMessage((*TapDeleteV2Reply)(nil), "tapv2.TapDeleteV2Reply") } -var Messages = []api.Message{ - (*SwInterfaceTapV2Details)(nil), - (*SwInterfaceTapV2Dump)(nil), - (*TapCreateV2)(nil), - (*TapCreateV2Reply)(nil), - (*TapDeleteV2)(nil), - (*TapDeleteV2Reply)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceTapV2Details)(nil), + (*SwInterfaceTapV2Dump)(nil), + (*TapCreateV2)(nil), + (*TapCreateV2Reply)(nil), + (*TapDeleteV2)(nil), + (*TapDeleteV2Reply)(nil), + } } + +// RPCService represents RPC service API for tapv2 module. +type RPCService interface { + DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) + TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) + TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceTapV2Client{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceTapV2Client interface { + Recv() (*SwInterfaceTapV2Details, error) +} + +type serviceClient_DumpSwInterfaceTapV2Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceTapV2Client) Recv() (*SwInterfaceTapV2Details, error) { + m := new(SwInterfaceTapV2Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) { + out := new(TapCreateV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { + out := new(TapDeleteV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/vmxnet3/vmxnet3.ba.go b/plugins/vpp/binapi/vpp1904/vmxnet3/vmxnet3.ba.go index aa4eec5e47..ffac55b19c 100644 --- a/plugins/vpp/binapi/vpp1904/vmxnet3/vmxnet3.ba.go +++ b/plugins/vpp/binapi/vpp1904/vmxnet3/vmxnet3.ba.go @@ -1,35 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/plugins/vmxnet3.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/vmxnet3.api.json /* - Package vmxnet3 is a generated from VPP binary API module 'vmxnet3'. +Package vmxnet3 is a generated VPP binary API for 'vmxnet3' module. - It contains following objects: - 3 services +It consists of: 2 types 6 messages + 3 services */ package vmxnet3 -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpVmxnet3(*Vmxnet3Dump) ([]*Vmxnet3Details, error) - Vmxnet3Create(*Vmxnet3Create) (*Vmxnet3CreateReply, error) - Vmxnet3Delete(*Vmxnet3Delete) (*Vmxnet3DeleteReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Types */ +const ( + // ModuleName is the name of this module. + ModuleName = "vmxnet3" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x97ba4933 +) -// Vmxnet3RxList represents VPP binary API type 'vmxnet3_rx_list': +// Vmxnet3RxList represents VPP binary API type 'vmxnet3_rx_list'. type Vmxnet3RxList struct { RxQsize uint16 RxFill []uint16 `struc:"[2]uint16"` @@ -45,7 +45,7 @@ func (*Vmxnet3RxList) GetCrcString() string { return "ccb3fe88" } -// Vmxnet3TxList represents VPP binary API type 'vmxnet3_tx_list': +// Vmxnet3TxList represents VPP binary API type 'vmxnet3_tx_list'. type Vmxnet3TxList struct { TxQsize uint16 TxNext uint16 @@ -60,9 +60,7 @@ func (*Vmxnet3TxList) GetCrcString() string { return "f5427b33" } -/* Messages */ - -// Vmxnet3Create represents VPP binary API message 'vmxnet3_create': +// Vmxnet3Create represents VPP binary API message 'vmxnet3_create'. type Vmxnet3Create struct { PciAddr uint32 EnableElog int32 @@ -83,7 +81,7 @@ func (*Vmxnet3Create) GetMessageType() api.MessageType { return api.RequestMessage } -// Vmxnet3CreateReply represents VPP binary API message 'vmxnet3_create_reply': +// Vmxnet3CreateReply represents VPP binary API message 'vmxnet3_create_reply'. type Vmxnet3CreateReply struct { Retval int32 SwIfIndex uint32 @@ -99,7 +97,7 @@ func (*Vmxnet3CreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Delete represents VPP binary API message 'vmxnet3_delete': +// Vmxnet3Delete represents VPP binary API message 'vmxnet3_delete'. type Vmxnet3Delete struct { SwIfIndex uint32 } @@ -114,7 +112,7 @@ func (*Vmxnet3Delete) GetMessageType() api.MessageType { return api.RequestMessage } -// Vmxnet3DeleteReply represents VPP binary API message 'vmxnet3_delete_reply': +// Vmxnet3DeleteReply represents VPP binary API message 'vmxnet3_delete_reply'. type Vmxnet3DeleteReply struct { Retval int32 } @@ -129,7 +127,7 @@ func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Details represents VPP binary API message 'vmxnet3_details': +// Vmxnet3Details represents VPP binary API message 'vmxnet3_details'. type Vmxnet3Details struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` @@ -153,7 +151,7 @@ func (*Vmxnet3Details) GetMessageType() api.MessageType { return api.ReplyMessage } -// Vmxnet3Dump represents VPP binary API message 'vmxnet3_dump': +// Vmxnet3Dump represents VPP binary API message 'vmxnet3_dump'. type Vmxnet3Dump struct{} func (*Vmxnet3Dump) GetMessageName() string { @@ -175,11 +173,87 @@ func init() { api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3.Vmxnet3Dump") } -var Messages = []api.Message{ - (*Vmxnet3Create)(nil), - (*Vmxnet3CreateReply)(nil), - (*Vmxnet3Delete)(nil), - (*Vmxnet3DeleteReply)(nil), - (*Vmxnet3Details)(nil), - (*Vmxnet3Dump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Vmxnet3Create)(nil), + (*Vmxnet3CreateReply)(nil), + (*Vmxnet3Delete)(nil), + (*Vmxnet3DeleteReply)(nil), + (*Vmxnet3Details)(nil), + (*Vmxnet3Dump)(nil), + } +} + +// RPCService represents RPC service API for vmxnet3 module. +type RPCService interface { + DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) + Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) + Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVmxnet3Client{stream} + return x, nil +} + +type RPCService_DumpVmxnet3Client interface { + Recv() (*Vmxnet3Details, error) +} + +type serviceClient_DumpVmxnet3Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVmxnet3Client) Recv() (*Vmxnet3Details, error) { + m := new(Vmxnet3Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) { + out := new(Vmxnet3CreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil } + +func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { + out := new(Vmxnet3DeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/vpe/vpe.ba.go b/plugins/vpp/binapi/vpp1904/vpe/vpe.ba.go index f37d89529e..cff53cd7c7 100644 --- a/plugins/vpp/binapi/vpp1904/vpe/vpe.ba.go +++ b/plugins/vpp/binapi/vpp1904/vpe/vpe.ba.go @@ -1,41 +1,35 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/vpe.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/vpe.api.json /* - Package vpe is a generated from VPP binary API module 'vpe'. +Package vpe is a generated VPP binary API for 'vpe' module. - It contains following objects: - 9 services +It consists of: 1 type 18 messages + 9 services */ package vpe -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - AddNodeNext(*AddNodeNext) (*AddNodeNextReply, error) - Cli(*Cli) (*CliReply, error) - CliInband(*CliInband) (*CliInbandReply, error) - ControlPing(*ControlPing) (*ControlPingReply, error) - GetNextIndex(*GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(*GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(*GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(*ShowThreads) (*ShowThreadsReply, error) - ShowVersion(*ShowVersion) (*ShowVersionReply, error) -} - -/* Types */ - -// ThreadData represents VPP binary API type 'thread_data': +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vpe" + // APIVersion is the API version of this module. + APIVersion = "1.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x2cc8d629 +) + +// ThreadData represents VPP binary API type 'thread_data'. type ThreadData struct { ID uint32 Name []byte `struc:"[64]byte"` @@ -53,9 +47,7 @@ func (*ThreadData) GetCrcString() string { return "0f57094e" } -/* Messages */ - -// AddNodeNext represents VPP binary API message 'add_node_next': +// AddNodeNext represents VPP binary API message 'add_node_next'. type AddNodeNext struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -71,7 +63,7 @@ func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } -// AddNodeNextReply represents VPP binary API message 'add_node_next_reply': +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. type AddNodeNextReply struct { Retval int32 NextIndex uint32 @@ -87,7 +79,7 @@ func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// Cli represents VPP binary API message 'cli': +// Cli represents VPP binary API message 'cli'. type Cli struct { CmdInShmem uint64 } @@ -102,7 +94,7 @@ func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInband represents VPP binary API message 'cli_inband': +// CliInband represents VPP binary API message 'cli_inband'. type CliInband struct { XXX_CmdLen uint32 `struc:"sizeof=Cmd"` Cmd string @@ -118,7 +110,7 @@ func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } -// CliInbandReply represents VPP binary API message 'cli_inband_reply': +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. type CliInbandReply struct { Retval int32 XXX_ReplyLen uint32 `struc:"sizeof=Reply"` @@ -135,7 +127,7 @@ func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// CliReply represents VPP binary API message 'cli_reply': +// CliReply represents VPP binary API message 'cli_reply'. type CliReply struct { Retval int32 ReplyInShmem uint64 @@ -151,7 +143,7 @@ func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ControlPing represents VPP binary API message 'control_ping': +// ControlPing represents VPP binary API message 'control_ping'. type ControlPing struct{} func (*ControlPing) GetMessageName() string { @@ -164,7 +156,7 @@ func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } -// ControlPingReply represents VPP binary API message 'control_ping_reply': +// ControlPingReply represents VPP binary API message 'control_ping_reply'. type ControlPingReply struct { Retval int32 ClientIndex uint32 @@ -181,7 +173,7 @@ func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNextIndex represents VPP binary API message 'get_next_index': +// GetNextIndex represents VPP binary API message 'get_next_index'. type GetNextIndex struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -197,7 +189,7 @@ func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNextIndexReply represents VPP binary API message 'get_next_index_reply': +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. type GetNextIndexReply struct { Retval int32 NextIndex uint32 @@ -213,7 +205,7 @@ func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeGraph represents VPP binary API message 'get_node_graph': +// GetNodeGraph represents VPP binary API message 'get_node_graph'. type GetNodeGraph struct{} func (*GetNodeGraph) GetMessageName() string { @@ -226,7 +218,7 @@ func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply': +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. type GetNodeGraphReply struct { Retval int32 ReplyInShmem uint64 @@ -242,7 +234,7 @@ func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetNodeIndex represents VPP binary API message 'get_node_index': +// GetNodeIndex represents VPP binary API message 'get_node_index'. type GetNodeIndex struct { NodeName []byte `struc:"[64]byte"` } @@ -257,7 +249,7 @@ func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } -// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply': +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. type GetNodeIndexReply struct { Retval int32 NodeIndex uint32 @@ -273,7 +265,7 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowThreads represents VPP binary API message 'show_threads': +// ShowThreads represents VPP binary API message 'show_threads'. type ShowThreads struct{} func (*ShowThreads) GetMessageName() string { @@ -286,7 +278,7 @@ func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowThreadsReply represents VPP binary API message 'show_threads_reply': +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. type ShowThreadsReply struct { Retval int32 Count uint32 `struc:"sizeof=ThreadData"` @@ -303,7 +295,7 @@ func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// ShowVersion represents VPP binary API message 'show_version': +// ShowVersion represents VPP binary API message 'show_version'. type ShowVersion struct{} func (*ShowVersion) GetMessageName() string { @@ -316,7 +308,7 @@ func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } -// ShowVersionReply represents VPP binary API message 'show_version_reply': +// ShowVersionReply represents VPP binary API message 'show_version_reply'. type ShowVersionReply struct { Retval int32 XXX_ProgramLen uint32 `struc:"sizeof=Program"` @@ -360,23 +352,142 @@ func init() { api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") } -var Messages = []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), - (*ShowVersion)(nil), - (*ShowVersionReply)(nil), -} +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + } +} + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1904/vxlan/vxlan.ba.go b/plugins/vpp/binapi/vpp1904/vxlan/vxlan.ba.go index bf520b7111..1f1778204a 100644 --- a/plugins/vpp/binapi/vpp1904/vxlan/vxlan.ba.go +++ b/plugins/vpp/binapi/vpp1904/vxlan/vxlan.ba.go @@ -1,35 +1,34 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/vxlan.api.json +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/vxlan.api.json /* - Package vxlan is a generated from VPP binary API module 'vxlan'. +Package vxlan is a generated VPP binary API for 'vxlan' module. - It contains following objects: - 4 services +It consists of: 8 messages + 4 services */ package vxlan -import api "git.fd.io/govpp.git/api" -import struc "github.com/lunixbochs/struc" -import bytes "bytes" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = struc.Pack -var _ = bytes.NewBuffer - -// Services represents VPP binary API services: -type Services interface { - DumpVxlanTunnel(*VxlanTunnelDump) ([]*VxlanTunnelDetails, error) - SwInterfaceSetVxlanBypass(*SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) - VxlanAddDelTunnel(*VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) - VxlanOffloadRx(*VxlanOffloadRx) (*VxlanOffloadRxReply, error) -} +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) -/* Messages */ +const ( + // ModuleName is the name of this module. + ModuleName = "vxlan" + // APIVersion is the API version of this module. + APIVersion = "1.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x38cd707d +) -// SwInterfaceSetVxlanBypass represents VPP binary API message 'sw_interface_set_vxlan_bypass': +// SwInterfaceSetVxlanBypass represents VPP binary API message 'sw_interface_set_vxlan_bypass'. type SwInterfaceSetVxlanBypass struct { SwIfIndex uint32 IsIPv6 uint8 @@ -46,7 +45,7 @@ func (*SwInterfaceSetVxlanBypass) GetMessageType() api.MessageType { return api.RequestMessage } -// SwInterfaceSetVxlanBypassReply represents VPP binary API message 'sw_interface_set_vxlan_bypass_reply': +// SwInterfaceSetVxlanBypassReply represents VPP binary API message 'sw_interface_set_vxlan_bypass_reply'. type SwInterfaceSetVxlanBypassReply struct { Retval int32 } @@ -61,7 +60,7 @@ func (*SwInterfaceSetVxlanBypassReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanAddDelTunnel represents VPP binary API message 'vxlan_add_del_tunnel': +// VxlanAddDelTunnel represents VPP binary API message 'vxlan_add_del_tunnel'. type VxlanAddDelTunnel struct { IsAdd uint8 IsIPv6 uint8 @@ -84,7 +83,7 @@ func (*VxlanAddDelTunnel) GetMessageType() api.MessageType { return api.RequestMessage } -// VxlanAddDelTunnelReply represents VPP binary API message 'vxlan_add_del_tunnel_reply': +// VxlanAddDelTunnelReply represents VPP binary API message 'vxlan_add_del_tunnel_reply'. type VxlanAddDelTunnelReply struct { Retval int32 SwIfIndex uint32 @@ -100,7 +99,7 @@ func (*VxlanAddDelTunnelReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanOffloadRx represents VPP binary API message 'vxlan_offload_rx': +// VxlanOffloadRx represents VPP binary API message 'vxlan_offload_rx'. type VxlanOffloadRx struct { HwIfIndex uint32 SwIfIndex uint32 @@ -117,7 +116,7 @@ func (*VxlanOffloadRx) GetMessageType() api.MessageType { return api.RequestMessage } -// VxlanOffloadRxReply represents VPP binary API message 'vxlan_offload_rx_reply': +// VxlanOffloadRxReply represents VPP binary API message 'vxlan_offload_rx_reply'. type VxlanOffloadRxReply struct { Retval int32 } @@ -132,7 +131,7 @@ func (*VxlanOffloadRxReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanTunnelDetails represents VPP binary API message 'vxlan_tunnel_details': +// VxlanTunnelDetails represents VPP binary API message 'vxlan_tunnel_details'. type VxlanTunnelDetails struct { SwIfIndex uint32 Instance uint32 @@ -155,7 +154,7 @@ func (*VxlanTunnelDetails) GetMessageType() api.MessageType { return api.ReplyMessage } -// VxlanTunnelDump represents VPP binary API message 'vxlan_tunnel_dump': +// VxlanTunnelDump represents VPP binary API message 'vxlan_tunnel_dump'. type VxlanTunnelDump struct { SwIfIndex uint32 } @@ -181,13 +180,99 @@ func init() { api.RegisterMessage((*VxlanTunnelDump)(nil), "vxlan.VxlanTunnelDump") } -var Messages = []api.Message{ - (*SwInterfaceSetVxlanBypass)(nil), - (*SwInterfaceSetVxlanBypassReply)(nil), - (*VxlanAddDelTunnel)(nil), - (*VxlanAddDelTunnelReply)(nil), - (*VxlanOffloadRx)(nil), - (*VxlanOffloadRxReply)(nil), - (*VxlanTunnelDetails)(nil), - (*VxlanTunnelDump)(nil), +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanBypass)(nil), + (*SwInterfaceSetVxlanBypassReply)(nil), + (*VxlanAddDelTunnel)(nil), + (*VxlanAddDelTunnelReply)(nil), + (*VxlanOffloadRx)(nil), + (*VxlanOffloadRxReply)(nil), + (*VxlanTunnelDetails)(nil), + (*VxlanTunnelDump)(nil), + } } + +// RPCService represents RPC service API for vxlan module. +type RPCService interface { + DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) + SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) + VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) + VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVxlanTunnelClient{stream} + return x, nil +} + +type RPCService_DumpVxlanTunnelClient interface { + Recv() (*VxlanTunnelDetails, error) +} + +type serviceClient_DumpVxlanTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVxlanTunnelClient) Recv() (*VxlanTunnelDetails, error) { + m := new(VxlanTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) { + out := new(SwInterfaceSetVxlanBypassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { + out := new(VxlanAddDelTunnelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { + out := new(VxlanOffloadRxReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/abf.patch b/plugins/vpp/binapi/vpp1908/abf.patch new file mode 100644 index 0000000000..b562ae5e09 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/abf.patch @@ -0,0 +1,15 @@ +diff --git b/plugins/vpp/binapi/vpp1908/abf/abf.ba.go a/plugins/vpp/binapi/vpp1908/abf/abf.ba.go +index 7194b0c3c..af524a4b6 100644 +--- b/plugins/vpp/binapi/vpp1908/abf/abf.ba.go ++++ a/plugins/vpp/binapi/vpp1908/abf/abf.ba.go +@@ -270,8 +270,8 @@ type FibPath struct { + Flags FibPathFlags + Proto FibPathNhProto + Nh FibPathNh +- NLabels uint8 +- LabelStack []FibMplsLabel `struc:"[16]FibMplsLabel"` ++ NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED ++ LabelStack []FibMplsLabel + } + + func (*FibPath) GetTypeName() string { diff --git a/plugins/vpp/binapi/vpp1908/abf/abf.ba.go b/plugins/vpp/binapi/vpp1908/abf/abf.ba.go new file mode 100644 index 0000000000..a6c4283cf5 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/abf/abf.ba.go @@ -0,0 +1,814 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/abf.api.json + +/* +Package abf is a generated VPP binary API for 'abf' module. + +It consists of: + 7 enums + 2 aliases + 11 types + 1 union + 10 messages + 5 services +*/ +package abf + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "abf" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x96d30784 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathFlags represents VPP binary API enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", +} + +var FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, +} + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", +} + +var FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, +} + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathType represents VPP binary API enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", +} + +var FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, +} + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// AbfItfAttach represents VPP binary API type 'abf_itf_attach'. +type AbfItfAttach struct { + PolicyID uint32 + SwIfIndex uint32 + Priority uint32 + IsIPv6 uint8 +} + +func (*AbfItfAttach) GetTypeName() string { + return "abf_itf_attach" +} + +// AbfPolicy represents VPP binary API type 'abf_policy'. +type AbfPolicy struct { + PolicyID uint32 + ACLIndex uint32 + NPaths uint8 `struc:"sizeof=Paths"` + Paths []FibPath +} + +func (*AbfPolicy) GetTypeName() string { + return "abf_policy" +} + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 + Label uint32 + TTL uint8 + Exp uint8 +} + +func (*FibMplsLabel) GetTypeName() string { + return "fib_mpls_label" +} + +// FibPath represents VPP binary API type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 + TableID uint32 + RpfID uint32 + Weight uint8 + Preference uint8 + Type FibPathType + Flags FibPathFlags + Proto FibPathNhProto + Nh FibPathNh + NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED + LabelStack []FibMplsLabel +} + +func (*FibPath) GetTypeName() string { + return "fib_path" +} + +// FibPathNh represents VPP binary API type 'fib_path_nh'. +type FibPathNh struct { + Address AddressUnion + ViaLabel uint32 + ObjID uint32 + ClassifyTableIndex uint32 +} + +func (*FibPathNh) GetTypeName() string { + return "fib_path_nh" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// AbfItfAttachAddDel represents VPP binary API message 'abf_itf_attach_add_del'. +type AbfItfAttachAddDel struct { + IsAdd uint8 + Attach AbfItfAttach +} + +func (*AbfItfAttachAddDel) GetMessageName() string { + return "abf_itf_attach_add_del" +} +func (*AbfItfAttachAddDel) GetCrcString() string { + return "4464f87d" +} +func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AbfItfAttachAddDelReply represents VPP binary API message 'abf_itf_attach_add_del_reply'. +type AbfItfAttachAddDelReply struct { + Retval int32 +} + +func (*AbfItfAttachAddDelReply) GetMessageName() string { + return "abf_itf_attach_add_del_reply" +} +func (*AbfItfAttachAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AbfItfAttachDetails represents VPP binary API message 'abf_itf_attach_details'. +type AbfItfAttachDetails struct { + Attach AbfItfAttach +} + +func (*AbfItfAttachDetails) GetMessageName() string { + return "abf_itf_attach_details" +} +func (*AbfItfAttachDetails) GetCrcString() string { + return "4a943370" +} +func (*AbfItfAttachDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AbfItfAttachDump represents VPP binary API message 'abf_itf_attach_dump'. +type AbfItfAttachDump struct{} + +func (*AbfItfAttachDump) GetMessageName() string { + return "abf_itf_attach_dump" +} +func (*AbfItfAttachDump) GetCrcString() string { + return "51077d14" +} +func (*AbfItfAttachDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AbfPluginGetVersion represents VPP binary API message 'abf_plugin_get_version'. +type AbfPluginGetVersion struct{} + +func (*AbfPluginGetVersion) GetMessageName() string { + return "abf_plugin_get_version" +} +func (*AbfPluginGetVersion) GetCrcString() string { + return "51077d14" +} +func (*AbfPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AbfPluginGetVersionReply represents VPP binary API message 'abf_plugin_get_version_reply'. +type AbfPluginGetVersionReply struct { + Major uint32 + Minor uint32 +} + +func (*AbfPluginGetVersionReply) GetMessageName() string { + return "abf_plugin_get_version_reply" +} +func (*AbfPluginGetVersionReply) GetCrcString() string { + return "9b32cf86" +} +func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AbfPolicyAddDel represents VPP binary API message 'abf_policy_add_del'. +type AbfPolicyAddDel struct { + IsAdd uint8 + Policy AbfPolicy +} + +func (*AbfPolicyAddDel) GetMessageName() string { + return "abf_policy_add_del" +} +func (*AbfPolicyAddDel) GetCrcString() string { + return "d1fc434d" +} +func (*AbfPolicyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AbfPolicyAddDelReply represents VPP binary API message 'abf_policy_add_del_reply'. +type AbfPolicyAddDelReply struct { + Retval int32 +} + +func (*AbfPolicyAddDelReply) GetMessageName() string { + return "abf_policy_add_del_reply" +} +func (*AbfPolicyAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AbfPolicyDetails represents VPP binary API message 'abf_policy_details'. +type AbfPolicyDetails struct { + Policy AbfPolicy +} + +func (*AbfPolicyDetails) GetMessageName() string { + return "abf_policy_details" +} +func (*AbfPolicyDetails) GetCrcString() string { + return "c19593c8" +} +func (*AbfPolicyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AbfPolicyDump represents VPP binary API message 'abf_policy_dump'. +type AbfPolicyDump struct{} + +func (*AbfPolicyDump) GetMessageName() string { + return "abf_policy_dump" +} +func (*AbfPolicyDump) GetCrcString() string { + return "51077d14" +} +func (*AbfPolicyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf.AbfItfAttachAddDel") + api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf.AbfItfAttachAddDelReply") + api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf.AbfItfAttachDetails") + api.RegisterMessage((*AbfItfAttachDump)(nil), "abf.AbfItfAttachDump") + api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf.AbfPluginGetVersion") + api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf.AbfPluginGetVersionReply") + api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf.AbfPolicyAddDel") + api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf.AbfPolicyAddDelReply") + api.RegisterMessage((*AbfPolicyDetails)(nil), "abf.AbfPolicyDetails") + api.RegisterMessage((*AbfPolicyDump)(nil), "abf.AbfPolicyDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AbfItfAttachAddDel)(nil), + (*AbfItfAttachAddDelReply)(nil), + (*AbfItfAttachDetails)(nil), + (*AbfItfAttachDump)(nil), + (*AbfPluginGetVersion)(nil), + (*AbfPluginGetVersionReply)(nil), + (*AbfPolicyAddDel)(nil), + (*AbfPolicyAddDelReply)(nil), + (*AbfPolicyDetails)(nil), + (*AbfPolicyDump)(nil), + } +} + +// RPCService represents RPC service API for abf module. +type RPCService interface { + DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) + DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) + AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) + AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) + AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAbfItfAttach(ctx context.Context, in *AbfItfAttachDump) (RPCService_DumpAbfItfAttachClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfItfAttachClient{stream} + return x, nil +} + +type RPCService_DumpAbfItfAttachClient interface { + Recv() (*AbfItfAttachDetails, error) +} + +type serviceClient_DumpAbfItfAttachClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAbfItfAttachClient) Recv() (*AbfItfAttachDetails, error) { + m := new(AbfItfAttachDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpAbfPolicy(ctx context.Context, in *AbfPolicyDump) (RPCService_DumpAbfPolicyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAbfPolicyClient{stream} + return x, nil +} + +type RPCService_DumpAbfPolicyClient interface { + Recv() (*AbfPolicyDetails, error) +} + +type serviceClient_DumpAbfPolicyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAbfPolicyClient) Recv() (*AbfPolicyDetails, error) { + m := new(AbfPolicyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) { + out := new(AbfItfAttachAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) { + out := new(AbfPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) { + out := new(AbfPolicyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/acl/acl.ba.go b/plugins/vpp/binapi/vpp1908/acl/acl.ba.go new file mode 100644 index 0000000000..9c3f04d09f --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/acl/acl.ba.go @@ -0,0 +1,1053 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/acl.api.json + +/* +Package acl is a generated VPP binary API for 'acl' module. + +It consists of: + 2 types + 38 messages + 19 services +*/ +package acl + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "acl" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0xedb7b898 +) + +// ACLRule represents VPP binary API type 'acl_rule'. +type ACLRule struct { + IsPermit uint8 + IsIPv6 uint8 + SrcIPAddr []byte `struc:"[16]byte"` + SrcIPPrefixLen uint8 + DstIPAddr []byte `struc:"[16]byte"` + DstIPPrefixLen uint8 + Proto uint8 + SrcportOrIcmptypeFirst uint16 + SrcportOrIcmptypeLast uint16 + DstportOrIcmpcodeFirst uint16 + DstportOrIcmpcodeLast uint16 + TCPFlagsMask uint8 + TCPFlagsValue uint8 +} + +func (*ACLRule) GetTypeName() string { + return "acl_rule" +} + +// MacipACLRule represents VPP binary API type 'macip_acl_rule'. +type MacipACLRule struct { + IsPermit uint8 + IsIPv6 uint8 + SrcMac []byte `struc:"[6]byte"` + SrcMacMask []byte `struc:"[6]byte"` + SrcIPAddr []byte `struc:"[16]byte"` + SrcIPPrefixLen uint8 +} + +func (*MacipACLRule) GetTypeName() string { + return "macip_acl_rule" +} + +// ACLAddReplace represents VPP binary API message 'acl_add_replace'. +type ACLAddReplace struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []ACLRule +} + +func (*ACLAddReplace) GetMessageName() string { + return "acl_add_replace" +} +func (*ACLAddReplace) GetCrcString() string { + return "13bc8539" +} +func (*ACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. +type ACLAddReplaceReply struct { + ACLIndex uint32 + Retval int32 +} + +func (*ACLAddReplaceReply) GetMessageName() string { + return "acl_add_replace_reply" +} +func (*ACLAddReplaceReply) GetCrcString() string { + return "ac407b0c" +} +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLDel represents VPP binary API message 'acl_del'. +type ACLDel struct { + ACLIndex uint32 +} + +func (*ACLDel) GetMessageName() string { + return "acl_del" +} +func (*ACLDel) GetCrcString() string { + return "ef34fea4" +} +func (*ACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLDelReply represents VPP binary API message 'acl_del_reply'. +type ACLDelReply struct { + Retval int32 +} + +func (*ACLDelReply) GetMessageName() string { + return "acl_del_reply" +} +func (*ACLDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*ACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLDetails represents VPP binary API message 'acl_details'. +type ACLDetails struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []ACLRule +} + +func (*ACLDetails) GetMessageName() string { + return "acl_details" +} +func (*ACLDetails) GetCrcString() string { + return "f89d7a88" +} +func (*ACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLDump represents VPP binary API message 'acl_dump'. +type ACLDump struct { + ACLIndex uint32 +} + +func (*ACLDump) GetMessageName() string { + return "acl_dump" +} +func (*ACLDump) GetCrcString() string { + return "ef34fea4" +} +func (*ACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. +type ACLInterfaceAddDel struct { + IsAdd uint8 + IsInput uint8 + SwIfIndex uint32 + ACLIndex uint32 +} + +func (*ACLInterfaceAddDel) GetMessageName() string { + return "acl_interface_add_del" +} +func (*ACLInterfaceAddDel) GetCrcString() string { + return "0b2aedd1" +} +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. +type ACLInterfaceAddDelReply struct { + Retval int32 +} + +func (*ACLInterfaceAddDelReply) GetMessageName() string { + return "acl_interface_add_del_reply" +} +func (*ACLInterfaceAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. +type ACLInterfaceEtypeWhitelistDetails struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Whitelist"` + NInput uint8 + Whitelist []uint16 +} + +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { + return "acl_interface_etype_whitelist_details" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { + return "6a5d4e81" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. +type ACLInterfaceEtypeWhitelistDump struct { + SwIfIndex uint32 +} + +func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { + return "acl_interface_etype_whitelist_dump" +} +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { + return "529cb13f" +} +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. +type ACLInterfaceListDetails struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Acls"` + NInput uint8 + Acls []uint32 +} + +func (*ACLInterfaceListDetails) GetMessageName() string { + return "acl_interface_list_details" +} +func (*ACLInterfaceListDetails) GetCrcString() string { + return "d5e80809" +} +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. +type ACLInterfaceListDump struct { + SwIfIndex uint32 +} + +func (*ACLInterfaceListDump) GetMessageName() string { + return "acl_interface_list_dump" +} +func (*ACLInterfaceListDump) GetCrcString() string { + return "529cb13f" +} +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. +type ACLInterfaceSetACLList struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Acls"` + NInput uint8 + Acls []uint32 +} + +func (*ACLInterfaceSetACLList) GetMessageName() string { + return "acl_interface_set_acl_list" +} +func (*ACLInterfaceSetACLList) GetCrcString() string { + return "8baece38" +} +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. +type ACLInterfaceSetACLListReply struct { + Retval int32 +} + +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { + return "e8d4e804" +} +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. +type ACLInterfaceSetEtypeWhitelist struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Whitelist"` + NInput uint8 + Whitelist []uint16 +} + +func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { + return "acl_interface_set_etype_whitelist" +} +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { + return "f515efc5" +} +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. +type ACLInterfaceSetEtypeWhitelistReply struct { + Retval int32 +} + +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { + return "acl_interface_set_etype_whitelist_reply" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { + return "e8d4e804" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. +type ACLPluginControlPing struct{} + +func (*ACLPluginControlPing) GetMessageName() string { + return "acl_plugin_control_ping" +} +func (*ACLPluginControlPing) GetCrcString() string { + return "51077d14" +} +func (*ACLPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. +type ACLPluginControlPingReply struct { + Retval int32 + ClientIndex uint32 + VpePID uint32 +} + +func (*ACLPluginControlPingReply) GetMessageName() string { + return "acl_plugin_control_ping_reply" +} +func (*ACLPluginControlPingReply) GetCrcString() string { + return "f6b0b8ca" +} +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. +type ACLPluginGetConnTableMaxEntries struct{} + +func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries" +} +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { + return "51077d14" +} +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. +type ACLPluginGetConnTableMaxEntriesReply struct { + ConnTableMaxEntries uint64 +} + +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries_reply" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { + return "7a096d3d" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. +type ACLPluginGetVersion struct{} + +func (*ACLPluginGetVersion) GetMessageName() string { + return "acl_plugin_get_version" +} +func (*ACLPluginGetVersion) GetCrcString() string { + return "51077d14" +} +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. +type ACLPluginGetVersionReply struct { + Major uint32 + Minor uint32 +} + +func (*ACLPluginGetVersionReply) GetMessageName() string { + return "acl_plugin_get_version_reply" +} +func (*ACLPluginGetVersionReply) GetCrcString() string { + return "9b32cf86" +} +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool +} + +func (*ACLStatsIntfCountersEnable) GetMessageName() string { + return "acl_stats_intf_counters_enable" +} +func (*ACLStatsIntfCountersEnable) GetCrcString() string { + return "b3e225d2" +} +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 +} + +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" +} +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { + return "e8d4e804" +} +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. +type MacipACLAdd struct { + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []MacipACLRule +} + +func (*MacipACLAdd) GetMessageName() string { + return "macip_acl_add" +} +func (*MacipACLAdd) GetCrcString() string { + return "0c680ca5" +} +func (*MacipACLAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. +type MacipACLAddReplace struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []MacipACLRule +} + +func (*MacipACLAddReplace) GetMessageName() string { + return "macip_acl_add_replace" +} +func (*MacipACLAddReplace) GetCrcString() string { + return "d3d313e7" +} +func (*MacipACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. +type MacipACLAddReplaceReply struct { + ACLIndex uint32 + Retval int32 +} + +func (*MacipACLAddReplaceReply) GetMessageName() string { + return "macip_acl_add_replace_reply" +} +func (*MacipACLAddReplaceReply) GetCrcString() string { + return "ac407b0c" +} +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. +type MacipACLAddReply struct { + ACLIndex uint32 + Retval int32 +} + +func (*MacipACLAddReply) GetMessageName() string { + return "macip_acl_add_reply" +} +func (*MacipACLAddReply) GetCrcString() string { + return "ac407b0c" +} +func (*MacipACLAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLDel represents VPP binary API message 'macip_acl_del'. +type MacipACLDel struct { + ACLIndex uint32 +} + +func (*MacipACLDel) GetMessageName() string { + return "macip_acl_del" +} +func (*MacipACLDel) GetCrcString() string { + return "ef34fea4" +} +func (*MacipACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. +type MacipACLDelReply struct { + Retval int32 +} + +func (*MacipACLDelReply) GetMessageName() string { + return "macip_acl_del_reply" +} +func (*MacipACLDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*MacipACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLDetails represents VPP binary API message 'macip_acl_details'. +type MacipACLDetails struct { + ACLIndex uint32 + Tag []byte `struc:"[64]byte"` + Count uint32 `struc:"sizeof=R"` + R []MacipACLRule +} + +func (*MacipACLDetails) GetMessageName() string { + return "macip_acl_details" +} +func (*MacipACLDetails) GetCrcString() string { + return "e164e69a" +} +func (*MacipACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLDump represents VPP binary API message 'macip_acl_dump'. +type MacipACLDump struct { + ACLIndex uint32 +} + +func (*MacipACLDump) GetMessageName() string { + return "macip_acl_dump" +} +func (*MacipACLDump) GetCrcString() string { + return "ef34fea4" +} +func (*MacipACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. +type MacipACLInterfaceAddDel struct { + IsAdd uint8 + SwIfIndex uint32 + ACLIndex uint32 +} + +func (*MacipACLInterfaceAddDel) GetMessageName() string { + return "macip_acl_interface_add_del" +} +func (*MacipACLInterfaceAddDel) GetCrcString() string { + return "6a6be97c" +} +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. +type MacipACLInterfaceAddDelReply struct { + Retval int32 +} + +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. +type MacipACLInterfaceGet struct{} + +func (*MacipACLInterfaceGet) GetMessageName() string { + return "macip_acl_interface_get" +} +func (*MacipACLInterfaceGet) GetCrcString() string { + return "51077d14" +} +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. +type MacipACLInterfaceGetReply struct { + Count uint32 `struc:"sizeof=Acls"` + Acls []uint32 +} + +func (*MacipACLInterfaceGetReply) GetMessageName() string { + return "macip_acl_interface_get_reply" +} +func (*MacipACLInterfaceGetReply) GetCrcString() string { + return "accf9b05" +} +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. +type MacipACLInterfaceListDetails struct { + SwIfIndex uint32 + Count uint8 `struc:"sizeof=Acls"` + Acls []uint32 +} + +func (*MacipACLInterfaceListDetails) GetMessageName() string { + return "macip_acl_interface_list_details" +} +func (*MacipACLInterfaceListDetails) GetCrcString() string { + return "29783fa0" +} +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. +type MacipACLInterfaceListDump struct { + SwIfIndex uint32 +} + +func (*MacipACLInterfaceListDump) GetMessageName() string { + return "macip_acl_interface_list_dump" +} +func (*MacipACLInterfaceListDump) GetCrcString() string { + return "529cb13f" +} +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") + api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") + api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") + api.RegisterMessage((*ACLDelReply)(nil), "acl.ACLDelReply") + api.RegisterMessage((*ACLDetails)(nil), "acl.ACLDetails") + api.RegisterMessage((*ACLDump)(nil), "acl.ACLDump") + api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl.ACLInterfaceAddDel") + api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl.ACLInterfaceAddDelReply") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl.ACLInterfaceEtypeWhitelistDetails") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl.ACLInterfaceEtypeWhitelistDump") + api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl.ACLInterfaceListDetails") + api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl.ACLInterfaceListDump") + api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl.ACLInterfaceSetACLList") + api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl.ACLInterfaceSetACLListReply") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl.ACLInterfaceSetEtypeWhitelist") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl.ACLInterfaceSetEtypeWhitelistReply") + api.RegisterMessage((*ACLPluginControlPing)(nil), "acl.ACLPluginControlPing") + api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl.ACLPluginControlPingReply") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl.ACLPluginGetConnTableMaxEntries") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") + api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") + api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") + api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") + api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") + api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") + api.RegisterMessage((*MacipACLAddReply)(nil), "acl.MacipACLAddReply") + api.RegisterMessage((*MacipACLDel)(nil), "acl.MacipACLDel") + api.RegisterMessage((*MacipACLDelReply)(nil), "acl.MacipACLDelReply") + api.RegisterMessage((*MacipACLDetails)(nil), "acl.MacipACLDetails") + api.RegisterMessage((*MacipACLDump)(nil), "acl.MacipACLDump") + api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "acl.MacipACLInterfaceAddDel") + api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "acl.MacipACLInterfaceAddDelReply") + api.RegisterMessage((*MacipACLInterfaceGet)(nil), "acl.MacipACLInterfaceGet") + api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "acl.MacipACLInterfaceGetReply") + api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails") + api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/af_packet/af_packet.ba.go b/plugins/vpp/binapi/vpp1908/af_packet/af_packet.ba.go new file mode 100644 index 0000000000..6f92b04411 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/af_packet/af_packet.ba.go @@ -0,0 +1,260 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/af_packet.api.json + +/* +Package af_packet is a generated VPP binary API for 'af_packet' module. + +It consists of: + 8 messages + 4 services +*/ +package af_packet + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "af_packet" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xfefd69b7 +) + +// AfPacketCreate represents VPP binary API message 'af_packet_create'. +type AfPacketCreate struct { + HostIfName []byte `struc:"[64]byte"` + HwAddr []byte `struc:"[6]byte"` + UseRandomHwAddr uint8 +} + +func (*AfPacketCreate) GetMessageName() string { + return "af_packet_create" +} +func (*AfPacketCreate) GetCrcString() string { + return "6d5d30d6" +} +func (*AfPacketCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. +type AfPacketCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*AfPacketCreateReply) GetMessageName() string { + return "af_packet_create_reply" +} +func (*AfPacketCreateReply) GetCrcString() string { + return "fda5941f" +} +func (*AfPacketCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AfPacketDelete represents VPP binary API message 'af_packet_delete'. +type AfPacketDelete struct { + HostIfName []byte `struc:"[64]byte"` +} + +func (*AfPacketDelete) GetMessageName() string { + return "af_packet_delete" +} +func (*AfPacketDelete) GetCrcString() string { + return "3efceda3" +} +func (*AfPacketDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. +type AfPacketDeleteReply struct { + Retval int32 +} + +func (*AfPacketDeleteReply) GetMessageName() string { + return "af_packet_delete_reply" +} +func (*AfPacketDeleteReply) GetCrcString() string { + return "e8d4e804" +} +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AfPacketDetails represents VPP binary API message 'af_packet_details'. +type AfPacketDetails struct { + SwIfIndex uint32 + HostIfName []byte `struc:"[64]byte"` +} + +func (*AfPacketDetails) GetMessageName() string { + return "af_packet_details" +} +func (*AfPacketDetails) GetCrcString() string { + return "057205fa" +} +func (*AfPacketDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AfPacketDump represents VPP binary API message 'af_packet_dump'. +type AfPacketDump struct{} + +func (*AfPacketDump) GetMessageName() string { + return "af_packet_dump" +} +func (*AfPacketDump) GetCrcString() string { + return "51077d14" +} +func (*AfPacketDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. +type AfPacketSetL4CksumOffload struct { + SwIfIndex uint8 + Set uint8 +} + +func (*AfPacketSetL4CksumOffload) GetMessageName() string { + return "af_packet_set_l4_cksum_offload" +} +func (*AfPacketSetL4CksumOffload) GetCrcString() string { + return "86538585" +} +func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. +type AfPacketSetL4CksumOffloadReply struct { + Retval int32 +} + +func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { + return "af_packet_set_l4_cksum_offload_reply" +} +func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { + return "e8d4e804" +} +func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") + api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") + api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") + api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply") + api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails") + api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump") + api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload") + api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } +} + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/bfd/bfd.ba.go b/plugins/vpp/binapi/vpp1908/bfd/bfd.ba.go new file mode 100644 index 0000000000..cbcb55e5d2 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/bfd/bfd.ba.go @@ -0,0 +1,760 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/bfd.api.json + +/* +Package bfd is a generated VPP binary API for 'bfd' module. + +It consists of: + 28 messages + 14 services +*/ +package bfd + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bfd" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x5c3ba394 +) + +// BfdAuthDelKey represents VPP binary API message 'bfd_auth_del_key'. +type BfdAuthDelKey struct { + ConfKeyID uint32 +} + +func (*BfdAuthDelKey) GetMessageName() string { + return "bfd_auth_del_key" +} +func (*BfdAuthDelKey) GetCrcString() string { + return "65310b22" +} +func (*BfdAuthDelKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdAuthDelKeyReply represents VPP binary API message 'bfd_auth_del_key_reply'. +type BfdAuthDelKeyReply struct { + Retval int32 +} + +func (*BfdAuthDelKeyReply) GetMessageName() string { + return "bfd_auth_del_key_reply" +} +func (*BfdAuthDelKeyReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdAuthKeysDetails represents VPP binary API message 'bfd_auth_keys_details'. +type BfdAuthKeysDetails struct { + ConfKeyID uint32 + UseCount uint32 + AuthType uint8 +} + +func (*BfdAuthKeysDetails) GetMessageName() string { + return "bfd_auth_keys_details" +} +func (*BfdAuthKeysDetails) GetCrcString() string { + return "84130e9f" +} +func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdAuthKeysDump represents VPP binary API message 'bfd_auth_keys_dump'. +type BfdAuthKeysDump struct{} + +func (*BfdAuthKeysDump) GetMessageName() string { + return "bfd_auth_keys_dump" +} +func (*BfdAuthKeysDump) GetCrcString() string { + return "51077d14" +} +func (*BfdAuthKeysDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdAuthSetKey represents VPP binary API message 'bfd_auth_set_key'. +type BfdAuthSetKey struct { + ConfKeyID uint32 + KeyLen uint8 + AuthType uint8 + Key []byte `struc:"[20]byte"` +} + +func (*BfdAuthSetKey) GetMessageName() string { + return "bfd_auth_set_key" +} +func (*BfdAuthSetKey) GetCrcString() string { + return "690b8877" +} +func (*BfdAuthSetKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdAuthSetKeyReply represents VPP binary API message 'bfd_auth_set_key_reply'. +type BfdAuthSetKeyReply struct { + Retval int32 +} + +func (*BfdAuthSetKeyReply) GetMessageName() string { + return "bfd_auth_set_key_reply" +} +func (*BfdAuthSetKeyReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPAdd represents VPP binary API message 'bfd_udp_add'. +type BfdUDPAdd struct { + SwIfIndex uint32 + DesiredMinTx uint32 + RequiredMinRx uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + DetectMult uint8 + IsAuthenticated uint8 + BfdKeyID uint8 + ConfKeyID uint32 +} + +func (*BfdUDPAdd) GetMessageName() string { + return "bfd_udp_add" +} +func (*BfdUDPAdd) GetCrcString() string { + return "61cf1850" +} +func (*BfdUDPAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPAddReply represents VPP binary API message 'bfd_udp_add_reply'. +type BfdUDPAddReply struct { + Retval int32 +} + +func (*BfdUDPAddReply) GetMessageName() string { + return "bfd_udp_add_reply" +} +func (*BfdUDPAddReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPAuthActivate represents VPP binary API message 'bfd_udp_auth_activate'. +type BfdUDPAuthActivate struct { + SwIfIndex uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + IsDelayed uint8 + BfdKeyID uint8 + ConfKeyID uint32 +} + +func (*BfdUDPAuthActivate) GetMessageName() string { + return "bfd_udp_auth_activate" +} +func (*BfdUDPAuthActivate) GetCrcString() string { + return "1bae0947" +} +func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPAuthActivateReply represents VPP binary API message 'bfd_udp_auth_activate_reply'. +type BfdUDPAuthActivateReply struct { + Retval int32 +} + +func (*BfdUDPAuthActivateReply) GetMessageName() string { + return "bfd_udp_auth_activate_reply" +} +func (*BfdUDPAuthActivateReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPAuthDeactivate represents VPP binary API message 'bfd_udp_auth_deactivate'. +type BfdUDPAuthDeactivate struct { + SwIfIndex uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + IsDelayed uint8 +} + +func (*BfdUDPAuthDeactivate) GetMessageName() string { + return "bfd_udp_auth_deactivate" +} +func (*BfdUDPAuthDeactivate) GetCrcString() string { + return "10661991" +} +func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPAuthDeactivateReply represents VPP binary API message 'bfd_udp_auth_deactivate_reply'. +type BfdUDPAuthDeactivateReply struct { + Retval int32 +} + +func (*BfdUDPAuthDeactivateReply) GetMessageName() string { + return "bfd_udp_auth_deactivate_reply" +} +func (*BfdUDPAuthDeactivateReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPDel represents VPP binary API message 'bfd_udp_del'. +type BfdUDPDel struct { + SwIfIndex uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 +} + +func (*BfdUDPDel) GetMessageName() string { + return "bfd_udp_del" +} +func (*BfdUDPDel) GetCrcString() string { + return "c9e9cc5a" +} +func (*BfdUDPDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPDelEchoSource represents VPP binary API message 'bfd_udp_del_echo_source'. +type BfdUDPDelEchoSource struct{} + +func (*BfdUDPDelEchoSource) GetMessageName() string { + return "bfd_udp_del_echo_source" +} +func (*BfdUDPDelEchoSource) GetCrcString() string { + return "51077d14" +} +func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPDelEchoSourceReply represents VPP binary API message 'bfd_udp_del_echo_source_reply'. +type BfdUDPDelEchoSourceReply struct { + Retval int32 +} + +func (*BfdUDPDelEchoSourceReply) GetMessageName() string { + return "bfd_udp_del_echo_source_reply" +} +func (*BfdUDPDelEchoSourceReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPDelReply represents VPP binary API message 'bfd_udp_del_reply'. +type BfdUDPDelReply struct { + Retval int32 +} + +func (*BfdUDPDelReply) GetMessageName() string { + return "bfd_udp_del_reply" +} +func (*BfdUDPDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPGetEchoSource represents VPP binary API message 'bfd_udp_get_echo_source'. +type BfdUDPGetEchoSource struct{} + +func (*BfdUDPGetEchoSource) GetMessageName() string { + return "bfd_udp_get_echo_source" +} +func (*BfdUDPGetEchoSource) GetCrcString() string { + return "51077d14" +} +func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPGetEchoSourceReply represents VPP binary API message 'bfd_udp_get_echo_source_reply'. +type BfdUDPGetEchoSourceReply struct { + Retval int32 + SwIfIndex uint32 + IsSet uint8 + HaveUsableIP4 uint8 + IP4Addr []byte `struc:"[4]byte"` + HaveUsableIP6 uint8 + IP6Addr []byte `struc:"[16]byte"` +} + +func (*BfdUDPGetEchoSourceReply) GetMessageName() string { + return "bfd_udp_get_echo_source_reply" +} +func (*BfdUDPGetEchoSourceReply) GetCrcString() string { + return "6924ca6b" +} +func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPMod represents VPP binary API message 'bfd_udp_mod'. +type BfdUDPMod struct { + SwIfIndex uint32 + DesiredMinTx uint32 + RequiredMinRx uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + DetectMult uint8 +} + +func (*BfdUDPMod) GetMessageName() string { + return "bfd_udp_mod" +} +func (*BfdUDPMod) GetCrcString() string { + return "6049bf47" +} +func (*BfdUDPMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPModReply represents VPP binary API message 'bfd_udp_mod_reply'. +type BfdUDPModReply struct { + Retval int32 +} + +func (*BfdUDPModReply) GetMessageName() string { + return "bfd_udp_mod_reply" +} +func (*BfdUDPModReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPSessionDetails represents VPP binary API message 'bfd_udp_session_details'. +type BfdUDPSessionDetails struct { + SwIfIndex uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + State uint8 + IsAuthenticated uint8 + BfdKeyID uint8 + ConfKeyID uint32 + RequiredMinRx uint32 + DesiredMinTx uint32 + DetectMult uint8 +} + +func (*BfdUDPSessionDetails) GetMessageName() string { + return "bfd_udp_session_details" +} +func (*BfdUDPSessionDetails) GetCrcString() string { + return "837bb0ed" +} +func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPSessionDump represents VPP binary API message 'bfd_udp_session_dump'. +type BfdUDPSessionDump struct{} + +func (*BfdUDPSessionDump) GetMessageName() string { + return "bfd_udp_session_dump" +} +func (*BfdUDPSessionDump) GetCrcString() string { + return "51077d14" +} +func (*BfdUDPSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPSessionSetFlags represents VPP binary API message 'bfd_udp_session_set_flags'. +type BfdUDPSessionSetFlags struct { + SwIfIndex uint32 + LocalAddr []byte `struc:"[16]byte"` + PeerAddr []byte `struc:"[16]byte"` + IsIPv6 uint8 + AdminUpDown uint8 +} + +func (*BfdUDPSessionSetFlags) GetMessageName() string { + return "bfd_udp_session_set_flags" +} +func (*BfdUDPSessionSetFlags) GetCrcString() string { + return "667d6e7c" +} +func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPSessionSetFlagsReply represents VPP binary API message 'bfd_udp_session_set_flags_reply'. +type BfdUDPSessionSetFlagsReply struct { + Retval int32 +} + +func (*BfdUDPSessionSetFlagsReply) GetMessageName() string { + return "bfd_udp_session_set_flags_reply" +} +func (*BfdUDPSessionSetFlagsReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BfdUDPSetEchoSource represents VPP binary API message 'bfd_udp_set_echo_source'. +type BfdUDPSetEchoSource struct { + SwIfIndex uint32 +} + +func (*BfdUDPSetEchoSource) GetMessageName() string { + return "bfd_udp_set_echo_source" +} +func (*BfdUDPSetEchoSource) GetCrcString() string { + return "529cb13f" +} +func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BfdUDPSetEchoSourceReply represents VPP binary API message 'bfd_udp_set_echo_source_reply'. +type BfdUDPSetEchoSourceReply struct { + Retval int32 +} + +func (*BfdUDPSetEchoSourceReply) GetMessageName() string { + return "bfd_udp_set_echo_source_reply" +} +func (*BfdUDPSetEchoSourceReply) GetCrcString() string { + return "e8d4e804" +} +func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantBfdEvents represents VPP binary API message 'want_bfd_events'. +type WantBfdEvents struct { + EnableDisable uint32 + PID uint32 +} + +func (*WantBfdEvents) GetMessageName() string { + return "want_bfd_events" +} +func (*WantBfdEvents) GetCrcString() string { + return "476f5a08" +} +func (*WantBfdEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantBfdEventsReply represents VPP binary API message 'want_bfd_events_reply'. +type WantBfdEventsReply struct { + Retval int32 +} + +func (*WantBfdEventsReply) GetMessageName() string { + return "want_bfd_events_reply" +} +func (*WantBfdEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantBfdEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*BfdAuthDelKey)(nil), "bfd.BfdAuthDelKey") + api.RegisterMessage((*BfdAuthDelKeyReply)(nil), "bfd.BfdAuthDelKeyReply") + api.RegisterMessage((*BfdAuthKeysDetails)(nil), "bfd.BfdAuthKeysDetails") + api.RegisterMessage((*BfdAuthKeysDump)(nil), "bfd.BfdAuthKeysDump") + api.RegisterMessage((*BfdAuthSetKey)(nil), "bfd.BfdAuthSetKey") + api.RegisterMessage((*BfdAuthSetKeyReply)(nil), "bfd.BfdAuthSetKeyReply") + api.RegisterMessage((*BfdUDPAdd)(nil), "bfd.BfdUDPAdd") + api.RegisterMessage((*BfdUDPAddReply)(nil), "bfd.BfdUDPAddReply") + api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd.BfdUDPAuthActivate") + api.RegisterMessage((*BfdUDPAuthActivateReply)(nil), "bfd.BfdUDPAuthActivateReply") + api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd.BfdUDPAuthDeactivate") + api.RegisterMessage((*BfdUDPAuthDeactivateReply)(nil), "bfd.BfdUDPAuthDeactivateReply") + api.RegisterMessage((*BfdUDPDel)(nil), "bfd.BfdUDPDel") + api.RegisterMessage((*BfdUDPDelEchoSource)(nil), "bfd.BfdUDPDelEchoSource") + api.RegisterMessage((*BfdUDPDelEchoSourceReply)(nil), "bfd.BfdUDPDelEchoSourceReply") + api.RegisterMessage((*BfdUDPDelReply)(nil), "bfd.BfdUDPDelReply") + api.RegisterMessage((*BfdUDPGetEchoSource)(nil), "bfd.BfdUDPGetEchoSource") + api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd.BfdUDPGetEchoSourceReply") + api.RegisterMessage((*BfdUDPMod)(nil), "bfd.BfdUDPMod") + api.RegisterMessage((*BfdUDPModReply)(nil), "bfd.BfdUDPModReply") + api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd.BfdUDPSessionDetails") + api.RegisterMessage((*BfdUDPSessionDump)(nil), "bfd.BfdUDPSessionDump") + api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd.BfdUDPSessionSetFlags") + api.RegisterMessage((*BfdUDPSessionSetFlagsReply)(nil), "bfd.BfdUDPSessionSetFlagsReply") + api.RegisterMessage((*BfdUDPSetEchoSource)(nil), "bfd.BfdUDPSetEchoSource") + api.RegisterMessage((*BfdUDPSetEchoSourceReply)(nil), "bfd.BfdUDPSetEchoSourceReply") + api.RegisterMessage((*WantBfdEvents)(nil), "bfd.WantBfdEvents") + api.RegisterMessage((*WantBfdEventsReply)(nil), "bfd.WantBfdEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BfdAuthDelKey)(nil), + (*BfdAuthDelKeyReply)(nil), + (*BfdAuthKeysDetails)(nil), + (*BfdAuthKeysDump)(nil), + (*BfdAuthSetKey)(nil), + (*BfdAuthSetKeyReply)(nil), + (*BfdUDPAdd)(nil), + (*BfdUDPAddReply)(nil), + (*BfdUDPAuthActivate)(nil), + (*BfdUDPAuthActivateReply)(nil), + (*BfdUDPAuthDeactivate)(nil), + (*BfdUDPAuthDeactivateReply)(nil), + (*BfdUDPDel)(nil), + (*BfdUDPDelEchoSource)(nil), + (*BfdUDPDelEchoSourceReply)(nil), + (*BfdUDPDelReply)(nil), + (*BfdUDPGetEchoSource)(nil), + (*BfdUDPGetEchoSourceReply)(nil), + (*BfdUDPMod)(nil), + (*BfdUDPModReply)(nil), + (*BfdUDPSessionDetails)(nil), + (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionSetFlags)(nil), + (*BfdUDPSessionSetFlagsReply)(nil), + (*BfdUDPSetEchoSource)(nil), + (*BfdUDPSetEchoSourceReply)(nil), + (*WantBfdEvents)(nil), + (*WantBfdEventsReply)(nil), + } +} + +// RPCService represents RPC service API for bfd module. +type RPCService interface { + DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) + DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) + BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) + BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) + BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) + BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) + BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) + BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) + BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) + BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) + BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) + BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) + BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) + WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBfdAuthKeys(ctx context.Context, in *BfdAuthKeysDump) (RPCService_DumpBfdAuthKeysClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdAuthKeysClient{stream} + return x, nil +} + +type RPCService_DumpBfdAuthKeysClient interface { + Recv() (*BfdAuthKeysDetails, error) +} + +type serviceClient_DumpBfdAuthKeysClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdAuthKeysClient) Recv() (*BfdAuthKeysDetails, error) { + m := new(BfdAuthKeysDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBfdUDPSession(ctx context.Context, in *BfdUDPSessionDump) (RPCService_DumpBfdUDPSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBfdUDPSessionClient{stream} + return x, nil +} + +type RPCService_DumpBfdUDPSessionClient interface { + Recv() (*BfdUDPSessionDetails, error) +} + +type serviceClient_DumpBfdUDPSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBfdUDPSessionClient) Recv() (*BfdUDPSessionDetails, error) { + m := new(BfdUDPSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { + out := new(BfdAuthDelKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { + out := new(BfdAuthSetKeyReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { + out := new(BfdUDPAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { + out := new(BfdUDPAuthActivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { + out := new(BfdUDPAuthDeactivateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { + out := new(BfdUDPDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { + out := new(BfdUDPDelEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { + out := new(BfdUDPGetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { + out := new(BfdUDPModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { + out := new(BfdUDPSessionSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { + out := new(BfdUDPSetEchoSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { + out := new(WantBfdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/bond/bond.ba.go b/plugins/vpp/binapi/vpp1908/bond/bond.ba.go new file mode 100644 index 0000000000..8d521b7a4a --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/bond/bond.ba.go @@ -0,0 +1,379 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/bond.api.json + +/* +Package bond is a generated VPP binary API for 'bond' module. + +It consists of: + 12 messages + 6 services +*/ +package bond + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "bond" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0xf29d9886 +) + +// BondCreate represents VPP binary API message 'bond_create'. +type BondCreate struct { + ID uint32 + UseCustomMac uint8 + MacAddress []byte `struc:"[6]byte"` + Mode uint8 + Lb uint8 + NumaOnly uint8 +} + +func (*BondCreate) GetMessageName() string { + return "bond_create" +} +func (*BondCreate) GetCrcString() string { + return "f19b4ad0" +} +func (*BondCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BondCreateReply represents VPP binary API message 'bond_create_reply'. +type BondCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*BondCreateReply) GetMessageName() string { + return "bond_create_reply" +} +func (*BondCreateReply) GetCrcString() string { + return "fda5941f" +} +func (*BondCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BondDelete represents VPP binary API message 'bond_delete'. +type BondDelete struct { + SwIfIndex uint32 +} + +func (*BondDelete) GetMessageName() string { + return "bond_delete" +} +func (*BondDelete) GetCrcString() string { + return "529cb13f" +} +func (*BondDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BondDeleteReply represents VPP binary API message 'bond_delete_reply'. +type BondDeleteReply struct { + Retval int32 +} + +func (*BondDeleteReply) GetMessageName() string { + return "bond_delete_reply" +} +func (*BondDeleteReply) GetCrcString() string { + return "e8d4e804" +} +func (*BondDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BondDetachSlave represents VPP binary API message 'bond_detach_slave'. +type BondDetachSlave struct { + SwIfIndex uint32 +} + +func (*BondDetachSlave) GetMessageName() string { + return "bond_detach_slave" +} +func (*BondDetachSlave) GetCrcString() string { + return "529cb13f" +} +func (*BondDetachSlave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BondDetachSlaveReply represents VPP binary API message 'bond_detach_slave_reply'. +type BondDetachSlaveReply struct { + Retval int32 +} + +func (*BondDetachSlaveReply) GetMessageName() string { + return "bond_detach_slave_reply" +} +func (*BondDetachSlaveReply) GetCrcString() string { + return "e8d4e804" +} +func (*BondDetachSlaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BondEnslave represents VPP binary API message 'bond_enslave'. +type BondEnslave struct { + SwIfIndex uint32 + BondSwIfIndex uint32 + IsPassive uint8 + IsLongTimeout uint8 +} + +func (*BondEnslave) GetMessageName() string { + return "bond_enslave" +} +func (*BondEnslave) GetCrcString() string { + return "0ded34f6" +} +func (*BondEnslave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BondEnslaveReply represents VPP binary API message 'bond_enslave_reply'. +type BondEnslaveReply struct { + Retval int32 +} + +func (*BondEnslaveReply) GetMessageName() string { + return "bond_enslave_reply" +} +func (*BondEnslaveReply) GetCrcString() string { + return "e8d4e804" +} +func (*BondEnslaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceBondDetails represents VPP binary API message 'sw_interface_bond_details'. +type SwInterfaceBondDetails struct { + SwIfIndex uint32 + ID uint32 + InterfaceName []byte `struc:"[64]byte"` + Mode uint8 + Lb uint8 + NumaOnly uint8 + ActiveSlaves uint32 + Slaves uint32 +} + +func (*SwInterfaceBondDetails) GetMessageName() string { + return "sw_interface_bond_details" +} +func (*SwInterfaceBondDetails) GetCrcString() string { + return "a8ac5a5f" +} +func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceBondDump represents VPP binary API message 'sw_interface_bond_dump'. +type SwInterfaceBondDump struct{} + +func (*SwInterfaceBondDump) GetMessageName() string { + return "sw_interface_bond_dump" +} +func (*SwInterfaceBondDump) GetCrcString() string { + return "51077d14" +} +func (*SwInterfaceBondDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSlaveDetails represents VPP binary API message 'sw_interface_slave_details'. +type SwInterfaceSlaveDetails struct { + SwIfIndex uint32 + InterfaceName []byte `struc:"[64]byte"` + IsPassive uint8 + IsLongTimeout uint8 +} + +func (*SwInterfaceSlaveDetails) GetMessageName() string { + return "sw_interface_slave_details" +} +func (*SwInterfaceSlaveDetails) GetCrcString() string { + return "d5c58e45" +} +func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSlaveDump represents VPP binary API message 'sw_interface_slave_dump'. +type SwInterfaceSlaveDump struct { + SwIfIndex uint32 +} + +func (*SwInterfaceSlaveDump) GetMessageName() string { + return "sw_interface_slave_dump" +} +func (*SwInterfaceSlaveDump) GetCrcString() string { + return "529cb13f" +} +func (*SwInterfaceSlaveDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*BondCreate)(nil), "bond.BondCreate") + api.RegisterMessage((*BondCreateReply)(nil), "bond.BondCreateReply") + api.RegisterMessage((*BondDelete)(nil), "bond.BondDelete") + api.RegisterMessage((*BondDeleteReply)(nil), "bond.BondDeleteReply") + api.RegisterMessage((*BondDetachSlave)(nil), "bond.BondDetachSlave") + api.RegisterMessage((*BondDetachSlaveReply)(nil), "bond.BondDetachSlaveReply") + api.RegisterMessage((*BondEnslave)(nil), "bond.BondEnslave") + api.RegisterMessage((*BondEnslaveReply)(nil), "bond.BondEnslaveReply") + api.RegisterMessage((*SwInterfaceBondDetails)(nil), "bond.SwInterfaceBondDetails") + api.RegisterMessage((*SwInterfaceBondDump)(nil), "bond.SwInterfaceBondDump") + api.RegisterMessage((*SwInterfaceSlaveDetails)(nil), "bond.SwInterfaceSlaveDetails") + api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "bond.SwInterfaceSlaveDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BondCreate)(nil), + (*BondCreateReply)(nil), + (*BondDelete)(nil), + (*BondDeleteReply)(nil), + (*BondDetachSlave)(nil), + (*BondDetachSlaveReply)(nil), + (*BondEnslave)(nil), + (*BondEnslaveReply)(nil), + (*SwInterfaceBondDetails)(nil), + (*SwInterfaceBondDump)(nil), + (*SwInterfaceSlaveDetails)(nil), + (*SwInterfaceSlaveDump)(nil), + } +} + +// RPCService represents RPC service API for bond module. +type RPCService interface { + DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) + DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) + BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) + BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceBond(ctx context.Context, in *SwInterfaceBondDump) (RPCService_DumpSwInterfaceBondClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceBondClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceBondClient interface { + Recv() (*SwInterfaceBondDetails, error) +} + +type serviceClient_DumpSwInterfaceBondClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceBondClient) Recv() (*SwInterfaceBondDetails, error) { + m := new(SwInterfaceBondDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceSlave(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_DumpSwInterfaceSlaveClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceSlaveClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceSlaveClient interface { + Recv() (*SwInterfaceSlaveDetails, error) +} + +type serviceClient_DumpSwInterfaceSlaveClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceSlaveClient) Recv() (*SwInterfaceSlaveDetails, error) { + m := new(SwInterfaceSlaveDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { + out := new(BondCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { + out := new(BondDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { + out := new(BondDetachSlaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { + out := new(BondEnslaveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/dhcp/dhcp.ba.go b/plugins/vpp/binapi/vpp1908/dhcp/dhcp.ba.go new file mode 100644 index 0000000000..e2ed54beaf --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/dhcp/dhcp.ba.go @@ -0,0 +1,1084 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/dhcp.api.json + +/* +Package dhcp is a generated VPP binary API for 'dhcp' module. + +It consists of: + 4 enums + 2 aliases + 12 types + 1 union + 25 messages + 11 services +*/ +package dhcp + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "dhcp" + // APIVersion is the API version of this module. + APIVersion = "2.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbc570632 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// DHCP6AddressInfo represents VPP binary API type 'dhcp6_address_info'. +type DHCP6AddressInfo struct { + Address []byte `struc:"[16]byte"` + ValidTime uint32 + PreferredTime uint32 +} + +func (*DHCP6AddressInfo) GetTypeName() string { + return "dhcp6_address_info" +} + +// DHCP6PdPrefixInfo represents VPP binary API type 'dhcp6_pd_prefix_info'. +type DHCP6PdPrefixInfo struct { + Prefix []byte `struc:"[16]byte"` + PrefixLength uint8 + ValidTime uint32 + PreferredTime uint32 +} + +func (*DHCP6PdPrefixInfo) GetTypeName() string { + return "dhcp6_pd_prefix_info" +} + +// DHCPClient represents VPP binary API type 'dhcp_client'. +type DHCPClient struct { + SwIfIndex uint32 + Hostname []byte `struc:"[64]byte"` + ID []byte `struc:"[64]byte"` + WantDHCPEvent uint8 + SetBroadcastFlag uint8 + Dscp IPDscp + PID uint32 +} + +func (*DHCPClient) GetTypeName() string { + return "dhcp_client" +} + +// DHCPLease represents VPP binary API type 'dhcp_lease'. +type DHCPLease struct { + SwIfIndex uint32 + State uint8 + Hostname []byte `struc:"[64]byte"` + IsIPv6 uint8 + MaskWidth uint8 + HostAddress []byte `struc:"[16]byte"` + RouterAddress []byte `struc:"[16]byte"` + HostMac []byte `struc:"[6]byte"` + Count uint8 `struc:"sizeof=DomainServer"` + DomainServer []DomainServer +} + +func (*DHCPLease) GetTypeName() string { + return "dhcp_lease" +} + +// DHCPServer represents VPP binary API type 'dhcp_server'. +type DHCPServer struct { + ServerVrfID uint32 + DHCPServer []byte `struc:"[16]byte"` +} + +func (*DHCPServer) GetTypeName() string { + return "dhcp_server" +} + +// DomainServer represents VPP binary API type 'domain_server'. +type DomainServer struct { + Address []byte `struc:"[16]byte"` +} + +func (*DomainServer) GetTypeName() string { + return "domain_server" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// DHCP6ClientsEnableDisable represents VPP binary API message 'dhcp6_clients_enable_disable'. +type DHCP6ClientsEnableDisable struct { + Enable uint8 +} + +func (*DHCP6ClientsEnableDisable) GetMessageName() string { + return "dhcp6_clients_enable_disable" +} +func (*DHCP6ClientsEnableDisable) GetCrcString() string { + return "8050327d" +} +func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCP6ClientsEnableDisableReply represents VPP binary API message 'dhcp6_clients_enable_disable_reply'. +type DHCP6ClientsEnableDisableReply struct { + Retval int32 +} + +func (*DHCP6ClientsEnableDisableReply) GetMessageName() string { + return "dhcp6_clients_enable_disable_reply" +} +func (*DHCP6ClientsEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCP6DuidLlSet represents VPP binary API message 'dhcp6_duid_ll_set'. +type DHCP6DuidLlSet struct { + DuidLl []byte `struc:"[10]byte"` +} + +func (*DHCP6DuidLlSet) GetMessageName() string { + return "dhcp6_duid_ll_set" +} +func (*DHCP6DuidLlSet) GetCrcString() string { + return "0f6ca323" +} +func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCP6DuidLlSetReply represents VPP binary API message 'dhcp6_duid_ll_set_reply'. +type DHCP6DuidLlSetReply struct { + Retval int32 +} + +func (*DHCP6DuidLlSetReply) GetMessageName() string { + return "dhcp6_duid_ll_set_reply" +} +func (*DHCP6DuidLlSetReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCP6PdReplyEvent represents VPP binary API message 'dhcp6_pd_reply_event'. +type DHCP6PdReplyEvent struct { + PID uint32 + SwIfIndex uint32 + ServerIndex uint32 + MsgType uint8 + T1 uint32 + T2 uint32 + InnerStatusCode uint16 + StatusCode uint16 + Preference uint8 + NPrefixes uint32 `struc:"sizeof=Prefixes"` + Prefixes []DHCP6PdPrefixInfo +} + +func (*DHCP6PdReplyEvent) GetMessageName() string { + return "dhcp6_pd_reply_event" +} +func (*DHCP6PdReplyEvent) GetCrcString() string { + return "0e53217a" +} +func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// DHCP6PdSendClientMessage represents VPP binary API message 'dhcp6_pd_send_client_message'. +type DHCP6PdSendClientMessage struct { + SwIfIndex uint32 + ServerIndex uint32 + Irt uint32 + Mrt uint32 + Mrc uint32 + Mrd uint32 + Stop uint8 + MsgType uint8 + T1 uint32 + T2 uint32 + NPrefixes uint32 `struc:"sizeof=Prefixes"` + Prefixes []DHCP6PdPrefixInfo +} + +func (*DHCP6PdSendClientMessage) GetMessageName() string { + return "dhcp6_pd_send_client_message" +} +func (*DHCP6PdSendClientMessage) GetCrcString() string { + return "dadbfe97" +} +func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCP6PdSendClientMessageReply represents VPP binary API message 'dhcp6_pd_send_client_message_reply'. +type DHCP6PdSendClientMessageReply struct { + Retval int32 +} + +func (*DHCP6PdSendClientMessageReply) GetMessageName() string { + return "dhcp6_pd_send_client_message_reply" +} +func (*DHCP6PdSendClientMessageReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCP6ReplyEvent represents VPP binary API message 'dhcp6_reply_event'. +type DHCP6ReplyEvent struct { + PID uint32 + SwIfIndex uint32 + ServerIndex uint32 + MsgType uint8 + T1 uint32 + T2 uint32 + InnerStatusCode uint16 + StatusCode uint16 + Preference uint8 + NAddresses uint32 `struc:"sizeof=Addresses"` + Addresses []DHCP6AddressInfo +} + +func (*DHCP6ReplyEvent) GetMessageName() string { + return "dhcp6_reply_event" +} +func (*DHCP6ReplyEvent) GetCrcString() string { + return "8a34e0f5" +} +func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// DHCP6SendClientMessage represents VPP binary API message 'dhcp6_send_client_message'. +type DHCP6SendClientMessage struct { + SwIfIndex uint32 + ServerIndex uint32 + Irt uint32 + Mrt uint32 + Mrc uint32 + Mrd uint32 + Stop uint8 + MsgType uint8 + T1 uint32 + T2 uint32 + NAddresses uint32 `struc:"sizeof=Addresses"` + Addresses []DHCP6AddressInfo +} + +func (*DHCP6SendClientMessage) GetMessageName() string { + return "dhcp6_send_client_message" +} +func (*DHCP6SendClientMessage) GetCrcString() string { + return "993f872f" +} +func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCP6SendClientMessageReply represents VPP binary API message 'dhcp6_send_client_message_reply'. +type DHCP6SendClientMessageReply struct { + Retval int32 +} + +func (*DHCP6SendClientMessageReply) GetMessageName() string { + return "dhcp6_send_client_message_reply" +} +func (*DHCP6SendClientMessageReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCPClientConfig represents VPP binary API message 'dhcp_client_config'. +type DHCPClientConfig struct { + IsAdd uint8 + Client DHCPClient +} + +func (*DHCPClientConfig) GetMessageName() string { + return "dhcp_client_config" +} +func (*DHCPClientConfig) GetCrcString() string { + return "87a429e7" +} +func (*DHCPClientConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCPClientConfigReply represents VPP binary API message 'dhcp_client_config_reply'. +type DHCPClientConfigReply struct { + Retval int32 +} + +func (*DHCPClientConfigReply) GetMessageName() string { + return "dhcp_client_config_reply" +} +func (*DHCPClientConfigReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCPClientConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCPClientDetails represents VPP binary API message 'dhcp_client_details'. +type DHCPClientDetails struct { + Client DHCPClient + Lease DHCPLease +} + +func (*DHCPClientDetails) GetMessageName() string { + return "dhcp_client_details" +} +func (*DHCPClientDetails) GetCrcString() string { + return "4a95a2ad" +} +func (*DHCPClientDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCPClientDump represents VPP binary API message 'dhcp_client_dump'. +type DHCPClientDump struct{} + +func (*DHCPClientDump) GetMessageName() string { + return "dhcp_client_dump" +} +func (*DHCPClientDump) GetCrcString() string { + return "51077d14" +} +func (*DHCPClientDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCPComplEvent represents VPP binary API message 'dhcp_compl_event'. +type DHCPComplEvent struct { + PID uint32 + Lease DHCPLease +} + +func (*DHCPComplEvent) GetMessageName() string { + return "dhcp_compl_event" +} +func (*DHCPComplEvent) GetCrcString() string { + return "ed1e53d7" +} +func (*DHCPComplEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// DHCPProxyConfig represents VPP binary API message 'dhcp_proxy_config'. +type DHCPProxyConfig struct { + RxVrfID uint32 + ServerVrfID uint32 + IsIPv6 uint8 + IsAdd uint8 + DHCPServer []byte `struc:"[16]byte"` + DHCPSrcAddress []byte `struc:"[16]byte"` +} + +func (*DHCPProxyConfig) GetMessageName() string { + return "dhcp_proxy_config" +} +func (*DHCPProxyConfig) GetCrcString() string { + return "6af4b645" +} +func (*DHCPProxyConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCPProxyConfigReply represents VPP binary API message 'dhcp_proxy_config_reply'. +type DHCPProxyConfigReply struct { + Retval int32 +} + +func (*DHCPProxyConfigReply) GetMessageName() string { + return "dhcp_proxy_config_reply" +} +func (*DHCPProxyConfigReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCPProxyDetails represents VPP binary API message 'dhcp_proxy_details'. +type DHCPProxyDetails struct { + RxVrfID uint32 + VssOui uint32 + VssFibID uint32 + VssType uint8 + VssVPNAsciiID []byte `struc:"[129]byte"` + IsIPv6 uint8 + DHCPSrcAddress []byte `struc:"[16]byte"` + Count uint8 `struc:"sizeof=Servers"` + Servers []DHCPServer +} + +func (*DHCPProxyDetails) GetMessageName() string { + return "dhcp_proxy_details" +} +func (*DHCPProxyDetails) GetCrcString() string { + return "e6c45917" +} +func (*DHCPProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DHCPProxyDump represents VPP binary API message 'dhcp_proxy_dump'. +type DHCPProxyDump struct { + IsIP6 uint8 +} + +func (*DHCPProxyDump) GetMessageName() string { + return "dhcp_proxy_dump" +} +func (*DHCPProxyDump) GetCrcString() string { + return "6fe91190" +} +func (*DHCPProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCPProxySetVss represents VPP binary API message 'dhcp_proxy_set_vss'. +type DHCPProxySetVss struct { + TblID uint32 + VssType uint8 + VPNAsciiID []byte `struc:"[129]byte"` + Oui uint32 + VPNIndex uint32 + IsIPv6 uint8 + IsAdd uint8 +} + +func (*DHCPProxySetVss) GetMessageName() string { + return "dhcp_proxy_set_vss" +} +func (*DHCPProxySetVss) GetCrcString() string { + return "606535aa" +} +func (*DHCPProxySetVss) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DHCPProxySetVssReply represents VPP binary API message 'dhcp_proxy_set_vss_reply'. +type DHCPProxySetVssReply struct { + Retval int32 +} + +func (*DHCPProxySetVssReply) GetMessageName() string { + return "dhcp_proxy_set_vss_reply" +} +func (*DHCPProxySetVssReply) GetCrcString() string { + return "e8d4e804" +} +func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantDHCP6PdReplyEvents represents VPP binary API message 'want_dhcp6_pd_reply_events'. +type WantDHCP6PdReplyEvents struct { + EnableDisable uint8 + PID uint32 +} + +func (*WantDHCP6PdReplyEvents) GetMessageName() string { + return "want_dhcp6_pd_reply_events" +} +func (*WantDHCP6PdReplyEvents) GetCrcString() string { + return "05b454b5" +} +func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantDHCP6PdReplyEventsReply represents VPP binary API message 'want_dhcp6_pd_reply_events_reply'. +type WantDHCP6PdReplyEventsReply struct { + Retval int32 +} + +func (*WantDHCP6PdReplyEventsReply) GetMessageName() string { + return "want_dhcp6_pd_reply_events_reply" +} +func (*WantDHCP6PdReplyEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantDHCP6ReplyEvents represents VPP binary API message 'want_dhcp6_reply_events'. +type WantDHCP6ReplyEvents struct { + EnableDisable uint8 + PID uint32 +} + +func (*WantDHCP6ReplyEvents) GetMessageName() string { + return "want_dhcp6_reply_events" +} +func (*WantDHCP6ReplyEvents) GetCrcString() string { + return "05b454b5" +} +func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantDHCP6ReplyEventsReply represents VPP binary API message 'want_dhcp6_reply_events_reply'. +type WantDHCP6ReplyEventsReply struct { + Retval int32 +} + +func (*WantDHCP6ReplyEventsReply) GetMessageName() string { + return "want_dhcp6_reply_events_reply" +} +func (*WantDHCP6ReplyEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantDHCP6ReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*DHCP6ClientsEnableDisable)(nil), "dhcp.DHCP6ClientsEnableDisable") + api.RegisterMessage((*DHCP6ClientsEnableDisableReply)(nil), "dhcp.DHCP6ClientsEnableDisableReply") + api.RegisterMessage((*DHCP6DuidLlSet)(nil), "dhcp.DHCP6DuidLlSet") + api.RegisterMessage((*DHCP6DuidLlSetReply)(nil), "dhcp.DHCP6DuidLlSetReply") + api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp.DHCP6PdReplyEvent") + api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp.DHCP6PdSendClientMessage") + api.RegisterMessage((*DHCP6PdSendClientMessageReply)(nil), "dhcp.DHCP6PdSendClientMessageReply") + api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp.DHCP6ReplyEvent") + api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp.DHCP6SendClientMessage") + api.RegisterMessage((*DHCP6SendClientMessageReply)(nil), "dhcp.DHCP6SendClientMessageReply") + api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp.DHCPClientConfig") + api.RegisterMessage((*DHCPClientConfigReply)(nil), "dhcp.DHCPClientConfigReply") + api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp.DHCPClientDetails") + api.RegisterMessage((*DHCPClientDump)(nil), "dhcp.DHCPClientDump") + api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp.DHCPComplEvent") + api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp.DHCPProxyConfig") + api.RegisterMessage((*DHCPProxyConfigReply)(nil), "dhcp.DHCPProxyConfigReply") + api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp.DHCPProxyDetails") + api.RegisterMessage((*DHCPProxyDump)(nil), "dhcp.DHCPProxyDump") + api.RegisterMessage((*DHCPProxySetVss)(nil), "dhcp.DHCPProxySetVss") + api.RegisterMessage((*DHCPProxySetVssReply)(nil), "dhcp.DHCPProxySetVssReply") + api.RegisterMessage((*WantDHCP6PdReplyEvents)(nil), "dhcp.WantDHCP6PdReplyEvents") + api.RegisterMessage((*WantDHCP6PdReplyEventsReply)(nil), "dhcp.WantDHCP6PdReplyEventsReply") + api.RegisterMessage((*WantDHCP6ReplyEvents)(nil), "dhcp.WantDHCP6ReplyEvents") + api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "dhcp.WantDHCP6ReplyEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientsEnableDisable)(nil), + (*DHCP6ClientsEnableDisableReply)(nil), + (*DHCP6DuidLlSet)(nil), + (*DHCP6DuidLlSetReply)(nil), + (*DHCP6PdReplyEvent)(nil), + (*DHCP6PdSendClientMessage)(nil), + (*DHCP6PdSendClientMessageReply)(nil), + (*DHCP6ReplyEvent)(nil), + (*DHCP6SendClientMessage)(nil), + (*DHCP6SendClientMessageReply)(nil), + (*DHCPClientConfig)(nil), + (*DHCPClientConfigReply)(nil), + (*DHCPClientDetails)(nil), + (*DHCPClientDump)(nil), + (*DHCPComplEvent)(nil), + (*DHCPProxyConfig)(nil), + (*DHCPProxyConfigReply)(nil), + (*DHCPProxyDetails)(nil), + (*DHCPProxyDump)(nil), + (*DHCPProxySetVss)(nil), + (*DHCPProxySetVssReply)(nil), + (*WantDHCP6PdReplyEvents)(nil), + (*WantDHCP6PdReplyEventsReply)(nil), + (*WantDHCP6ReplyEvents)(nil), + (*WantDHCP6ReplyEventsReply)(nil), + } +} + +// RPCService represents RPC service API for dhcp module. +type RPCService interface { + DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) + DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) + DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) + DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) + DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) + DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) + DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) + DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) + DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) + WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) + WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDHCPClient(ctx context.Context, in *DHCPClientDump) (RPCService_DumpDHCPClientClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPClientClient{stream} + return x, nil +} + +type RPCService_DumpDHCPClientClient interface { + Recv() (*DHCPClientDetails, error) +} + +type serviceClient_DumpDHCPClientClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPClientClient) Recv() (*DHCPClientDetails, error) { + m := new(DHCPClientDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpDHCPProxy(ctx context.Context, in *DHCPProxyDump) (RPCService_DumpDHCPProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDHCPProxyClient{stream} + return x, nil +} + +type RPCService_DumpDHCPProxyClient interface { + Recv() (*DHCPProxyDetails, error) +} + +type serviceClient_DumpDHCPProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDHCPProxyClient) Recv() (*DHCPProxyDetails, error) { + m := new(DHCPProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { + out := new(DHCP6ClientsEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { + out := new(DHCP6DuidLlSetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { + out := new(DHCP6PdSendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { + out := new(DHCP6SendClientMessageReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { + out := new(DHCPClientConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { + out := new(DHCPProxyConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { + out := new(DHCPProxySetVssReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { + out := new(WantDHCP6PdReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { + out := new(WantDHCP6ReplyEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/gen.go b/plugins/vpp/binapi/vpp1908/gen.go new file mode 100644 index 0000000000..f9c07c89b0 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/gen.go @@ -0,0 +1,39 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +//go:generate -command binapigen binapi-generator --output-dir=. + +//go:generate binapigen --input-file=/usr/share/vpp/api/core/af_packet.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/bfd.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/bond.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/dhcp.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/interface.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/ip.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/ipsec.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/l2.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/memclnt.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/punt.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/session.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/sr.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/tapv2.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/vpe.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/core/vxlan.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/abf.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/acl.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/memif.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/nat.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/stn.api.json +//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/vmxnet3.api.json diff --git a/plugins/vpp/binapi/vpp1908/interfaces/interfaces.ba.go b/plugins/vpp/binapi/vpp1908/interfaces/interfaces.ba.go new file mode 100644 index 0000000000..b0eb978c5c --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/interfaces/interfaces.ba.go @@ -0,0 +1,1304 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/interface.api.json + +/* +Package interfaces is a generated VPP binary API for 'interface' module. + +It consists of: + 1 alias + 51 messages + 25 services +*/ +package interfaces + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "interface" + // APIVersion is the API version of this module. + APIVersion = "2.3.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x6aab37be +) + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. +type CollectDetailedInterfaceStats struct { + SwIfIndex uint32 + EnableDisable uint8 +} + +func (*CollectDetailedInterfaceStats) GetMessageName() string { + return "collect_detailed_interface_stats" +} +func (*CollectDetailedInterfaceStats) GetCrcString() string { + return "69d24598" +} +func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. +type CollectDetailedInterfaceStatsReply struct { + Retval int32 +} + +func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { + return "collect_detailed_interface_stats_reply" +} +func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { + return "e8d4e804" +} +func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// CreateLoopback represents VPP binary API message 'create_loopback'. +type CreateLoopback struct { + MacAddress []byte `struc:"[6]byte"` +} + +func (*CreateLoopback) GetMessageName() string { + return "create_loopback" +} +func (*CreateLoopback) GetCrcString() string { + return "3b54129c" +} +func (*CreateLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. +type CreateLoopbackInstance struct { + MacAddress []byte `struc:"[6]byte"` + IsSpecified uint8 + UserInstance uint32 +} + +func (*CreateLoopbackInstance) GetMessageName() string { + return "create_loopback_instance" +} +func (*CreateLoopbackInstance) GetCrcString() string { + return "7bbd53b6" +} +func (*CreateLoopbackInstance) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. +type CreateLoopbackInstanceReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*CreateLoopbackInstanceReply) GetMessageName() string { + return "create_loopback_instance_reply" +} +func (*CreateLoopbackInstanceReply) GetCrcString() string { + return "fda5941f" +} +func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. +type CreateLoopbackReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*CreateLoopbackReply) GetMessageName() string { + return "create_loopback_reply" +} +func (*CreateLoopbackReply) GetCrcString() string { + return "fda5941f" +} +func (*CreateLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// CreateSubif represents VPP binary API message 'create_subif'. +type CreateSubif struct { + SwIfIndex uint32 + SubID uint32 + NoTags uint8 + OneTag uint8 + TwoTags uint8 + Dot1ad uint8 + ExactMatch uint8 + DefaultSub uint8 + OuterVlanIDAny uint8 + InnerVlanIDAny uint8 + OuterVlanID uint16 + InnerVlanID uint16 +} + +func (*CreateSubif) GetMessageName() string { + return "create_subif" +} +func (*CreateSubif) GetCrcString() string { + return "86cfe408" +} +func (*CreateSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CreateSubifReply represents VPP binary API message 'create_subif_reply'. +type CreateSubifReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*CreateSubifReply) GetMessageName() string { + return "create_subif_reply" +} +func (*CreateSubifReply) GetCrcString() string { + return "fda5941f" +} +func (*CreateSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. +type CreateVlanSubif struct { + SwIfIndex uint32 + VlanID uint32 +} + +func (*CreateVlanSubif) GetMessageName() string { + return "create_vlan_subif" +} +func (*CreateVlanSubif) GetCrcString() string { + return "70cadeda" +} +func (*CreateVlanSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. +type CreateVlanSubifReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*CreateVlanSubifReply) GetMessageName() string { + return "create_vlan_subif_reply" +} +func (*CreateVlanSubifReply) GetCrcString() string { + return "fda5941f" +} +func (*CreateVlanSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DeleteLoopback represents VPP binary API message 'delete_loopback'. +type DeleteLoopback struct { + SwIfIndex uint32 +} + +func (*DeleteLoopback) GetMessageName() string { + return "delete_loopback" +} +func (*DeleteLoopback) GetCrcString() string { + return "529cb13f" +} +func (*DeleteLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. +type DeleteLoopbackReply struct { + Retval int32 +} + +func (*DeleteLoopbackReply) GetMessageName() string { + return "delete_loopback_reply" +} +func (*DeleteLoopbackReply) GetCrcString() string { + return "e8d4e804" +} +func (*DeleteLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DeleteSubif represents VPP binary API message 'delete_subif'. +type DeleteSubif struct { + SwIfIndex uint32 +} + +func (*DeleteSubif) GetMessageName() string { + return "delete_subif" +} +func (*DeleteSubif) GetCrcString() string { + return "529cb13f" +} +func (*DeleteSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. +type DeleteSubifReply struct { + Retval int32 +} + +func (*DeleteSubifReply) GetMessageName() string { + return "delete_subif_reply" +} +func (*DeleteSubifReply) GetCrcString() string { + return "e8d4e804" +} +func (*DeleteSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. +type HwInterfaceSetMtu struct { + SwIfIndex uint32 + Mtu uint16 +} + +func (*HwInterfaceSetMtu) GetMessageName() string { + return "hw_interface_set_mtu" +} +func (*HwInterfaceSetMtu) GetCrcString() string { + return "132da1e7" +} +func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. +type HwInterfaceSetMtuReply struct { + Retval int32 +} + +func (*HwInterfaceSetMtuReply) GetMessageName() string { + return "hw_interface_set_mtu_reply" +} +func (*HwInterfaceSetMtuReply) GetCrcString() string { + return "e8d4e804" +} +func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. +type InterfaceNameRenumber struct { + SwIfIndex uint32 + NewShowDevInstance uint32 +} + +func (*InterfaceNameRenumber) GetMessageName() string { + return "interface_name_renumber" +} +func (*InterfaceNameRenumber) GetCrcString() string { + return "39194269" +} +func (*InterfaceNameRenumber) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. +type InterfaceNameRenumberReply struct { + Retval int32 +} + +func (*InterfaceNameRenumberReply) GetMessageName() string { + return "interface_name_renumber_reply" +} +func (*InterfaceNameRenumberReply) GetCrcString() string { + return "e8d4e804" +} +func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. +type SwInterfaceAddDelAddress struct { + SwIfIndex uint32 + IsAdd uint8 + IsIPv6 uint8 + DelAll uint8 + AddressLength uint8 + Address []byte `struc:"[16]byte"` +} + +func (*SwInterfaceAddDelAddress) GetMessageName() string { + return "sw_interface_add_del_address" +} +func (*SwInterfaceAddDelAddress) GetCrcString() string { + return "7b583179" +} +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. +type SwInterfaceAddDelAddressReply struct { + Retval int32 +} + +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. +type SwInterfaceClearStats struct { + SwIfIndex uint32 +} + +func (*SwInterfaceClearStats) GetMessageName() string { + return "sw_interface_clear_stats" +} +func (*SwInterfaceClearStats) GetCrcString() string { + return "529cb13f" +} +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. +type SwInterfaceClearStatsReply struct { + Retval int32 +} + +func (*SwInterfaceClearStatsReply) GetMessageName() string { + return "sw_interface_clear_stats_reply" +} +func (*SwInterfaceClearStatsReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. +type SwInterfaceDetails struct { + SwIfIndex uint32 + SupSwIfIndex uint32 + L2AddressLength uint32 + L2Address []byte `struc:"[8]byte"` + InterfaceName []byte `struc:"[64]byte"` + AdminUpDown uint8 + LinkUpDown uint8 + LinkDuplex uint8 + LinkSpeed uint32 + LinkMtu uint16 + Mtu []uint32 `struc:"[4]uint32"` + SubID uint32 + SubDot1ad uint8 + SubDot1ah uint8 + SubNumberOfTags uint8 + SubOuterVlanID uint16 + SubInnerVlanID uint16 + SubExactMatch uint8 + SubDefault uint8 + SubOuterVlanIDAny uint8 + SubInnerVlanIDAny uint8 + VtrOp uint32 + VtrPushDot1q uint32 + VtrTag1 uint32 + VtrTag2 uint32 + Tag []byte `struc:"[64]byte"` + OuterTag uint16 + BDmac []byte `struc:"[6]byte"` + BSmac []byte `struc:"[6]byte"` + BVlanid uint16 + ISid uint32 +} + +func (*SwInterfaceDetails) GetMessageName() string { + return "sw_interface_details" +} +func (*SwInterfaceDetails) GetCrcString() string { + return "e4ee7eb6" +} +func (*SwInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. +type SwInterfaceDump struct { + SwIfIndex InterfaceIndex + NameFilterValid uint8 + NameFilter []byte `struc:"[49]byte"` +} + +func (*SwInterfaceDump) GetMessageName() string { + return "sw_interface_dump" +} +func (*SwInterfaceDump) GetCrcString() string { + return "052753c5" +} +func (*SwInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. +type SwInterfaceEvent struct { + PID uint32 + SwIfIndex uint32 + AdminUpDown uint8 + LinkUpDown uint8 + Deleted uint8 +} + +func (*SwInterfaceEvent) GetMessageName() string { + return "sw_interface_event" +} +func (*SwInterfaceEvent) GetCrcString() string { + return "bf9938e4" +} +func (*SwInterfaceEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. +type SwInterfaceGetMacAddress struct { + SwIfIndex uint32 +} + +func (*SwInterfaceGetMacAddress) GetMessageName() string { + return "sw_interface_get_mac_address" +} +func (*SwInterfaceGetMacAddress) GetCrcString() string { + return "529cb13f" +} +func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. +type SwInterfaceGetMacAddressReply struct { + Retval int32 + MacAddress []byte `struc:"[6]byte"` +} + +func (*SwInterfaceGetMacAddressReply) GetMessageName() string { + return "sw_interface_get_mac_address_reply" +} +func (*SwInterfaceGetMacAddressReply) GetCrcString() string { + return "8ea538d3" +} +func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. +type SwInterfaceGetTable struct { + SwIfIndex uint32 + IsIPv6 uint8 +} + +func (*SwInterfaceGetTable) GetMessageName() string { + return "sw_interface_get_table" +} +func (*SwInterfaceGetTable) GetCrcString() string { + return "6b7bcd0a" +} +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. +type SwInterfaceGetTableReply struct { + Retval int32 + VrfID uint32 +} + +func (*SwInterfaceGetTableReply) GetMessageName() string { + return "sw_interface_get_table_reply" +} +func (*SwInterfaceGetTableReply) GetCrcString() string { + return "a6eb0109" +} +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. +type SwInterfaceRxPlacementDetails struct { + SwIfIndex uint32 + QueueID uint32 + WorkerID uint32 + Mode uint8 +} + +func (*SwInterfaceRxPlacementDetails) GetMessageName() string { + return "sw_interface_rx_placement_details" +} +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { + return "0e9e33f4" +} +func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. +type SwInterfaceRxPlacementDump struct { + SwIfIndex uint32 +} + +func (*SwInterfaceRxPlacementDump) GetMessageName() string { + return "sw_interface_rx_placement_dump" +} +func (*SwInterfaceRxPlacementDump) GetCrcString() string { + return "529cb13f" +} +func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. +type SwInterfaceSetFlags struct { + SwIfIndex uint32 + AdminUpDown uint8 +} + +func (*SwInterfaceSetFlags) GetMessageName() string { + return "sw_interface_set_flags" +} +func (*SwInterfaceSetFlags) GetCrcString() string { + return "555485f5" +} +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. +type SwInterfaceSetFlagsReply struct { + Retval int32 +} + +func (*SwInterfaceSetFlagsReply) GetMessageName() string { + return "sw_interface_set_flags_reply" +} +func (*SwInterfaceSetFlagsReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. +type SwInterfaceSetIPDirectedBroadcast struct { + SwIfIndex uint32 + Enable uint8 +} + +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { + return "a36fadc0" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. +type SwInterfaceSetIPDirectedBroadcastReply struct { + Retval int32 +} + +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast_reply" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. +type SwInterfaceSetMacAddress struct { + SwIfIndex uint32 + MacAddress []byte `struc:"[6]byte"` +} + +func (*SwInterfaceSetMacAddress) GetMessageName() string { + return "sw_interface_set_mac_address" +} +func (*SwInterfaceSetMacAddress) GetCrcString() string { + return "eed5dfca" +} +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. +type SwInterfaceSetMacAddressReply struct { + Retval int32 +} + +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. +type SwInterfaceSetMtu struct { + SwIfIndex uint32 + Mtu []uint32 `struc:"[4]uint32"` +} + +func (*SwInterfaceSetMtu) GetMessageName() string { + return "sw_interface_set_mtu" +} +func (*SwInterfaceSetMtu) GetCrcString() string { + return "d0008db8" +} +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. +type SwInterfaceSetMtuReply struct { + Retval int32 +} + +func (*SwInterfaceSetMtuReply) GetMessageName() string { + return "sw_interface_set_mtu_reply" +} +func (*SwInterfaceSetMtuReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. +type SwInterfaceSetRxMode struct { + SwIfIndex uint32 + QueueIDValid uint8 + QueueID uint32 + Mode uint8 +} + +func (*SwInterfaceSetRxMode) GetMessageName() string { + return "sw_interface_set_rx_mode" +} +func (*SwInterfaceSetRxMode) GetCrcString() string { + return "2a1cc58c" +} +func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. +type SwInterfaceSetRxModeReply struct { + Retval int32 +} + +func (*SwInterfaceSetRxModeReply) GetMessageName() string { + return "sw_interface_set_rx_mode_reply" +} +func (*SwInterfaceSetRxModeReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. +type SwInterfaceSetRxPlacement struct { + SwIfIndex uint32 + QueueID uint32 + WorkerID uint32 + IsMain uint8 +} + +func (*SwInterfaceSetRxPlacement) GetMessageName() string { + return "sw_interface_set_rx_placement" +} +func (*SwInterfaceSetRxPlacement) GetCrcString() string { + return "4ef4377d" +} +func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. +type SwInterfaceSetRxPlacementReply struct { + Retval int32 +} + +func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { + return "sw_interface_set_rx_placement_reply" +} +func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. +type SwInterfaceSetTable struct { + SwIfIndex uint32 + IsIPv6 uint8 + VrfID uint32 +} + +func (*SwInterfaceSetTable) GetMessageName() string { + return "sw_interface_set_table" +} +func (*SwInterfaceSetTable) GetCrcString() string { + return "acb25d89" +} +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. +type SwInterfaceSetTableReply struct { + Retval int32 +} + +func (*SwInterfaceSetTableReply) GetMessageName() string { + return "sw_interface_set_table_reply" +} +func (*SwInterfaceSetTableReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. +type SwInterfaceSetUnnumbered struct { + SwIfIndex uint32 + UnnumberedSwIfIndex uint32 + IsAdd uint8 +} + +func (*SwInterfaceSetUnnumbered) GetMessageName() string { + return "sw_interface_set_unnumbered" +} +func (*SwInterfaceSetUnnumbered) GetCrcString() string { + return "a2c1bbda" +} +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. +type SwInterfaceSetUnnumberedReply struct { + Retval int32 +} + +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. +type SwInterfaceTagAddDel struct { + IsAdd uint8 + SwIfIndex uint32 + Tag []byte `struc:"[64]byte"` +} + +func (*SwInterfaceTagAddDel) GetMessageName() string { + return "sw_interface_tag_add_del" +} +func (*SwInterfaceTagAddDel) GetCrcString() string { + return "14cc636c" +} +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. +type SwInterfaceTagAddDelReply struct { + Retval int32 +} + +func (*SwInterfaceTagAddDelReply) GetMessageName() string { + return "sw_interface_tag_add_del_reply" +} +func (*SwInterfaceTagAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. +type WantInterfaceEvents struct { + EnableDisable uint32 + PID uint32 +} + +func (*WantInterfaceEvents) GetMessageName() string { + return "want_interface_events" +} +func (*WantInterfaceEvents) GetCrcString() string { + return "476f5a08" +} +func (*WantInterfaceEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. +type WantInterfaceEventsReply struct { + Retval int32 +} + +func (*WantInterfaceEventsReply) GetMessageName() string { + return "want_interface_events_reply" +} +func (*WantInterfaceEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") + api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") + api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") + api.RegisterMessage((*CreateLoopbackInstance)(nil), "interface.CreateLoopbackInstance") + api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "interface.CreateLoopbackInstanceReply") + api.RegisterMessage((*CreateLoopbackReply)(nil), "interface.CreateLoopbackReply") + api.RegisterMessage((*CreateSubif)(nil), "interface.CreateSubif") + api.RegisterMessage((*CreateSubifReply)(nil), "interface.CreateSubifReply") + api.RegisterMessage((*CreateVlanSubif)(nil), "interface.CreateVlanSubif") + api.RegisterMessage((*CreateVlanSubifReply)(nil), "interface.CreateVlanSubifReply") + api.RegisterMessage((*DeleteLoopback)(nil), "interface.DeleteLoopback") + api.RegisterMessage((*DeleteLoopbackReply)(nil), "interface.DeleteLoopbackReply") + api.RegisterMessage((*DeleteSubif)(nil), "interface.DeleteSubif") + api.RegisterMessage((*DeleteSubifReply)(nil), "interface.DeleteSubifReply") + api.RegisterMessage((*HwInterfaceSetMtu)(nil), "interface.HwInterfaceSetMtu") + api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "interface.HwInterfaceSetMtuReply") + api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface.InterfaceNameRenumber") + api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface.InterfaceNameRenumberReply") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "interface.SwInterfaceAddDelAddress") + api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") + api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") + api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") + api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") + api.RegisterMessage((*SwInterfaceDump)(nil), "interface.SwInterfaceDump") + api.RegisterMessage((*SwInterfaceEvent)(nil), "interface.SwInterfaceEvent") + api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "interface.SwInterfaceGetMacAddress") + api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "interface.SwInterfaceGetMacAddressReply") + api.RegisterMessage((*SwInterfaceGetTable)(nil), "interface.SwInterfaceGetTable") + api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "interface.SwInterfaceGetTableReply") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "interface.SwInterfaceRxPlacementDetails") + api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "interface.SwInterfaceRxPlacementDump") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "interface.SwInterfaceSetFlags") + api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "interface.SwInterfaceSetFlagsReply") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "interface.SwInterfaceSetIPDirectedBroadcast") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "interface.SwInterfaceSetIPDirectedBroadcastReply") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "interface.SwInterfaceSetMacAddress") + api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "interface.SwInterfaceSetMacAddressReply") + api.RegisterMessage((*SwInterfaceSetMtu)(nil), "interface.SwInterfaceSetMtu") + api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "interface.SwInterfaceSetMtuReply") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "interface.SwInterfaceSetRxMode") + api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "interface.SwInterfaceSetRxModeReply") + api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "interface.SwInterfaceSetRxPlacement") + api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "interface.SwInterfaceSetRxPlacementReply") + api.RegisterMessage((*SwInterfaceSetTable)(nil), "interface.SwInterfaceSetTable") + api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "interface.SwInterfaceSetTableReply") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "interface.SwInterfaceSetUnnumbered") + api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "interface.SwInterfaceSetUnnumberedReply") + api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "interface.SwInterfaceTagAddDel") + api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "interface.SwInterfaceTagAddDelReply") + api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents") + api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/ip.patch b/plugins/vpp/binapi/vpp1908/ip.patch new file mode 100644 index 0000000000..1adcd3661d --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/ip.patch @@ -0,0 +1,15 @@ +diff --git b/plugins/vpp/binapi/vpp1908/ip/ip.ba.go a/plugins/vpp/binapi/vpp1908/ip/ip.ba.go +index 41c09efbf..3426f811b 100644 +--- b/plugins/vpp/binapi/vpp1908/ip/ip.ba.go ++++ a/plugins/vpp/binapi/vpp1908/ip/ip.ba.go +@@ -316,8 +316,8 @@ type FibPath struct { + Flags FibPathFlags + Proto FibPathNhProto + Nh FibPathNh +- NLabels uint8 +- LabelStack []FibMplsLabel `struc:"[16]FibMplsLabel"` ++ NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED, see https://jira.fd.io/browse/VPP-1261 ++ LabelStack []FibMplsLabel + } + + func (*FibPath) GetTypeName() string { diff --git a/plugins/vpp/binapi/vpp1908/ip/ip.ba.go b/plugins/vpp/binapi/vpp1908/ip/ip.ba.go new file mode 100644 index 0000000000..191e53c007 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/ip/ip.ba.go @@ -0,0 +1,3083 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/ip.api.json + +/* +Package ip is a generated VPP binary API for 'ip' module. + +It consists of: + 9 enums + 3 aliases + 17 types + 1 union + 93 messages + 45 services +*/ +package ip + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "ip" + // APIVersion is the API version of this module. + APIVersion = "3.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x902699f5 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathFlags represents VPP binary API enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", +} + +var FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, +} + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", +} + +var FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, +} + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// FibPathType represents VPP binary API enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", +} + +var FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, +} + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPNeighborFlags represents VPP binary API enum 'ip_neighbor_flags'. +type IPNeighborFlags uint32 + +const ( + IP_API_NEIGHBOR_FLAG_NONE IPNeighborFlags = 0 + IP_API_NEIGHBOR_FLAG_STATIC IPNeighborFlags = 1 + IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY IPNeighborFlags = 2 +) + +var IPNeighborFlags_name = map[uint32]string{ + 0: "IP_API_NEIGHBOR_FLAG_NONE", + 1: "IP_API_NEIGHBOR_FLAG_STATIC", + 2: "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY", +} + +var IPNeighborFlags_value = map[string]uint32{ + "IP_API_NEIGHBOR_FLAG_NONE": 0, + "IP_API_NEIGHBOR_FLAG_STATIC": 1, + "IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY": 2, +} + +func (x IPNeighborFlags) String() string { + s, ok := IPNeighborFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. +type MfibItfFlags uint32 + +const ( + MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 + MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 + MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 + MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 + MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 + MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 +) + +var MfibItfFlags_name = map[uint32]string{ + 0: "MFIB_API_ITF_FLAG_NONE", + 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", + 2: "MFIB_API_ITF_FLAG_ACCEPT", + 4: "MFIB_API_ITF_FLAG_FORWARD", + 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", + 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", +} + +var MfibItfFlags_value = map[string]uint32{ + "MFIB_API_ITF_FLAG_NONE": 0, + "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, + "MFIB_API_ITF_FLAG_ACCEPT": 2, + "MFIB_API_ITF_FLAG_FORWARD": 4, + "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, + "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, +} + +func (x MfibItfFlags) String() string { + s, ok := MfibItfFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 + Label uint32 + TTL uint8 + Exp uint8 +} + +func (*FibMplsLabel) GetTypeName() string { + return "fib_mpls_label" +} + +// FibPath represents VPP binary API type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 + TableID uint32 + RpfID uint32 + Weight uint8 + Preference uint8 + Type FibPathType + Flags FibPathFlags + Proto FibPathNhProto + Nh FibPathNh + NLabels uint8 `struc:"sizeof=LabelStack"` // MANUALLY FIXED, see https://jira.fd.io/browse/VPP-1261 + LabelStack []FibMplsLabel +} + +func (*FibPath) GetTypeName() string { + return "fib_path" +} + +// FibPathNh represents VPP binary API type 'fib_path_nh'. +type FibPathNh struct { + Address AddressUnion + ViaLabel uint32 + ObjID uint32 + ClassifyTableIndex uint32 +} + +func (*FibPathNh) GetTypeName() string { + return "fib_path_nh" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info'. +type IP6RaPrefixInfo struct { + Prefix Prefix + Flags uint8 + ValidTime uint32 + PreferredTime uint32 +} + +func (*IP6RaPrefixInfo) GetTypeName() string { + return "ip6_ra_prefix_info" +} + +// IPMroute represents VPP binary API type 'ip_mroute'. +type IPMroute struct { + TableID uint32 + EntryFlags uint32 + RpfID uint32 + Prefix Mprefix + NPaths uint8 `struc:"sizeof=Paths"` + Paths []MfibPath +} + +func (*IPMroute) GetTypeName() string { + return "ip_mroute" +} + +// IPNeighbor represents VPP binary API type 'ip_neighbor'. +type IPNeighbor struct { + SwIfIndex uint32 + Flags IPNeighborFlags + MacAddress MacAddress + IPAddress Address +} + +func (*IPNeighbor) GetTypeName() string { + return "ip_neighbor" +} + +// IPRoute represents VPP binary API type 'ip_route'. +type IPRoute struct { + TableID uint32 + StatsIndex uint32 + Prefix Prefix + NPaths uint8 `struc:"sizeof=Paths"` + Paths []FibPath +} + +func (*IPRoute) GetTypeName() string { + return "ip_route" +} + +// IPTable represents VPP binary API type 'ip_table'. +type IPTable struct { + TableID uint32 + IsIP6 uint8 + Name []byte `struc:"[64]byte"` +} + +func (*IPTable) GetTypeName() string { + return "ip_table" +} + +// MfibPath represents VPP binary API type 'mfib_path'. +type MfibPath struct { + ItfFlags MfibItfFlags + Path FibPath +} + +func (*MfibPath) GetTypeName() string { + return "mfib_path" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// ProxyArp represents VPP binary API type 'proxy_arp'. +type ProxyArp struct { + TableID uint32 + Low IP4Address + Hi IP4Address +} + +func (*ProxyArp) GetTypeName() string { + return "proxy_arp" +} + +// PuntRedirect represents VPP binary API type 'punt_redirect'. +type PuntRedirect struct { + RxSwIfIndex uint32 + TxSwIfIndex uint32 + Nh Address +} + +func (*PuntRedirect) GetTypeName() string { + return "punt_redirect" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// IoamDisable represents VPP binary API message 'ioam_disable'. +type IoamDisable struct { + ID uint16 +} + +func (*IoamDisable) GetMessageName() string { + return "ioam_disable" +} +func (*IoamDisable) GetCrcString() string { + return "6b16a45e" +} +func (*IoamDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. +type IoamDisableReply struct { + Retval int32 +} + +func (*IoamDisableReply) GetMessageName() string { + return "ioam_disable_reply" +} +func (*IoamDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*IoamDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IoamEnable represents VPP binary API message 'ioam_enable'. +type IoamEnable struct { + ID uint16 + Seqno uint8 + Analyse uint8 + PotEnable uint8 + TraceEnable uint8 + NodeID uint32 +} + +func (*IoamEnable) GetMessageName() string { + return "ioam_enable" +} +func (*IoamEnable) GetCrcString() string { + return "9392e032" +} +func (*IoamEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. +type IoamEnableReply struct { + Retval int32 +} + +func (*IoamEnableReply) GetMessageName() string { + return "ioam_enable_reply" +} +func (*IoamEnableReply) GetCrcString() string { + return "e8d4e804" +} +func (*IoamEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IP4ArpEvent represents VPP binary API message 'ip4_arp_event'. +type IP4ArpEvent struct { + IP IP4Address + PID uint32 + SwIfIndex uint32 + Mac MacAddress + MacIP uint8 +} + +func (*IP4ArpEvent) GetMessageName() string { + return "ip4_arp_event" +} +func (*IP4ArpEvent) GetCrcString() string { + return "72cdde7c" +} +func (*IP4ArpEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// IP6NdEvent represents VPP binary API message 'ip6_nd_event'. +type IP6NdEvent struct { + PID uint32 + SwIfIndex uint32 + IP IP6Address + Mac MacAddress + MacIP uint8 +} + +func (*IP6NdEvent) GetMessageName() string { + return "ip6_nd_event" +} +func (*IP6NdEvent) GetCrcString() string { + return "3a23e7d4" +} +func (*IP6NdEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// IP6RaEvent represents VPP binary API message 'ip6_ra_event'. +type IP6RaEvent struct { + PID uint32 + SwIfIndex uint32 + RouterAddr IP6Address + CurrentHopLimit uint8 + Flags uint8 + RouterLifetimeInSec uint16 + NeighborReachableTimeInMsec uint32 + TimeInMsecBetweenRetransmittedNeighborSolicitations uint32 + NPrefixes uint32 `struc:"sizeof=Prefixes"` + Prefixes []IP6RaPrefixInfo +} + +func (*IP6RaEvent) GetMessageName() string { + return "ip6_ra_event" +} +func (*IP6RaEvent) GetCrcString() string { + return "34c9ddac" +} +func (*IP6RaEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del'. +type IP6ndProxyAddDel struct { + SwIfIndex uint32 + IsDel uint8 + IP IP6Address +} + +func (*IP6ndProxyAddDel) GetMessageName() string { + return "ip6nd_proxy_add_del" +} +func (*IP6ndProxyAddDel) GetCrcString() string { + return "bff10d55" +} +func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply'. +type IP6ndProxyAddDelReply struct { + Retval int32 +} + +func (*IP6ndProxyAddDelReply) GetMessageName() string { + return "ip6nd_proxy_add_del_reply" +} +func (*IP6ndProxyAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details'. +type IP6ndProxyDetails struct { + SwIfIndex uint32 + IP IP6Address +} + +func (*IP6ndProxyDetails) GetMessageName() string { + return "ip6nd_proxy_details" +} +func (*IP6ndProxyDetails) GetCrcString() string { + return "bbbd7894" +} +func (*IP6ndProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump'. +type IP6ndProxyDump struct{} + +func (*IP6ndProxyDump) GetMessageName() string { + return "ip6nd_proxy_dump" +} +func (*IP6ndProxyDump) GetCrcString() string { + return "51077d14" +} +func (*IP6ndProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation'. +type IP6ndSendRouterSolicitation struct { + Irt uint32 + Mrt uint32 + Mrc uint32 + Mrd uint32 + SwIfIndex uint32 + Stop uint8 +} + +func (*IP6ndSendRouterSolicitation) GetMessageName() string { + return "ip6nd_send_router_solicitation" +} +func (*IP6ndSendRouterSolicitation) GetCrcString() string { + return "bd968917" +} +func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply'. +type IP6ndSendRouterSolicitationReply struct { + Retval int32 +} + +func (*IP6ndSendRouterSolicitationReply) GetMessageName() string { + return "ip6nd_send_router_solicitation_reply" +} +func (*IP6ndSendRouterSolicitationReply) GetCrcString() string { + return "e8d4e804" +} +func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPAddressDetails represents VPP binary API message 'ip_address_details'. +type IPAddressDetails struct { + SwIfIndex uint32 + Prefix Prefix +} + +func (*IPAddressDetails) GetMessageName() string { + return "ip_address_details" +} +func (*IPAddressDetails) GetCrcString() string { + return "2f1dbc7d" +} +func (*IPAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPAddressDump represents VPP binary API message 'ip_address_dump'. +type IPAddressDump struct { + SwIfIndex uint32 + IsIPv6 uint8 +} + +func (*IPAddressDump) GetMessageName() string { + return "ip_address_dump" +} +func (*IPAddressDump) GetCrcString() string { + return "6b7bcd0a" +} +func (*IPAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. +type IPContainerProxyAddDel struct { + Pfx Prefix + SwIfIndex uint32 + IsAdd uint8 +} + +func (*IPContainerProxyAddDel) GetMessageName() string { + return "ip_container_proxy_add_del" +} +func (*IPContainerProxyAddDel) GetCrcString() string { + return "5ba831f3" +} +func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. +type IPContainerProxyAddDelReply struct { + Retval int32 +} + +func (*IPContainerProxyAddDelReply) GetMessageName() string { + return "ip_container_proxy_add_del_reply" +} +func (*IPContainerProxyAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. +type IPContainerProxyDetails struct { + SwIfIndex uint32 + Prefix Prefix +} + +func (*IPContainerProxyDetails) GetMessageName() string { + return "ip_container_proxy_details" +} +func (*IPContainerProxyDetails) GetCrcString() string { + return "2f1dbc7d" +} +func (*IPContainerProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. +type IPContainerProxyDump struct{} + +func (*IPContainerProxyDump) GetMessageName() string { + return "ip_container_proxy_dump" +} +func (*IPContainerProxyDump) GetCrcString() string { + return "51077d14" +} +func (*IPContainerProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPDetails represents VPP binary API message 'ip_details'. +type IPDetails struct { + SwIfIndex uint32 + IsIPv6 uint8 +} + +func (*IPDetails) GetMessageName() string { + return "ip_details" +} +func (*IPDetails) GetCrcString() string { + return "8bb37ec4" +} +func (*IPDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPDump represents VPP binary API message 'ip_dump'. +type IPDump struct { + IsIPv6 uint8 +} + +func (*IPDump) GetMessageName() string { + return "ip_dump" +} +func (*IPDump) GetCrcString() string { + return "de883da4" +} +func (*IPDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. +type IPMrouteAddDel struct { + IsAdd uint8 + IsMultipath uint8 + Route IPMroute +} + +func (*IPMrouteAddDel) GetMessageName() string { + return "ip_mroute_add_del" +} +func (*IPMrouteAddDel) GetCrcString() string { + return "997baab2" +} +func (*IPMrouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. +type IPMrouteAddDelReply struct { + Retval int32 + StatsIndex uint32 +} + +func (*IPMrouteAddDelReply) GetMessageName() string { + return "ip_mroute_add_del_reply" +} +func (*IPMrouteAddDelReply) GetCrcString() string { + return "1992deab" +} +func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. +type IPMrouteDetails struct { + Route IPMroute +} + +func (*IPMrouteDetails) GetMessageName() string { + return "ip_mroute_details" +} +func (*IPMrouteDetails) GetCrcString() string { + return "39405e5a" +} +func (*IPMrouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. +type IPMrouteDump struct { + Table IPTable +} + +func (*IPMrouteDump) GetMessageName() string { + return "ip_mroute_dump" +} +func (*IPMrouteDump) GetCrcString() string { + return "f5ad78e8" +} +func (*IPMrouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPMtableDetails represents VPP binary API message 'ip_mtable_details'. +type IPMtableDetails struct { + Table IPTable +} + +func (*IPMtableDetails) GetMessageName() string { + return "ip_mtable_details" +} +func (*IPMtableDetails) GetCrcString() string { + return "f5ad78e8" +} +func (*IPMtableDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPMtableDump represents VPP binary API message 'ip_mtable_dump'. +type IPMtableDump struct{} + +func (*IPMtableDump) GetMessageName() string { + return "ip_mtable_dump" +} +func (*IPMtableDump) GetCrcString() string { + return "51077d14" +} +func (*IPMtableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del'. +type IPNeighborAddDel struct { + IsAdd uint8 + Neighbor IPNeighbor +} + +func (*IPNeighborAddDel) GetMessageName() string { + return "ip_neighbor_add_del" +} +func (*IPNeighborAddDel) GetCrcString() string { + return "7a68a3c4" +} +func (*IPNeighborAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply'. +type IPNeighborAddDelReply struct { + Retval int32 + StatsIndex uint32 +} + +func (*IPNeighborAddDelReply) GetMessageName() string { + return "ip_neighbor_add_del_reply" +} +func (*IPNeighborAddDelReply) GetCrcString() string { + return "1992deab" +} +func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPNeighborDetails represents VPP binary API message 'ip_neighbor_details'. +type IPNeighborDetails struct { + Neighbor IPNeighbor +} + +func (*IPNeighborDetails) GetMessageName() string { + return "ip_neighbor_details" +} +func (*IPNeighborDetails) GetCrcString() string { + return "4a05f212" +} +func (*IPNeighborDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPNeighborDump represents VPP binary API message 'ip_neighbor_dump'. +type IPNeighborDump struct { + SwIfIndex uint32 + IsIPv6 uint8 +} + +func (*IPNeighborDump) GetMessageName() string { + return "ip_neighbor_dump" +} +func (*IPNeighborDump) GetCrcString() string { + return "6b7bcd0a" +} +func (*IPNeighborDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor'. +type IPProbeNeighbor struct { + SwIfIndex uint32 + Dst Address +} + +func (*IPProbeNeighbor) GetMessageName() string { + return "ip_probe_neighbor" +} +func (*IPProbeNeighbor) GetCrcString() string { + return "2736142d" +} +func (*IPProbeNeighbor) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply'. +type IPProbeNeighborReply struct { + Retval int32 +} + +func (*IPProbeNeighborReply) GetMessageName() string { + return "ip_probe_neighbor_reply" +} +func (*IPProbeNeighborReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPProbeNeighborReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPPuntPolice represents VPP binary API message 'ip_punt_police'. +type IPPuntPolice struct { + PolicerIndex uint32 + IsAdd uint8 + IsIP6 uint8 +} + +func (*IPPuntPolice) GetMessageName() string { + return "ip_punt_police" +} +func (*IPPuntPolice) GetCrcString() string { + return "38691592" +} +func (*IPPuntPolice) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. +type IPPuntPoliceReply struct { + Retval int32 +} + +func (*IPPuntPoliceReply) GetMessageName() string { + return "ip_punt_police_reply" +} +func (*IPPuntPoliceReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPPuntPoliceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. +type IPPuntRedirect struct { + Punt PuntRedirect + IsAdd uint8 +} + +func (*IPPuntRedirect) GetMessageName() string { + return "ip_punt_redirect" +} +func (*IPPuntRedirect) GetCrcString() string { + return "70b793c6" +} +func (*IPPuntRedirect) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. +type IPPuntRedirectDetails struct { + Punt PuntRedirect +} + +func (*IPPuntRedirectDetails) GetMessageName() string { + return "ip_punt_redirect_details" +} +func (*IPPuntRedirectDetails) GetCrcString() string { + return "07e504f8" +} +func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. +type IPPuntRedirectDump struct { + SwIfIndex uint32 + IsIPv6 uint8 +} + +func (*IPPuntRedirectDump) GetMessageName() string { + return "ip_punt_redirect_dump" +} +func (*IPPuntRedirectDump) GetCrcString() string { + return "6b7bcd0a" +} +func (*IPPuntRedirectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. +type IPPuntRedirectReply struct { + Retval int32 +} + +func (*IPPuntRedirectReply) GetMessageName() string { + return "ip_punt_redirect_reply" +} +func (*IPPuntRedirectReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPPuntRedirectReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. +type IPReassemblyEnableDisable struct { + SwIfIndex uint32 + EnableIP4 uint8 + EnableIP6 uint8 +} + +func (*IPReassemblyEnableDisable) GetMessageName() string { + return "ip_reassembly_enable_disable" +} +func (*IPReassemblyEnableDisable) GetCrcString() string { + return "bb8dc5d0" +} +func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. +type IPReassemblyEnableDisableReply struct { + Retval int32 +} + +func (*IPReassemblyEnableDisableReply) GetMessageName() string { + return "ip_reassembly_enable_disable_reply" +} +func (*IPReassemblyEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. +type IPReassemblyGet struct { + IsIP6 uint8 +} + +func (*IPReassemblyGet) GetMessageName() string { + return "ip_reassembly_get" +} +func (*IPReassemblyGet) GetCrcString() string { + return "6fe91190" +} +func (*IPReassemblyGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. +type IPReassemblyGetReply struct { + Retval int32 + TimeoutMs uint32 + MaxReassemblies uint32 + MaxReassemblyLength uint32 + ExpireWalkIntervalMs uint32 + IsIP6 uint8 +} + +func (*IPReassemblyGetReply) GetMessageName() string { + return "ip_reassembly_get_reply" +} +func (*IPReassemblyGetReply) GetCrcString() string { + return "c96e518d" +} +func (*IPReassemblyGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. +type IPReassemblySet struct { + TimeoutMs uint32 + MaxReassemblies uint32 + MaxReassemblyLength uint32 + ExpireWalkIntervalMs uint32 + IsIP6 uint8 +} + +func (*IPReassemblySet) GetMessageName() string { + return "ip_reassembly_set" +} +func (*IPReassemblySet) GetCrcString() string { + return "403051cd" +} +func (*IPReassemblySet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. +type IPReassemblySetReply struct { + Retval int32 +} + +func (*IPReassemblySetReply) GetMessageName() string { + return "ip_reassembly_set_reply" +} +func (*IPReassemblySetReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPReassemblySetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. +type IPRouteAddDel struct { + IsAdd uint8 + IsMultipath uint8 + Route IPRoute +} + +func (*IPRouteAddDel) GetMessageName() string { + return "ip_route_add_del" +} +func (*IPRouteAddDel) GetCrcString() string { + return "83e086ce" +} +func (*IPRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. +type IPRouteAddDelReply struct { + Retval int32 + StatsIndex uint32 +} + +func (*IPRouteAddDelReply) GetMessageName() string { + return "ip_route_add_del_reply" +} +func (*IPRouteAddDelReply) GetCrcString() string { + return "1992deab" +} +func (*IPRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPRouteDetails represents VPP binary API message 'ip_route_details'. +type IPRouteDetails struct { + Route IPRoute +} + +func (*IPRouteDetails) GetMessageName() string { + return "ip_route_details" +} +func (*IPRouteDetails) GetCrcString() string { + return "acdee858" +} +func (*IPRouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPRouteDump represents VPP binary API message 'ip_route_dump'. +type IPRouteDump struct { + Table IPTable +} + +func (*IPRouteDump) GetMessageName() string { + return "ip_route_dump" +} +func (*IPRouteDump) GetCrcString() string { + return "f5ad78e8" +} +func (*IPRouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable'. +type IPScanNeighborEnableDisable struct { + Mode uint8 + ScanInterval uint8 + MaxProcTime uint8 + MaxUpdate uint8 + ScanIntDelay uint8 + StaleThreshold uint8 +} + +func (*IPScanNeighborEnableDisable) GetMessageName() string { + return "ip_scan_neighbor_enable_disable" +} +func (*IPScanNeighborEnableDisable) GetCrcString() string { + return "0a6bf57a" +} +func (*IPScanNeighborEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply'. +type IPScanNeighborEnableDisableReply struct { + Retval int32 +} + +func (*IPScanNeighborEnableDisableReply) GetMessageName() string { + return "ip_scan_neighbor_enable_disable_reply" +} +func (*IPScanNeighborEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPScanNeighborEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. +type IPSourceAndPortRangeCheckAddDel struct { + IsAdd uint8 + Prefix Prefix + NumberOfRanges uint8 + LowPorts []uint16 `struc:"[32]uint16"` + HighPorts []uint16 `struc:"[32]uint16"` + VrfID uint32 +} + +func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_add_del" +} +func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { + return "b50ed159" +} +func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. +type IPSourceAndPortRangeCheckAddDelReply struct { + Retval int32 +} + +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_add_del_reply" +} +func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. +type IPSourceAndPortRangeCheckInterfaceAddDel struct { + IsAdd uint8 + SwIfIndex uint32 + TCPInVrfID uint32 + TCPOutVrfID uint32 + UDPInVrfID uint32 + UDPOutVrfID uint32 +} + +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { + return "6966bc44" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. +type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { + Retval int32 +} + +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del_reply" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. +type IPSourceCheckInterfaceAddDel struct { + IsAdd uint8 + Loose uint8 + SwIfIndex uint32 +} + +func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_check_interface_add_del" +} +func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { + return "0a60152a" +} +func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. +type IPSourceCheckInterfaceAddDelReply struct { + Retval int32 +} + +func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_check_interface_add_del_reply" +} +func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. +type IPTableAddDel struct { + IsAdd uint8 + Table IPTable +} + +func (*IPTableAddDel) GetMessageName() string { + return "ip_table_add_del" +} +func (*IPTableAddDel) GetCrcString() string { + return "e5d378f2" +} +func (*IPTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. +type IPTableAddDelReply struct { + Retval int32 +} + +func (*IPTableAddDelReply) GetMessageName() string { + return "ip_table_add_del_reply" +} +func (*IPTableAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IPTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPTableDetails represents VPP binary API message 'ip_table_details'. +type IPTableDetails struct { + Table IPTable +} + +func (*IPTableDetails) GetMessageName() string { + return "ip_table_details" +} +func (*IPTableDetails) GetCrcString() string { + return "4d251961" +} +func (*IPTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPTableDump represents VPP binary API message 'ip_table_dump'. +type IPTableDump struct{} + +func (*IPTableDump) GetMessageName() string { + return "ip_table_dump" +} +func (*IPTableDump) GetCrcString() string { + return "51077d14" +} +func (*IPTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. +type IPUnnumberedDetails struct { + SwIfIndex uint32 + IPSwIfIndex uint32 +} + +func (*IPUnnumberedDetails) GetMessageName() string { + return "ip_unnumbered_details" +} +func (*IPUnnumberedDetails) GetCrcString() string { + return "ae694cf4" +} +func (*IPUnnumberedDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. +type IPUnnumberedDump struct { + SwIfIndex uint32 +} + +func (*IPUnnumberedDump) GetMessageName() string { + return "ip_unnumbered_dump" +} +func (*IPUnnumberedDump) GetCrcString() string { + return "529cb13f" +} +func (*IPUnnumberedDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. +type MfibSignalDetails struct { + SwIfIndex uint32 + TableID uint32 + Prefix Mprefix + IPPacketLen uint16 + IPPacketData []byte `struc:"[256]byte"` +} + +func (*MfibSignalDetails) GetMessageName() string { + return "mfib_signal_details" +} +func (*MfibSignalDetails) GetCrcString() string { + return "cd461bfa" +} +func (*MfibSignalDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. +type MfibSignalDump struct{} + +func (*MfibSignalDump) GetMessageName() string { + return "mfib_signal_dump" +} +func (*MfibSignalDump) GetCrcString() string { + return "51077d14" +} +func (*MfibSignalDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del'. +type ProxyArpAddDel struct { + IsAdd uint8 + Proxy ProxyArp +} + +func (*ProxyArpAddDel) GetMessageName() string { + return "proxy_arp_add_del" +} +func (*ProxyArpAddDel) GetCrcString() string { + return "93a0e853" +} +func (*ProxyArpAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply'. +type ProxyArpAddDelReply struct { + Retval int32 +} + +func (*ProxyArpAddDelReply) GetMessageName() string { + return "proxy_arp_add_del_reply" +} +func (*ProxyArpAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ProxyArpDetails represents VPP binary API message 'proxy_arp_details'. +type ProxyArpDetails struct { + Proxy ProxyArp +} + +func (*ProxyArpDetails) GetMessageName() string { + return "proxy_arp_details" +} +func (*ProxyArpDetails) GetCrcString() string { + return "2515902a" +} +func (*ProxyArpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ProxyArpDump represents VPP binary API message 'proxy_arp_dump'. +type ProxyArpDump struct{} + +func (*ProxyArpDump) GetMessageName() string { + return "proxy_arp_dump" +} +func (*ProxyArpDump) GetCrcString() string { + return "51077d14" +} +func (*ProxyArpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details'. +type ProxyArpIntfcDetails struct { + SwIfIndex uint32 +} + +func (*ProxyArpIntfcDetails) GetMessageName() string { + return "proxy_arp_intfc_details" +} +func (*ProxyArpIntfcDetails) GetCrcString() string { + return "f6458e5f" +} +func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump'. +type ProxyArpIntfcDump struct{} + +func (*ProxyArpIntfcDump) GetMessageName() string { + return "proxy_arp_intfc_dump" +} +func (*ProxyArpIntfcDump) GetCrcString() string { + return "51077d14" +} +func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable'. +type ProxyArpIntfcEnableDisable struct { + SwIfIndex uint32 + EnableDisable uint8 +} + +func (*ProxyArpIntfcEnableDisable) GetMessageName() string { + return "proxy_arp_intfc_enable_disable" +} +func (*ProxyArpIntfcEnableDisable) GetCrcString() string { + return "69d24598" +} +func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply'. +type ProxyArpIntfcEnableDisableReply struct { + Retval int32 +} + +func (*ProxyArpIntfcEnableDisableReply) GetMessageName() string { + return "proxy_arp_intfc_enable_disable_reply" +} +func (*ProxyArpIntfcEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ResetFib represents VPP binary API message 'reset_fib'. +type ResetFib struct { + VrfID uint32 + IsIPv6 uint8 +} + +func (*ResetFib) GetMessageName() string { + return "reset_fib" +} +func (*ResetFib) GetCrcString() string { + return "8553ebd9" +} +func (*ResetFib) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ResetFibReply represents VPP binary API message 'reset_fib_reply'. +type ResetFibReply struct { + Retval int32 +} + +func (*ResetFibReply) GetMessageName() string { + return "reset_fib_reply" +} +func (*ResetFibReply) GetCrcString() string { + return "e8d4e804" +} +func (*ResetFibReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit'. +type SetArpNeighborLimit struct { + IsIPv6 uint8 + ArpNeighborLimit uint32 +} + +func (*SetArpNeighborLimit) GetMessageName() string { + return "set_arp_neighbor_limit" +} +func (*SetArpNeighborLimit) GetCrcString() string { + return "97d01fd6" +} +func (*SetArpNeighborLimit) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply'. +type SetArpNeighborLimitReply struct { + Retval int32 +} + +func (*SetArpNeighborLimitReply) GetMessageName() string { + return "set_arp_neighbor_limit_reply" +} +func (*SetArpNeighborLimitReply) GetCrcString() string { + return "e8d4e804" +} +func (*SetArpNeighborLimitReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. +type SetIPFlowHash struct { + VrfID uint32 + IsIPv6 uint8 + Src uint8 + Dst uint8 + Sport uint8 + Dport uint8 + Proto uint8 + Reverse uint8 + Symmetric uint8 +} + +func (*SetIPFlowHash) GetMessageName() string { + return "set_ip_flow_hash" +} +func (*SetIPFlowHash) GetCrcString() string { + return "a9084bfb" +} +func (*SetIPFlowHash) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. +type SetIPFlowHashReply struct { + Retval int32 +} + +func (*SetIPFlowHashReply) GetMessageName() string { + return "set_ip_flow_hash_reply" +} +func (*SetIPFlowHashReply) GetCrcString() string { + return "e8d4e804" +} +func (*SetIPFlowHashReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. +type SwInterfaceIP6EnableDisable struct { + SwIfIndex uint32 + Enable uint8 +} + +func (*SwInterfaceIP6EnableDisable) GetMessageName() string { + return "sw_interface_ip6_enable_disable" +} +func (*SwInterfaceIP6EnableDisable) GetCrcString() string { + return "a36fadc0" +} +func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. +type SwInterfaceIP6EnableDisableReply struct { + Retval int32 +} + +func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { + return "sw_interface_ip6_enable_disable_reply" +} +func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. +type SwInterfaceIP6SetLinkLocalAddress struct { + SwIfIndex uint32 + Address []byte `struc:"[16]byte"` +} + +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { + return "d73bf1ab" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. +type SwInterfaceIP6SetLinkLocalAddressReply struct { + Retval int32 +} + +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address_reply" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config'. +type SwInterfaceIP6ndRaConfig struct { + SwIfIndex uint32 + Suppress uint8 + Managed uint8 + Other uint8 + LlOption uint8 + SendUnicast uint8 + Cease uint8 + IsNo uint8 + DefaultRouter uint8 + MaxInterval uint32 + MinInterval uint32 + Lifetime uint32 + InitialCount uint32 + InitialInterval uint32 +} + +func (*SwInterfaceIP6ndRaConfig) GetMessageName() string { + return "sw_interface_ip6nd_ra_config" +} +func (*SwInterfaceIP6ndRaConfig) GetCrcString() string { + return "c3f02daa" +} +func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply'. +type SwInterfaceIP6ndRaConfigReply struct { + Retval int32 +} + +func (*SwInterfaceIP6ndRaConfigReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_config_reply" +} +func (*SwInterfaceIP6ndRaConfigReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix'. +type SwInterfaceIP6ndRaPrefix struct { + SwIfIndex uint32 + Prefix Prefix + UseDefault uint8 + NoAdvertise uint8 + OffLink uint8 + NoAutoconfig uint8 + NoOnlink uint8 + IsNo uint8 + ValLifetime uint32 + PrefLifetime uint32 +} + +func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { + return "sw_interface_ip6nd_ra_prefix" +} +func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { + return "0f759f82" +} +func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply'. +type SwInterfaceIP6ndRaPrefixReply struct { + Retval int32 +} + +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageName() string { + return "sw_interface_ip6nd_ra_prefix_reply" +} +func (*SwInterfaceIP6ndRaPrefixReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events'. +type WantIP4ArpEvents struct { + EnableDisable uint8 + PID uint32 + IP IP4Address +} + +func (*WantIP4ArpEvents) GetMessageName() string { + return "want_ip4_arp_events" +} +func (*WantIP4ArpEvents) GetCrcString() string { + return "70fd7195" +} +func (*WantIP4ArpEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply'. +type WantIP4ArpEventsReply struct { + Retval int32 +} + +func (*WantIP4ArpEventsReply) GetMessageName() string { + return "want_ip4_arp_events_reply" +} +func (*WantIP4ArpEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantIP4ArpEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events'. +type WantIP6NdEvents struct { + EnableDisable uint8 + PID uint32 + IP IP6Address +} + +func (*WantIP6NdEvents) GetMessageName() string { + return "want_ip6_nd_events" +} +func (*WantIP6NdEvents) GetCrcString() string { + return "ba330719" +} +func (*WantIP6NdEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply'. +type WantIP6NdEventsReply struct { + Retval int32 +} + +func (*WantIP6NdEventsReply) GetMessageName() string { + return "want_ip6_nd_events_reply" +} +func (*WantIP6NdEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantIP6NdEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events'. +type WantIP6RaEvents struct { + EnableDisable uint8 + PID uint32 +} + +func (*WantIP6RaEvents) GetMessageName() string { + return "want_ip6_ra_events" +} +func (*WantIP6RaEvents) GetCrcString() string { + return "05b454b5" +} +func (*WantIP6RaEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply'. +type WantIP6RaEventsReply struct { + Retval int32 +} + +func (*WantIP6RaEventsReply) GetMessageName() string { + return "want_ip6_ra_events_reply" +} +func (*WantIP6RaEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantIP6RaEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") + api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") + api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") + api.RegisterMessage((*IoamEnableReply)(nil), "ip.IoamEnableReply") + api.RegisterMessage((*IP4ArpEvent)(nil), "ip.IP4ArpEvent") + api.RegisterMessage((*IP6NdEvent)(nil), "ip.IP6NdEvent") + api.RegisterMessage((*IP6RaEvent)(nil), "ip.IP6RaEvent") + api.RegisterMessage((*IP6ndProxyAddDel)(nil), "ip.IP6ndProxyAddDel") + api.RegisterMessage((*IP6ndProxyAddDelReply)(nil), "ip.IP6ndProxyAddDelReply") + api.RegisterMessage((*IP6ndProxyDetails)(nil), "ip.IP6ndProxyDetails") + api.RegisterMessage((*IP6ndProxyDump)(nil), "ip.IP6ndProxyDump") + api.RegisterMessage((*IP6ndSendRouterSolicitation)(nil), "ip.IP6ndSendRouterSolicitation") + api.RegisterMessage((*IP6ndSendRouterSolicitationReply)(nil), "ip.IP6ndSendRouterSolicitationReply") + api.RegisterMessage((*IPAddressDetails)(nil), "ip.IPAddressDetails") + api.RegisterMessage((*IPAddressDump)(nil), "ip.IPAddressDump") + api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip.IPContainerProxyAddDel") + api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip.IPContainerProxyAddDelReply") + api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip.IPContainerProxyDetails") + api.RegisterMessage((*IPContainerProxyDump)(nil), "ip.IPContainerProxyDump") + api.RegisterMessage((*IPDetails)(nil), "ip.IPDetails") + api.RegisterMessage((*IPDump)(nil), "ip.IPDump") + api.RegisterMessage((*IPMrouteAddDel)(nil), "ip.IPMrouteAddDel") + api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip.IPMrouteAddDelReply") + api.RegisterMessage((*IPMrouteDetails)(nil), "ip.IPMrouteDetails") + api.RegisterMessage((*IPMrouteDump)(nil), "ip.IPMrouteDump") + api.RegisterMessage((*IPMtableDetails)(nil), "ip.IPMtableDetails") + api.RegisterMessage((*IPMtableDump)(nil), "ip.IPMtableDump") + api.RegisterMessage((*IPNeighborAddDel)(nil), "ip.IPNeighborAddDel") + api.RegisterMessage((*IPNeighborAddDelReply)(nil), "ip.IPNeighborAddDelReply") + api.RegisterMessage((*IPNeighborDetails)(nil), "ip.IPNeighborDetails") + api.RegisterMessage((*IPNeighborDump)(nil), "ip.IPNeighborDump") + api.RegisterMessage((*IPProbeNeighbor)(nil), "ip.IPProbeNeighbor") + api.RegisterMessage((*IPProbeNeighborReply)(nil), "ip.IPProbeNeighborReply") + api.RegisterMessage((*IPPuntPolice)(nil), "ip.IPPuntPolice") + api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip.IPPuntPoliceReply") + api.RegisterMessage((*IPPuntRedirect)(nil), "ip.IPPuntRedirect") + api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip.IPPuntRedirectDetails") + api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip.IPPuntRedirectDump") + api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip.IPPuntRedirectReply") + api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip.IPReassemblyEnableDisable") + api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip.IPReassemblyEnableDisableReply") + api.RegisterMessage((*IPReassemblyGet)(nil), "ip.IPReassemblyGet") + api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip.IPReassemblyGetReply") + api.RegisterMessage((*IPReassemblySet)(nil), "ip.IPReassemblySet") + api.RegisterMessage((*IPReassemblySetReply)(nil), "ip.IPReassemblySetReply") + api.RegisterMessage((*IPRouteAddDel)(nil), "ip.IPRouteAddDel") + api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") + api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") + api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") + api.RegisterMessage((*IPScanNeighborEnableDisable)(nil), "ip.IPScanNeighborEnableDisable") + api.RegisterMessage((*IPScanNeighborEnableDisableReply)(nil), "ip.IPScanNeighborEnableDisableReply") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") + api.RegisterMessage((*IPSourceCheckInterfaceAddDel)(nil), "ip.IPSourceCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceCheckInterfaceAddDelReply)(nil), "ip.IPSourceCheckInterfaceAddDelReply") + api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") + api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") + api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") + api.RegisterMessage((*IPTableDump)(nil), "ip.IPTableDump") + api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip.IPUnnumberedDetails") + api.RegisterMessage((*IPUnnumberedDump)(nil), "ip.IPUnnumberedDump") + api.RegisterMessage((*MfibSignalDetails)(nil), "ip.MfibSignalDetails") + api.RegisterMessage((*MfibSignalDump)(nil), "ip.MfibSignalDump") + api.RegisterMessage((*ProxyArpAddDel)(nil), "ip.ProxyArpAddDel") + api.RegisterMessage((*ProxyArpAddDelReply)(nil), "ip.ProxyArpAddDelReply") + api.RegisterMessage((*ProxyArpDetails)(nil), "ip.ProxyArpDetails") + api.RegisterMessage((*ProxyArpDump)(nil), "ip.ProxyArpDump") + api.RegisterMessage((*ProxyArpIntfcDetails)(nil), "ip.ProxyArpIntfcDetails") + api.RegisterMessage((*ProxyArpIntfcDump)(nil), "ip.ProxyArpIntfcDump") + api.RegisterMessage((*ProxyArpIntfcEnableDisable)(nil), "ip.ProxyArpIntfcEnableDisable") + api.RegisterMessage((*ProxyArpIntfcEnableDisableReply)(nil), "ip.ProxyArpIntfcEnableDisableReply") + api.RegisterMessage((*ResetFib)(nil), "ip.ResetFib") + api.RegisterMessage((*ResetFibReply)(nil), "ip.ResetFibReply") + api.RegisterMessage((*SetArpNeighborLimit)(nil), "ip.SetArpNeighborLimit") + api.RegisterMessage((*SetArpNeighborLimitReply)(nil), "ip.SetArpNeighborLimitReply") + api.RegisterMessage((*SetIPFlowHash)(nil), "ip.SetIPFlowHash") + api.RegisterMessage((*SetIPFlowHashReply)(nil), "ip.SetIPFlowHashReply") + api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "ip.SwInterfaceIP6EnableDisable") + api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "ip.SwInterfaceIP6EnableDisableReply") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "ip.SwInterfaceIP6SetLinkLocalAddress") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "ip.SwInterfaceIP6SetLinkLocalAddressReply") + api.RegisterMessage((*SwInterfaceIP6ndRaConfig)(nil), "ip.SwInterfaceIP6ndRaConfig") + api.RegisterMessage((*SwInterfaceIP6ndRaConfigReply)(nil), "ip.SwInterfaceIP6ndRaConfigReply") + api.RegisterMessage((*SwInterfaceIP6ndRaPrefix)(nil), "ip.SwInterfaceIP6ndRaPrefix") + api.RegisterMessage((*SwInterfaceIP6ndRaPrefixReply)(nil), "ip.SwInterfaceIP6ndRaPrefixReply") + api.RegisterMessage((*WantIP4ArpEvents)(nil), "ip.WantIP4ArpEvents") + api.RegisterMessage((*WantIP4ArpEventsReply)(nil), "ip.WantIP4ArpEventsReply") + api.RegisterMessage((*WantIP6NdEvents)(nil), "ip.WantIP6NdEvents") + api.RegisterMessage((*WantIP6NdEventsReply)(nil), "ip.WantIP6NdEventsReply") + api.RegisterMessage((*WantIP6RaEvents)(nil), "ip.WantIP6RaEvents") + api.RegisterMessage((*WantIP6RaEventsReply)(nil), "ip.WantIP6RaEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IP4ArpEvent)(nil), + (*IP6NdEvent)(nil), + (*IP6RaEvent)(nil), + (*IP6ndProxyAddDel)(nil), + (*IP6ndProxyAddDelReply)(nil), + (*IP6ndProxyDetails)(nil), + (*IP6ndProxyDump)(nil), + (*IP6ndSendRouterSolicitation)(nil), + (*IP6ndSendRouterSolicitationReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPMrouteDetails)(nil), + (*IPMrouteDump)(nil), + (*IPMtableDetails)(nil), + (*IPMtableDump)(nil), + (*IPNeighborAddDel)(nil), + (*IPNeighborAddDelReply)(nil), + (*IPNeighborDetails)(nil), + (*IPNeighborDump)(nil), + (*IPProbeNeighbor)(nil), + (*IPProbeNeighborReply)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPRouteAddDel)(nil), + (*IPRouteAddDelReply)(nil), + (*IPRouteDetails)(nil), + (*IPRouteDump)(nil), + (*IPScanNeighborEnableDisable)(nil), + (*IPScanNeighborEnableDisableReply)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPTableDetails)(nil), + (*IPTableDump)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + (*ResetFib)(nil), + (*ResetFibReply)(nil), + (*SetArpNeighborLimit)(nil), + (*SetArpNeighborLimitReply)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6SetLinkLocalAddress)(nil), + (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), + (*SwInterfaceIP6ndRaConfig)(nil), + (*SwInterfaceIP6ndRaConfigReply)(nil), + (*SwInterfaceIP6ndRaPrefix)(nil), + (*SwInterfaceIP6ndRaPrefixReply)(nil), + (*WantIP4ArpEvents)(nil), + (*WantIP4ArpEventsReply)(nil), + (*WantIP6NdEvents)(nil), + (*WantIP6NdEventsReply)(nil), + (*WantIP6RaEvents)(nil), + (*WantIP6RaEventsReply)(nil), + } +} + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) + DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) + DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) + DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) + DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) + IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) + IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) + ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) + SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) + SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) + SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) + WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) + WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) + WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIP6ndProxy(ctx context.Context, in *IP6ndProxyDump) (RPCService_DumpIP6ndProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIP6ndProxyClient{stream} + return x, nil +} + +type RPCService_DumpIP6ndProxyClient interface { + Recv() (*IP6ndProxyDetails, error) +} + +type serviceClient_DumpIP6ndProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIP6ndProxyClient) Recv() (*IP6ndProxyDetails, error) { + m := new(IP6ndProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMrouteClient{stream} + return x, nil +} + +type RPCService_DumpIPMrouteClient interface { + Recv() (*IPMrouteDetails, error) +} + +type serviceClient_DumpIPMrouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { + m := new(IPMrouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMtableClient{stream} + return x, nil +} + +type RPCService_DumpIPMtableClient interface { + Recv() (*IPMtableDetails, error) +} + +type serviceClient_DumpIPMtableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { + m := new(IPMtableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPNeighbor(ctx context.Context, in *IPNeighborDump) (RPCService_DumpIPNeighborClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPNeighborClient{stream} + return x, nil +} + +type RPCService_DumpIPNeighborClient interface { + Recv() (*IPNeighborDetails, error) +} + +type serviceClient_DumpIPNeighborClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPNeighborClient) Recv() (*IPNeighborDetails, error) { + m := new(IPNeighborDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPRouteClient{stream} + return x, nil +} + +type RPCService_DumpIPRouteClient interface { + Recv() (*IPRouteDetails, error) +} + +type serviceClient_DumpIPRouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { + m := new(IPRouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPTableClient{stream} + return x, nil +} + +type RPCService_DumpIPTableClient interface { + Recv() (*IPTableDetails, error) +} + +type serviceClient_DumpIPTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { + m := new(IPTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil +} + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArp(ctx context.Context, in *ProxyArpDump) (RPCService_DumpProxyArpClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpClient interface { + Recv() (*ProxyArpDetails, error) +} + +type serviceClient_DumpProxyArpClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpClient) Recv() (*ProxyArpDetails, error) { + m := new(ProxyArpDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpProxyArpIntfc(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_DumpProxyArpIntfcClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpProxyArpIntfcClient{stream} + return x, nil +} + +type RPCService_DumpProxyArpIntfcClient interface { + Recv() (*ProxyArpIntfcDetails, error) +} + +type serviceClient_DumpProxyArpIntfcClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpProxyArpIntfcClient) Recv() (*ProxyArpIntfcDetails, error) { + m := new(ProxyArpIntfcDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) { + out := new(IP6ndProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6ndSendRouterSolicitation) (*IP6ndSendRouterSolicitationReply, error) { + out := new(IP6ndSendRouterSolicitationReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) { + out := new(IPNeighborAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPProbeNeighbor(ctx context.Context, in *IPProbeNeighbor) (*IPProbeNeighborReply, error) { + out := new(IPProbeNeighborReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { + out := new(IPRouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPScanNeighborEnableDisable(ctx context.Context, in *IPScanNeighborEnableDisable) (*IPScanNeighborEnableDisableReply, error) { + out := new(IPScanNeighborEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ResetFib(ctx context.Context, in *ResetFib) (*ResetFibReply, error) { + out := new(ResetFibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetArpNeighborLimit(ctx context.Context, in *SetArpNeighborLimit) (*SetArpNeighborLimitReply, error) { + out := new(SetArpNeighborLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6SetLinkLocalAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { + out := new(SwInterfaceIP6ndRaConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { + out := new(SwInterfaceIP6ndRaPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP4ArpEvents(ctx context.Context, in *WantIP4ArpEvents) (*WantIP4ArpEventsReply, error) { + out := new(WantIP4ArpEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6NdEvents(ctx context.Context, in *WantIP6NdEvents) (*WantIP6NdEventsReply, error) { + out := new(WantIP6NdEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { + out := new(WantIP6RaEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/ipsec/ipsec.ba.go b/plugins/vpp/binapi/vpp1908/ipsec/ipsec.ba.go new file mode 100644 index 0000000000..80f10ac24d --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/ipsec/ipsec.ba.go @@ -0,0 +1,1439 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/ipsec.api.json + +/* +Package ipsec is a generated VPP binary API for 'ipsec' module. + +It consists of: + 9 enums + 3 aliases + 10 types + 1 union + 30 messages + 15 services +*/ +package ipsec + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "ipsec" + // APIVersion is the API version of this module. + APIVersion = "3.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xaffef530 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecCryptoAlg represents VPP binary API enum 'ipsec_crypto_alg'. +type IpsecCryptoAlg uint32 + +const ( + IPSEC_API_CRYPTO_ALG_NONE IpsecCryptoAlg = 0 + IPSEC_API_CRYPTO_ALG_AES_CBC_128 IpsecCryptoAlg = 1 + IPSEC_API_CRYPTO_ALG_AES_CBC_192 IpsecCryptoAlg = 2 + IPSEC_API_CRYPTO_ALG_AES_CBC_256 IpsecCryptoAlg = 3 + IPSEC_API_CRYPTO_ALG_AES_CTR_128 IpsecCryptoAlg = 4 + IPSEC_API_CRYPTO_ALG_AES_CTR_192 IpsecCryptoAlg = 5 + IPSEC_API_CRYPTO_ALG_AES_CTR_256 IpsecCryptoAlg = 6 + IPSEC_API_CRYPTO_ALG_AES_GCM_128 IpsecCryptoAlg = 7 + IPSEC_API_CRYPTO_ALG_AES_GCM_192 IpsecCryptoAlg = 8 + IPSEC_API_CRYPTO_ALG_AES_GCM_256 IpsecCryptoAlg = 9 + IPSEC_API_CRYPTO_ALG_DES_CBC IpsecCryptoAlg = 10 + IPSEC_API_CRYPTO_ALG_3DES_CBC IpsecCryptoAlg = 11 +) + +var IpsecCryptoAlg_name = map[uint32]string{ + 0: "IPSEC_API_CRYPTO_ALG_NONE", + 1: "IPSEC_API_CRYPTO_ALG_AES_CBC_128", + 2: "IPSEC_API_CRYPTO_ALG_AES_CBC_192", + 3: "IPSEC_API_CRYPTO_ALG_AES_CBC_256", + 4: "IPSEC_API_CRYPTO_ALG_AES_CTR_128", + 5: "IPSEC_API_CRYPTO_ALG_AES_CTR_192", + 6: "IPSEC_API_CRYPTO_ALG_AES_CTR_256", + 7: "IPSEC_API_CRYPTO_ALG_AES_GCM_128", + 8: "IPSEC_API_CRYPTO_ALG_AES_GCM_192", + 9: "IPSEC_API_CRYPTO_ALG_AES_GCM_256", + 10: "IPSEC_API_CRYPTO_ALG_DES_CBC", + 11: "IPSEC_API_CRYPTO_ALG_3DES_CBC", +} + +var IpsecCryptoAlg_value = map[string]uint32{ + "IPSEC_API_CRYPTO_ALG_NONE": 0, + "IPSEC_API_CRYPTO_ALG_AES_CBC_128": 1, + "IPSEC_API_CRYPTO_ALG_AES_CBC_192": 2, + "IPSEC_API_CRYPTO_ALG_AES_CBC_256": 3, + "IPSEC_API_CRYPTO_ALG_AES_CTR_128": 4, + "IPSEC_API_CRYPTO_ALG_AES_CTR_192": 5, + "IPSEC_API_CRYPTO_ALG_AES_CTR_256": 6, + "IPSEC_API_CRYPTO_ALG_AES_GCM_128": 7, + "IPSEC_API_CRYPTO_ALG_AES_GCM_192": 8, + "IPSEC_API_CRYPTO_ALG_AES_GCM_256": 9, + "IPSEC_API_CRYPTO_ALG_DES_CBC": 10, + "IPSEC_API_CRYPTO_ALG_3DES_CBC": 11, +} + +func (x IpsecCryptoAlg) String() string { + s, ok := IpsecCryptoAlg_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecIntegAlg represents VPP binary API enum 'ipsec_integ_alg'. +type IpsecIntegAlg uint32 + +const ( + IPSEC_API_INTEG_ALG_NONE IpsecIntegAlg = 0 + IPSEC_API_INTEG_ALG_MD5_96 IpsecIntegAlg = 1 + IPSEC_API_INTEG_ALG_SHA1_96 IpsecIntegAlg = 2 + IPSEC_API_INTEG_ALG_SHA_256_96 IpsecIntegAlg = 3 + IPSEC_API_INTEG_ALG_SHA_256_128 IpsecIntegAlg = 4 + IPSEC_API_INTEG_ALG_SHA_384_192 IpsecIntegAlg = 5 + IPSEC_API_INTEG_ALG_SHA_512_256 IpsecIntegAlg = 6 +) + +var IpsecIntegAlg_name = map[uint32]string{ + 0: "IPSEC_API_INTEG_ALG_NONE", + 1: "IPSEC_API_INTEG_ALG_MD5_96", + 2: "IPSEC_API_INTEG_ALG_SHA1_96", + 3: "IPSEC_API_INTEG_ALG_SHA_256_96", + 4: "IPSEC_API_INTEG_ALG_SHA_256_128", + 5: "IPSEC_API_INTEG_ALG_SHA_384_192", + 6: "IPSEC_API_INTEG_ALG_SHA_512_256", +} + +var IpsecIntegAlg_value = map[string]uint32{ + "IPSEC_API_INTEG_ALG_NONE": 0, + "IPSEC_API_INTEG_ALG_MD5_96": 1, + "IPSEC_API_INTEG_ALG_SHA1_96": 2, + "IPSEC_API_INTEG_ALG_SHA_256_96": 3, + "IPSEC_API_INTEG_ALG_SHA_256_128": 4, + "IPSEC_API_INTEG_ALG_SHA_384_192": 5, + "IPSEC_API_INTEG_ALG_SHA_512_256": 6, +} + +func (x IpsecIntegAlg) String() string { + s, ok := IpsecIntegAlg_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecProto represents VPP binary API enum 'ipsec_proto'. +type IpsecProto uint32 + +const ( + IPSEC_API_PROTO_ESP IpsecProto = 1 + IPSEC_API_PROTO_AH IpsecProto = 2 +) + +var IpsecProto_name = map[uint32]string{ + 1: "IPSEC_API_PROTO_ESP", + 2: "IPSEC_API_PROTO_AH", +} + +var IpsecProto_value = map[string]uint32{ + "IPSEC_API_PROTO_ESP": 1, + "IPSEC_API_PROTO_AH": 2, +} + +func (x IpsecProto) String() string { + s, ok := IpsecProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecSadFlags represents VPP binary API enum 'ipsec_sad_flags'. +type IpsecSadFlags uint32 + +const ( + IPSEC_API_SAD_FLAG_NONE IpsecSadFlags = 0 + IPSEC_API_SAD_FLAG_USE_ESN IpsecSadFlags = 1 + IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY IpsecSadFlags = 2 + IPSEC_API_SAD_FLAG_IS_TUNNEL IpsecSadFlags = 4 + IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 IpsecSadFlags = 8 + IPSEC_API_SAD_FLAG_UDP_ENCAP IpsecSadFlags = 16 +) + +var IpsecSadFlags_name = map[uint32]string{ + 0: "IPSEC_API_SAD_FLAG_NONE", + 1: "IPSEC_API_SAD_FLAG_USE_ESN", + 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", + 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", + 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", + 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", +} + +var IpsecSadFlags_value = map[string]uint32{ + "IPSEC_API_SAD_FLAG_NONE": 0, + "IPSEC_API_SAD_FLAG_USE_ESN": 1, + "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY": 2, + "IPSEC_API_SAD_FLAG_IS_TUNNEL": 4, + "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6": 8, + "IPSEC_API_SAD_FLAG_UDP_ENCAP": 16, +} + +func (x IpsecSadFlags) String() string { + s, ok := IpsecSadFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IpsecSpdAction represents VPP binary API enum 'ipsec_spd_action'. +type IpsecSpdAction uint32 + +const ( + IPSEC_API_SPD_ACTION_BYPASS IpsecSpdAction = 0 + IPSEC_API_SPD_ACTION_DISCARD IpsecSpdAction = 1 + IPSEC_API_SPD_ACTION_RESOLVE IpsecSpdAction = 2 + IPSEC_API_SPD_ACTION_PROTECT IpsecSpdAction = 3 +) + +var IpsecSpdAction_name = map[uint32]string{ + 0: "IPSEC_API_SPD_ACTION_BYPASS", + 1: "IPSEC_API_SPD_ACTION_DISCARD", + 2: "IPSEC_API_SPD_ACTION_RESOLVE", + 3: "IPSEC_API_SPD_ACTION_PROTECT", +} + +var IpsecSpdAction_value = map[string]uint32{ + "IPSEC_API_SPD_ACTION_BYPASS": 0, + "IPSEC_API_SPD_ACTION_DISCARD": 1, + "IPSEC_API_SPD_ACTION_RESOLVE": 2, + "IPSEC_API_SPD_ACTION_PROTECT": 3, +} + +func (x IpsecSpdAction) String() string { + s, ok := IpsecSpdAction_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// IpsecSadEntry represents VPP binary API type 'ipsec_sad_entry'. +type IpsecSadEntry struct { + SadID uint32 + Spi uint32 + Protocol IpsecProto + CryptoAlgorithm IpsecCryptoAlg + CryptoKey Key + IntegrityAlgorithm IpsecIntegAlg + IntegrityKey Key + Flags IpsecSadFlags + TunnelSrc Address + TunnelDst Address + TxTableID uint32 + Salt uint32 +} + +func (*IpsecSadEntry) GetTypeName() string { + return "ipsec_sad_entry" +} + +// IpsecSpdEntry represents VPP binary API type 'ipsec_spd_entry'. +type IpsecSpdEntry struct { + SpdID uint32 + Priority int32 + IsOutbound uint8 + SaID uint32 + Policy IpsecSpdAction + Protocol uint8 + RemoteAddressStart Address + RemoteAddressStop Address + LocalAddressStart Address + LocalAddressStop Address + RemotePortStart uint16 + RemotePortStop uint16 + LocalPortStart uint16 + LocalPortStop uint16 +} + +func (*IpsecSpdEntry) GetTypeName() string { + return "ipsec_spd_entry" +} + +// IpsecTunnelProtect represents VPP binary API type 'ipsec_tunnel_protect'. +type IpsecTunnelProtect struct { + SwIfIndex InterfaceIndex + SaOut uint32 + NSaIn uint8 `struc:"sizeof=SaIn"` + SaIn []uint32 +} + +func (*IpsecTunnelProtect) GetTypeName() string { + return "ipsec_tunnel_protect" +} + +// Key represents VPP binary API type 'key'. +type Key struct { + Length uint8 + Data []byte `struc:"[128]byte"` +} + +func (*Key) GetTypeName() string { + return "key" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// IpsecBackendDetails represents VPP binary API message 'ipsec_backend_details'. +type IpsecBackendDetails struct { + Name []byte `struc:"[128]byte"` + Protocol IpsecProto + Index uint8 + Active uint8 +} + +func (*IpsecBackendDetails) GetMessageName() string { + return "ipsec_backend_details" +} +func (*IpsecBackendDetails) GetCrcString() string { + return "7700751c" +} +func (*IpsecBackendDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecBackendDump represents VPP binary API message 'ipsec_backend_dump'. +type IpsecBackendDump struct{} + +func (*IpsecBackendDump) GetMessageName() string { + return "ipsec_backend_dump" +} +func (*IpsecBackendDump) GetCrcString() string { + return "51077d14" +} +func (*IpsecBackendDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecInterfaceAddDelSpd represents VPP binary API message 'ipsec_interface_add_del_spd'. +type IpsecInterfaceAddDelSpd struct { + IsAdd uint8 + SwIfIndex uint32 + SpdID uint32 +} + +func (*IpsecInterfaceAddDelSpd) GetMessageName() string { + return "ipsec_interface_add_del_spd" +} +func (*IpsecInterfaceAddDelSpd) GetCrcString() string { + return "1e3b8286" +} +func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecInterfaceAddDelSpdReply represents VPP binary API message 'ipsec_interface_add_del_spd_reply'. +type IpsecInterfaceAddDelSpdReply struct { + Retval int32 +} + +func (*IpsecInterfaceAddDelSpdReply) GetMessageName() string { + return "ipsec_interface_add_del_spd_reply" +} +func (*IpsecInterfaceAddDelSpdReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSaDetails represents VPP binary API message 'ipsec_sa_details'. +type IpsecSaDetails struct { + Entry IpsecSadEntry + SwIfIndex uint32 + Salt uint32 + SeqOutbound uint64 + LastSeqInbound uint64 + ReplayWindow uint64 + TotalDataSize uint64 +} + +func (*IpsecSaDetails) GetMessageName() string { + return "ipsec_sa_details" +} +func (*IpsecSaDetails) GetCrcString() string { + return "9c8d829a" +} +func (*IpsecSaDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSaDump represents VPP binary API message 'ipsec_sa_dump'. +type IpsecSaDump struct { + SaID uint32 +} + +func (*IpsecSaDump) GetMessageName() string { + return "ipsec_sa_dump" +} +func (*IpsecSaDump) GetCrcString() string { + return "2076c2f4" +} +func (*IpsecSaDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSadEntryAddDel represents VPP binary API message 'ipsec_sad_entry_add_del'. +type IpsecSadEntryAddDel struct { + IsAdd uint8 + Entry IpsecSadEntry +} + +func (*IpsecSadEntryAddDel) GetMessageName() string { + return "ipsec_sad_entry_add_del" +} +func (*IpsecSadEntryAddDel) GetCrcString() string { + return "a25ab61e" +} +func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSadEntryAddDelReply represents VPP binary API message 'ipsec_sad_entry_add_del_reply'. +type IpsecSadEntryAddDelReply struct { + Retval int32 + StatIndex uint32 +} + +func (*IpsecSadEntryAddDelReply) GetMessageName() string { + return "ipsec_sad_entry_add_del_reply" +} +func (*IpsecSadEntryAddDelReply) GetCrcString() string { + return "9ffac24b" +} +func (*IpsecSadEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSelectBackend represents VPP binary API message 'ipsec_select_backend'. +type IpsecSelectBackend struct { + Protocol IpsecProto + Index uint8 +} + +func (*IpsecSelectBackend) GetMessageName() string { + return "ipsec_select_backend" +} +func (*IpsecSelectBackend) GetCrcString() string { + return "4fd24836" +} +func (*IpsecSelectBackend) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSelectBackendReply represents VPP binary API message 'ipsec_select_backend_reply'. +type IpsecSelectBackendReply struct { + Retval int32 +} + +func (*IpsecSelectBackendReply) GetMessageName() string { + return "ipsec_select_backend_reply" +} +func (*IpsecSelectBackendReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecSelectBackendReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdAddDel represents VPP binary API message 'ipsec_spd_add_del'. +type IpsecSpdAddDel struct { + IsAdd uint8 + SpdID uint32 +} + +func (*IpsecSpdAddDel) GetMessageName() string { + return "ipsec_spd_add_del" +} +func (*IpsecSpdAddDel) GetCrcString() string { + return "9ffdf5da" +} +func (*IpsecSpdAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSpdAddDelReply represents VPP binary API message 'ipsec_spd_add_del_reply'. +type IpsecSpdAddDelReply struct { + Retval int32 +} + +func (*IpsecSpdAddDelReply) GetMessageName() string { + return "ipsec_spd_add_del_reply" +} +func (*IpsecSpdAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdDetails represents VPP binary API message 'ipsec_spd_details'. +type IpsecSpdDetails struct { + Entry IpsecSpdEntry +} + +func (*IpsecSpdDetails) GetMessageName() string { + return "ipsec_spd_details" +} +func (*IpsecSpdDetails) GetCrcString() string { + return "06df7fb3" +} +func (*IpsecSpdDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdDump represents VPP binary API message 'ipsec_spd_dump'. +type IpsecSpdDump struct { + SpdID uint32 + SaID uint32 +} + +func (*IpsecSpdDump) GetMessageName() string { + return "ipsec_spd_dump" +} +func (*IpsecSpdDump) GetCrcString() string { + return "afefbf7d" +} +func (*IpsecSpdDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSpdEntryAddDel represents VPP binary API message 'ipsec_spd_entry_add_del'. +type IpsecSpdEntryAddDel struct { + IsAdd uint8 + Entry IpsecSpdEntry +} + +func (*IpsecSpdEntryAddDel) GetMessageName() string { + return "ipsec_spd_entry_add_del" +} +func (*IpsecSpdEntryAddDel) GetCrcString() string { + return "6bc6a3b5" +} +func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSpdEntryAddDelReply represents VPP binary API message 'ipsec_spd_entry_add_del_reply'. +type IpsecSpdEntryAddDelReply struct { + Retval int32 + StatIndex uint32 +} + +func (*IpsecSpdEntryAddDelReply) GetMessageName() string { + return "ipsec_spd_entry_add_del_reply" +} +func (*IpsecSpdEntryAddDelReply) GetCrcString() string { + return "9ffac24b" +} +func (*IpsecSpdEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdInterfaceDetails represents VPP binary API message 'ipsec_spd_interface_details'. +type IpsecSpdInterfaceDetails struct { + SpdIndex uint32 + SwIfIndex uint32 +} + +func (*IpsecSpdInterfaceDetails) GetMessageName() string { + return "ipsec_spd_interface_details" +} +func (*IpsecSpdInterfaceDetails) GetCrcString() string { + return "2c54296d" +} +func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdInterfaceDump represents VPP binary API message 'ipsec_spd_interface_dump'. +type IpsecSpdInterfaceDump struct { + SpdIndex uint32 + SpdIndexValid uint8 +} + +func (*IpsecSpdInterfaceDump) GetMessageName() string { + return "ipsec_spd_interface_dump" +} +func (*IpsecSpdInterfaceDump) GetCrcString() string { + return "8971de19" +} +func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecSpdsDetails represents VPP binary API message 'ipsec_spds_details'. +type IpsecSpdsDetails struct { + SpdID uint32 + Npolicies uint32 +} + +func (*IpsecSpdsDetails) GetMessageName() string { + return "ipsec_spds_details" +} +func (*IpsecSpdsDetails) GetCrcString() string { + return "a04bb254" +} +func (*IpsecSpdsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecSpdsDump represents VPP binary API message 'ipsec_spds_dump'. +type IpsecSpdsDump struct{} + +func (*IpsecSpdsDump) GetMessageName() string { + return "ipsec_spds_dump" +} +func (*IpsecSpdsDump) GetCrcString() string { + return "51077d14" +} +func (*IpsecSpdsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelIfAddDel represents VPP binary API message 'ipsec_tunnel_if_add_del'. +type IpsecTunnelIfAddDel struct { + IsAdd uint8 + Esn uint8 + AntiReplay uint8 + LocalIP Address + RemoteIP Address + LocalSpi uint32 + RemoteSpi uint32 + CryptoAlg uint8 + LocalCryptoKeyLen uint8 + LocalCryptoKey []byte `struc:"[128]byte"` + RemoteCryptoKeyLen uint8 + RemoteCryptoKey []byte `struc:"[128]byte"` + IntegAlg uint8 + LocalIntegKeyLen uint8 + LocalIntegKey []byte `struc:"[128]byte"` + RemoteIntegKeyLen uint8 + RemoteIntegKey []byte `struc:"[128]byte"` + Renumber uint8 + ShowInstance uint32 + UDPEncap uint8 + TxTableID uint32 + Salt uint32 +} + +func (*IpsecTunnelIfAddDel) GetMessageName() string { + return "ipsec_tunnel_if_add_del" +} +func (*IpsecTunnelIfAddDel) GetCrcString() string { + return "aa539b47" +} +func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelIfAddDelReply represents VPP binary API message 'ipsec_tunnel_if_add_del_reply'. +type IpsecTunnelIfAddDelReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*IpsecTunnelIfAddDelReply) GetMessageName() string { + return "ipsec_tunnel_if_add_del_reply" +} +func (*IpsecTunnelIfAddDelReply) GetCrcString() string { + return "fda5941f" +} +func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecTunnelIfSetSa represents VPP binary API message 'ipsec_tunnel_if_set_sa'. +type IpsecTunnelIfSetSa struct { + SwIfIndex uint32 + SaID uint32 + IsOutbound uint8 +} + +func (*IpsecTunnelIfSetSa) GetMessageName() string { + return "ipsec_tunnel_if_set_sa" +} +func (*IpsecTunnelIfSetSa) GetCrcString() string { + return "6ab567f2" +} +func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelIfSetSaReply represents VPP binary API message 'ipsec_tunnel_if_set_sa_reply'. +type IpsecTunnelIfSetSaReply struct { + Retval int32 +} + +func (*IpsecTunnelIfSetSaReply) GetMessageName() string { + return "ipsec_tunnel_if_set_sa_reply" +} +func (*IpsecTunnelIfSetSaReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecTunnelIfSetSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecTunnelProtectDel represents VPP binary API message 'ipsec_tunnel_protect_del'. +type IpsecTunnelProtectDel struct { + SwIfIndex InterfaceIndex +} + +func (*IpsecTunnelProtectDel) GetMessageName() string { + return "ipsec_tunnel_protect_del" +} +func (*IpsecTunnelProtectDel) GetCrcString() string { + return "d85aab0d" +} +func (*IpsecTunnelProtectDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelProtectDelReply represents VPP binary API message 'ipsec_tunnel_protect_del_reply'. +type IpsecTunnelProtectDelReply struct { + Retval int32 +} + +func (*IpsecTunnelProtectDelReply) GetMessageName() string { + return "ipsec_tunnel_protect_del_reply" +} +func (*IpsecTunnelProtectDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecTunnelProtectDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecTunnelProtectDetails represents VPP binary API message 'ipsec_tunnel_protect_details'. +type IpsecTunnelProtectDetails struct { + Tun IpsecTunnelProtect +} + +func (*IpsecTunnelProtectDetails) GetMessageName() string { + return "ipsec_tunnel_protect_details" +} +func (*IpsecTunnelProtectDetails) GetCrcString() string { + return "f724bc50" +} +func (*IpsecTunnelProtectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// IpsecTunnelProtectDump represents VPP binary API message 'ipsec_tunnel_protect_dump'. +type IpsecTunnelProtectDump struct { + SwIfIndex InterfaceIndex +} + +func (*IpsecTunnelProtectDump) GetMessageName() string { + return "ipsec_tunnel_protect_dump" +} +func (*IpsecTunnelProtectDump) GetCrcString() string { + return "d85aab0d" +} +func (*IpsecTunnelProtectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelProtectUpdate represents VPP binary API message 'ipsec_tunnel_protect_update'. +type IpsecTunnelProtectUpdate struct { + Tunnel IpsecTunnelProtect +} + +func (*IpsecTunnelProtectUpdate) GetMessageName() string { + return "ipsec_tunnel_protect_update" +} +func (*IpsecTunnelProtectUpdate) GetCrcString() string { + return "316dab99" +} +func (*IpsecTunnelProtectUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// IpsecTunnelProtectUpdateReply represents VPP binary API message 'ipsec_tunnel_protect_update_reply'. +type IpsecTunnelProtectUpdateReply struct { + Retval int32 +} + +func (*IpsecTunnelProtectUpdateReply) GetMessageName() string { + return "ipsec_tunnel_protect_update_reply" +} +func (*IpsecTunnelProtectUpdateReply) GetCrcString() string { + return "e8d4e804" +} +func (*IpsecTunnelProtectUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*IpsecBackendDetails)(nil), "ipsec.IpsecBackendDetails") + api.RegisterMessage((*IpsecBackendDump)(nil), "ipsec.IpsecBackendDump") + api.RegisterMessage((*IpsecInterfaceAddDelSpd)(nil), "ipsec.IpsecInterfaceAddDelSpd") + api.RegisterMessage((*IpsecInterfaceAddDelSpdReply)(nil), "ipsec.IpsecInterfaceAddDelSpdReply") + api.RegisterMessage((*IpsecSaDetails)(nil), "ipsec.IpsecSaDetails") + api.RegisterMessage((*IpsecSaDump)(nil), "ipsec.IpsecSaDump") + api.RegisterMessage((*IpsecSadEntryAddDel)(nil), "ipsec.IpsecSadEntryAddDel") + api.RegisterMessage((*IpsecSadEntryAddDelReply)(nil), "ipsec.IpsecSadEntryAddDelReply") + api.RegisterMessage((*IpsecSelectBackend)(nil), "ipsec.IpsecSelectBackend") + api.RegisterMessage((*IpsecSelectBackendReply)(nil), "ipsec.IpsecSelectBackendReply") + api.RegisterMessage((*IpsecSpdAddDel)(nil), "ipsec.IpsecSpdAddDel") + api.RegisterMessage((*IpsecSpdAddDelReply)(nil), "ipsec.IpsecSpdAddDelReply") + api.RegisterMessage((*IpsecSpdDetails)(nil), "ipsec.IpsecSpdDetails") + api.RegisterMessage((*IpsecSpdDump)(nil), "ipsec.IpsecSpdDump") + api.RegisterMessage((*IpsecSpdEntryAddDel)(nil), "ipsec.IpsecSpdEntryAddDel") + api.RegisterMessage((*IpsecSpdEntryAddDelReply)(nil), "ipsec.IpsecSpdEntryAddDelReply") + api.RegisterMessage((*IpsecSpdInterfaceDetails)(nil), "ipsec.IpsecSpdInterfaceDetails") + api.RegisterMessage((*IpsecSpdInterfaceDump)(nil), "ipsec.IpsecSpdInterfaceDump") + api.RegisterMessage((*IpsecSpdsDetails)(nil), "ipsec.IpsecSpdsDetails") + api.RegisterMessage((*IpsecSpdsDump)(nil), "ipsec.IpsecSpdsDump") + api.RegisterMessage((*IpsecTunnelIfAddDel)(nil), "ipsec.IpsecTunnelIfAddDel") + api.RegisterMessage((*IpsecTunnelIfAddDelReply)(nil), "ipsec.IpsecTunnelIfAddDelReply") + api.RegisterMessage((*IpsecTunnelIfSetSa)(nil), "ipsec.IpsecTunnelIfSetSa") + api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec.IpsecTunnelIfSetSaReply") + api.RegisterMessage((*IpsecTunnelProtectDel)(nil), "ipsec.IpsecTunnelProtectDel") + api.RegisterMessage((*IpsecTunnelProtectDelReply)(nil), "ipsec.IpsecTunnelProtectDelReply") + api.RegisterMessage((*IpsecTunnelProtectDetails)(nil), "ipsec.IpsecTunnelProtectDetails") + api.RegisterMessage((*IpsecTunnelProtectDump)(nil), "ipsec.IpsecTunnelProtectDump") + api.RegisterMessage((*IpsecTunnelProtectUpdate)(nil), "ipsec.IpsecTunnelProtectUpdate") + api.RegisterMessage((*IpsecTunnelProtectUpdateReply)(nil), "ipsec.IpsecTunnelProtectUpdateReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IpsecBackendDetails)(nil), + (*IpsecBackendDump)(nil), + (*IpsecInterfaceAddDelSpd)(nil), + (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecSaDetails)(nil), + (*IpsecSaDump)(nil), + (*IpsecSadEntryAddDel)(nil), + (*IpsecSadEntryAddDelReply)(nil), + (*IpsecSelectBackend)(nil), + (*IpsecSelectBackendReply)(nil), + (*IpsecSpdAddDel)(nil), + (*IpsecSpdAddDelReply)(nil), + (*IpsecSpdDetails)(nil), + (*IpsecSpdDump)(nil), + (*IpsecSpdEntryAddDel)(nil), + (*IpsecSpdEntryAddDelReply)(nil), + (*IpsecSpdInterfaceDetails)(nil), + (*IpsecSpdInterfaceDump)(nil), + (*IpsecSpdsDetails)(nil), + (*IpsecSpdsDump)(nil), + (*IpsecTunnelIfAddDel)(nil), + (*IpsecTunnelIfAddDelReply)(nil), + (*IpsecTunnelIfSetSa)(nil), + (*IpsecTunnelIfSetSaReply)(nil), + (*IpsecTunnelProtectDel)(nil), + (*IpsecTunnelProtectDelReply)(nil), + (*IpsecTunnelProtectDetails)(nil), + (*IpsecTunnelProtectDump)(nil), + (*IpsecTunnelProtectUpdate)(nil), + (*IpsecTunnelProtectUpdateReply)(nil), + } +} + +// RPCService represents RPC service API for ipsec module. +type RPCService interface { + DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) + DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) + DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) + DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) + DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) + DumpIpsecTunnelProtect(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_DumpIpsecTunnelProtectClient, error) + IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) + IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) + IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) + IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) + IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) + IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) + IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIpsecBackend(ctx context.Context, in *IpsecBackendDump) (RPCService_DumpIpsecBackendClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecBackendClient{stream} + return x, nil +} + +type RPCService_DumpIpsecBackendClient interface { + Recv() (*IpsecBackendDetails, error) +} + +type serviceClient_DumpIpsecBackendClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecBackendClient) Recv() (*IpsecBackendDetails, error) { + m := new(IpsecBackendDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSa(ctx context.Context, in *IpsecSaDump) (RPCService_DumpIpsecSaClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSaClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSaClient interface { + Recv() (*IpsecSaDetails, error) +} + +type serviceClient_DumpIpsecSaClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSaClient) Recv() (*IpsecSaDetails, error) { + m := new(IpsecSaDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpd(ctx context.Context, in *IpsecSpdDump) (RPCService_DumpIpsecSpdClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdClient interface { + Recv() (*IpsecSpdDetails, error) +} + +type serviceClient_DumpIpsecSpdClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdClient) Recv() (*IpsecSpdDetails, error) { + m := new(IpsecSpdDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpdInterface(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_DumpIpsecSpdInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdInterfaceClient interface { + Recv() (*IpsecSpdInterfaceDetails, error) +} + +type serviceClient_DumpIpsecSpdInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdInterfaceClient) Recv() (*IpsecSpdInterfaceDetails, error) { + m := new(IpsecSpdInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecSpds(ctx context.Context, in *IpsecSpdsDump) (RPCService_DumpIpsecSpdsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecSpdsClient{stream} + return x, nil +} + +type RPCService_DumpIpsecSpdsClient interface { + Recv() (*IpsecSpdsDetails, error) +} + +type serviceClient_DumpIpsecSpdsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecSpdsClient) Recv() (*IpsecSpdsDetails, error) { + m := new(IpsecSpdsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIpsecTunnelProtect(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_DumpIpsecTunnelProtectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIpsecTunnelProtectClient{stream} + return x, nil +} + +type RPCService_DumpIpsecTunnelProtectClient interface { + Recv() (*IpsecTunnelProtectDetails, error) +} + +type serviceClient_DumpIpsecTunnelProtectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIpsecTunnelProtectClient) Recv() (*IpsecTunnelProtectDetails, error) { + m := new(IpsecTunnelProtectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) { + out := new(IpsecInterfaceAddDelSpdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) { + out := new(IpsecSadEntryAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { + out := new(IpsecSelectBackendReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { + out := new(IpsecSpdAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) { + out := new(IpsecSpdEntryAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { + out := new(IpsecTunnelIfAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { + out := new(IpsecTunnelIfSetSaReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) { + out := new(IpsecTunnelProtectDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) { + out := new(IpsecTunnelProtectUpdateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/l2/l2.ba.go b/plugins/vpp/binapi/vpp1908/l2/l2.ba.go new file mode 100644 index 0000000000..33a83a21a1 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/l2/l2.ba.go @@ -0,0 +1,1731 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/l2.api.json + +/* +Package l2 is a generated VPP binary API for 'l2' module. + +It consists of: + 6 enums + 3 aliases + 9 types + 1 union + 51 messages + 25 services +*/ +package l2 + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "l2" + // APIVersion is the API version of this module. + APIVersion = "2.2.2" + // VersionCrc is the CRC of this module. + VersionCrc = 0x532950d2 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// BdFlags represents VPP binary API enum 'bd_flags'. +type BdFlags uint32 + +const ( + BRIDGE_API_FLAG_NONE BdFlags = 0 + BRIDGE_API_FLAG_LEARN BdFlags = 1 + BRIDGE_API_FLAG_FWD BdFlags = 2 + BRIDGE_API_FLAG_FLOOD BdFlags = 4 + BRIDGE_API_FLAG_UU_FLOOD BdFlags = 8 + BRIDGE_API_FLAG_ARP_TERM BdFlags = 16 + BRIDGE_API_FLAG_ARP_UFWD BdFlags = 32 +) + +var BdFlags_name = map[uint32]string{ + 0: "BRIDGE_API_FLAG_NONE", + 1: "BRIDGE_API_FLAG_LEARN", + 2: "BRIDGE_API_FLAG_FWD", + 4: "BRIDGE_API_FLAG_FLOOD", + 8: "BRIDGE_API_FLAG_UU_FLOOD", + 16: "BRIDGE_API_FLAG_ARP_TERM", + 32: "BRIDGE_API_FLAG_ARP_UFWD", +} + +var BdFlags_value = map[string]uint32{ + "BRIDGE_API_FLAG_NONE": 0, + "BRIDGE_API_FLAG_LEARN": 1, + "BRIDGE_API_FLAG_FWD": 2, + "BRIDGE_API_FLAG_FLOOD": 4, + "BRIDGE_API_FLAG_UU_FLOOD": 8, + "BRIDGE_API_FLAG_ARP_TERM": 16, + "BRIDGE_API_FLAG_ARP_UFWD": 32, +} + +func (x BdFlags) String() string { + s, ok := BdFlags_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// L2PortType represents VPP binary API enum 'l2_port_type'. +type L2PortType uint32 + +const ( + L2_API_PORT_TYPE_NORMAL L2PortType = 0 + L2_API_PORT_TYPE_BVI L2PortType = 1 + L2_API_PORT_TYPE_UU_FWD L2PortType = 2 +) + +var L2PortType_name = map[uint32]string{ + 0: "L2_API_PORT_TYPE_NORMAL", + 1: "L2_API_PORT_TYPE_BVI", + 2: "L2_API_PORT_TYPE_UU_FWD", +} + +var L2PortType_value = map[string]uint32{ + "L2_API_PORT_TYPE_NORMAL": 0, + "L2_API_PORT_TYPE_BVI": 1, + "L2_API_PORT_TYPE_UU_FWD": 2, +} + +func (x L2PortType) String() string { + s, ok := L2PortType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// BdIPMac represents VPP binary API type 'bd_ip_mac'. +type BdIPMac struct { + BdID uint32 + IP Address + Mac MacAddress +} + +func (*BdIPMac) GetTypeName() string { + return "bd_ip_mac" +} + +// BridgeDomainSwIf represents VPP binary API type 'bridge_domain_sw_if'. +type BridgeDomainSwIf struct { + Context uint32 + SwIfIndex uint32 + Shg uint8 +} + +func (*BridgeDomainSwIf) GetTypeName() string { + return "bridge_domain_sw_if" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// MacEntry represents VPP binary API type 'mac_entry'. +type MacEntry struct { + SwIfIndex uint32 + MacAddr []byte `struc:"[6]byte"` + Action uint8 + Flags uint8 +} + +func (*MacEntry) GetTypeName() string { + return "mac_entry" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// BdIPMacAddDel represents VPP binary API message 'bd_ip_mac_add_del'. +type BdIPMacAddDel struct { + IsAdd uint8 + Entry BdIPMac +} + +func (*BdIPMacAddDel) GetMessageName() string { + return "bd_ip_mac_add_del" +} +func (*BdIPMacAddDel) GetCrcString() string { + return "97367ad1" +} +func (*BdIPMacAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BdIPMacAddDelReply represents VPP binary API message 'bd_ip_mac_add_del_reply'. +type BdIPMacAddDelReply struct { + Retval int32 +} + +func (*BdIPMacAddDelReply) GetMessageName() string { + return "bd_ip_mac_add_del_reply" +} +func (*BdIPMacAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*BdIPMacAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BdIPMacDetails represents VPP binary API message 'bd_ip_mac_details'. +type BdIPMacDetails struct { + Entry BdIPMac +} + +func (*BdIPMacDetails) GetMessageName() string { + return "bd_ip_mac_details" +} +func (*BdIPMacDetails) GetCrcString() string { + return "3f1eb886" +} +func (*BdIPMacDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BdIPMacDump represents VPP binary API message 'bd_ip_mac_dump'. +type BdIPMacDump struct { + BdID uint32 +} + +func (*BdIPMacDump) GetMessageName() string { + return "bd_ip_mac_dump" +} +func (*BdIPMacDump) GetCrcString() string { + return "c25fdce6" +} +func (*BdIPMacDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BdIPMacFlush represents VPP binary API message 'bd_ip_mac_flush'. +type BdIPMacFlush struct { + BdID uint32 +} + +func (*BdIPMacFlush) GetMessageName() string { + return "bd_ip_mac_flush" +} +func (*BdIPMacFlush) GetCrcString() string { + return "c25fdce6" +} +func (*BdIPMacFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BdIPMacFlushReply represents VPP binary API message 'bd_ip_mac_flush_reply'. +type BdIPMacFlushReply struct { + Retval int32 +} + +func (*BdIPMacFlushReply) GetMessageName() string { + return "bd_ip_mac_flush_reply" +} +func (*BdIPMacFlushReply) GetCrcString() string { + return "e8d4e804" +} +func (*BdIPMacFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BridgeDomainAddDel represents VPP binary API message 'bridge_domain_add_del'. +type BridgeDomainAddDel struct { + BdID uint32 + Flood uint8 + UuFlood uint8 + Forward uint8 + Learn uint8 + ArpTerm uint8 + ArpUfwd uint8 + MacAge uint8 + BdTag []byte `struc:"[64]byte"` + IsAdd uint8 +} + +func (*BridgeDomainAddDel) GetMessageName() string { + return "bridge_domain_add_del" +} +func (*BridgeDomainAddDel) GetCrcString() string { + return "c6360720" +} +func (*BridgeDomainAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BridgeDomainAddDelReply represents VPP binary API message 'bridge_domain_add_del_reply'. +type BridgeDomainAddDelReply struct { + Retval int32 +} + +func (*BridgeDomainAddDelReply) GetMessageName() string { + return "bridge_domain_add_del_reply" +} +func (*BridgeDomainAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*BridgeDomainAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BridgeDomainDetails represents VPP binary API message 'bridge_domain_details'. +type BridgeDomainDetails struct { + BdID uint32 + Flood uint8 + UuFlood uint8 + Forward uint8 + Learn uint8 + ArpTerm uint8 + ArpUfwd uint8 + MacAge uint8 + BdTag []byte `struc:"[64]byte"` + BviSwIfIndex uint32 + UuFwdSwIfIndex uint32 + NSwIfs uint32 `struc:"sizeof=SwIfDetails"` + SwIfDetails []BridgeDomainSwIf +} + +func (*BridgeDomainDetails) GetMessageName() string { + return "bridge_domain_details" +} +func (*BridgeDomainDetails) GetCrcString() string { + return "748c854a" +} +func (*BridgeDomainDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BridgeDomainDump represents VPP binary API message 'bridge_domain_dump'. +type BridgeDomainDump struct { + BdID uint32 +} + +func (*BridgeDomainDump) GetMessageName() string { + return "bridge_domain_dump" +} +func (*BridgeDomainDump) GetCrcString() string { + return "c25fdce6" +} +func (*BridgeDomainDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BridgeDomainSetMacAge represents VPP binary API message 'bridge_domain_set_mac_age'. +type BridgeDomainSetMacAge struct { + BdID uint32 + MacAge uint8 +} + +func (*BridgeDomainSetMacAge) GetMessageName() string { + return "bridge_domain_set_mac_age" +} +func (*BridgeDomainSetMacAge) GetCrcString() string { + return "b537ad7b" +} +func (*BridgeDomainSetMacAge) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BridgeDomainSetMacAgeReply represents VPP binary API message 'bridge_domain_set_mac_age_reply'. +type BridgeDomainSetMacAgeReply struct { + Retval int32 +} + +func (*BridgeDomainSetMacAgeReply) GetMessageName() string { + return "bridge_domain_set_mac_age_reply" +} +func (*BridgeDomainSetMacAgeReply) GetCrcString() string { + return "e8d4e804" +} +func (*BridgeDomainSetMacAgeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BridgeFlags represents VPP binary API message 'bridge_flags'. +type BridgeFlags struct { + BdID uint32 + IsSet uint8 + Flags BdFlags +} + +func (*BridgeFlags) GetMessageName() string { + return "bridge_flags" +} +func (*BridgeFlags) GetCrcString() string { + return "2eb9b76c" +} +func (*BridgeFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BridgeFlagsReply represents VPP binary API message 'bridge_flags_reply'. +type BridgeFlagsReply struct { + Retval int32 + ResultingFeatureBitmap uint32 +} + +func (*BridgeFlagsReply) GetMessageName() string { + return "bridge_flags_reply" +} +func (*BridgeFlagsReply) GetCrcString() string { + return "29b2a2b3" +} +func (*BridgeFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BviCreate represents VPP binary API message 'bvi_create'. +type BviCreate struct { + Mac MacAddress + UserInstance uint32 +} + +func (*BviCreate) GetMessageName() string { + return "bvi_create" +} +func (*BviCreate) GetCrcString() string { + return "27a79e9e" +} +func (*BviCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BviCreateReply represents VPP binary API message 'bvi_create_reply'. +type BviCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*BviCreateReply) GetMessageName() string { + return "bvi_create_reply" +} +func (*BviCreateReply) GetCrcString() string { + return "fda5941f" +} +func (*BviCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BviDelete represents VPP binary API message 'bvi_delete'. +type BviDelete struct { + SwIfIndex uint32 +} + +func (*BviDelete) GetMessageName() string { + return "bvi_delete" +} +func (*BviDelete) GetCrcString() string { + return "529cb13f" +} +func (*BviDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BviDeleteReply represents VPP binary API message 'bvi_delete_reply'. +type BviDeleteReply struct { + Retval int32 +} + +func (*BviDeleteReply) GetMessageName() string { + return "bvi_delete_reply" +} +func (*BviDeleteReply) GetCrcString() string { + return "e8d4e804" +} +func (*BviDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2FibClearTable represents VPP binary API message 'l2_fib_clear_table'. +type L2FibClearTable struct{} + +func (*L2FibClearTable) GetMessageName() string { + return "l2_fib_clear_table" +} +func (*L2FibClearTable) GetCrcString() string { + return "51077d14" +} +func (*L2FibClearTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2FibClearTableReply represents VPP binary API message 'l2_fib_clear_table_reply'. +type L2FibClearTableReply struct { + Retval int32 +} + +func (*L2FibClearTableReply) GetMessageName() string { + return "l2_fib_clear_table_reply" +} +func (*L2FibClearTableReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2FibClearTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2FibTableDetails represents VPP binary API message 'l2_fib_table_details'. +type L2FibTableDetails struct { + BdID uint32 + Mac []byte `struc:"[6]byte"` + SwIfIndex uint32 + StaticMac uint8 + FilterMac uint8 + BviMac uint8 +} + +func (*L2FibTableDetails) GetMessageName() string { + return "l2_fib_table_details" +} +func (*L2FibTableDetails) GetCrcString() string { + return "c7392706" +} +func (*L2FibTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2FibTableDump represents VPP binary API message 'l2_fib_table_dump'. +type L2FibTableDump struct { + BdID uint32 +} + +func (*L2FibTableDump) GetMessageName() string { + return "l2_fib_table_dump" +} +func (*L2FibTableDump) GetCrcString() string { + return "c25fdce6" +} +func (*L2FibTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2Flags represents VPP binary API message 'l2_flags'. +type L2Flags struct { + SwIfIndex uint32 + IsSet uint8 + FeatureBitmap uint32 +} + +func (*L2Flags) GetMessageName() string { + return "l2_flags" +} +func (*L2Flags) GetCrcString() string { + return "0e889fb9" +} +func (*L2Flags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2FlagsReply represents VPP binary API message 'l2_flags_reply'. +type L2FlagsReply struct { + Retval int32 + ResultingFeatureBitmap uint32 +} + +func (*L2FlagsReply) GetMessageName() string { + return "l2_flags_reply" +} +func (*L2FlagsReply) GetCrcString() string { + return "29b2a2b3" +} +func (*L2FlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2InterfaceEfpFilter represents VPP binary API message 'l2_interface_efp_filter'. +type L2InterfaceEfpFilter struct { + SwIfIndex uint32 + EnableDisable uint8 +} + +func (*L2InterfaceEfpFilter) GetMessageName() string { + return "l2_interface_efp_filter" +} +func (*L2InterfaceEfpFilter) GetCrcString() string { + return "69d24598" +} +func (*L2InterfaceEfpFilter) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2InterfaceEfpFilterReply represents VPP binary API message 'l2_interface_efp_filter_reply'. +type L2InterfaceEfpFilterReply struct { + Retval int32 +} + +func (*L2InterfaceEfpFilterReply) GetMessageName() string { + return "l2_interface_efp_filter_reply" +} +func (*L2InterfaceEfpFilterReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2InterfaceEfpFilterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2InterfacePbbTagRewrite represents VPP binary API message 'l2_interface_pbb_tag_rewrite'. +type L2InterfacePbbTagRewrite struct { + SwIfIndex uint32 + VtrOp uint32 + OuterTag uint16 + BDmac []byte `struc:"[6]byte"` + BSmac []byte `struc:"[6]byte"` + BVlanid uint16 + ISid uint32 +} + +func (*L2InterfacePbbTagRewrite) GetMessageName() string { + return "l2_interface_pbb_tag_rewrite" +} +func (*L2InterfacePbbTagRewrite) GetCrcString() string { + return "6cf815f9" +} +func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2InterfacePbbTagRewriteReply represents VPP binary API message 'l2_interface_pbb_tag_rewrite_reply'. +type L2InterfacePbbTagRewriteReply struct { + Retval int32 +} + +func (*L2InterfacePbbTagRewriteReply) GetMessageName() string { + return "l2_interface_pbb_tag_rewrite_reply" +} +func (*L2InterfacePbbTagRewriteReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2InterfacePbbTagRewriteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2InterfaceVlanTagRewrite represents VPP binary API message 'l2_interface_vlan_tag_rewrite'. +type L2InterfaceVlanTagRewrite struct { + SwIfIndex uint32 + VtrOp uint32 + PushDot1q uint32 + Tag1 uint32 + Tag2 uint32 +} + +func (*L2InterfaceVlanTagRewrite) GetMessageName() string { + return "l2_interface_vlan_tag_rewrite" +} +func (*L2InterfaceVlanTagRewrite) GetCrcString() string { + return "b90be6b4" +} +func (*L2InterfaceVlanTagRewrite) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2InterfaceVlanTagRewriteReply represents VPP binary API message 'l2_interface_vlan_tag_rewrite_reply'. +type L2InterfaceVlanTagRewriteReply struct { + Retval int32 +} + +func (*L2InterfaceVlanTagRewriteReply) GetMessageName() string { + return "l2_interface_vlan_tag_rewrite_reply" +} +func (*L2InterfaceVlanTagRewriteReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2InterfaceVlanTagRewriteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2MacsEvent represents VPP binary API message 'l2_macs_event'. +type L2MacsEvent struct { + PID uint32 + NMacs uint32 `struc:"sizeof=Mac"` + Mac []MacEntry +} + +func (*L2MacsEvent) GetMessageName() string { + return "l2_macs_event" +} +func (*L2MacsEvent) GetCrcString() string { + return "afc74a60" +} +func (*L2MacsEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// L2PatchAddDel represents VPP binary API message 'l2_patch_add_del'. +type L2PatchAddDel struct { + RxSwIfIndex uint32 + TxSwIfIndex uint32 + IsAdd uint8 +} + +func (*L2PatchAddDel) GetMessageName() string { + return "l2_patch_add_del" +} +func (*L2PatchAddDel) GetCrcString() string { + return "62506e63" +} +func (*L2PatchAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2PatchAddDelReply represents VPP binary API message 'l2_patch_add_del_reply'. +type L2PatchAddDelReply struct { + Retval int32 +} + +func (*L2PatchAddDelReply) GetMessageName() string { + return "l2_patch_add_del_reply" +} +func (*L2PatchAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2PatchAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2XconnectDetails represents VPP binary API message 'l2_xconnect_details'. +type L2XconnectDetails struct { + RxSwIfIndex uint32 + TxSwIfIndex uint32 +} + +func (*L2XconnectDetails) GetMessageName() string { + return "l2_xconnect_details" +} +func (*L2XconnectDetails) GetCrcString() string { + return "722e2378" +} +func (*L2XconnectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2XconnectDump represents VPP binary API message 'l2_xconnect_dump'. +type L2XconnectDump struct{} + +func (*L2XconnectDump) GetMessageName() string { + return "l2_xconnect_dump" +} +func (*L2XconnectDump) GetCrcString() string { + return "51077d14" +} +func (*L2XconnectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2fibAddDel represents VPP binary API message 'l2fib_add_del'. +type L2fibAddDel struct { + Mac []byte `struc:"[6]byte"` + BdID uint32 + SwIfIndex uint32 + IsAdd uint8 + StaticMac uint8 + FilterMac uint8 + BviMac uint8 +} + +func (*L2fibAddDel) GetMessageName() string { + return "l2fib_add_del" +} +func (*L2fibAddDel) GetCrcString() string { + return "34ced3eb" +} +func (*L2fibAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2fibAddDelReply represents VPP binary API message 'l2fib_add_del_reply'. +type L2fibAddDelReply struct { + Retval int32 +} + +func (*L2fibAddDelReply) GetMessageName() string { + return "l2fib_add_del_reply" +} +func (*L2fibAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2fibAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2fibFlushAll represents VPP binary API message 'l2fib_flush_all'. +type L2fibFlushAll struct{} + +func (*L2fibFlushAll) GetMessageName() string { + return "l2fib_flush_all" +} +func (*L2fibFlushAll) GetCrcString() string { + return "51077d14" +} +func (*L2fibFlushAll) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2fibFlushAllReply represents VPP binary API message 'l2fib_flush_all_reply'. +type L2fibFlushAllReply struct { + Retval int32 +} + +func (*L2fibFlushAllReply) GetMessageName() string { + return "l2fib_flush_all_reply" +} +func (*L2fibFlushAllReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2fibFlushAllReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2fibFlushBd represents VPP binary API message 'l2fib_flush_bd'. +type L2fibFlushBd struct { + BdID uint32 +} + +func (*L2fibFlushBd) GetMessageName() string { + return "l2fib_flush_bd" +} +func (*L2fibFlushBd) GetCrcString() string { + return "c25fdce6" +} +func (*L2fibFlushBd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2fibFlushBdReply represents VPP binary API message 'l2fib_flush_bd_reply'. +type L2fibFlushBdReply struct { + Retval int32 +} + +func (*L2fibFlushBdReply) GetMessageName() string { + return "l2fib_flush_bd_reply" +} +func (*L2fibFlushBdReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2fibFlushBdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// L2fibFlushInt represents VPP binary API message 'l2fib_flush_int'. +type L2fibFlushInt struct { + SwIfIndex uint32 +} + +func (*L2fibFlushInt) GetMessageName() string { + return "l2fib_flush_int" +} +func (*L2fibFlushInt) GetCrcString() string { + return "529cb13f" +} +func (*L2fibFlushInt) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// L2fibFlushIntReply represents VPP binary API message 'l2fib_flush_int_reply'. +type L2fibFlushIntReply struct { + Retval int32 +} + +func (*L2fibFlushIntReply) GetMessageName() string { + return "l2fib_flush_int_reply" +} +func (*L2fibFlushIntReply) GetCrcString() string { + return "e8d4e804" +} +func (*L2fibFlushIntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetL2Bridge represents VPP binary API message 'sw_interface_set_l2_bridge'. +type SwInterfaceSetL2Bridge struct { + RxSwIfIndex uint32 + BdID uint32 + PortType L2PortType + Shg uint8 + Enable uint8 +} + +func (*SwInterfaceSetL2Bridge) GetMessageName() string { + return "sw_interface_set_l2_bridge" +} +func (*SwInterfaceSetL2Bridge) GetCrcString() string { + return "5579f809" +} +func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetL2BridgeReply represents VPP binary API message 'sw_interface_set_l2_bridge_reply'. +type SwInterfaceSetL2BridgeReply struct { + Retval int32 +} + +func (*SwInterfaceSetL2BridgeReply) GetMessageName() string { + return "sw_interface_set_l2_bridge_reply" +} +func (*SwInterfaceSetL2BridgeReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetL2BridgeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetL2Xconnect represents VPP binary API message 'sw_interface_set_l2_xconnect'. +type SwInterfaceSetL2Xconnect struct { + RxSwIfIndex uint32 + TxSwIfIndex uint32 + Enable uint8 +} + +func (*SwInterfaceSetL2Xconnect) GetMessageName() string { + return "sw_interface_set_l2_xconnect" +} +func (*SwInterfaceSetL2Xconnect) GetCrcString() string { + return "95de3988" +} +func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetL2XconnectReply represents VPP binary API message 'sw_interface_set_l2_xconnect_reply'. +type SwInterfaceSetL2XconnectReply struct { + Retval int32 +} + +func (*SwInterfaceSetL2XconnectReply) GetMessageName() string { + return "sw_interface_set_l2_xconnect_reply" +} +func (*SwInterfaceSetL2XconnectReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetL2XconnectReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceSetVpath represents VPP binary API message 'sw_interface_set_vpath'. +type SwInterfaceSetVpath struct { + SwIfIndex uint32 + Enable uint8 +} + +func (*SwInterfaceSetVpath) GetMessageName() string { + return "sw_interface_set_vpath" +} +func (*SwInterfaceSetVpath) GetCrcString() string { + return "a36fadc0" +} +func (*SwInterfaceSetVpath) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetVpathReply represents VPP binary API message 'sw_interface_set_vpath_reply'. +type SwInterfaceSetVpathReply struct { + Retval int32 +} + +func (*SwInterfaceSetVpathReply) GetMessageName() string { + return "sw_interface_set_vpath_reply" +} +func (*SwInterfaceSetVpathReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetVpathReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// WantL2MacsEvents represents VPP binary API message 'want_l2_macs_events'. +type WantL2MacsEvents struct { + LearnLimit uint32 + ScanDelay uint8 + MaxMacsInEvent uint8 + EnableDisable uint8 + PID uint32 +} + +func (*WantL2MacsEvents) GetMessageName() string { + return "want_l2_macs_events" +} +func (*WantL2MacsEvents) GetCrcString() string { + return "94e63394" +} +func (*WantL2MacsEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// WantL2MacsEventsReply represents VPP binary API message 'want_l2_macs_events_reply'. +type WantL2MacsEventsReply struct { + Retval int32 +} + +func (*WantL2MacsEventsReply) GetMessageName() string { + return "want_l2_macs_events_reply" +} +func (*WantL2MacsEventsReply) GetCrcString() string { + return "e8d4e804" +} +func (*WantL2MacsEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*BdIPMacAddDel)(nil), "l2.BdIPMacAddDel") + api.RegisterMessage((*BdIPMacAddDelReply)(nil), "l2.BdIPMacAddDelReply") + api.RegisterMessage((*BdIPMacDetails)(nil), "l2.BdIPMacDetails") + api.RegisterMessage((*BdIPMacDump)(nil), "l2.BdIPMacDump") + api.RegisterMessage((*BdIPMacFlush)(nil), "l2.BdIPMacFlush") + api.RegisterMessage((*BdIPMacFlushReply)(nil), "l2.BdIPMacFlushReply") + api.RegisterMessage((*BridgeDomainAddDel)(nil), "l2.BridgeDomainAddDel") + api.RegisterMessage((*BridgeDomainAddDelReply)(nil), "l2.BridgeDomainAddDelReply") + api.RegisterMessage((*BridgeDomainDetails)(nil), "l2.BridgeDomainDetails") + api.RegisterMessage((*BridgeDomainDump)(nil), "l2.BridgeDomainDump") + api.RegisterMessage((*BridgeDomainSetMacAge)(nil), "l2.BridgeDomainSetMacAge") + api.RegisterMessage((*BridgeDomainSetMacAgeReply)(nil), "l2.BridgeDomainSetMacAgeReply") + api.RegisterMessage((*BridgeFlags)(nil), "l2.BridgeFlags") + api.RegisterMessage((*BridgeFlagsReply)(nil), "l2.BridgeFlagsReply") + api.RegisterMessage((*BviCreate)(nil), "l2.BviCreate") + api.RegisterMessage((*BviCreateReply)(nil), "l2.BviCreateReply") + api.RegisterMessage((*BviDelete)(nil), "l2.BviDelete") + api.RegisterMessage((*BviDeleteReply)(nil), "l2.BviDeleteReply") + api.RegisterMessage((*L2FibClearTable)(nil), "l2.L2FibClearTable") + api.RegisterMessage((*L2FibClearTableReply)(nil), "l2.L2FibClearTableReply") + api.RegisterMessage((*L2FibTableDetails)(nil), "l2.L2FibTableDetails") + api.RegisterMessage((*L2FibTableDump)(nil), "l2.L2FibTableDump") + api.RegisterMessage((*L2Flags)(nil), "l2.L2Flags") + api.RegisterMessage((*L2FlagsReply)(nil), "l2.L2FlagsReply") + api.RegisterMessage((*L2InterfaceEfpFilter)(nil), "l2.L2InterfaceEfpFilter") + api.RegisterMessage((*L2InterfaceEfpFilterReply)(nil), "l2.L2InterfaceEfpFilterReply") + api.RegisterMessage((*L2InterfacePbbTagRewrite)(nil), "l2.L2InterfacePbbTagRewrite") + api.RegisterMessage((*L2InterfacePbbTagRewriteReply)(nil), "l2.L2InterfacePbbTagRewriteReply") + api.RegisterMessage((*L2InterfaceVlanTagRewrite)(nil), "l2.L2InterfaceVlanTagRewrite") + api.RegisterMessage((*L2InterfaceVlanTagRewriteReply)(nil), "l2.L2InterfaceVlanTagRewriteReply") + api.RegisterMessage((*L2MacsEvent)(nil), "l2.L2MacsEvent") + api.RegisterMessage((*L2PatchAddDel)(nil), "l2.L2PatchAddDel") + api.RegisterMessage((*L2PatchAddDelReply)(nil), "l2.L2PatchAddDelReply") + api.RegisterMessage((*L2XconnectDetails)(nil), "l2.L2XconnectDetails") + api.RegisterMessage((*L2XconnectDump)(nil), "l2.L2XconnectDump") + api.RegisterMessage((*L2fibAddDel)(nil), "l2.L2fibAddDel") + api.RegisterMessage((*L2fibAddDelReply)(nil), "l2.L2fibAddDelReply") + api.RegisterMessage((*L2fibFlushAll)(nil), "l2.L2fibFlushAll") + api.RegisterMessage((*L2fibFlushAllReply)(nil), "l2.L2fibFlushAllReply") + api.RegisterMessage((*L2fibFlushBd)(nil), "l2.L2fibFlushBd") + api.RegisterMessage((*L2fibFlushBdReply)(nil), "l2.L2fibFlushBdReply") + api.RegisterMessage((*L2fibFlushInt)(nil), "l2.L2fibFlushInt") + api.RegisterMessage((*L2fibFlushIntReply)(nil), "l2.L2fibFlushIntReply") + api.RegisterMessage((*SwInterfaceSetL2Bridge)(nil), "l2.SwInterfaceSetL2Bridge") + api.RegisterMessage((*SwInterfaceSetL2BridgeReply)(nil), "l2.SwInterfaceSetL2BridgeReply") + api.RegisterMessage((*SwInterfaceSetL2Xconnect)(nil), "l2.SwInterfaceSetL2Xconnect") + api.RegisterMessage((*SwInterfaceSetL2XconnectReply)(nil), "l2.SwInterfaceSetL2XconnectReply") + api.RegisterMessage((*SwInterfaceSetVpath)(nil), "l2.SwInterfaceSetVpath") + api.RegisterMessage((*SwInterfaceSetVpathReply)(nil), "l2.SwInterfaceSetVpathReply") + api.RegisterMessage((*WantL2MacsEvents)(nil), "l2.WantL2MacsEvents") + api.RegisterMessage((*WantL2MacsEventsReply)(nil), "l2.WantL2MacsEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BdIPMacAddDel)(nil), + (*BdIPMacAddDelReply)(nil), + (*BdIPMacDetails)(nil), + (*BdIPMacDump)(nil), + (*BdIPMacFlush)(nil), + (*BdIPMacFlushReply)(nil), + (*BridgeDomainAddDel)(nil), + (*BridgeDomainAddDelReply)(nil), + (*BridgeDomainDetails)(nil), + (*BridgeDomainDump)(nil), + (*BridgeDomainSetMacAge)(nil), + (*BridgeDomainSetMacAgeReply)(nil), + (*BridgeFlags)(nil), + (*BridgeFlagsReply)(nil), + (*BviCreate)(nil), + (*BviCreateReply)(nil), + (*BviDelete)(nil), + (*BviDeleteReply)(nil), + (*L2FibClearTable)(nil), + (*L2FibClearTableReply)(nil), + (*L2FibTableDetails)(nil), + (*L2FibTableDump)(nil), + (*L2Flags)(nil), + (*L2FlagsReply)(nil), + (*L2InterfaceEfpFilter)(nil), + (*L2InterfaceEfpFilterReply)(nil), + (*L2InterfacePbbTagRewrite)(nil), + (*L2InterfacePbbTagRewriteReply)(nil), + (*L2InterfaceVlanTagRewrite)(nil), + (*L2InterfaceVlanTagRewriteReply)(nil), + (*L2MacsEvent)(nil), + (*L2PatchAddDel)(nil), + (*L2PatchAddDelReply)(nil), + (*L2XconnectDetails)(nil), + (*L2XconnectDump)(nil), + (*L2fibAddDel)(nil), + (*L2fibAddDelReply)(nil), + (*L2fibFlushAll)(nil), + (*L2fibFlushAllReply)(nil), + (*L2fibFlushBd)(nil), + (*L2fibFlushBdReply)(nil), + (*L2fibFlushInt)(nil), + (*L2fibFlushIntReply)(nil), + (*SwInterfaceSetL2Bridge)(nil), + (*SwInterfaceSetL2BridgeReply)(nil), + (*SwInterfaceSetL2Xconnect)(nil), + (*SwInterfaceSetL2XconnectReply)(nil), + (*SwInterfaceSetVpath)(nil), + (*SwInterfaceSetVpathReply)(nil), + (*WantL2MacsEvents)(nil), + (*WantL2MacsEventsReply)(nil), + } +} + +// RPCService represents RPC service API for l2 module. +type RPCService interface { + DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) + DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) + DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) + DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) + BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) + BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) + BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) + BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) + BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) + BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) + BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) + L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) + L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) + L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) + L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) + L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) + L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) + L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) + L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) + L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) + L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) + SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) + SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) + SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) + WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpBdIPMac(ctx context.Context, in *BdIPMacDump) (RPCService_DumpBdIPMacClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBdIPMacClient{stream} + return x, nil +} + +type RPCService_DumpBdIPMacClient interface { + Recv() (*BdIPMacDetails, error) +} + +type serviceClient_DumpBdIPMacClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBdIPMacClient) Recv() (*BdIPMacDetails, error) { + m := new(BdIPMacDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpBridgeDomain(ctx context.Context, in *BridgeDomainDump) (RPCService_DumpBridgeDomainClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpBridgeDomainClient{stream} + return x, nil +} + +type RPCService_DumpBridgeDomainClient interface { + Recv() (*BridgeDomainDetails, error) +} + +type serviceClient_DumpBridgeDomainClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpBridgeDomainClient) Recv() (*BridgeDomainDetails, error) { + m := new(BridgeDomainDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2FibTable(ctx context.Context, in *L2FibTableDump) (RPCService_DumpL2FibTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2FibTableClient{stream} + return x, nil +} + +type RPCService_DumpL2FibTableClient interface { + Recv() (*L2FibTableDetails, error) +} + +type serviceClient_DumpL2FibTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2FibTableClient) Recv() (*L2FibTableDetails, error) { + m := new(L2FibTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpL2Xconnect(ctx context.Context, in *L2XconnectDump) (RPCService_DumpL2XconnectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpL2XconnectClient{stream} + return x, nil +} + +type RPCService_DumpL2XconnectClient interface { + Recv() (*L2XconnectDetails, error) +} + +type serviceClient_DumpL2XconnectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpL2XconnectClient) Recv() (*L2XconnectDetails, error) { + m := new(L2XconnectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) { + out := new(BdIPMacAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*BdIPMacFlushReply, error) { + out := new(BdIPMacFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { + out := new(BridgeDomainAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDomainSetMacAge) (*BridgeDomainSetMacAgeReply, error) { + out := new(BridgeDomainSetMacAgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { + out := new(BridgeFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) { + out := new(BviCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) { + out := new(BviDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { + out := new(L2FibClearTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply, error) { + out := new(L2FlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { + out := new(L2InterfaceEfpFilterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { + out := new(L2InterfacePbbTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { + out := new(L2InterfaceVlanTagRewriteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { + out := new(L2PatchAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fibAddDelReply, error) { + out := new(L2fibAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { + out := new(L2fibFlushAllReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { + out := new(L2fibFlushBdReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { + out := new(L2fibFlushIntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { + out := new(SwInterfaceSetL2BridgeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { + out := new(SwInterfaceSetL2XconnectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { + out := new(SwInterfaceSetVpathReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { + out := new(WantL2MacsEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/memclnt/memclnt.ba.go b/plugins/vpp/binapi/vpp1908/memclnt/memclnt.ba.go new file mode 100644 index 0000000000..04e8ae401e --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/memclnt/memclnt.ba.go @@ -0,0 +1,595 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/memclnt.api.json + +/* +Package memclnt is a generated VPP binary API for 'memclnt' module. + +It consists of: + 2 types + 22 messages + 13 services +*/ +package memclnt + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "memclnt" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x949f3cb1 +) + +// MessageTableEntry represents VPP binary API type 'message_table_entry'. +type MessageTableEntry struct { + Index uint16 + Name []byte `struc:"[64]byte"` +} + +func (*MessageTableEntry) GetTypeName() string { + return "message_table_entry" +} + +// ModuleVersion represents VPP binary API type 'module_version'. +type ModuleVersion struct { + Major uint32 + Minor uint32 + Patch uint32 + Name []byte `struc:"[64]byte"` +} + +func (*ModuleVersion) GetTypeName() string { + return "module_version" +} + +// APIVersions represents VPP binary API message 'api_versions'. +type APIVersions struct{} + +func (*APIVersions) GetMessageName() string { + return "api_versions" +} +func (*APIVersions) GetCrcString() string { + return "51077d14" +} +func (*APIVersions) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. +type APIVersionsReply struct { + Retval int32 + Count uint32 `struc:"sizeof=APIVersions"` + APIVersions []ModuleVersion +} + +func (*APIVersionsReply) GetMessageName() string { + return "api_versions_reply" +} +func (*APIVersionsReply) GetCrcString() string { + return "76f45113" +} +func (*APIVersionsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. +type GetFirstMsgID struct { + Name []byte `struc:"[64]byte"` +} + +func (*GetFirstMsgID) GetMessageName() string { + return "get_first_msg_id" +} +func (*GetFirstMsgID) GetCrcString() string { + return "0cb71b0e" +} +func (*GetFirstMsgID) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. +type GetFirstMsgIDReply struct { + Retval int32 + FirstMsgID uint16 +} + +func (*GetFirstMsgIDReply) GetMessageName() string { + return "get_first_msg_id_reply" +} +func (*GetFirstMsgIDReply) GetCrcString() string { + return "7d337472" +} +func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemclntCreate represents VPP binary API message 'memclnt_create'. +type MemclntCreate struct { + CtxQuota int32 + InputQueue uint64 + Name []byte `struc:"[64]byte"` + APIVersions []uint32 `struc:"[8]uint32"` +} + +func (*MemclntCreate) GetMessageName() string { + return "memclnt_create" +} +func (*MemclntCreate) GetCrcString() string { + return "6d33c5ea" +} +func (*MemclntCreate) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. +type MemclntCreateReply struct { + Response int32 + Handle uint64 + Index uint32 + MessageTable uint64 +} + +func (*MemclntCreateReply) GetMessageName() string { + return "memclnt_create_reply" +} +func (*MemclntCreateReply) GetCrcString() string { + return "42ec4560" +} +func (*MemclntCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemclntDelete represents VPP binary API message 'memclnt_delete'. +type MemclntDelete struct { + Index uint32 + Handle uint64 + DoCleanup uint8 +} + +func (*MemclntDelete) GetMessageName() string { + return "memclnt_delete" +} +func (*MemclntDelete) GetCrcString() string { + return "4dd351e9" +} +func (*MemclntDelete) GetMessageType() api.MessageType { + return api.OtherMessage +} + +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. +type MemclntDeleteReply struct { + Response int32 + Handle uint64 +} + +func (*MemclntDeleteReply) GetMessageName() string { + return "memclnt_delete_reply" +} +func (*MemclntDeleteReply) GetCrcString() string { + return "3d3b6312" +} +func (*MemclntDeleteReply) GetMessageType() api.MessageType { + return api.OtherMessage +} + +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. +type MemclntKeepalive struct{} + +func (*MemclntKeepalive) GetMessageName() string { + return "memclnt_keepalive" +} +func (*MemclntKeepalive) GetCrcString() string { + return "51077d14" +} +func (*MemclntKeepalive) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. +type MemclntKeepaliveReply struct { + Retval int32 +} + +func (*MemclntKeepaliveReply) GetMessageName() string { + return "memclnt_keepalive_reply" +} +func (*MemclntKeepaliveReply) GetCrcString() string { + return "e8d4e804" +} +func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. +type MemclntReadTimeout struct { + Dummy uint8 +} + +func (*MemclntReadTimeout) GetMessageName() string { + return "memclnt_read_timeout" +} +func (*MemclntReadTimeout) GetCrcString() string { + return "c3a3a452" +} +func (*MemclntReadTimeout) GetMessageType() api.MessageType { + return api.OtherMessage +} + +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. +type MemclntRxThreadSuspend struct { + Dummy uint8 +} + +func (*MemclntRxThreadSuspend) GetMessageName() string { + return "memclnt_rx_thread_suspend" +} +func (*MemclntRxThreadSuspend) GetCrcString() string { + return "c3a3a452" +} +func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { + return api.OtherMessage +} + +// RPCCall represents VPP binary API message 'rpc_call'. +type RPCCall struct { + Function uint64 + Multicast uint8 + NeedBarrierSync uint8 + SendReply uint8 + DataLen uint32 `struc:"sizeof=Data"` + Data []byte +} + +func (*RPCCall) GetMessageName() string { + return "rpc_call" +} +func (*RPCCall) GetCrcString() string { + return "7e8a2c95" +} +func (*RPCCall) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. +type RPCCallReply struct { + Retval int32 +} + +func (*RPCCallReply) GetMessageName() string { + return "rpc_call_reply" +} +func (*RPCCallReply) GetCrcString() string { + return "e8d4e804" +} +func (*RPCCallReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. +type RxThreadExit struct { + Dummy uint8 +} + +func (*RxThreadExit) GetMessageName() string { + return "rx_thread_exit" +} +func (*RxThreadExit) GetCrcString() string { + return "c3a3a452" +} +func (*RxThreadExit) GetMessageType() api.MessageType { + return api.OtherMessage +} + +// SockInitShm represents VPP binary API message 'sock_init_shm'. +type SockInitShm struct { + RequestedSize uint32 + Nitems uint8 `struc:"sizeof=Configs"` + Configs []uint64 +} + +func (*SockInitShm) GetMessageName() string { + return "sock_init_shm" +} +func (*SockInitShm) GetCrcString() string { + return "51646d92" +} +func (*SockInitShm) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. +type SockInitShmReply struct { + Retval int32 +} + +func (*SockInitShmReply) GetMessageName() string { + return "sock_init_shm_reply" +} +func (*SockInitShmReply) GetCrcString() string { + return "e8d4e804" +} +func (*SockInitShmReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SockclntCreate represents VPP binary API message 'sockclnt_create'. +type SockclntCreate struct { + Name []byte `struc:"[64]byte"` +} + +func (*SockclntCreate) GetMessageName() string { + return "sockclnt_create" +} +func (*SockclntCreate) GetCrcString() string { + return "df2cf94d" +} +func (*SockclntCreate) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. +type SockclntCreateReply struct { + Response int32 + Index uint32 + Count uint16 `struc:"sizeof=MessageTable"` + MessageTable []MessageTableEntry +} + +func (*SockclntCreateReply) GetMessageName() string { + return "sockclnt_create_reply" +} +func (*SockclntCreateReply) GetCrcString() string { + return "21795657" +} +func (*SockclntCreateReply) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. +type SockclntDelete struct { + Index uint32 +} + +func (*SockclntDelete) GetMessageName() string { + return "sockclnt_delete" +} +func (*SockclntDelete) GetCrcString() string { + return "8ac76db6" +} +func (*SockclntDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. +type SockclntDeleteReply struct { + Response int32 +} + +func (*SockclntDeleteReply) GetMessageName() string { + return "sockclnt_delete_reply" +} +func (*SockclntDeleteReply) GetCrcString() string { + return "8f38b1ee" +} +func (*SockclntDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. +type TracePluginMsgIds struct { + PluginName []byte `struc:"[128]byte"` + FirstMsgID uint16 + LastMsgID uint16 +} + +func (*TracePluginMsgIds) GetMessageName() string { + return "trace_plugin_msg_ids" +} +func (*TracePluginMsgIds) GetCrcString() string { + return "64af79f9" +} +func (*TracePluginMsgIds) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") + api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") + api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") + api.RegisterMessage((*GetFirstMsgIDReply)(nil), "memclnt.GetFirstMsgIDReply") + api.RegisterMessage((*MemclntCreate)(nil), "memclnt.MemclntCreate") + api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt.MemclntCreateReply") + api.RegisterMessage((*MemclntDelete)(nil), "memclnt.MemclntDelete") + api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt.MemclntDeleteReply") + api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt.MemclntKeepalive") + api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt.MemclntKeepaliveReply") + api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt.MemclntReadTimeout") + api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt.MemclntRxThreadSuspend") + api.RegisterMessage((*RPCCall)(nil), "memclnt.RPCCall") + api.RegisterMessage((*RPCCallReply)(nil), "memclnt.RPCCallReply") + api.RegisterMessage((*RxThreadExit)(nil), "memclnt.RxThreadExit") + api.RegisterMessage((*SockInitShm)(nil), "memclnt.SockInitShm") + api.RegisterMessage((*SockInitShmReply)(nil), "memclnt.SockInitShmReply") + api.RegisterMessage((*SockclntCreate)(nil), "memclnt.SockclntCreate") + api.RegisterMessage((*SockclntCreateReply)(nil), "memclnt.SockclntCreateReply") + api.RegisterMessage((*SockclntDelete)(nil), "memclnt.SockclntDelete") + api.RegisterMessage((*SockclntDeleteReply)(nil), "memclnt.SockclntDeleteReply") + api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/memif/memif.ba.go b/plugins/vpp/binapi/vpp1908/memif/memif.ba.go new file mode 100644 index 0000000000..f9babf764a --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/memif/memif.ba.go @@ -0,0 +1,337 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/memif.api.json + +/* +Package memif is a generated VPP binary API for 'memif' module. + +It consists of: + 10 messages + 5 services +*/ +package memif + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "memif" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x939f78a7 +) + +// MemifCreate represents VPP binary API message 'memif_create'. +type MemifCreate struct { + Role uint8 + Mode uint8 + RxQueues uint8 + TxQueues uint8 + ID uint32 + SocketID uint32 + Secret []byte `struc:"[24]byte"` + RingSize uint32 + BufferSize uint16 + HwAddr []byte `struc:"[6]byte"` +} + +func (*MemifCreate) GetMessageName() string { + return "memif_create" +} +func (*MemifCreate) GetCrcString() string { + return "6597cdb2" +} +func (*MemifCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MemifCreateReply represents VPP binary API message 'memif_create_reply'. +type MemifCreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*MemifCreateReply) GetMessageName() string { + return "memif_create_reply" +} +func (*MemifCreateReply) GetCrcString() string { + return "fda5941f" +} +func (*MemifCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemifDelete represents VPP binary API message 'memif_delete'. +type MemifDelete struct { + SwIfIndex uint32 +} + +func (*MemifDelete) GetMessageName() string { + return "memif_delete" +} +func (*MemifDelete) GetCrcString() string { + return "529cb13f" +} +func (*MemifDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. +type MemifDeleteReply struct { + Retval int32 +} + +func (*MemifDeleteReply) GetMessageName() string { + return "memif_delete_reply" +} +func (*MemifDeleteReply) GetCrcString() string { + return "e8d4e804" +} +func (*MemifDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemifDetails represents VPP binary API message 'memif_details'. +type MemifDetails struct { + SwIfIndex uint32 + IfName []byte `struc:"[64]byte"` + HwAddr []byte `struc:"[6]byte"` + ID uint32 + Role uint8 + Mode uint8 + SocketID uint32 + RingSize uint32 + BufferSize uint16 + AdminUpDown uint8 + LinkUpDown uint8 +} + +func (*MemifDetails) GetMessageName() string { + return "memif_details" +} +func (*MemifDetails) GetCrcString() string { + return "4f5a3397" +} +func (*MemifDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemifDump represents VPP binary API message 'memif_dump'. +type MemifDump struct{} + +func (*MemifDump) GetMessageName() string { + return "memif_dump" +} +func (*MemifDump) GetCrcString() string { + return "51077d14" +} +func (*MemifDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. +type MemifSocketFilenameAddDel struct { + IsAdd uint8 + SocketID uint32 + SocketFilename []byte `struc:"[128]byte"` +} + +func (*MemifSocketFilenameAddDel) GetMessageName() string { + return "memif_socket_filename_add_del" +} +func (*MemifSocketFilenameAddDel) GetCrcString() string { + return "30e3929d" +} +func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. +type MemifSocketFilenameAddDelReply struct { + Retval int32 +} + +func (*MemifSocketFilenameAddDelReply) GetMessageName() string { + return "memif_socket_filename_add_del_reply" +} +func (*MemifSocketFilenameAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. +type MemifSocketFilenameDetails struct { + SocketID uint32 + SocketFilename []byte `struc:"[128]byte"` +} + +func (*MemifSocketFilenameDetails) GetMessageName() string { + return "memif_socket_filename_details" +} +func (*MemifSocketFilenameDetails) GetCrcString() string { + return "e347e32f" +} +func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. +type MemifSocketFilenameDump struct{} + +func (*MemifSocketFilenameDump) GetMessageName() string { + return "memif_socket_filename_dump" +} +func (*MemifSocketFilenameDump) GetCrcString() string { + return "51077d14" +} +func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") + api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") + api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") + api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") + api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") + api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") + api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") + api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") + api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") + api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/nat/nat.ba.go b/plugins/vpp/binapi/vpp1908/nat/nat.ba.go new file mode 100644 index 0000000000..0276a94a02 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/nat/nat.ba.go @@ -0,0 +1,4025 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/nat.api.json + +/* +Package nat is a generated VPP binary API for 'nat' module. + +It consists of: + 6 enums + 3 aliases + 7 types + 1 union + 137 messages + 68 services +*/ +package nat + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "nat" + // APIVersion is the API version of this module. + APIVersion = "5.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x11e8f685 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// NatConfigFlags represents VPP binary API enum 'nat_config_flags'. +type NatConfigFlags uint8 + +const ( + NAT_IS_NONE NatConfigFlags = 0 + NAT_IS_TWICE_NAT NatConfigFlags = 1 + NAT_IS_SELF_TWICE_NAT NatConfigFlags = 2 + NAT_IS_OUT2IN_ONLY NatConfigFlags = 4 + NAT_IS_ADDR_ONLY NatConfigFlags = 8 + NAT_IS_OUTSIDE NatConfigFlags = 16 + NAT_IS_INSIDE NatConfigFlags = 32 + NAT_IS_STATIC NatConfigFlags = 64 + NAT_IS_EXT_HOST_VALID NatConfigFlags = 128 +) + +var NatConfigFlags_name = map[uint8]string{ + 0: "NAT_IS_NONE", + 1: "NAT_IS_TWICE_NAT", + 2: "NAT_IS_SELF_TWICE_NAT", + 4: "NAT_IS_OUT2IN_ONLY", + 8: "NAT_IS_ADDR_ONLY", + 16: "NAT_IS_OUTSIDE", + 32: "NAT_IS_INSIDE", + 64: "NAT_IS_STATIC", + 128: "NAT_IS_EXT_HOST_VALID", +} + +var NatConfigFlags_value = map[string]uint8{ + "NAT_IS_NONE": 0, + "NAT_IS_TWICE_NAT": 1, + "NAT_IS_SELF_TWICE_NAT": 2, + "NAT_IS_OUT2IN_ONLY": 4, + "NAT_IS_ADDR_ONLY": 8, + "NAT_IS_OUTSIDE": 16, + "NAT_IS_INSIDE": 32, + "NAT_IS_STATIC": 64, + "NAT_IS_EXT_HOST_VALID": 128, +} + +func (x NatConfigFlags) String() string { + s, ok := NatConfigFlags_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// NatLogLevel represents VPP binary API enum 'nat_log_level'. +type NatLogLevel uint8 + +const ( + NAT_LOG_NONE NatLogLevel = 0 + NAT_LOG_ERROR NatLogLevel = 1 + NAT_LOG_WARNING NatLogLevel = 2 + NAT_LOG_NOTICE NatLogLevel = 3 + NAT_LOG_INFO NatLogLevel = 4 + NAT_LOG_DEBUG NatLogLevel = 5 +) + +var NatLogLevel_name = map[uint8]string{ + 0: "NAT_LOG_NONE", + 1: "NAT_LOG_ERROR", + 2: "NAT_LOG_WARNING", + 3: "NAT_LOG_NOTICE", + 4: "NAT_LOG_INFO", + 5: "NAT_LOG_DEBUG", +} + +var NatLogLevel_value = map[string]uint8{ + "NAT_LOG_NONE": 0, + "NAT_LOG_ERROR": 1, + "NAT_LOG_WARNING": 2, + "NAT_LOG_NOTICE": 3, + "NAT_LOG_INFO": 4, + "NAT_LOG_DEBUG": 5, +} + +func (x NatLogLevel) String() string { + s, ok := NatLogLevel_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Nat44LbAddrPort represents VPP binary API type 'nat44_lb_addr_port'. +type Nat44LbAddrPort struct { + Addr IP4Address + Port uint16 + Probability uint8 + VrfID uint32 +} + +func (*Nat44LbAddrPort) GetTypeName() string { + return "nat44_lb_addr_port" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// DsliteAddDelPoolAddrRange represents VPP binary API message 'dslite_add_del_pool_addr_range'. +type DsliteAddDelPoolAddrRange struct { + StartAddr IP4Address + EndAddr IP4Address + IsAdd bool +} + +func (*DsliteAddDelPoolAddrRange) GetMessageName() string { + return "dslite_add_del_pool_addr_range" +} +func (*DsliteAddDelPoolAddrRange) GetCrcString() string { + return "b3e85e4d" +} +func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteAddDelPoolAddrRangeReply represents VPP binary API message 'dslite_add_del_pool_addr_range_reply'. +type DsliteAddDelPoolAddrRangeReply struct { + Retval int32 +} + +func (*DsliteAddDelPoolAddrRangeReply) GetMessageName() string { + return "dslite_add_del_pool_addr_range_reply" +} +func (*DsliteAddDelPoolAddrRangeReply) GetCrcString() string { + return "e8d4e804" +} +func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DsliteAddressDetails represents VPP binary API message 'dslite_address_details'. +type DsliteAddressDetails struct { + IPAddress IP4Address +} + +func (*DsliteAddressDetails) GetMessageName() string { + return "dslite_address_details" +} +func (*DsliteAddressDetails) GetCrcString() string { + return "9ed18b19" +} +func (*DsliteAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DsliteAddressDump represents VPP binary API message 'dslite_address_dump'. +type DsliteAddressDump struct{} + +func (*DsliteAddressDump) GetMessageName() string { + return "dslite_address_dump" +} +func (*DsliteAddressDump) GetCrcString() string { + return "51077d14" +} +func (*DsliteAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteGetAftrAddr represents VPP binary API message 'dslite_get_aftr_addr'. +type DsliteGetAftrAddr struct{} + +func (*DsliteGetAftrAddr) GetMessageName() string { + return "dslite_get_aftr_addr" +} +func (*DsliteGetAftrAddr) GetCrcString() string { + return "51077d14" +} +func (*DsliteGetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteGetAftrAddrReply represents VPP binary API message 'dslite_get_aftr_addr_reply'. +type DsliteGetAftrAddrReply struct { + Retval int32 + IP4Addr IP4Address + IP6Addr IP6Address +} + +func (*DsliteGetAftrAddrReply) GetMessageName() string { + return "dslite_get_aftr_addr_reply" +} +func (*DsliteGetAftrAddrReply) GetCrcString() string { + return "c4b65514" +} +func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DsliteGetB4Addr represents VPP binary API message 'dslite_get_b4_addr'. +type DsliteGetB4Addr struct{} + +func (*DsliteGetB4Addr) GetMessageName() string { + return "dslite_get_b4_addr" +} +func (*DsliteGetB4Addr) GetCrcString() string { + return "51077d14" +} +func (*DsliteGetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteGetB4AddrReply represents VPP binary API message 'dslite_get_b4_addr_reply'. +type DsliteGetB4AddrReply struct { + Retval int32 + IP4Addr IP4Address + IP6Addr IP6Address +} + +func (*DsliteGetB4AddrReply) GetMessageName() string { + return "dslite_get_b4_addr_reply" +} +func (*DsliteGetB4AddrReply) GetCrcString() string { + return "c4b65514" +} +func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DsliteSetAftrAddr represents VPP binary API message 'dslite_set_aftr_addr'. +type DsliteSetAftrAddr struct { + IP4Addr IP4Address + IP6Addr IP6Address +} + +func (*DsliteSetAftrAddr) GetMessageName() string { + return "dslite_set_aftr_addr" +} +func (*DsliteSetAftrAddr) GetCrcString() string { + return "ac3d29bd" +} +func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteSetAftrAddrReply represents VPP binary API message 'dslite_set_aftr_addr_reply'. +type DsliteSetAftrAddrReply struct { + Retval int32 +} + +func (*DsliteSetAftrAddrReply) GetMessageName() string { + return "dslite_set_aftr_addr_reply" +} +func (*DsliteSetAftrAddrReply) GetCrcString() string { + return "e8d4e804" +} +func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DsliteSetB4Addr represents VPP binary API message 'dslite_set_b4_addr'. +type DsliteSetB4Addr struct { + IP4Addr IP4Address + IP6Addr IP6Address +} + +func (*DsliteSetB4Addr) GetMessageName() string { + return "dslite_set_b4_addr" +} +func (*DsliteSetB4Addr) GetCrcString() string { + return "ac3d29bd" +} +func (*DsliteSetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DsliteSetB4AddrReply represents VPP binary API message 'dslite_set_b4_addr_reply'. +type DsliteSetB4AddrReply struct { + Retval int32 +} + +func (*DsliteSetB4AddrReply) GetMessageName() string { + return "dslite_set_b4_addr_reply" +} +func (*DsliteSetB4AddrReply) GetCrcString() string { + return "e8d4e804" +} +func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddDelAddressRange represents VPP binary API message 'nat44_add_del_address_range'. +type Nat44AddDelAddressRange struct { + FirstIPAddress IP4Address + LastIPAddress IP4Address + VrfID uint32 + IsAdd bool + Flags NatConfigFlags +} + +func (*Nat44AddDelAddressRange) GetMessageName() string { + return "nat44_add_del_address_range" +} +func (*Nat44AddDelAddressRange) GetCrcString() string { + return "b9406f1f" +} +func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44AddDelAddressRangeReply represents VPP binary API message 'nat44_add_del_address_range_reply'. +type Nat44AddDelAddressRangeReply struct { + Retval int32 +} + +func (*Nat44AddDelAddressRangeReply) GetMessageName() string { + return "nat44_add_del_address_range_reply" +} +func (*Nat44AddDelAddressRangeReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44AddDelAddressRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddDelIdentityMapping represents VPP binary API message 'nat44_add_del_identity_mapping'. +type Nat44AddDelIdentityMapping struct { + IsAdd bool + Flags NatConfigFlags + IPAddress IP4Address + Protocol uint8 + Port uint16 + SwIfIndex InterfaceIndex + VrfID uint32 + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44AddDelIdentityMapping) GetMessageName() string { + return "nat44_add_del_identity_mapping" +} +func (*Nat44AddDelIdentityMapping) GetCrcString() string { + return "27cfdf6a" +} +func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44AddDelIdentityMappingReply represents VPP binary API message 'nat44_add_del_identity_mapping_reply'. +type Nat44AddDelIdentityMappingReply struct { + Retval int32 +} + +func (*Nat44AddDelIdentityMappingReply) GetMessageName() string { + return "nat44_add_del_identity_mapping_reply" +} +func (*Nat44AddDelIdentityMappingReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44AddDelIdentityMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddDelInterfaceAddr represents VPP binary API message 'nat44_add_del_interface_addr'. +type Nat44AddDelInterfaceAddr struct { + IsAdd bool + SwIfIndex InterfaceIndex + Flags NatConfigFlags +} + +func (*Nat44AddDelInterfaceAddr) GetMessageName() string { + return "nat44_add_del_interface_addr" +} +func (*Nat44AddDelInterfaceAddr) GetCrcString() string { + return "296a5cc4" +} +func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44AddDelInterfaceAddrReply represents VPP binary API message 'nat44_add_del_interface_addr_reply'. +type Nat44AddDelInterfaceAddrReply struct { + Retval int32 +} + +func (*Nat44AddDelInterfaceAddrReply) GetMessageName() string { + return "nat44_add_del_interface_addr_reply" +} +func (*Nat44AddDelInterfaceAddrReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44AddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddDelLbStaticMapping represents VPP binary API message 'nat44_add_del_lb_static_mapping'. +type Nat44AddDelLbStaticMapping struct { + IsAdd bool + Flags NatConfigFlags + ExternalAddr IP4Address + ExternalPort uint16 + Protocol uint8 + Affinity uint32 + LocalNum uint32 `struc:"sizeof=Locals"` + Locals []Nat44LbAddrPort + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44AddDelLbStaticMapping) GetMessageName() string { + return "nat44_add_del_lb_static_mapping" +} +func (*Nat44AddDelLbStaticMapping) GetCrcString() string { + return "fdbafb24" +} +func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44AddDelLbStaticMappingReply represents VPP binary API message 'nat44_add_del_lb_static_mapping_reply'. +type Nat44AddDelLbStaticMappingReply struct { + Retval int32 +} + +func (*Nat44AddDelLbStaticMappingReply) GetMessageName() string { + return "nat44_add_del_lb_static_mapping_reply" +} +func (*Nat44AddDelLbStaticMappingReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44AddDelLbStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddDelStaticMapping represents VPP binary API message 'nat44_add_del_static_mapping'. +type Nat44AddDelStaticMapping struct { + IsAdd bool + Flags NatConfigFlags + LocalIPAddress IP4Address + ExternalIPAddress IP4Address + Protocol uint8 + LocalPort uint16 + ExternalPort uint16 + ExternalSwIfIndex InterfaceIndex + VrfID uint32 + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44AddDelStaticMapping) GetMessageName() string { + return "nat44_add_del_static_mapping" +} +func (*Nat44AddDelStaticMapping) GetCrcString() string { + return "e26e4d05" +} +func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44AddDelStaticMappingReply represents VPP binary API message 'nat44_add_del_static_mapping_reply'. +type Nat44AddDelStaticMappingReply struct { + Retval int32 +} + +func (*Nat44AddDelStaticMappingReply) GetMessageName() string { + return "nat44_add_del_static_mapping_reply" +} +func (*Nat44AddDelStaticMappingReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44AddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddressDetails represents VPP binary API message 'nat44_address_details'. +type Nat44AddressDetails struct { + IPAddress IP4Address + Flags NatConfigFlags + VrfID uint32 +} + +func (*Nat44AddressDetails) GetMessageName() string { + return "nat44_address_details" +} +func (*Nat44AddressDetails) GetCrcString() string { + return "5839c1a8" +} +func (*Nat44AddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44AddressDump represents VPP binary API message 'nat44_address_dump'. +type Nat44AddressDump struct{} + +func (*Nat44AddressDump) GetMessageName() string { + return "nat44_address_dump" +} +func (*Nat44AddressDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44AddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44DelSession represents VPP binary API message 'nat44_del_session'. +type Nat44DelSession struct { + Address IP4Address + Protocol uint8 + Port uint16 + VrfID uint32 + Flags NatConfigFlags + ExtHostAddress IP4Address + ExtHostPort uint16 +} + +func (*Nat44DelSession) GetMessageName() string { + return "nat44_del_session" +} +func (*Nat44DelSession) GetCrcString() string { + return "138f3174" +} +func (*Nat44DelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44DelSessionReply represents VPP binary API message 'nat44_del_session_reply'. +type Nat44DelSessionReply struct { + Retval int32 +} + +func (*Nat44DelSessionReply) GetMessageName() string { + return "nat44_del_session_reply" +} +func (*Nat44DelSessionReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44DelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44ForwardingEnableDisable represents VPP binary API message 'nat44_forwarding_enable_disable'. +type Nat44ForwardingEnableDisable struct { + Enable bool +} + +func (*Nat44ForwardingEnableDisable) GetMessageName() string { + return "nat44_forwarding_enable_disable" +} +func (*Nat44ForwardingEnableDisable) GetCrcString() string { + return "b3e225d2" +} +func (*Nat44ForwardingEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44ForwardingEnableDisableReply represents VPP binary API message 'nat44_forwarding_enable_disable_reply'. +type Nat44ForwardingEnableDisableReply struct { + Retval int32 +} + +func (*Nat44ForwardingEnableDisableReply) GetMessageName() string { + return "nat44_forwarding_enable_disable_reply" +} +func (*Nat44ForwardingEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44ForwardingEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44ForwardingIsEnabled represents VPP binary API message 'nat44_forwarding_is_enabled'. +type Nat44ForwardingIsEnabled struct{} + +func (*Nat44ForwardingIsEnabled) GetMessageName() string { + return "nat44_forwarding_is_enabled" +} +func (*Nat44ForwardingIsEnabled) GetCrcString() string { + return "51077d14" +} +func (*Nat44ForwardingIsEnabled) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44ForwardingIsEnabledReply represents VPP binary API message 'nat44_forwarding_is_enabled_reply'. +type Nat44ForwardingIsEnabledReply struct { + Enabled bool +} + +func (*Nat44ForwardingIsEnabledReply) GetMessageName() string { + return "nat44_forwarding_is_enabled_reply" +} +func (*Nat44ForwardingIsEnabledReply) GetCrcString() string { + return "46924a06" +} +func (*Nat44ForwardingIsEnabledReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44IdentityMappingDetails represents VPP binary API message 'nat44_identity_mapping_details'. +type Nat44IdentityMappingDetails struct { + Flags NatConfigFlags + IPAddress IP4Address + Protocol uint8 + Port uint16 + SwIfIndex InterfaceIndex + VrfID uint32 + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44IdentityMappingDetails) GetMessageName() string { + return "nat44_identity_mapping_details" +} +func (*Nat44IdentityMappingDetails) GetCrcString() string { + return "ede3c486" +} +func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44IdentityMappingDump represents VPP binary API message 'nat44_identity_mapping_dump'. +type Nat44IdentityMappingDump struct{} + +func (*Nat44IdentityMappingDump) GetMessageName() string { + return "nat44_identity_mapping_dump" +} +func (*Nat44IdentityMappingDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44IdentityMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44InterfaceAddDelFeature represents VPP binary API message 'nat44_interface_add_del_feature'. +type Nat44InterfaceAddDelFeature struct { + IsAdd bool + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat44InterfaceAddDelFeature) GetMessageName() string { + return "nat44_interface_add_del_feature" +} +func (*Nat44InterfaceAddDelFeature) GetCrcString() string { + return "ef3edad1" +} +func (*Nat44InterfaceAddDelFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44InterfaceAddDelFeatureReply represents VPP binary API message 'nat44_interface_add_del_feature_reply'. +type Nat44InterfaceAddDelFeatureReply struct { + Retval int32 +} + +func (*Nat44InterfaceAddDelFeatureReply) GetMessageName() string { + return "nat44_interface_add_del_feature_reply" +} +func (*Nat44InterfaceAddDelFeatureReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44InterfaceAddDelOutputFeature represents VPP binary API message 'nat44_interface_add_del_output_feature'. +type Nat44InterfaceAddDelOutputFeature struct { + IsAdd bool + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat44InterfaceAddDelOutputFeature) GetMessageName() string { + return "nat44_interface_add_del_output_feature" +} +func (*Nat44InterfaceAddDelOutputFeature) GetCrcString() string { + return "ef3edad1" +} +func (*Nat44InterfaceAddDelOutputFeature) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44InterfaceAddDelOutputFeatureReply represents VPP binary API message 'nat44_interface_add_del_output_feature_reply'. +type Nat44InterfaceAddDelOutputFeatureReply struct { + Retval int32 +} + +func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageName() string { + return "nat44_interface_add_del_output_feature_reply" +} +func (*Nat44InterfaceAddDelOutputFeatureReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44InterfaceAddrDetails represents VPP binary API message 'nat44_interface_addr_details'. +type Nat44InterfaceAddrDetails struct { + SwIfIndex InterfaceIndex + Flags NatConfigFlags +} + +func (*Nat44InterfaceAddrDetails) GetMessageName() string { + return "nat44_interface_addr_details" +} +func (*Nat44InterfaceAddrDetails) GetCrcString() string { + return "053725cb" +} +func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44InterfaceAddrDump represents VPP binary API message 'nat44_interface_addr_dump'. +type Nat44InterfaceAddrDump struct{} + +func (*Nat44InterfaceAddrDump) GetMessageName() string { + return "nat44_interface_addr_dump" +} +func (*Nat44InterfaceAddrDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44InterfaceAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44InterfaceDetails represents VPP binary API message 'nat44_interface_details'. +type Nat44InterfaceDetails struct { + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat44InterfaceDetails) GetMessageName() string { + return "nat44_interface_details" +} +func (*Nat44InterfaceDetails) GetCrcString() string { + return "c363a3de" +} +func (*Nat44InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44InterfaceDump represents VPP binary API message 'nat44_interface_dump'. +type Nat44InterfaceDump struct{} + +func (*Nat44InterfaceDump) GetMessageName() string { + return "nat44_interface_dump" +} +func (*Nat44InterfaceDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44InterfaceOutputFeatureDetails represents VPP binary API message 'nat44_interface_output_feature_details'. +type Nat44InterfaceOutputFeatureDetails struct { + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat44InterfaceOutputFeatureDetails) GetMessageName() string { + return "nat44_interface_output_feature_details" +} +func (*Nat44InterfaceOutputFeatureDetails) GetCrcString() string { + return "c363a3de" +} +func (*Nat44InterfaceOutputFeatureDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44InterfaceOutputFeatureDump represents VPP binary API message 'nat44_interface_output_feature_dump'. +type Nat44InterfaceOutputFeatureDump struct{} + +func (*Nat44InterfaceOutputFeatureDump) GetMessageName() string { + return "nat44_interface_output_feature_dump" +} +func (*Nat44InterfaceOutputFeatureDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44InterfaceOutputFeatureDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44LbStaticMappingAddDelLocal represents VPP binary API message 'nat44_lb_static_mapping_add_del_local'. +type Nat44LbStaticMappingAddDelLocal struct { + IsAdd bool + ExternalAddr IP4Address + ExternalPort uint16 + Protocol uint8 + Local Nat44LbAddrPort +} + +func (*Nat44LbStaticMappingAddDelLocal) GetMessageName() string { + return "nat44_lb_static_mapping_add_del_local" +} +func (*Nat44LbStaticMappingAddDelLocal) GetCrcString() string { + return "5d9011ee" +} +func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44LbStaticMappingAddDelLocalReply represents VPP binary API message 'nat44_lb_static_mapping_add_del_local_reply'. +type Nat44LbStaticMappingAddDelLocalReply struct { + Retval int32 +} + +func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageName() string { + return "nat44_lb_static_mapping_add_del_local_reply" +} +func (*Nat44LbStaticMappingAddDelLocalReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44LbStaticMappingDetails represents VPP binary API message 'nat44_lb_static_mapping_details'. +type Nat44LbStaticMappingDetails struct { + ExternalAddr IP4Address + ExternalPort uint16 + Protocol uint8 + Flags NatConfigFlags + Affinity uint32 + LocalNum uint32 `struc:"sizeof=Locals"` + Locals []Nat44LbAddrPort + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44LbStaticMappingDetails) GetMessageName() string { + return "nat44_lb_static_mapping_details" +} +func (*Nat44LbStaticMappingDetails) GetCrcString() string { + return "561d7343" +} +func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44LbStaticMappingDump represents VPP binary API message 'nat44_lb_static_mapping_dump'. +type Nat44LbStaticMappingDump struct{} + +func (*Nat44LbStaticMappingDump) GetMessageName() string { + return "nat44_lb_static_mapping_dump" +} +func (*Nat44LbStaticMappingDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44LbStaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44StaticMappingDetails represents VPP binary API message 'nat44_static_mapping_details'. +type Nat44StaticMappingDetails struct { + Flags NatConfigFlags + LocalIPAddress IP4Address + ExternalIPAddress IP4Address + Protocol uint8 + LocalPort uint16 + ExternalPort uint16 + ExternalSwIfIndex InterfaceIndex + VrfID uint32 + XXX_TagLen uint32 `struc:"sizeof=Tag"` + Tag string +} + +func (*Nat44StaticMappingDetails) GetMessageName() string { + return "nat44_static_mapping_details" +} +func (*Nat44StaticMappingDetails) GetCrcString() string { + return "68e5b3cc" +} +func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44StaticMappingDump represents VPP binary API message 'nat44_static_mapping_dump'. +type Nat44StaticMappingDump struct{} + +func (*Nat44StaticMappingDump) GetMessageName() string { + return "nat44_static_mapping_dump" +} +func (*Nat44StaticMappingDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44StaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44UserDetails represents VPP binary API message 'nat44_user_details'. +type Nat44UserDetails struct { + VrfID uint32 + IPAddress IP4Address + Nsessions uint32 + Nstaticsessions uint32 +} + +func (*Nat44UserDetails) GetMessageName() string { + return "nat44_user_details" +} +func (*Nat44UserDetails) GetCrcString() string { + return "e35837b4" +} +func (*Nat44UserDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44UserDump represents VPP binary API message 'nat44_user_dump'. +type Nat44UserDump struct{} + +func (*Nat44UserDump) GetMessageName() string { + return "nat44_user_dump" +} +func (*Nat44UserDump) GetCrcString() string { + return "51077d14" +} +func (*Nat44UserDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat44UserSessionDetails represents VPP binary API message 'nat44_user_session_details'. +type Nat44UserSessionDetails struct { + OutsideIPAddress IP4Address + OutsidePort uint16 + InsideIPAddress IP4Address + InsidePort uint16 + Protocol uint16 + Flags NatConfigFlags + LastHeard uint64 + TotalBytes uint64 + TotalPkts uint32 + ExtHostAddress IP4Address + ExtHostPort uint16 + ExtHostNatAddress IP4Address + ExtHostNatPort uint16 +} + +func (*Nat44UserSessionDetails) GetMessageName() string { + return "nat44_user_session_details" +} +func (*Nat44UserSessionDetails) GetCrcString() string { + return "1d185082" +} +func (*Nat44UserSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat44UserSessionDump represents VPP binary API message 'nat44_user_session_dump'. +type Nat44UserSessionDump struct { + IPAddress IP4Address + VrfID uint32 +} + +func (*Nat44UserSessionDump) GetMessageName() string { + return "nat44_user_session_dump" +} +func (*Nat44UserSessionDump) GetCrcString() string { + return "69c0a6a5" +} +func (*Nat44UserSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelInterface represents VPP binary API message 'nat64_add_del_interface'. +type Nat64AddDelInterface struct { + IsAdd bool + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat64AddDelInterface) GetMessageName() string { + return "nat64_add_del_interface" +} +func (*Nat64AddDelInterface) GetCrcString() string { + return "ef3edad1" +} +func (*Nat64AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelInterfaceAddr represents VPP binary API message 'nat64_add_del_interface_addr'. +type Nat64AddDelInterfaceAddr struct { + IsAdd bool + SwIfIndex InterfaceIndex +} + +func (*Nat64AddDelInterfaceAddr) GetMessageName() string { + return "nat64_add_del_interface_addr" +} +func (*Nat64AddDelInterfaceAddr) GetCrcString() string { + return "2667112d" +} +func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelInterfaceAddrReply represents VPP binary API message 'nat64_add_del_interface_addr_reply'. +type Nat64AddDelInterfaceAddrReply struct { + Retval int32 +} + +func (*Nat64AddDelInterfaceAddrReply) GetMessageName() string { + return "nat64_add_del_interface_addr_reply" +} +func (*Nat64AddDelInterfaceAddrReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64AddDelInterfaceReply represents VPP binary API message 'nat64_add_del_interface_reply'. +type Nat64AddDelInterfaceReply struct { + Retval int32 +} + +func (*Nat64AddDelInterfaceReply) GetMessageName() string { + return "nat64_add_del_interface_reply" +} +func (*Nat64AddDelInterfaceReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64AddDelPoolAddrRange represents VPP binary API message 'nat64_add_del_pool_addr_range'. +type Nat64AddDelPoolAddrRange struct { + StartAddr IP4Address + EndAddr IP4Address + VrfID uint32 + IsAdd bool +} + +func (*Nat64AddDelPoolAddrRange) GetMessageName() string { + return "nat64_add_del_pool_addr_range" +} +func (*Nat64AddDelPoolAddrRange) GetCrcString() string { + return "0d7c833f" +} +func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelPoolAddrRangeReply represents VPP binary API message 'nat64_add_del_pool_addr_range_reply'. +type Nat64AddDelPoolAddrRangeReply struct { + Retval int32 +} + +func (*Nat64AddDelPoolAddrRangeReply) GetMessageName() string { + return "nat64_add_del_pool_addr_range_reply" +} +func (*Nat64AddDelPoolAddrRangeReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64AddDelPrefix represents VPP binary API message 'nat64_add_del_prefix'. +type Nat64AddDelPrefix struct { + Prefix IP6Prefix + VrfID uint32 + IsAdd bool +} + +func (*Nat64AddDelPrefix) GetMessageName() string { + return "nat64_add_del_prefix" +} +func (*Nat64AddDelPrefix) GetCrcString() string { + return "f1c54efa" +} +func (*Nat64AddDelPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelPrefixReply represents VPP binary API message 'nat64_add_del_prefix_reply'. +type Nat64AddDelPrefixReply struct { + Retval int32 +} + +func (*Nat64AddDelPrefixReply) GetMessageName() string { + return "nat64_add_del_prefix_reply" +} +func (*Nat64AddDelPrefixReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64AddDelStaticBib represents VPP binary API message 'nat64_add_del_static_bib'. +type Nat64AddDelStaticBib struct { + IAddr IP6Address + OAddr IP4Address + IPort uint16 + OPort uint16 + VrfID uint32 + Proto uint8 + IsAdd bool +} + +func (*Nat64AddDelStaticBib) GetMessageName() string { + return "nat64_add_del_static_bib" +} +func (*Nat64AddDelStaticBib) GetCrcString() string { + return "42a44519" +} +func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64AddDelStaticBibReply represents VPP binary API message 'nat64_add_del_static_bib_reply'. +type Nat64AddDelStaticBibReply struct { + Retval int32 +} + +func (*Nat64AddDelStaticBibReply) GetMessageName() string { + return "nat64_add_del_static_bib_reply" +} +func (*Nat64AddDelStaticBibReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64BibDetails represents VPP binary API message 'nat64_bib_details'. +type Nat64BibDetails struct { + IAddr IP6Address + OAddr IP4Address + IPort uint16 + OPort uint16 + VrfID uint32 + Proto uint8 + Flags NatConfigFlags + SesNum uint32 +} + +func (*Nat64BibDetails) GetMessageName() string { + return "nat64_bib_details" +} +func (*Nat64BibDetails) GetCrcString() string { + return "776fd58a" +} +func (*Nat64BibDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64BibDump represents VPP binary API message 'nat64_bib_dump'. +type Nat64BibDump struct { + Proto uint8 +} + +func (*Nat64BibDump) GetMessageName() string { + return "nat64_bib_dump" +} +func (*Nat64BibDump) GetCrcString() string { + return "cfcb6b75" +} +func (*Nat64BibDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64InterfaceDetails represents VPP binary API message 'nat64_interface_details'. +type Nat64InterfaceDetails struct { + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat64InterfaceDetails) GetMessageName() string { + return "nat64_interface_details" +} +func (*Nat64InterfaceDetails) GetCrcString() string { + return "c363a3de" +} +func (*Nat64InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64InterfaceDump represents VPP binary API message 'nat64_interface_dump'. +type Nat64InterfaceDump struct{} + +func (*Nat64InterfaceDump) GetMessageName() string { + return "nat64_interface_dump" +} +func (*Nat64InterfaceDump) GetCrcString() string { + return "51077d14" +} +func (*Nat64InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64PoolAddrDetails represents VPP binary API message 'nat64_pool_addr_details'. +type Nat64PoolAddrDetails struct { + Address IP4Address + VrfID uint32 +} + +func (*Nat64PoolAddrDetails) GetMessageName() string { + return "nat64_pool_addr_details" +} +func (*Nat64PoolAddrDetails) GetCrcString() string { + return "36f4365b" +} +func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64PoolAddrDump represents VPP binary API message 'nat64_pool_addr_dump'. +type Nat64PoolAddrDump struct{} + +func (*Nat64PoolAddrDump) GetMessageName() string { + return "nat64_pool_addr_dump" +} +func (*Nat64PoolAddrDump) GetCrcString() string { + return "51077d14" +} +func (*Nat64PoolAddrDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64PrefixDetails represents VPP binary API message 'nat64_prefix_details'. +type Nat64PrefixDetails struct { + Prefix IP6Prefix + VrfID uint32 +} + +func (*Nat64PrefixDetails) GetMessageName() string { + return "nat64_prefix_details" +} +func (*Nat64PrefixDetails) GetCrcString() string { + return "6e0088d7" +} +func (*Nat64PrefixDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64PrefixDump represents VPP binary API message 'nat64_prefix_dump'. +type Nat64PrefixDump struct{} + +func (*Nat64PrefixDump) GetMessageName() string { + return "nat64_prefix_dump" +} +func (*Nat64PrefixDump) GetCrcString() string { + return "51077d14" +} +func (*Nat64PrefixDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat64StDetails represents VPP binary API message 'nat64_st_details'. +type Nat64StDetails struct { + IlAddr IP6Address + OlAddr IP4Address + IlPort uint16 + OlPort uint16 + IrAddr IP6Address + OrAddr IP4Address + RPort uint16 + VrfID uint32 + Proto uint8 +} + +func (*Nat64StDetails) GetMessageName() string { + return "nat64_st_details" +} +func (*Nat64StDetails) GetCrcString() string { + return "7c5125d0" +} +func (*Nat64StDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat64StDump represents VPP binary API message 'nat64_st_dump'. +type Nat64StDump struct { + Proto uint8 +} + +func (*Nat64StDump) GetMessageName() string { + return "nat64_st_dump" +} +func (*Nat64StDump) GetCrcString() string { + return "cfcb6b75" +} +func (*Nat64StDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat66AddDelInterface represents VPP binary API message 'nat66_add_del_interface'. +type Nat66AddDelInterface struct { + IsAdd bool + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat66AddDelInterface) GetMessageName() string { + return "nat66_add_del_interface" +} +func (*Nat66AddDelInterface) GetCrcString() string { + return "ef3edad1" +} +func (*Nat66AddDelInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat66AddDelInterfaceReply represents VPP binary API message 'nat66_add_del_interface_reply'. +type Nat66AddDelInterfaceReply struct { + Retval int32 +} + +func (*Nat66AddDelInterfaceReply) GetMessageName() string { + return "nat66_add_del_interface_reply" +} +func (*Nat66AddDelInterfaceReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat66AddDelStaticMapping represents VPP binary API message 'nat66_add_del_static_mapping'. +type Nat66AddDelStaticMapping struct { + IsAdd bool + LocalIPAddress IP6Address + ExternalIPAddress IP6Address + VrfID uint32 +} + +func (*Nat66AddDelStaticMapping) GetMessageName() string { + return "nat66_add_del_static_mapping" +} +func (*Nat66AddDelStaticMapping) GetCrcString() string { + return "1c15424e" +} +func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat66AddDelStaticMappingReply represents VPP binary API message 'nat66_add_del_static_mapping_reply'. +type Nat66AddDelStaticMappingReply struct { + Retval int32 +} + +func (*Nat66AddDelStaticMappingReply) GetMessageName() string { + return "nat66_add_del_static_mapping_reply" +} +func (*Nat66AddDelStaticMappingReply) GetCrcString() string { + return "e8d4e804" +} +func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat66InterfaceDetails represents VPP binary API message 'nat66_interface_details'. +type Nat66InterfaceDetails struct { + Flags NatConfigFlags + SwIfIndex InterfaceIndex +} + +func (*Nat66InterfaceDetails) GetMessageName() string { + return "nat66_interface_details" +} +func (*Nat66InterfaceDetails) GetCrcString() string { + return "c363a3de" +} +func (*Nat66InterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat66InterfaceDump represents VPP binary API message 'nat66_interface_dump'. +type Nat66InterfaceDump struct{} + +func (*Nat66InterfaceDump) GetMessageName() string { + return "nat66_interface_dump" +} +func (*Nat66InterfaceDump) GetCrcString() string { + return "51077d14" +} +func (*Nat66InterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Nat66StaticMappingDetails represents VPP binary API message 'nat66_static_mapping_details'. +type Nat66StaticMappingDetails struct { + LocalIPAddress IP6Address + ExternalIPAddress IP6Address + VrfID uint32 + TotalBytes uint64 + TotalPkts uint64 +} + +func (*Nat66StaticMappingDetails) GetMessageName() string { + return "nat66_static_mapping_details" +} +func (*Nat66StaticMappingDetails) GetCrcString() string { + return "5e1189f9" +} +func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Nat66StaticMappingDump represents VPP binary API message 'nat66_static_mapping_dump'. +type Nat66StaticMappingDump struct{} + +func (*Nat66StaticMappingDump) GetMessageName() string { + return "nat66_static_mapping_dump" +} +func (*Nat66StaticMappingDump) GetCrcString() string { + return "51077d14" +} +func (*Nat66StaticMappingDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatControlPing represents VPP binary API message 'nat_control_ping'. +type NatControlPing struct{} + +func (*NatControlPing) GetMessageName() string { + return "nat_control_ping" +} +func (*NatControlPing) GetCrcString() string { + return "51077d14" +} +func (*NatControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatControlPingReply represents VPP binary API message 'nat_control_ping_reply'. +type NatControlPingReply struct { + Retval int32 + ClientIndex uint32 + VpePID uint32 +} + +func (*NatControlPingReply) GetMessageName() string { + return "nat_control_ping_reply" +} +func (*NatControlPingReply) GetCrcString() string { + return "f6b0b8ca" +} +func (*NatControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetAddDelMap represents VPP binary API message 'nat_det_add_del_map'. +type NatDetAddDelMap struct { + IsAdd bool + InAddr IP4Address + InPlen uint8 + OutAddr IP4Address + OutPlen uint8 +} + +func (*NatDetAddDelMap) GetMessageName() string { + return "nat_det_add_del_map" +} +func (*NatDetAddDelMap) GetCrcString() string { + return "04b76549" +} +func (*NatDetAddDelMap) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetAddDelMapReply represents VPP binary API message 'nat_det_add_del_map_reply'. +type NatDetAddDelMapReply struct { + Retval int32 +} + +func (*NatDetAddDelMapReply) GetMessageName() string { + return "nat_det_add_del_map_reply" +} +func (*NatDetAddDelMapReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatDetAddDelMapReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetCloseSessionIn represents VPP binary API message 'nat_det_close_session_in'. +type NatDetCloseSessionIn struct { + InAddr IP4Address + InPort uint16 + ExtAddr IP4Address + ExtPort uint16 +} + +func (*NatDetCloseSessionIn) GetMessageName() string { + return "nat_det_close_session_in" +} +func (*NatDetCloseSessionIn) GetCrcString() string { + return "fedaebae" +} +func (*NatDetCloseSessionIn) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetCloseSessionInReply represents VPP binary API message 'nat_det_close_session_in_reply'. +type NatDetCloseSessionInReply struct { + Retval int32 +} + +func (*NatDetCloseSessionInReply) GetMessageName() string { + return "nat_det_close_session_in_reply" +} +func (*NatDetCloseSessionInReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetCloseSessionOut represents VPP binary API message 'nat_det_close_session_out'. +type NatDetCloseSessionOut struct { + OutAddr IP4Address + OutPort uint16 + ExtAddr IP4Address + ExtPort uint16 +} + +func (*NatDetCloseSessionOut) GetMessageName() string { + return "nat_det_close_session_out" +} +func (*NatDetCloseSessionOut) GetCrcString() string { + return "be61efd5" +} +func (*NatDetCloseSessionOut) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetCloseSessionOutReply represents VPP binary API message 'nat_det_close_session_out_reply'. +type NatDetCloseSessionOutReply struct { + Retval int32 +} + +func (*NatDetCloseSessionOutReply) GetMessageName() string { + return "nat_det_close_session_out_reply" +} +func (*NatDetCloseSessionOutReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetForward represents VPP binary API message 'nat_det_forward'. +type NatDetForward struct { + InAddr IP4Address +} + +func (*NatDetForward) GetMessageName() string { + return "nat_det_forward" +} +func (*NatDetForward) GetCrcString() string { + return "347c6d3e" +} +func (*NatDetForward) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetForwardReply represents VPP binary API message 'nat_det_forward_reply'. +type NatDetForwardReply struct { + Retval int32 + OutPortLo uint16 + OutPortHi uint16 + OutAddr IP4Address +} + +func (*NatDetForwardReply) GetMessageName() string { + return "nat_det_forward_reply" +} +func (*NatDetForwardReply) GetCrcString() string { + return "d64bcb1b" +} +func (*NatDetForwardReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetMapDetails represents VPP binary API message 'nat_det_map_details'. +type NatDetMapDetails struct { + InAddr IP4Address + InPlen uint8 + OutAddr IP4Address + OutPlen uint8 + SharingRatio uint32 + PortsPerHost uint16 + SesNum uint32 +} + +func (*NatDetMapDetails) GetMessageName() string { + return "nat_det_map_details" +} +func (*NatDetMapDetails) GetCrcString() string { + return "5cd9ca79" +} +func (*NatDetMapDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetMapDump represents VPP binary API message 'nat_det_map_dump'. +type NatDetMapDump struct{} + +func (*NatDetMapDump) GetMessageName() string { + return "nat_det_map_dump" +} +func (*NatDetMapDump) GetCrcString() string { + return "51077d14" +} +func (*NatDetMapDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetReverse represents VPP binary API message 'nat_det_reverse'. +type NatDetReverse struct { + OutPort uint16 + OutAddr IP4Address +} + +func (*NatDetReverse) GetMessageName() string { + return "nat_det_reverse" +} +func (*NatDetReverse) GetCrcString() string { + return "c99c32db" +} +func (*NatDetReverse) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatDetReverseReply represents VPP binary API message 'nat_det_reverse_reply'. +type NatDetReverseReply struct { + Retval int32 + InAddr IP4Address +} + +func (*NatDetReverseReply) GetMessageName() string { + return "nat_det_reverse_reply" +} +func (*NatDetReverseReply) GetCrcString() string { + return "0ce4aee6" +} +func (*NatDetReverseReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetSessionDetails represents VPP binary API message 'nat_det_session_details'. +type NatDetSessionDetails struct { + InPort uint16 + ExtAddr IP4Address + ExtPort uint16 + OutPort uint16 + State uint8 + Expire uint32 +} + +func (*NatDetSessionDetails) GetMessageName() string { + return "nat_det_session_details" +} +func (*NatDetSessionDetails) GetCrcString() string { + return "31da0ce5" +} +func (*NatDetSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatDetSessionDump represents VPP binary API message 'nat_det_session_dump'. +type NatDetSessionDump struct { + UserAddr IP4Address +} + +func (*NatDetSessionDump) GetMessageName() string { + return "nat_det_session_dump" +} +func (*NatDetSessionDump) GetCrcString() string { + return "4e489ac2" +} +func (*NatDetSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatGetAddrAndPortAllocAlg represents VPP binary API message 'nat_get_addr_and_port_alloc_alg'. +type NatGetAddrAndPortAllocAlg struct{} + +func (*NatGetAddrAndPortAllocAlg) GetMessageName() string { + return "nat_get_addr_and_port_alloc_alg" +} +func (*NatGetAddrAndPortAllocAlg) GetCrcString() string { + return "51077d14" +} +func (*NatGetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatGetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_get_addr_and_port_alloc_alg_reply'. +type NatGetAddrAndPortAllocAlgReply struct { + Retval int32 + Alg uint8 + PsidOffset uint8 + PsidLength uint8 + Psid uint16 + StartPort uint16 + EndPort uint16 +} + +func (*NatGetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat_get_addr_and_port_alloc_alg_reply" +} +func (*NatGetAddrAndPortAllocAlgReply) GetCrcString() string { + return "3607a7d0" +} +func (*NatGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatGetMssClamping represents VPP binary API message 'nat_get_mss_clamping'. +type NatGetMssClamping struct{} + +func (*NatGetMssClamping) GetMessageName() string { + return "nat_get_mss_clamping" +} +func (*NatGetMssClamping) GetCrcString() string { + return "51077d14" +} +func (*NatGetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatGetMssClampingReply represents VPP binary API message 'nat_get_mss_clamping_reply'. +type NatGetMssClampingReply struct { + Retval int32 + MssValue uint16 + Enable bool +} + +func (*NatGetMssClampingReply) GetMessageName() string { + return "nat_get_mss_clamping_reply" +} +func (*NatGetMssClampingReply) GetCrcString() string { + return "1c0b2a78" +} +func (*NatGetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatGetReass represents VPP binary API message 'nat_get_reass'. +type NatGetReass struct{} + +func (*NatGetReass) GetMessageName() string { + return "nat_get_reass" +} +func (*NatGetReass) GetCrcString() string { + return "51077d14" +} +func (*NatGetReass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatGetReassReply represents VPP binary API message 'nat_get_reass_reply'. +type NatGetReassReply struct { + Retval int32 + IP4Timeout uint32 + IP4MaxReass uint16 + IP4MaxFrag uint8 + IP4DropFrag uint8 + IP6Timeout uint32 + IP6MaxReass uint16 + IP6MaxFrag uint8 + IP6DropFrag uint8 +} + +func (*NatGetReassReply) GetMessageName() string { + return "nat_get_reass_reply" +} +func (*NatGetReassReply) GetCrcString() string { + return "8102a0fb" +} +func (*NatGetReassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatGetTimeouts represents VPP binary API message 'nat_get_timeouts'. +type NatGetTimeouts struct{} + +func (*NatGetTimeouts) GetMessageName() string { + return "nat_get_timeouts" +} +func (*NatGetTimeouts) GetCrcString() string { + return "51077d14" +} +func (*NatGetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatGetTimeoutsReply represents VPP binary API message 'nat_get_timeouts_reply'. +type NatGetTimeoutsReply struct { + Retval int32 + UDP uint32 + TCPEstablished uint32 + TCPTransitory uint32 + ICMP uint32 +} + +func (*NatGetTimeoutsReply) GetMessageName() string { + return "nat_get_timeouts_reply" +} +func (*NatGetTimeoutsReply) GetCrcString() string { + return "3c4df4e1" +} +func (*NatGetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaFlush represents VPP binary API message 'nat_ha_flush'. +type NatHaFlush struct{} + +func (*NatHaFlush) GetMessageName() string { + return "nat_ha_flush" +} +func (*NatHaFlush) GetCrcString() string { + return "51077d14" +} +func (*NatHaFlush) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaFlushReply represents VPP binary API message 'nat_ha_flush_reply'. +type NatHaFlushReply struct { + Retval int32 +} + +func (*NatHaFlushReply) GetMessageName() string { + return "nat_ha_flush_reply" +} +func (*NatHaFlushReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatHaFlushReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaGetFailover represents VPP binary API message 'nat_ha_get_failover'. +type NatHaGetFailover struct{} + +func (*NatHaGetFailover) GetMessageName() string { + return "nat_ha_get_failover" +} +func (*NatHaGetFailover) GetCrcString() string { + return "51077d14" +} +func (*NatHaGetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaGetFailoverReply represents VPP binary API message 'nat_ha_get_failover_reply'. +type NatHaGetFailoverReply struct { + Retval int32 + IPAddress IP4Address + Port uint16 + SessionRefreshInterval uint32 +} + +func (*NatHaGetFailoverReply) GetMessageName() string { + return "nat_ha_get_failover_reply" +} +func (*NatHaGetFailoverReply) GetCrcString() string { + return "d4cb310a" +} +func (*NatHaGetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaGetListener represents VPP binary API message 'nat_ha_get_listener'. +type NatHaGetListener struct{} + +func (*NatHaGetListener) GetMessageName() string { + return "nat_ha_get_listener" +} +func (*NatHaGetListener) GetCrcString() string { + return "51077d14" +} +func (*NatHaGetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaGetListenerReply represents VPP binary API message 'nat_ha_get_listener_reply'. +type NatHaGetListenerReply struct { + Retval int32 + IPAddress IP4Address + Port uint16 + PathMtu uint32 +} + +func (*NatHaGetListenerReply) GetMessageName() string { + return "nat_ha_get_listener_reply" +} +func (*NatHaGetListenerReply) GetCrcString() string { + return "fb8786ad" +} +func (*NatHaGetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaResync represents VPP binary API message 'nat_ha_resync'. +type NatHaResync struct { + WantResyncEvent uint8 + PID uint32 +} + +func (*NatHaResync) GetMessageName() string { + return "nat_ha_resync" +} +func (*NatHaResync) GetCrcString() string { + return "c8ab9e03" +} +func (*NatHaResync) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaResyncCompletedEvent represents VPP binary API message 'nat_ha_resync_completed_event'. +type NatHaResyncCompletedEvent struct { + PID uint32 + MissedCount uint32 +} + +func (*NatHaResyncCompletedEvent) GetMessageName() string { + return "nat_ha_resync_completed_event" +} +func (*NatHaResyncCompletedEvent) GetCrcString() string { + return "fdc598fb" +} +func (*NatHaResyncCompletedEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +// NatHaResyncReply represents VPP binary API message 'nat_ha_resync_reply'. +type NatHaResyncReply struct { + Retval int32 +} + +func (*NatHaResyncReply) GetMessageName() string { + return "nat_ha_resync_reply" +} +func (*NatHaResyncReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatHaResyncReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaSetFailover represents VPP binary API message 'nat_ha_set_failover'. +type NatHaSetFailover struct { + IPAddress IP4Address + Port uint16 + SessionRefreshInterval uint32 +} + +func (*NatHaSetFailover) GetMessageName() string { + return "nat_ha_set_failover" +} +func (*NatHaSetFailover) GetCrcString() string { + return "a5d89e59" +} +func (*NatHaSetFailover) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaSetFailoverReply represents VPP binary API message 'nat_ha_set_failover_reply'. +type NatHaSetFailoverReply struct { + Retval int32 +} + +func (*NatHaSetFailoverReply) GetMessageName() string { + return "nat_ha_set_failover_reply" +} +func (*NatHaSetFailoverReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatHaSetFailoverReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatHaSetListener represents VPP binary API message 'nat_ha_set_listener'. +type NatHaSetListener struct { + IPAddress IP4Address + Port uint16 + PathMtu uint32 +} + +func (*NatHaSetListener) GetMessageName() string { + return "nat_ha_set_listener" +} +func (*NatHaSetListener) GetCrcString() string { + return "ddf1d491" +} +func (*NatHaSetListener) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatHaSetListenerReply represents VPP binary API message 'nat_ha_set_listener_reply'. +type NatHaSetListenerReply struct { + Retval int32 +} + +func (*NatHaSetListenerReply) GetMessageName() string { + return "nat_ha_set_listener_reply" +} +func (*NatHaSetListenerReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatHaSetListenerReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatIpfixEnableDisable represents VPP binary API message 'nat_ipfix_enable_disable'. +type NatIpfixEnableDisable struct { + DomainID uint32 + SrcPort uint16 + Enable bool +} + +func (*NatIpfixEnableDisable) GetMessageName() string { + return "nat_ipfix_enable_disable" +} +func (*NatIpfixEnableDisable) GetCrcString() string { + return "9af4a2d2" +} +func (*NatIpfixEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatIpfixEnableDisableReply represents VPP binary API message 'nat_ipfix_enable_disable_reply'. +type NatIpfixEnableDisableReply struct { + Retval int32 +} + +func (*NatIpfixEnableDisableReply) GetMessageName() string { + return "nat_ipfix_enable_disable_reply" +} +func (*NatIpfixEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatIpfixEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatReassDetails represents VPP binary API message 'nat_reass_details'. +type NatReassDetails struct { + SrcAddr Address + DstAddr Address + FragID uint32 + Proto uint8 + FragN uint8 +} + +func (*NatReassDetails) GetMessageName() string { + return "nat_reass_details" +} +func (*NatReassDetails) GetCrcString() string { + return "43dc3cc2" +} +func (*NatReassDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatReassDump represents VPP binary API message 'nat_reass_dump'. +type NatReassDump struct{} + +func (*NatReassDump) GetMessageName() string { + return "nat_reass_dump" +} +func (*NatReassDump) GetCrcString() string { + return "51077d14" +} +func (*NatReassDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetAddrAndPortAllocAlg represents VPP binary API message 'nat_set_addr_and_port_alloc_alg'. +type NatSetAddrAndPortAllocAlg struct { + Alg uint8 + PsidOffset uint8 + PsidLength uint8 + Psid uint16 + StartPort uint16 + EndPort uint16 +} + +func (*NatSetAddrAndPortAllocAlg) GetMessageName() string { + return "nat_set_addr_and_port_alloc_alg" +} +func (*NatSetAddrAndPortAllocAlg) GetCrcString() string { + return "deeb746f" +} +func (*NatSetAddrAndPortAllocAlg) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetAddrAndPortAllocAlgReply represents VPP binary API message 'nat_set_addr_and_port_alloc_alg_reply'. +type NatSetAddrAndPortAllocAlgReply struct { + Retval int32 +} + +func (*NatSetAddrAndPortAllocAlgReply) GetMessageName() string { + return "nat_set_addr_and_port_alloc_alg_reply" +} +func (*NatSetAddrAndPortAllocAlgReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatSetLogLevel represents VPP binary API message 'nat_set_log_level'. +type NatSetLogLevel struct { + LogLevel NatLogLevel +} + +func (*NatSetLogLevel) GetMessageName() string { + return "nat_set_log_level" +} +func (*NatSetLogLevel) GetCrcString() string { + return "70076bfe" +} +func (*NatSetLogLevel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetLogLevelReply represents VPP binary API message 'nat_set_log_level_reply'. +type NatSetLogLevelReply struct { + Retval int32 +} + +func (*NatSetLogLevelReply) GetMessageName() string { + return "nat_set_log_level_reply" +} +func (*NatSetLogLevelReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetLogLevelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatSetMssClamping represents VPP binary API message 'nat_set_mss_clamping'. +type NatSetMssClamping struct { + MssValue uint16 + Enable bool +} + +func (*NatSetMssClamping) GetMessageName() string { + return "nat_set_mss_clamping" +} +func (*NatSetMssClamping) GetCrcString() string { + return "25e90abb" +} +func (*NatSetMssClamping) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetMssClampingReply represents VPP binary API message 'nat_set_mss_clamping_reply'. +type NatSetMssClampingReply struct { + Retval int32 +} + +func (*NatSetMssClampingReply) GetMessageName() string { + return "nat_set_mss_clamping_reply" +} +func (*NatSetMssClampingReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetMssClampingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatSetReass represents VPP binary API message 'nat_set_reass'. +type NatSetReass struct { + Timeout uint32 + MaxReass uint16 + MaxFrag uint8 + DropFrag uint8 + IsIP6 bool +} + +func (*NatSetReass) GetMessageName() string { + return "nat_set_reass" +} +func (*NatSetReass) GetCrcString() string { + return "364ce510" +} +func (*NatSetReass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetReassReply represents VPP binary API message 'nat_set_reass_reply'. +type NatSetReassReply struct { + Retval int32 +} + +func (*NatSetReassReply) GetMessageName() string { + return "nat_set_reass_reply" +} +func (*NatSetReassReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetReassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatSetTimeouts represents VPP binary API message 'nat_set_timeouts'. +type NatSetTimeouts struct { + UDP uint32 + TCPEstablished uint32 + TCPTransitory uint32 + ICMP uint32 +} + +func (*NatSetTimeouts) GetMessageName() string { + return "nat_set_timeouts" +} +func (*NatSetTimeouts) GetCrcString() string { + return "d4746b16" +} +func (*NatSetTimeouts) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetTimeoutsReply represents VPP binary API message 'nat_set_timeouts_reply'. +type NatSetTimeoutsReply struct { + Retval int32 +} + +func (*NatSetTimeoutsReply) GetMessageName() string { + return "nat_set_timeouts_reply" +} +func (*NatSetTimeoutsReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetTimeoutsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatSetWorkers represents VPP binary API message 'nat_set_workers'. +type NatSetWorkers struct { + WorkerMask uint64 +} + +func (*NatSetWorkers) GetMessageName() string { + return "nat_set_workers" +} +func (*NatSetWorkers) GetCrcString() string { + return "da926638" +} +func (*NatSetWorkers) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatSetWorkersReply represents VPP binary API message 'nat_set_workers_reply'. +type NatSetWorkersReply struct { + Retval int32 +} + +func (*NatSetWorkersReply) GetMessageName() string { + return "nat_set_workers_reply" +} +func (*NatSetWorkersReply) GetCrcString() string { + return "e8d4e804" +} +func (*NatSetWorkersReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatShowConfig represents VPP binary API message 'nat_show_config'. +type NatShowConfig struct{} + +func (*NatShowConfig) GetMessageName() string { + return "nat_show_config" +} +func (*NatShowConfig) GetCrcString() string { + return "51077d14" +} +func (*NatShowConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// NatShowConfigReply represents VPP binary API message 'nat_show_config_reply'. +type NatShowConfigReply struct { + Retval int32 + StaticMappingOnly bool + StaticMappingConnectionTracking bool + Deterministic bool + EndpointDependent bool + Out2inDpo bool + DsliteCe bool + TranslationBuckets uint32 + TranslationMemorySize uint32 + UserBuckets uint32 + UserMemorySize uint32 + MaxTranslationsPerUser uint32 + OutsideVrfID uint32 + InsideVrfID uint32 + Nat64BibBuckets uint32 + Nat64BibMemorySize uint32 + Nat64StBuckets uint32 + Nat64StMemorySize uint32 +} + +func (*NatShowConfigReply) GetMessageName() string { + return "nat_show_config_reply" +} +func (*NatShowConfigReply) GetCrcString() string { + return "006a0786" +} +func (*NatShowConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatWorkerDetails represents VPP binary API message 'nat_worker_details'. +type NatWorkerDetails struct { + WorkerIndex uint32 + LcoreID uint32 + XXX_NameLen uint32 `struc:"sizeof=Name"` + Name string +} + +func (*NatWorkerDetails) GetMessageName() string { + return "nat_worker_details" +} +func (*NatWorkerDetails) GetCrcString() string { + return "9922dabd" +} +func (*NatWorkerDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// NatWorkerDump represents VPP binary API message 'nat_worker_dump'. +type NatWorkerDump struct{} + +func (*NatWorkerDump) GetMessageName() string { + return "nat_worker_dump" +} +func (*NatWorkerDump) GetCrcString() string { + return "51077d14" +} +func (*NatWorkerDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*DsliteAddDelPoolAddrRange)(nil), "nat.DsliteAddDelPoolAddrRange") + api.RegisterMessage((*DsliteAddDelPoolAddrRangeReply)(nil), "nat.DsliteAddDelPoolAddrRangeReply") + api.RegisterMessage((*DsliteAddressDetails)(nil), "nat.DsliteAddressDetails") + api.RegisterMessage((*DsliteAddressDump)(nil), "nat.DsliteAddressDump") + api.RegisterMessage((*DsliteGetAftrAddr)(nil), "nat.DsliteGetAftrAddr") + api.RegisterMessage((*DsliteGetAftrAddrReply)(nil), "nat.DsliteGetAftrAddrReply") + api.RegisterMessage((*DsliteGetB4Addr)(nil), "nat.DsliteGetB4Addr") + api.RegisterMessage((*DsliteGetB4AddrReply)(nil), "nat.DsliteGetB4AddrReply") + api.RegisterMessage((*DsliteSetAftrAddr)(nil), "nat.DsliteSetAftrAddr") + api.RegisterMessage((*DsliteSetAftrAddrReply)(nil), "nat.DsliteSetAftrAddrReply") + api.RegisterMessage((*DsliteSetB4Addr)(nil), "nat.DsliteSetB4Addr") + api.RegisterMessage((*DsliteSetB4AddrReply)(nil), "nat.DsliteSetB4AddrReply") + api.RegisterMessage((*Nat44AddDelAddressRange)(nil), "nat.Nat44AddDelAddressRange") + api.RegisterMessage((*Nat44AddDelAddressRangeReply)(nil), "nat.Nat44AddDelAddressRangeReply") + api.RegisterMessage((*Nat44AddDelIdentityMapping)(nil), "nat.Nat44AddDelIdentityMapping") + api.RegisterMessage((*Nat44AddDelIdentityMappingReply)(nil), "nat.Nat44AddDelIdentityMappingReply") + api.RegisterMessage((*Nat44AddDelInterfaceAddr)(nil), "nat.Nat44AddDelInterfaceAddr") + api.RegisterMessage((*Nat44AddDelInterfaceAddrReply)(nil), "nat.Nat44AddDelInterfaceAddrReply") + api.RegisterMessage((*Nat44AddDelLbStaticMapping)(nil), "nat.Nat44AddDelLbStaticMapping") + api.RegisterMessage((*Nat44AddDelLbStaticMappingReply)(nil), "nat.Nat44AddDelLbStaticMappingReply") + api.RegisterMessage((*Nat44AddDelStaticMapping)(nil), "nat.Nat44AddDelStaticMapping") + api.RegisterMessage((*Nat44AddDelStaticMappingReply)(nil), "nat.Nat44AddDelStaticMappingReply") + api.RegisterMessage((*Nat44AddressDetails)(nil), "nat.Nat44AddressDetails") + api.RegisterMessage((*Nat44AddressDump)(nil), "nat.Nat44AddressDump") + api.RegisterMessage((*Nat44DelSession)(nil), "nat.Nat44DelSession") + api.RegisterMessage((*Nat44DelSessionReply)(nil), "nat.Nat44DelSessionReply") + api.RegisterMessage((*Nat44ForwardingEnableDisable)(nil), "nat.Nat44ForwardingEnableDisable") + api.RegisterMessage((*Nat44ForwardingEnableDisableReply)(nil), "nat.Nat44ForwardingEnableDisableReply") + api.RegisterMessage((*Nat44ForwardingIsEnabled)(nil), "nat.Nat44ForwardingIsEnabled") + api.RegisterMessage((*Nat44ForwardingIsEnabledReply)(nil), "nat.Nat44ForwardingIsEnabledReply") + api.RegisterMessage((*Nat44IdentityMappingDetails)(nil), "nat.Nat44IdentityMappingDetails") + api.RegisterMessage((*Nat44IdentityMappingDump)(nil), "nat.Nat44IdentityMappingDump") + api.RegisterMessage((*Nat44InterfaceAddDelFeature)(nil), "nat.Nat44InterfaceAddDelFeature") + api.RegisterMessage((*Nat44InterfaceAddDelFeatureReply)(nil), "nat.Nat44InterfaceAddDelFeatureReply") + api.RegisterMessage((*Nat44InterfaceAddDelOutputFeature)(nil), "nat.Nat44InterfaceAddDelOutputFeature") + api.RegisterMessage((*Nat44InterfaceAddDelOutputFeatureReply)(nil), "nat.Nat44InterfaceAddDelOutputFeatureReply") + api.RegisterMessage((*Nat44InterfaceAddrDetails)(nil), "nat.Nat44InterfaceAddrDetails") + api.RegisterMessage((*Nat44InterfaceAddrDump)(nil), "nat.Nat44InterfaceAddrDump") + api.RegisterMessage((*Nat44InterfaceDetails)(nil), "nat.Nat44InterfaceDetails") + api.RegisterMessage((*Nat44InterfaceDump)(nil), "nat.Nat44InterfaceDump") + api.RegisterMessage((*Nat44InterfaceOutputFeatureDetails)(nil), "nat.Nat44InterfaceOutputFeatureDetails") + api.RegisterMessage((*Nat44InterfaceOutputFeatureDump)(nil), "nat.Nat44InterfaceOutputFeatureDump") + api.RegisterMessage((*Nat44LbStaticMappingAddDelLocal)(nil), "nat.Nat44LbStaticMappingAddDelLocal") + api.RegisterMessage((*Nat44LbStaticMappingAddDelLocalReply)(nil), "nat.Nat44LbStaticMappingAddDelLocalReply") + api.RegisterMessage((*Nat44LbStaticMappingDetails)(nil), "nat.Nat44LbStaticMappingDetails") + api.RegisterMessage((*Nat44LbStaticMappingDump)(nil), "nat.Nat44LbStaticMappingDump") + api.RegisterMessage((*Nat44StaticMappingDetails)(nil), "nat.Nat44StaticMappingDetails") + api.RegisterMessage((*Nat44StaticMappingDump)(nil), "nat.Nat44StaticMappingDump") + api.RegisterMessage((*Nat44UserDetails)(nil), "nat.Nat44UserDetails") + api.RegisterMessage((*Nat44UserDump)(nil), "nat.Nat44UserDump") + api.RegisterMessage((*Nat44UserSessionDetails)(nil), "nat.Nat44UserSessionDetails") + api.RegisterMessage((*Nat44UserSessionDump)(nil), "nat.Nat44UserSessionDump") + api.RegisterMessage((*Nat64AddDelInterface)(nil), "nat.Nat64AddDelInterface") + api.RegisterMessage((*Nat64AddDelInterfaceAddr)(nil), "nat.Nat64AddDelInterfaceAddr") + api.RegisterMessage((*Nat64AddDelInterfaceAddrReply)(nil), "nat.Nat64AddDelInterfaceAddrReply") + api.RegisterMessage((*Nat64AddDelInterfaceReply)(nil), "nat.Nat64AddDelInterfaceReply") + api.RegisterMessage((*Nat64AddDelPoolAddrRange)(nil), "nat.Nat64AddDelPoolAddrRange") + api.RegisterMessage((*Nat64AddDelPoolAddrRangeReply)(nil), "nat.Nat64AddDelPoolAddrRangeReply") + api.RegisterMessage((*Nat64AddDelPrefix)(nil), "nat.Nat64AddDelPrefix") + api.RegisterMessage((*Nat64AddDelPrefixReply)(nil), "nat.Nat64AddDelPrefixReply") + api.RegisterMessage((*Nat64AddDelStaticBib)(nil), "nat.Nat64AddDelStaticBib") + api.RegisterMessage((*Nat64AddDelStaticBibReply)(nil), "nat.Nat64AddDelStaticBibReply") + api.RegisterMessage((*Nat64BibDetails)(nil), "nat.Nat64BibDetails") + api.RegisterMessage((*Nat64BibDump)(nil), "nat.Nat64BibDump") + api.RegisterMessage((*Nat64InterfaceDetails)(nil), "nat.Nat64InterfaceDetails") + api.RegisterMessage((*Nat64InterfaceDump)(nil), "nat.Nat64InterfaceDump") + api.RegisterMessage((*Nat64PoolAddrDetails)(nil), "nat.Nat64PoolAddrDetails") + api.RegisterMessage((*Nat64PoolAddrDump)(nil), "nat.Nat64PoolAddrDump") + api.RegisterMessage((*Nat64PrefixDetails)(nil), "nat.Nat64PrefixDetails") + api.RegisterMessage((*Nat64PrefixDump)(nil), "nat.Nat64PrefixDump") + api.RegisterMessage((*Nat64StDetails)(nil), "nat.Nat64StDetails") + api.RegisterMessage((*Nat64StDump)(nil), "nat.Nat64StDump") + api.RegisterMessage((*Nat66AddDelInterface)(nil), "nat.Nat66AddDelInterface") + api.RegisterMessage((*Nat66AddDelInterfaceReply)(nil), "nat.Nat66AddDelInterfaceReply") + api.RegisterMessage((*Nat66AddDelStaticMapping)(nil), "nat.Nat66AddDelStaticMapping") + api.RegisterMessage((*Nat66AddDelStaticMappingReply)(nil), "nat.Nat66AddDelStaticMappingReply") + api.RegisterMessage((*Nat66InterfaceDetails)(nil), "nat.Nat66InterfaceDetails") + api.RegisterMessage((*Nat66InterfaceDump)(nil), "nat.Nat66InterfaceDump") + api.RegisterMessage((*Nat66StaticMappingDetails)(nil), "nat.Nat66StaticMappingDetails") + api.RegisterMessage((*Nat66StaticMappingDump)(nil), "nat.Nat66StaticMappingDump") + api.RegisterMessage((*NatControlPing)(nil), "nat.NatControlPing") + api.RegisterMessage((*NatControlPingReply)(nil), "nat.NatControlPingReply") + api.RegisterMessage((*NatDetAddDelMap)(nil), "nat.NatDetAddDelMap") + api.RegisterMessage((*NatDetAddDelMapReply)(nil), "nat.NatDetAddDelMapReply") + api.RegisterMessage((*NatDetCloseSessionIn)(nil), "nat.NatDetCloseSessionIn") + api.RegisterMessage((*NatDetCloseSessionInReply)(nil), "nat.NatDetCloseSessionInReply") + api.RegisterMessage((*NatDetCloseSessionOut)(nil), "nat.NatDetCloseSessionOut") + api.RegisterMessage((*NatDetCloseSessionOutReply)(nil), "nat.NatDetCloseSessionOutReply") + api.RegisterMessage((*NatDetForward)(nil), "nat.NatDetForward") + api.RegisterMessage((*NatDetForwardReply)(nil), "nat.NatDetForwardReply") + api.RegisterMessage((*NatDetMapDetails)(nil), "nat.NatDetMapDetails") + api.RegisterMessage((*NatDetMapDump)(nil), "nat.NatDetMapDump") + api.RegisterMessage((*NatDetReverse)(nil), "nat.NatDetReverse") + api.RegisterMessage((*NatDetReverseReply)(nil), "nat.NatDetReverseReply") + api.RegisterMessage((*NatDetSessionDetails)(nil), "nat.NatDetSessionDetails") + api.RegisterMessage((*NatDetSessionDump)(nil), "nat.NatDetSessionDump") + api.RegisterMessage((*NatGetAddrAndPortAllocAlg)(nil), "nat.NatGetAddrAndPortAllocAlg") + api.RegisterMessage((*NatGetAddrAndPortAllocAlgReply)(nil), "nat.NatGetAddrAndPortAllocAlgReply") + api.RegisterMessage((*NatGetMssClamping)(nil), "nat.NatGetMssClamping") + api.RegisterMessage((*NatGetMssClampingReply)(nil), "nat.NatGetMssClampingReply") + api.RegisterMessage((*NatGetReass)(nil), "nat.NatGetReass") + api.RegisterMessage((*NatGetReassReply)(nil), "nat.NatGetReassReply") + api.RegisterMessage((*NatGetTimeouts)(nil), "nat.NatGetTimeouts") + api.RegisterMessage((*NatGetTimeoutsReply)(nil), "nat.NatGetTimeoutsReply") + api.RegisterMessage((*NatHaFlush)(nil), "nat.NatHaFlush") + api.RegisterMessage((*NatHaFlushReply)(nil), "nat.NatHaFlushReply") + api.RegisterMessage((*NatHaGetFailover)(nil), "nat.NatHaGetFailover") + api.RegisterMessage((*NatHaGetFailoverReply)(nil), "nat.NatHaGetFailoverReply") + api.RegisterMessage((*NatHaGetListener)(nil), "nat.NatHaGetListener") + api.RegisterMessage((*NatHaGetListenerReply)(nil), "nat.NatHaGetListenerReply") + api.RegisterMessage((*NatHaResync)(nil), "nat.NatHaResync") + api.RegisterMessage((*NatHaResyncCompletedEvent)(nil), "nat.NatHaResyncCompletedEvent") + api.RegisterMessage((*NatHaResyncReply)(nil), "nat.NatHaResyncReply") + api.RegisterMessage((*NatHaSetFailover)(nil), "nat.NatHaSetFailover") + api.RegisterMessage((*NatHaSetFailoverReply)(nil), "nat.NatHaSetFailoverReply") + api.RegisterMessage((*NatHaSetListener)(nil), "nat.NatHaSetListener") + api.RegisterMessage((*NatHaSetListenerReply)(nil), "nat.NatHaSetListenerReply") + api.RegisterMessage((*NatIpfixEnableDisable)(nil), "nat.NatIpfixEnableDisable") + api.RegisterMessage((*NatIpfixEnableDisableReply)(nil), "nat.NatIpfixEnableDisableReply") + api.RegisterMessage((*NatReassDetails)(nil), "nat.NatReassDetails") + api.RegisterMessage((*NatReassDump)(nil), "nat.NatReassDump") + api.RegisterMessage((*NatSetAddrAndPortAllocAlg)(nil), "nat.NatSetAddrAndPortAllocAlg") + api.RegisterMessage((*NatSetAddrAndPortAllocAlgReply)(nil), "nat.NatSetAddrAndPortAllocAlgReply") + api.RegisterMessage((*NatSetLogLevel)(nil), "nat.NatSetLogLevel") + api.RegisterMessage((*NatSetLogLevelReply)(nil), "nat.NatSetLogLevelReply") + api.RegisterMessage((*NatSetMssClamping)(nil), "nat.NatSetMssClamping") + api.RegisterMessage((*NatSetMssClampingReply)(nil), "nat.NatSetMssClampingReply") + api.RegisterMessage((*NatSetReass)(nil), "nat.NatSetReass") + api.RegisterMessage((*NatSetReassReply)(nil), "nat.NatSetReassReply") + api.RegisterMessage((*NatSetTimeouts)(nil), "nat.NatSetTimeouts") + api.RegisterMessage((*NatSetTimeoutsReply)(nil), "nat.NatSetTimeoutsReply") + api.RegisterMessage((*NatSetWorkers)(nil), "nat.NatSetWorkers") + api.RegisterMessage((*NatSetWorkersReply)(nil), "nat.NatSetWorkersReply") + api.RegisterMessage((*NatShowConfig)(nil), "nat.NatShowConfig") + api.RegisterMessage((*NatShowConfigReply)(nil), "nat.NatShowConfigReply") + api.RegisterMessage((*NatWorkerDetails)(nil), "nat.NatWorkerDetails") + api.RegisterMessage((*NatWorkerDump)(nil), "nat.NatWorkerDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DsliteAddDelPoolAddrRange)(nil), + (*DsliteAddDelPoolAddrRangeReply)(nil), + (*DsliteAddressDetails)(nil), + (*DsliteAddressDump)(nil), + (*DsliteGetAftrAddr)(nil), + (*DsliteGetAftrAddrReply)(nil), + (*DsliteGetB4Addr)(nil), + (*DsliteGetB4AddrReply)(nil), + (*DsliteSetAftrAddr)(nil), + (*DsliteSetAftrAddrReply)(nil), + (*DsliteSetB4Addr)(nil), + (*DsliteSetB4AddrReply)(nil), + (*Nat44AddDelAddressRange)(nil), + (*Nat44AddDelAddressRangeReply)(nil), + (*Nat44AddDelIdentityMapping)(nil), + (*Nat44AddDelIdentityMappingReply)(nil), + (*Nat44AddDelInterfaceAddr)(nil), + (*Nat44AddDelInterfaceAddrReply)(nil), + (*Nat44AddDelLbStaticMapping)(nil), + (*Nat44AddDelLbStaticMappingReply)(nil), + (*Nat44AddDelStaticMapping)(nil), + (*Nat44AddDelStaticMappingReply)(nil), + (*Nat44AddressDetails)(nil), + (*Nat44AddressDump)(nil), + (*Nat44DelSession)(nil), + (*Nat44DelSessionReply)(nil), + (*Nat44ForwardingEnableDisable)(nil), + (*Nat44ForwardingEnableDisableReply)(nil), + (*Nat44ForwardingIsEnabled)(nil), + (*Nat44ForwardingIsEnabledReply)(nil), + (*Nat44IdentityMappingDetails)(nil), + (*Nat44IdentityMappingDump)(nil), + (*Nat44InterfaceAddDelFeature)(nil), + (*Nat44InterfaceAddDelFeatureReply)(nil), + (*Nat44InterfaceAddDelOutputFeature)(nil), + (*Nat44InterfaceAddDelOutputFeatureReply)(nil), + (*Nat44InterfaceAddrDetails)(nil), + (*Nat44InterfaceAddrDump)(nil), + (*Nat44InterfaceDetails)(nil), + (*Nat44InterfaceDump)(nil), + (*Nat44InterfaceOutputFeatureDetails)(nil), + (*Nat44InterfaceOutputFeatureDump)(nil), + (*Nat44LbStaticMappingAddDelLocal)(nil), + (*Nat44LbStaticMappingAddDelLocalReply)(nil), + (*Nat44LbStaticMappingDetails)(nil), + (*Nat44LbStaticMappingDump)(nil), + (*Nat44StaticMappingDetails)(nil), + (*Nat44StaticMappingDump)(nil), + (*Nat44UserDetails)(nil), + (*Nat44UserDump)(nil), + (*Nat44UserSessionDetails)(nil), + (*Nat44UserSessionDump)(nil), + (*Nat64AddDelInterface)(nil), + (*Nat64AddDelInterfaceAddr)(nil), + (*Nat64AddDelInterfaceAddrReply)(nil), + (*Nat64AddDelInterfaceReply)(nil), + (*Nat64AddDelPoolAddrRange)(nil), + (*Nat64AddDelPoolAddrRangeReply)(nil), + (*Nat64AddDelPrefix)(nil), + (*Nat64AddDelPrefixReply)(nil), + (*Nat64AddDelStaticBib)(nil), + (*Nat64AddDelStaticBibReply)(nil), + (*Nat64BibDetails)(nil), + (*Nat64BibDump)(nil), + (*Nat64InterfaceDetails)(nil), + (*Nat64InterfaceDump)(nil), + (*Nat64PoolAddrDetails)(nil), + (*Nat64PoolAddrDump)(nil), + (*Nat64PrefixDetails)(nil), + (*Nat64PrefixDump)(nil), + (*Nat64StDetails)(nil), + (*Nat64StDump)(nil), + (*Nat66AddDelInterface)(nil), + (*Nat66AddDelInterfaceReply)(nil), + (*Nat66AddDelStaticMapping)(nil), + (*Nat66AddDelStaticMappingReply)(nil), + (*Nat66InterfaceDetails)(nil), + (*Nat66InterfaceDump)(nil), + (*Nat66StaticMappingDetails)(nil), + (*Nat66StaticMappingDump)(nil), + (*NatControlPing)(nil), + (*NatControlPingReply)(nil), + (*NatDetAddDelMap)(nil), + (*NatDetAddDelMapReply)(nil), + (*NatDetCloseSessionIn)(nil), + (*NatDetCloseSessionInReply)(nil), + (*NatDetCloseSessionOut)(nil), + (*NatDetCloseSessionOutReply)(nil), + (*NatDetForward)(nil), + (*NatDetForwardReply)(nil), + (*NatDetMapDetails)(nil), + (*NatDetMapDump)(nil), + (*NatDetReverse)(nil), + (*NatDetReverseReply)(nil), + (*NatDetSessionDetails)(nil), + (*NatDetSessionDump)(nil), + (*NatGetAddrAndPortAllocAlg)(nil), + (*NatGetAddrAndPortAllocAlgReply)(nil), + (*NatGetMssClamping)(nil), + (*NatGetMssClampingReply)(nil), + (*NatGetReass)(nil), + (*NatGetReassReply)(nil), + (*NatGetTimeouts)(nil), + (*NatGetTimeoutsReply)(nil), + (*NatHaFlush)(nil), + (*NatHaFlushReply)(nil), + (*NatHaGetFailover)(nil), + (*NatHaGetFailoverReply)(nil), + (*NatHaGetListener)(nil), + (*NatHaGetListenerReply)(nil), + (*NatHaResync)(nil), + (*NatHaResyncCompletedEvent)(nil), + (*NatHaResyncReply)(nil), + (*NatHaSetFailover)(nil), + (*NatHaSetFailoverReply)(nil), + (*NatHaSetListener)(nil), + (*NatHaSetListenerReply)(nil), + (*NatIpfixEnableDisable)(nil), + (*NatIpfixEnableDisableReply)(nil), + (*NatReassDetails)(nil), + (*NatReassDump)(nil), + (*NatSetAddrAndPortAllocAlg)(nil), + (*NatSetAddrAndPortAllocAlgReply)(nil), + (*NatSetLogLevel)(nil), + (*NatSetLogLevelReply)(nil), + (*NatSetMssClamping)(nil), + (*NatSetMssClampingReply)(nil), + (*NatSetReass)(nil), + (*NatSetReassReply)(nil), + (*NatSetTimeouts)(nil), + (*NatSetTimeoutsReply)(nil), + (*NatSetWorkers)(nil), + (*NatSetWorkersReply)(nil), + (*NatShowConfig)(nil), + (*NatShowConfigReply)(nil), + (*NatWorkerDetails)(nil), + (*NatWorkerDump)(nil), + } +} + +// RPCService represents RPC service API for nat module. +type RPCService interface { + DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) + DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) + DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) + DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) + DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) + DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) + DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) + DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) + DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) + DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) + DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) + DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) + DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) + DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) + DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) + DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) + DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) + DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) + DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) + DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) + DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) + DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) + DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) + DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) + DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) + DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) + Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) + Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) + Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) + Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) + Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) + Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) + Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) + Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) + Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) + Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) + Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) + Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) + Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) + Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) + Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) + Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) + Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) + Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) + NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) + NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) + NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) + NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) + NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) + NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) + NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) + NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) + NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) + NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) + NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) + NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) + NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) + NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) + NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) + NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) + NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) + NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) + NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) + NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) + NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) + NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) + NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) + NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpDsliteAddress(ctx context.Context, in *DsliteAddressDump) (RPCService_DumpDsliteAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpDsliteAddressClient{stream} + return x, nil +} + +type RPCService_DumpDsliteAddressClient interface { + Recv() (*DsliteAddressDetails, error) +} + +type serviceClient_DumpDsliteAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpDsliteAddressClient) Recv() (*DsliteAddressDetails, error) { + m := new(DsliteAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Address(ctx context.Context, in *Nat44AddressDump) (RPCService_DumpNat44AddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44AddressClient{stream} + return x, nil +} + +type RPCService_DumpNat44AddressClient interface { + Recv() (*Nat44AddressDetails, error) +} + +type serviceClient_DumpNat44AddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44AddressClient) Recv() (*Nat44AddressDetails, error) { + m := new(Nat44AddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44IdentityMapping(ctx context.Context, in *Nat44IdentityMappingDump) (RPCService_DumpNat44IdentityMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44IdentityMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44IdentityMappingClient interface { + Recv() (*Nat44IdentityMappingDetails, error) +} + +type serviceClient_DumpNat44IdentityMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44IdentityMappingClient) Recv() (*Nat44IdentityMappingDetails, error) { + m := new(Nat44IdentityMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceAddr(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_DumpNat44InterfaceAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceAddrClient interface { + Recv() (*Nat44InterfaceAddrDetails, error) +} + +type serviceClient_DumpNat44InterfaceAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceAddrClient) Recv() (*Nat44InterfaceAddrDetails, error) { + m := new(Nat44InterfaceAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44Interface(ctx context.Context, in *Nat44InterfaceDump) (RPCService_DumpNat44InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceClient interface { + Recv() (*Nat44InterfaceDetails, error) +} + +type serviceClient_DumpNat44InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceClient) Recv() (*Nat44InterfaceDetails, error) { + m := new(Nat44InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44InterfaceOutputFeature(ctx context.Context, in *Nat44InterfaceOutputFeatureDump) (RPCService_DumpNat44InterfaceOutputFeatureClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44InterfaceOutputFeatureClient{stream} + return x, nil +} + +type RPCService_DumpNat44InterfaceOutputFeatureClient interface { + Recv() (*Nat44InterfaceOutputFeatureDetails, error) +} + +type serviceClient_DumpNat44InterfaceOutputFeatureClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44InterfaceOutputFeatureClient) Recv() (*Nat44InterfaceOutputFeatureDetails, error) { + m := new(Nat44InterfaceOutputFeatureDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44LbStaticMapping(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_DumpNat44LbStaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44LbStaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44LbStaticMappingClient interface { + Recv() (*Nat44LbStaticMappingDetails, error) +} + +type serviceClient_DumpNat44LbStaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44LbStaticMappingClient) Recv() (*Nat44LbStaticMappingDetails, error) { + m := new(Nat44LbStaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44StaticMapping(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_DumpNat44StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat44StaticMappingClient interface { + Recv() (*Nat44StaticMappingDetails, error) +} + +type serviceClient_DumpNat44StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44StaticMappingClient) Recv() (*Nat44StaticMappingDetails, error) { + m := new(Nat44StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44User(ctx context.Context, in *Nat44UserDump) (RPCService_DumpNat44UserClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserClient interface { + Recv() (*Nat44UserDetails, error) +} + +type serviceClient_DumpNat44UserClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserClient) Recv() (*Nat44UserDetails, error) { + m := new(Nat44UserDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat44UserSession(ctx context.Context, in *Nat44UserSessionDump) (RPCService_DumpNat44UserSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat44UserSessionClient{stream} + return x, nil +} + +type RPCService_DumpNat44UserSessionClient interface { + Recv() (*Nat44UserSessionDetails, error) +} + +type serviceClient_DumpNat44UserSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat44UserSessionClient) Recv() (*Nat44UserSessionDetails, error) { + m := new(Nat44UserSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Bib(ctx context.Context, in *Nat64BibDump) (RPCService_DumpNat64BibClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64BibClient{stream} + return x, nil +} + +type RPCService_DumpNat64BibClient interface { + Recv() (*Nat64BibDetails, error) +} + +type serviceClient_DumpNat64BibClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64BibClient) Recv() (*Nat64BibDetails, error) { + m := new(Nat64BibDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Interface(ctx context.Context, in *Nat64InterfaceDump) (RPCService_DumpNat64InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat64InterfaceClient interface { + Recv() (*Nat64InterfaceDetails, error) +} + +type serviceClient_DumpNat64InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64InterfaceClient) Recv() (*Nat64InterfaceDetails, error) { + m := new(Nat64InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64PoolAddr(ctx context.Context, in *Nat64PoolAddrDump) (RPCService_DumpNat64PoolAddrClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PoolAddrClient{stream} + return x, nil +} + +type RPCService_DumpNat64PoolAddrClient interface { + Recv() (*Nat64PoolAddrDetails, error) +} + +type serviceClient_DumpNat64PoolAddrClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PoolAddrClient) Recv() (*Nat64PoolAddrDetails, error) { + m := new(Nat64PoolAddrDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64Prefix(ctx context.Context, in *Nat64PrefixDump) (RPCService_DumpNat64PrefixClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64PrefixClient{stream} + return x, nil +} + +type RPCService_DumpNat64PrefixClient interface { + Recv() (*Nat64PrefixDetails, error) +} + +type serviceClient_DumpNat64PrefixClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64PrefixClient) Recv() (*Nat64PrefixDetails, error) { + m := new(Nat64PrefixDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat64St(ctx context.Context, in *Nat64StDump) (RPCService_DumpNat64StClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat64StClient{stream} + return x, nil +} + +type RPCService_DumpNat64StClient interface { + Recv() (*Nat64StDetails, error) +} + +type serviceClient_DumpNat64StClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat64StClient) Recv() (*Nat64StDetails, error) { + m := new(Nat64StDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat66Interface(ctx context.Context, in *Nat66InterfaceDump) (RPCService_DumpNat66InterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66InterfaceClient{stream} + return x, nil +} + +type RPCService_DumpNat66InterfaceClient interface { + Recv() (*Nat66InterfaceDetails, error) +} + +type serviceClient_DumpNat66InterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66InterfaceClient) Recv() (*Nat66InterfaceDetails, error) { + m := new(Nat66InterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNat66StaticMapping(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_DumpNat66StaticMappingClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNat66StaticMappingClient{stream} + return x, nil +} + +type RPCService_DumpNat66StaticMappingClient interface { + Recv() (*Nat66StaticMappingDetails, error) +} + +type serviceClient_DumpNat66StaticMappingClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNat66StaticMappingClient) Recv() (*Nat66StaticMappingDetails, error) { + m := new(Nat66StaticMappingDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetMap(ctx context.Context, in *NatDetMapDump) (RPCService_DumpNatDetMapClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetMapClient{stream} + return x, nil +} + +type RPCService_DumpNatDetMapClient interface { + Recv() (*NatDetMapDetails, error) +} + +type serviceClient_DumpNatDetMapClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetMapClient) Recv() (*NatDetMapDetails, error) { + m := new(NatDetMapDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatDetSession(ctx context.Context, in *NatDetSessionDump) (RPCService_DumpNatDetSessionClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatDetSessionClient{stream} + return x, nil +} + +type RPCService_DumpNatDetSessionClient interface { + Recv() (*NatDetSessionDetails, error) +} + +type serviceClient_DumpNatDetSessionClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatDetSessionClient) Recv() (*NatDetSessionDetails, error) { + m := new(NatDetSessionDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatReass(ctx context.Context, in *NatReassDump) (RPCService_DumpNatReassClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatReassClient{stream} + return x, nil +} + +type RPCService_DumpNatReassClient interface { + Recv() (*NatReassDetails, error) +} + +type serviceClient_DumpNatReassClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatReassClient) Recv() (*NatReassDetails, error) { + m := new(NatReassDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpNatWorker(ctx context.Context, in *NatWorkerDump) (RPCService_DumpNatWorkerClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpNatWorkerClient{stream} + return x, nil +} + +type RPCService_DumpNatWorkerClient interface { + Recv() (*NatWorkerDetails, error) +} + +type serviceClient_DumpNatWorkerClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpNatWorkerClient) Recv() (*NatWorkerDetails, error) { + m := new(NatWorkerDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) { + out := new(DsliteAddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) { + out := new(DsliteGetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { + out := new(DsliteGetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { + out := new(DsliteSetAftrAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { + out := new(DsliteSetB4AddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) { + out := new(Nat44AddDelAddressRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { + out := new(Nat44AddDelIdentityMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { + out := new(Nat44AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { + out := new(Nat44AddDelLbStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { + out := new(Nat44AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession) (*Nat44DelSessionReply, error) { + out := new(Nat44DelSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { + out := new(Nat44ForwardingEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { + out := new(Nat44ForwardingIsEnabledReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat44InterfaceAddDelFeature) (*Nat44InterfaceAddDelFeatureReply, error) { + out := new(Nat44InterfaceAddDelFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { + out := new(Nat44InterfaceAddDelOutputFeatureReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in *Nat44LbStaticMappingAddDelLocal) (*Nat44LbStaticMappingAddDelLocalReply, error) { + out := new(Nat44LbStaticMappingAddDelLocalReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDelInterface) (*Nat64AddDelInterfaceReply, error) { + out := new(Nat64AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { + out := new(Nat64AddDelInterfaceAddrReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { + out := new(Nat64AddDelPoolAddrRangeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { + out := new(Nat64AddDelPrefixReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { + out := new(Nat64AddDelStaticBibReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) { + out := new(Nat66AddDelInterfaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { + out := new(Nat66AddDelStaticMappingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) (*NatControlPingReply, error) { + out := new(NatControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { + out := new(NatDetAddDelMapReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { + out := new(NatDetCloseSessionInReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { + out := new(NatDetCloseSessionOutReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { + out := new(NatDetForwardReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (*NatDetReverseReply, error) { + out := new(NatDetReverseReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGetAddrAndPortAllocAlg) (*NatGetAddrAndPortAllocAlgReply, error) { + out := new(NatGetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { + out := new(NatGetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetReass(ctx context.Context, in *NatGetReass) (*NatGetReassReply, error) { + out := new(NatGetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { + out := new(NatGetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) { + out := new(NatHaFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) { + out := new(NatHaGetFailoverReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) { + out := new(NatHaGetListenerReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) { + out := new(NatHaResyncReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) { + out := new(NatHaSetFailoverReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) { + out := new(NatHaSetListenerReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { + out := new(NatIpfixEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { + out := new(NatSetAddrAndPortAllocAlgReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) { + out := new(NatSetLogLevelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { + out := new(NatSetMssClampingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetReass(ctx context.Context, in *NatSetReass) (*NatSetReassReply, error) { + out := new(NatSetReassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { + out := new(NatSetTimeoutsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { + out := new(NatSetWorkersReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { + out := new(NatShowConfigReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/punt/punt.ba.go b/plugins/vpp/binapi/vpp1908/punt/punt.ba.go new file mode 100644 index 0000000000..a835d26f81 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/punt/punt.ba.go @@ -0,0 +1,775 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/punt.api.json + +/* +Package punt is a generated VPP binary API for 'punt' module. + +It consists of: + 5 enums + 2 aliases + 11 types + 2 unions + 10 messages + 5 services +*/ +package punt + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "punt" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xd16c6294 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", +} + +var AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, +} + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", +} + +var IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, +} + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", +} + +var IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, +} + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", +} + +var IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, +} + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// PuntType represents VPP binary API enum 'punt_type'. +type PuntType uint32 + +const ( + PUNT_API_TYPE_L4 PuntType = 1 + PUNT_API_TYPE_IP_PROTO PuntType = 2 + PUNT_API_TYPE_EXCEPTION PuntType = 3 +) + +var PuntType_name = map[uint32]string{ + 1: "PUNT_API_TYPE_L4", + 2: "PUNT_API_TYPE_IP_PROTO", + 3: "PUNT_API_TYPE_EXCEPTION", +} + +var PuntType_value = map[string]uint32{ + "PUNT_API_TYPE_L4": 1, + "PUNT_API_TYPE_IP_PROTO": 2, + "PUNT_API_TYPE_EXCEPTION": 3, +} + +func (x PuntType) String() string { + s, ok := PuntType_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily + Un AddressUnion +} + +func (*Address) GetTypeName() string { + return "address" +} + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address + Len uint8 +} + +func (*IP4Prefix) GetTypeName() string { + return "ip4_prefix" +} + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address + Len uint8 +} + +func (*IP6Prefix) GetTypeName() string { + return "ip6_prefix" +} + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily + GrpAddressLength uint16 + GrpAddress AddressUnion + SrcAddress AddressUnion +} + +func (*Mprefix) GetTypeName() string { + return "mprefix" +} + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address + Len uint8 +} + +func (*Prefix) GetTypeName() string { + return "prefix" +} + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 + Ge uint8 +} + +func (*PrefixMatcher) GetTypeName() string { + return "prefix_matcher" +} + +// Punt represents VPP binary API type 'punt'. +type Punt struct { + Type PuntType + Punt PuntUnion +} + +func (*Punt) GetTypeName() string { + return "punt" +} + +// PuntException represents VPP binary API type 'punt_exception'. +type PuntException struct { + ID uint32 +} + +func (*PuntException) GetTypeName() string { + return "punt_exception" +} + +// PuntIPProto represents VPP binary API type 'punt_ip_proto'. +type PuntIPProto struct { + Af AddressFamily + Protocol IPProto +} + +func (*PuntIPProto) GetTypeName() string { + return "punt_ip_proto" +} + +// PuntL4 represents VPP binary API type 'punt_l4'. +type PuntL4 struct { + Af AddressFamily + Protocol IPProto + Port uint16 +} + +func (*PuntL4) GetTypeName() string { + return "punt_l4" +} + +// PuntReason represents VPP binary API type 'punt_reason'. +type PuntReason struct { + ID uint32 + XXX_NameLen uint32 `struc:"sizeof=Name"` + Name string +} + +func (*PuntReason) GetTypeName() string { + return "punt_reason" +} + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { + return "address_union" +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// PuntUnion represents VPP binary API union 'punt_union'. +type PuntUnion struct { + XXX_UnionData [10]byte +} + +func (*PuntUnion) GetTypeName() string { + return "punt_union" +} + +func PuntUnionException(a PuntException) (u PuntUnion) { + u.SetException(a) + return +} +func (u *PuntUnion) SetException(a PuntException) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *PuntUnion) GetException() (a PuntException) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func PuntUnionL4(a PuntL4) (u PuntUnion) { + u.SetL4(a) + return +} +func (u *PuntUnion) SetL4(a PuntL4) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *PuntUnion) GetL4() (a PuntL4) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) { + u.SetIPProto(a) + return +} +func (u *PuntUnion) SetIPProto(a PuntIPProto) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *PuntUnion) GetIPProto() (a PuntIPProto) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// PuntReasonDetails represents VPP binary API message 'punt_reason_details'. +type PuntReasonDetails struct { + Reason PuntReason +} + +func (*PuntReasonDetails) GetMessageName() string { + return "punt_reason_details" +} +func (*PuntReasonDetails) GetCrcString() string { + return "aa3dd9e5" +} +func (*PuntReasonDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// PuntReasonDump represents VPP binary API message 'punt_reason_dump'. +type PuntReasonDump struct { + Reason PuntReason +} + +func (*PuntReasonDump) GetMessageName() string { + return "punt_reason_dump" +} +func (*PuntReasonDump) GetCrcString() string { + return "bf8f10da" +} +func (*PuntReasonDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// PuntSocketDeregister represents VPP binary API message 'punt_socket_deregister'. +type PuntSocketDeregister struct { + Punt Punt +} + +func (*PuntSocketDeregister) GetMessageName() string { + return "punt_socket_deregister" +} +func (*PuntSocketDeregister) GetCrcString() string { + return "98a444f4" +} +func (*PuntSocketDeregister) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// PuntSocketDeregisterReply represents VPP binary API message 'punt_socket_deregister_reply'. +type PuntSocketDeregisterReply struct { + Retval int32 +} + +func (*PuntSocketDeregisterReply) GetMessageName() string { + return "punt_socket_deregister_reply" +} +func (*PuntSocketDeregisterReply) GetCrcString() string { + return "e8d4e804" +} +func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// PuntSocketDetails represents VPP binary API message 'punt_socket_details'. +type PuntSocketDetails struct { + Punt Punt + Pathname []byte `struc:"[108]byte"` +} + +func (*PuntSocketDetails) GetMessageName() string { + return "punt_socket_details" +} +func (*PuntSocketDetails) GetCrcString() string { + return "25100aad" +} +func (*PuntSocketDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// PuntSocketDump represents VPP binary API message 'punt_socket_dump'. +type PuntSocketDump struct { + Type PuntType +} + +func (*PuntSocketDump) GetMessageName() string { + return "punt_socket_dump" +} +func (*PuntSocketDump) GetCrcString() string { + return "52974935" +} +func (*PuntSocketDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// PuntSocketRegister represents VPP binary API message 'punt_socket_register'. +type PuntSocketRegister struct { + HeaderVersion uint32 + Punt Punt + Pathname []byte `struc:"[108]byte"` +} + +func (*PuntSocketRegister) GetMessageName() string { + return "punt_socket_register" +} +func (*PuntSocketRegister) GetCrcString() string { + return "ddc0d8e0" +} +func (*PuntSocketRegister) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// PuntSocketRegisterReply represents VPP binary API message 'punt_socket_register_reply'. +type PuntSocketRegisterReply struct { + Retval int32 + Pathname []byte `struc:"[64]byte"` +} + +func (*PuntSocketRegisterReply) GetMessageName() string { + return "punt_socket_register_reply" +} +func (*PuntSocketRegisterReply) GetCrcString() string { + return "42dc0ee6" +} +func (*PuntSocketRegisterReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SetPunt represents VPP binary API message 'set_punt'. +type SetPunt struct { + IsAdd uint8 + Punt Punt +} + +func (*SetPunt) GetMessageName() string { + return "set_punt" +} +func (*SetPunt) GetCrcString() string { + return "032a42ef" +} +func (*SetPunt) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SetPuntReply represents VPP binary API message 'set_punt_reply'. +type SetPuntReply struct { + Retval int32 +} + +func (*SetPuntReply) GetMessageName() string { + return "set_punt_reply" +} +func (*SetPuntReply) GetCrcString() string { + return "e8d4e804" +} +func (*SetPuntReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*PuntReasonDetails)(nil), "punt.PuntReasonDetails") + api.RegisterMessage((*PuntReasonDump)(nil), "punt.PuntReasonDump") + api.RegisterMessage((*PuntSocketDeregister)(nil), "punt.PuntSocketDeregister") + api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt.PuntSocketDeregisterReply") + api.RegisterMessage((*PuntSocketDetails)(nil), "punt.PuntSocketDetails") + api.RegisterMessage((*PuntSocketDump)(nil), "punt.PuntSocketDump") + api.RegisterMessage((*PuntSocketRegister)(nil), "punt.PuntSocketRegister") + api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt.PuntSocketRegisterReply") + api.RegisterMessage((*SetPunt)(nil), "punt.SetPunt") + api.RegisterMessage((*SetPuntReply)(nil), "punt.SetPuntReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PuntReasonDetails)(nil), + (*PuntReasonDump)(nil), + (*PuntSocketDeregister)(nil), + (*PuntSocketDeregisterReply)(nil), + (*PuntSocketDetails)(nil), + (*PuntSocketDump)(nil), + (*PuntSocketRegister)(nil), + (*PuntSocketRegisterReply)(nil), + (*SetPunt)(nil), + (*SetPuntReply)(nil), + } +} + +// RPCService represents RPC service API for punt module. +type RPCService interface { + DumpPuntReason(ctx context.Context, in *PuntReasonDump) (RPCService_DumpPuntReasonClient, error) + DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) + PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) + PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) + SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpPuntReason(ctx context.Context, in *PuntReasonDump) (RPCService_DumpPuntReasonClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntReasonClient{stream} + return x, nil +} + +type RPCService_DumpPuntReasonClient interface { + Recv() (*PuntReasonDetails, error) +} + +type serviceClient_DumpPuntReasonClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpPuntReasonClient) Recv() (*PuntReasonDetails, error) { + m := new(PuntReasonDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpPuntSocket(ctx context.Context, in *PuntSocketDump) (RPCService_DumpPuntSocketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpPuntSocketClient{stream} + return x, nil +} + +type RPCService_DumpPuntSocketClient interface { + Recv() (*PuntSocketDetails, error) +} + +type serviceClient_DumpPuntSocketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpPuntSocketClient) Recv() (*PuntSocketDetails, error) { + m := new(PuntSocketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) { + out := new(PuntSocketDeregisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRegister) (*PuntSocketRegisterReply, error) { + out := new(PuntSocketRegisterReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { + out := new(SetPuntReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/session/session.ba.go b/plugins/vpp/binapi/vpp1908/session/session.ba.go new file mode 100644 index 0000000000..d00913609d --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/session/session.ba.go @@ -0,0 +1,995 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/session.api.json + +/* +Package session is a generated VPP binary API for 'session' module. + +It consists of: + 38 messages + 19 services +*/ +package session + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "session" + // APIVersion is the API version of this module. + APIVersion = "1.6.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x9570a9fb +) + +// AppCutThroughRegistrationAdd represents VPP binary API message 'app_cut_through_registration_add'. +type AppCutThroughRegistrationAdd struct { + EvtQAddress uint64 + PeerEvtQAddress uint64 + WrkIndex uint32 + NFds uint8 + FdFlags uint8 +} + +func (*AppCutThroughRegistrationAdd) GetMessageName() string { + return "app_cut_through_registration_add" +} +func (*AppCutThroughRegistrationAdd) GetCrcString() string { + return "6d73b1b9" +} +func (*AppCutThroughRegistrationAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AppCutThroughRegistrationAddReply represents VPP binary API message 'app_cut_through_registration_add_reply'. +type AppCutThroughRegistrationAddReply struct { + Retval int32 +} + +func (*AppCutThroughRegistrationAddReply) GetMessageName() string { + return "app_cut_through_registration_add_reply" +} +func (*AppCutThroughRegistrationAddReply) GetCrcString() string { + return "e8d4e804" +} +func (*AppCutThroughRegistrationAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AppNamespaceAddDel represents VPP binary API message 'app_namespace_add_del'. +type AppNamespaceAddDel struct { + Secret uint64 + SwIfIndex uint32 + IP4FibID uint32 + IP6FibID uint32 + NamespaceIDLen uint8 + NamespaceID []byte `struc:"[64]byte"` +} + +func (*AppNamespaceAddDel) GetMessageName() string { + return "app_namespace_add_del" +} +func (*AppNamespaceAddDel) GetCrcString() string { + return "dd074c65" +} +func (*AppNamespaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AppNamespaceAddDelReply represents VPP binary API message 'app_namespace_add_del_reply'. +type AppNamespaceAddDelReply struct { + Retval int32 + AppnsIndex uint32 +} + +func (*AppNamespaceAddDelReply) GetMessageName() string { + return "app_namespace_add_del_reply" +} +func (*AppNamespaceAddDelReply) GetCrcString() string { + return "85137120" +} +func (*AppNamespaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// AppWorkerAddDel represents VPP binary API message 'app_worker_add_del'. +type AppWorkerAddDel struct { + AppIndex uint32 + WrkIndex uint32 + IsAdd uint8 +} + +func (*AppWorkerAddDel) GetMessageName() string { + return "app_worker_add_del" +} +func (*AppWorkerAddDel) GetCrcString() string { + return "6d2b2279" +} +func (*AppWorkerAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AppWorkerAddDelReply represents VPP binary API message 'app_worker_add_del_reply'. +type AppWorkerAddDelReply struct { + Retval int32 + WrkIndex uint32 + AppEventQueueAddress uint64 + NFds uint8 + FdFlags uint8 + SegmentNameLength uint8 + SegmentName []byte `struc:"[128]byte"` + SegmentHandle uint64 + IsAdd uint8 +} + +func (*AppWorkerAddDelReply) GetMessageName() string { + return "app_worker_add_del_reply" +} +func (*AppWorkerAddDelReply) GetCrcString() string { + return "56b21abc" +} +func (*AppWorkerAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ApplicationAttach represents VPP binary API message 'application_attach'. +type ApplicationAttach struct { + InitialSegmentSize uint32 + Options []uint64 `struc:"[16]uint64"` + NamespaceIDLen uint8 + NamespaceID []byte `struc:"[64]byte"` +} + +func (*ApplicationAttach) GetMessageName() string { + return "application_attach" +} +func (*ApplicationAttach) GetCrcString() string { + return "81d4f974" +} +func (*ApplicationAttach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ApplicationAttachReply represents VPP binary API message 'application_attach_reply'. +type ApplicationAttachReply struct { + Retval int32 + AppEventQueueAddress uint64 + NFds uint8 + FdFlags uint8 + SegmentSize uint32 + SegmentNameLength uint8 + SegmentName []byte `struc:"[128]byte"` + AppIndex uint32 + SegmentHandle uint64 +} + +func (*ApplicationAttachReply) GetMessageName() string { + return "application_attach_reply" +} +func (*ApplicationAttachReply) GetCrcString() string { + return "581866e8" +} +func (*ApplicationAttachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ApplicationDetach represents VPP binary API message 'application_detach'. +type ApplicationDetach struct{} + +func (*ApplicationDetach) GetMessageName() string { + return "application_detach" +} +func (*ApplicationDetach) GetCrcString() string { + return "51077d14" +} +func (*ApplicationDetach) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ApplicationDetachReply represents VPP binary API message 'application_detach_reply'. +type ApplicationDetachReply struct { + Retval int32 +} + +func (*ApplicationDetachReply) GetMessageName() string { + return "application_detach_reply" +} +func (*ApplicationDetachReply) GetCrcString() string { + return "e8d4e804" +} +func (*ApplicationDetachReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ApplicationTLSCertAdd represents VPP binary API message 'application_tls_cert_add'. +type ApplicationTLSCertAdd struct { + AppIndex uint32 + CertLen uint16 `struc:"sizeof=Cert"` + Cert []byte +} + +func (*ApplicationTLSCertAdd) GetMessageName() string { + return "application_tls_cert_add" +} +func (*ApplicationTLSCertAdd) GetCrcString() string { + return "3f5cfe45" +} +func (*ApplicationTLSCertAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ApplicationTLSCertAddReply represents VPP binary API message 'application_tls_cert_add_reply'. +type ApplicationTLSCertAddReply struct { + Retval int32 +} + +func (*ApplicationTLSCertAddReply) GetMessageName() string { + return "application_tls_cert_add_reply" +} +func (*ApplicationTLSCertAddReply) GetCrcString() string { + return "e8d4e804" +} +func (*ApplicationTLSCertAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ApplicationTLSKeyAdd represents VPP binary API message 'application_tls_key_add'. +type ApplicationTLSKeyAdd struct { + AppIndex uint32 + KeyLen uint16 `struc:"sizeof=Key"` + Key []byte +} + +func (*ApplicationTLSKeyAdd) GetMessageName() string { + return "application_tls_key_add" +} +func (*ApplicationTLSKeyAdd) GetCrcString() string { + return "5eaf70cd" +} +func (*ApplicationTLSKeyAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ApplicationTLSKeyAddReply represents VPP binary API message 'application_tls_key_add_reply'. +type ApplicationTLSKeyAddReply struct { + Retval int32 +} + +func (*ApplicationTLSKeyAddReply) GetMessageName() string { + return "application_tls_key_add_reply" +} +func (*ApplicationTLSKeyAddReply) GetCrcString() string { + return "e8d4e804" +} +func (*ApplicationTLSKeyAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BindSock represents VPP binary API message 'bind_sock'. +type BindSock struct { + WrkIndex uint32 + Vrf uint32 + IsIP4 uint8 + IP []byte `struc:"[16]byte"` + Port uint16 + Proto uint8 + Options []uint64 `struc:"[16]uint64"` +} + +func (*BindSock) GetMessageName() string { + return "bind_sock" +} +func (*BindSock) GetCrcString() string { + return "0394633f" +} +func (*BindSock) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BindSockReply represents VPP binary API message 'bind_sock_reply'. +type BindSockReply struct { + Retval int32 +} + +func (*BindSockReply) GetMessageName() string { + return "bind_sock_reply" +} +func (*BindSockReply) GetCrcString() string { + return "e8d4e804" +} +func (*BindSockReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// BindURI represents VPP binary API message 'bind_uri'. +type BindURI struct { + AcceptCookie uint32 + URI []byte `struc:"[128]byte"` +} + +func (*BindURI) GetMessageName() string { + return "bind_uri" +} +func (*BindURI) GetCrcString() string { + return "fae140cb" +} +func (*BindURI) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// BindURIReply represents VPP binary API message 'bind_uri_reply'. +type BindURIReply struct { + Retval int32 +} + +func (*BindURIReply) GetMessageName() string { + return "bind_uri_reply" +} +func (*BindURIReply) GetCrcString() string { + return "e8d4e804" +} +func (*BindURIReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ConnectSock represents VPP binary API message 'connect_sock'. +type ConnectSock struct { + WrkIndex uint32 + ClientQueueAddress uint64 + Options []uint64 `struc:"[16]uint64"` + Vrf uint32 + IsIP4 uint8 + IP []byte `struc:"[16]byte"` + Port uint16 + Proto uint8 + HostnameLen uint8 `struc:"sizeof=Hostname"` + Hostname []byte + ParentHandle uint64 +} + +func (*ConnectSock) GetMessageName() string { + return "connect_sock" +} +func (*ConnectSock) GetCrcString() string { + return "af27d10c" +} +func (*ConnectSock) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ConnectSockReply represents VPP binary API message 'connect_sock_reply'. +type ConnectSockReply struct { + Retval int32 +} + +func (*ConnectSockReply) GetMessageName() string { + return "connect_sock_reply" +} +func (*ConnectSockReply) GetCrcString() string { + return "e8d4e804" +} +func (*ConnectSockReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ConnectURI represents VPP binary API message 'connect_uri'. +type ConnectURI struct { + ClientQueueAddress uint64 + Options []uint64 `struc:"[16]uint64"` + URI []byte `struc:"[128]byte"` +} + +func (*ConnectURI) GetMessageName() string { + return "connect_uri" +} +func (*ConnectURI) GetCrcString() string { + return "a36143d6" +} +func (*ConnectURI) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ConnectURIReply represents VPP binary API message 'connect_uri_reply'. +type ConnectURIReply struct { + Retval int32 +} + +func (*ConnectURIReply) GetMessageName() string { + return "connect_uri_reply" +} +func (*ConnectURIReply) GetCrcString() string { + return "e8d4e804" +} +func (*ConnectURIReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// DisconnectSession represents VPP binary API message 'disconnect_session'. +type DisconnectSession struct { + Handle uint64 +} + +func (*DisconnectSession) GetMessageName() string { + return "disconnect_session" +} +func (*DisconnectSession) GetCrcString() string { + return "7279205b" +} +func (*DisconnectSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// DisconnectSessionReply represents VPP binary API message 'disconnect_session_reply'. +type DisconnectSessionReply struct { + Retval int32 + Handle uint64 +} + +func (*DisconnectSessionReply) GetMessageName() string { + return "disconnect_session_reply" +} +func (*DisconnectSessionReply) GetCrcString() string { + return "d6960a03" +} +func (*DisconnectSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// MapAnotherSegment represents VPP binary API message 'map_another_segment'. +type MapAnotherSegment struct { + FdFlags uint8 + SegmentSize uint32 + SegmentName []byte `struc:"[128]byte"` + SegmentHandle uint64 +} + +func (*MapAnotherSegment) GetMessageName() string { + return "map_another_segment" +} +func (*MapAnotherSegment) GetCrcString() string { + return "dc2d630b" +} +func (*MapAnotherSegment) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// MapAnotherSegmentReply represents VPP binary API message 'map_another_segment_reply'. +type MapAnotherSegmentReply struct { + Retval int32 +} + +func (*MapAnotherSegmentReply) GetMessageName() string { + return "map_another_segment_reply" +} +func (*MapAnotherSegmentReply) GetCrcString() string { + return "e8d4e804" +} +func (*MapAnotherSegmentReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SessionEnableDisable represents VPP binary API message 'session_enable_disable'. +type SessionEnableDisable struct { + IsEnable uint8 +} + +func (*SessionEnableDisable) GetMessageName() string { + return "session_enable_disable" +} +func (*SessionEnableDisable) GetCrcString() string { + return "30ac9be7" +} +func (*SessionEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SessionEnableDisableReply represents VPP binary API message 'session_enable_disable_reply'. +type SessionEnableDisableReply struct { + Retval int32 +} + +func (*SessionEnableDisableReply) GetMessageName() string { + return "session_enable_disable_reply" +} +func (*SessionEnableDisableReply) GetCrcString() string { + return "e8d4e804" +} +func (*SessionEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SessionRuleAddDel represents VPP binary API message 'session_rule_add_del'. +type SessionRuleAddDel struct { + TransportProto uint8 + IsIP4 uint8 + LclIP []byte `struc:"[16]byte"` + LclPlen uint8 + RmtIP []byte `struc:"[16]byte"` + RmtPlen uint8 + LclPort uint16 + RmtPort uint16 + ActionIndex uint32 + IsAdd uint8 + AppnsIndex uint32 + Scope uint8 + Tag []byte `struc:"[64]byte"` +} + +func (*SessionRuleAddDel) GetMessageName() string { + return "session_rule_add_del" +} +func (*SessionRuleAddDel) GetCrcString() string { + return "4ab2eb06" +} +func (*SessionRuleAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SessionRuleAddDelReply represents VPP binary API message 'session_rule_add_del_reply'. +type SessionRuleAddDelReply struct { + Retval int32 +} + +func (*SessionRuleAddDelReply) GetMessageName() string { + return "session_rule_add_del_reply" +} +func (*SessionRuleAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*SessionRuleAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SessionRulesDetails represents VPP binary API message 'session_rules_details'. +type SessionRulesDetails struct { + TransportProto uint8 + IsIP4 uint8 + LclIP []byte `struc:"[16]byte"` + LclPlen uint8 + RmtIP []byte `struc:"[16]byte"` + RmtPlen uint8 + LclPort uint16 + RmtPort uint16 + ActionIndex uint32 + AppnsIndex uint32 + Scope uint8 + Tag []byte `struc:"[64]byte"` +} + +func (*SessionRulesDetails) GetMessageName() string { + return "session_rules_details" +} +func (*SessionRulesDetails) GetCrcString() string { + return "a52b0e96" +} +func (*SessionRulesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SessionRulesDump represents VPP binary API message 'session_rules_dump'. +type SessionRulesDump struct{} + +func (*SessionRulesDump) GetMessageName() string { + return "session_rules_dump" +} +func (*SessionRulesDump) GetCrcString() string { + return "51077d14" +} +func (*SessionRulesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// UnbindSock represents VPP binary API message 'unbind_sock'. +type UnbindSock struct { + WrkIndex uint32 + Handle uint64 +} + +func (*UnbindSock) GetMessageName() string { + return "unbind_sock" +} +func (*UnbindSock) GetCrcString() string { + return "08880908" +} +func (*UnbindSock) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// UnbindSockReply represents VPP binary API message 'unbind_sock_reply'. +type UnbindSockReply struct { + Retval int32 +} + +func (*UnbindSockReply) GetMessageName() string { + return "unbind_sock_reply" +} +func (*UnbindSockReply) GetCrcString() string { + return "e8d4e804" +} +func (*UnbindSockReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// UnbindURI represents VPP binary API message 'unbind_uri'. +type UnbindURI struct { + URI []byte `struc:"[128]byte"` +} + +func (*UnbindURI) GetMessageName() string { + return "unbind_uri" +} +func (*UnbindURI) GetCrcString() string { + return "294cf07d" +} +func (*UnbindURI) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// UnbindURIReply represents VPP binary API message 'unbind_uri_reply'. +type UnbindURIReply struct { + Retval int32 +} + +func (*UnbindURIReply) GetMessageName() string { + return "unbind_uri_reply" +} +func (*UnbindURIReply) GetCrcString() string { + return "e8d4e804" +} +func (*UnbindURIReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// UnmapSegment represents VPP binary API message 'unmap_segment'. +type UnmapSegment struct { + SegmentHandle uint64 +} + +func (*UnmapSegment) GetMessageName() string { + return "unmap_segment" +} +func (*UnmapSegment) GetCrcString() string { + return "f77096f6" +} +func (*UnmapSegment) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// UnmapSegmentReply represents VPP binary API message 'unmap_segment_reply'. +type UnmapSegmentReply struct { + Retval int32 +} + +func (*UnmapSegmentReply) GetMessageName() string { + return "unmap_segment_reply" +} +func (*UnmapSegmentReply) GetCrcString() string { + return "e8d4e804" +} +func (*UnmapSegmentReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*AppCutThroughRegistrationAdd)(nil), "session.AppCutThroughRegistrationAdd") + api.RegisterMessage((*AppCutThroughRegistrationAddReply)(nil), "session.AppCutThroughRegistrationAddReply") + api.RegisterMessage((*AppNamespaceAddDel)(nil), "session.AppNamespaceAddDel") + api.RegisterMessage((*AppNamespaceAddDelReply)(nil), "session.AppNamespaceAddDelReply") + api.RegisterMessage((*AppWorkerAddDel)(nil), "session.AppWorkerAddDel") + api.RegisterMessage((*AppWorkerAddDelReply)(nil), "session.AppWorkerAddDelReply") + api.RegisterMessage((*ApplicationAttach)(nil), "session.ApplicationAttach") + api.RegisterMessage((*ApplicationAttachReply)(nil), "session.ApplicationAttachReply") + api.RegisterMessage((*ApplicationDetach)(nil), "session.ApplicationDetach") + api.RegisterMessage((*ApplicationDetachReply)(nil), "session.ApplicationDetachReply") + api.RegisterMessage((*ApplicationTLSCertAdd)(nil), "session.ApplicationTLSCertAdd") + api.RegisterMessage((*ApplicationTLSCertAddReply)(nil), "session.ApplicationTLSCertAddReply") + api.RegisterMessage((*ApplicationTLSKeyAdd)(nil), "session.ApplicationTLSKeyAdd") + api.RegisterMessage((*ApplicationTLSKeyAddReply)(nil), "session.ApplicationTLSKeyAddReply") + api.RegisterMessage((*BindSock)(nil), "session.BindSock") + api.RegisterMessage((*BindSockReply)(nil), "session.BindSockReply") + api.RegisterMessage((*BindURI)(nil), "session.BindURI") + api.RegisterMessage((*BindURIReply)(nil), "session.BindURIReply") + api.RegisterMessage((*ConnectSock)(nil), "session.ConnectSock") + api.RegisterMessage((*ConnectSockReply)(nil), "session.ConnectSockReply") + api.RegisterMessage((*ConnectURI)(nil), "session.ConnectURI") + api.RegisterMessage((*ConnectURIReply)(nil), "session.ConnectURIReply") + api.RegisterMessage((*DisconnectSession)(nil), "session.DisconnectSession") + api.RegisterMessage((*DisconnectSessionReply)(nil), "session.DisconnectSessionReply") + api.RegisterMessage((*MapAnotherSegment)(nil), "session.MapAnotherSegment") + api.RegisterMessage((*MapAnotherSegmentReply)(nil), "session.MapAnotherSegmentReply") + api.RegisterMessage((*SessionEnableDisable)(nil), "session.SessionEnableDisable") + api.RegisterMessage((*SessionEnableDisableReply)(nil), "session.SessionEnableDisableReply") + api.RegisterMessage((*SessionRuleAddDel)(nil), "session.SessionRuleAddDel") + api.RegisterMessage((*SessionRuleAddDelReply)(nil), "session.SessionRuleAddDelReply") + api.RegisterMessage((*SessionRulesDetails)(nil), "session.SessionRulesDetails") + api.RegisterMessage((*SessionRulesDump)(nil), "session.SessionRulesDump") + api.RegisterMessage((*UnbindSock)(nil), "session.UnbindSock") + api.RegisterMessage((*UnbindSockReply)(nil), "session.UnbindSockReply") + api.RegisterMessage((*UnbindURI)(nil), "session.UnbindURI") + api.RegisterMessage((*UnbindURIReply)(nil), "session.UnbindURIReply") + api.RegisterMessage((*UnmapSegment)(nil), "session.UnmapSegment") + api.RegisterMessage((*UnmapSegmentReply)(nil), "session.UnmapSegmentReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AppCutThroughRegistrationAdd)(nil), + (*AppCutThroughRegistrationAddReply)(nil), + (*AppNamespaceAddDel)(nil), + (*AppNamespaceAddDelReply)(nil), + (*AppWorkerAddDel)(nil), + (*AppWorkerAddDelReply)(nil), + (*ApplicationAttach)(nil), + (*ApplicationAttachReply)(nil), + (*ApplicationDetach)(nil), + (*ApplicationDetachReply)(nil), + (*ApplicationTLSCertAdd)(nil), + (*ApplicationTLSCertAddReply)(nil), + (*ApplicationTLSKeyAdd)(nil), + (*ApplicationTLSKeyAddReply)(nil), + (*BindSock)(nil), + (*BindSockReply)(nil), + (*BindURI)(nil), + (*BindURIReply)(nil), + (*ConnectSock)(nil), + (*ConnectSockReply)(nil), + (*ConnectURI)(nil), + (*ConnectURIReply)(nil), + (*DisconnectSession)(nil), + (*DisconnectSessionReply)(nil), + (*MapAnotherSegment)(nil), + (*MapAnotherSegmentReply)(nil), + (*SessionEnableDisable)(nil), + (*SessionEnableDisableReply)(nil), + (*SessionRuleAddDel)(nil), + (*SessionRuleAddDelReply)(nil), + (*SessionRulesDetails)(nil), + (*SessionRulesDump)(nil), + (*UnbindSock)(nil), + (*UnbindSockReply)(nil), + (*UnbindURI)(nil), + (*UnbindURIReply)(nil), + (*UnmapSegment)(nil), + (*UnmapSegmentReply)(nil), + } +} + +// RPCService represents RPC service API for session module. +type RPCService interface { + DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) + AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) + AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) + AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) + ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) + ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) + ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) + ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) + BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) + BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) + ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) + ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) + DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) + MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) + SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) + SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) + UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) + UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) + UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSessionRules(ctx context.Context, in *SessionRulesDump) (RPCService_DumpSessionRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSessionRulesClient{stream} + return x, nil +} + +type RPCService_DumpSessionRulesClient interface { + Recv() (*SessionRulesDetails, error) +} + +type serviceClient_DumpSessionRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSessionRulesClient) Recv() (*SessionRulesDetails, error) { + m := new(SessionRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) { + out := new(AppCutThroughRegistrationAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { + out := new(AppNamespaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { + out := new(AppWorkerAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) { + out := new(ApplicationAttachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { + out := new(ApplicationDetachReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { + out := new(ApplicationTLSCertAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { + out := new(ApplicationTLSKeyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) { + out := new(BindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) { + out := new(BindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) { + out := new(ConnectSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) { + out := new(ConnectURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) { + out := new(DisconnectSessionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) { + out := new(MapAnotherSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { + out := new(SessionEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { + out := new(SessionRuleAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) { + out := new(UnbindSockReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) { + out := new(UnbindURIReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) { + out := new(UnmapSegmentReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/sr.patch b/plugins/vpp/binapi/vpp1908/sr.patch new file mode 100644 index 0000000000..9a45537c24 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/sr.patch @@ -0,0 +1,16 @@ +diff --git b/plugins/vpp/binapi/vpp1908/sr/sr.ba.go a/plugins/vpp/binapi/vpp1908/sr/sr.ba.go +index e7e0a021..42153a48 100644 +--- b/plugins/vpp/binapi/vpp1908/sr/sr.ba.go ++++ a/plugins/vpp/binapi/vpp1908/sr/sr.ba.go +@@ -61,9 +61,9 @@ func (*Srv6Sid) GetCrcString() string { + + // Srv6SidList represents VPP binary API type 'srv6_sid_list': + type Srv6SidList struct { +- NumSids uint8 ++ NumSids uint8 `struc:"sizeof=Sids"` + Weight uint32 +- Sids []Srv6Sid `struc:"[16]Srv6Sid"` ++ Sids []Srv6Sid + } + + func (*Srv6SidList) GetTypeName() string { diff --git a/plugins/vpp/binapi/vpp1908/sr/sr.ba.go b/plugins/vpp/binapi/vpp1908/sr/sr.ba.go new file mode 100644 index 0000000000..c2847d3410 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/sr/sr.ba.go @@ -0,0 +1,579 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/sr.api.json + +/* +Package sr is a generated VPP binary API for 'sr' module. + +It consists of: + 3 types + 18 messages + 9 services +*/ +package sr + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xaa3993c3 +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +type SrIP6Address struct { + Data []byte `struc:"[16]byte"` +} + +func (*SrIP6Address) GetTypeName() string { + return "sr_ip6_address" +} + +// Srv6Sid represents VPP binary API type 'srv6_sid'. +type Srv6Sid struct { + Addr []byte `struc:"[16]byte"` +} + +func (*Srv6Sid) GetTypeName() string { + return "srv6_sid" +} + +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `struc:"sizeof=Sids"` + Weight uint32 + Sids []Srv6Sid +} + +func (*Srv6SidList) GetTypeName() string { + return "srv6_sid_list" +} + +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel uint8 + Localsid Srv6Sid + EndPsp uint8 + Behavior uint8 + SwIfIndex uint32 + VlanIndex uint32 + FibTable uint32 + NhAddr6 []byte `struc:"[16]byte"` + NhAddr4 []byte `struc:"[4]byte"` +} + +func (*SrLocalsidAddDel) GetMessageName() string { + return "sr_localsid_add_del" +} +func (*SrLocalsidAddDel) GetCrcString() string { + return "b30489eb" +} +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 +} + +func (*SrLocalsidAddDelReply) GetMessageName() string { + return "sr_localsid_add_del_reply" +} +func (*SrLocalsidAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr Srv6Sid + EndPsp uint8 + Behavior uint16 + FibTable uint32 + VlanIndex uint32 + XconnectNhAddr6 []byte `struc:"[16]byte"` + XconnectNhAddr4 []byte `struc:"[4]byte"` + XconnectIfaceOrVrfTable uint32 +} + +func (*SrLocalsidsDetails) GetMessageName() string { + return "sr_localsids_details" +} +func (*SrLocalsidsDetails) GetCrcString() string { + return "0791babc" +} +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (*SrLocalsidsDump) GetMessageName() string { + return "sr_localsids_dump" +} +func (*SrLocalsidsDump) GetCrcString() string { + return "51077d14" +} +func (*SrLocalsidsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid Srv6Sid + Type uint8 + IsEncap uint8 + FibTable uint32 + NumSidLists uint8 `struc:"sizeof=SidLists"` + SidLists []Srv6SidList +} + +func (*SrPoliciesDetails) GetMessageName() string { + return "sr_policies_details" +} +func (*SrPoliciesDetails) GetCrcString() string { + return "5087f460" +} +func (*SrPoliciesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (*SrPoliciesDump) GetMessageName() string { + return "sr_policies_dump" +} +func (*SrPoliciesDump) GetCrcString() string { + return "51077d14" +} +func (*SrPoliciesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr []byte `struc:"[16]byte"` + Weight uint32 + IsEncap uint8 + Type uint8 + FibTable uint32 + Sids Srv6SidList +} + +func (*SrPolicyAdd) GetMessageName() string { + return "sr_policy_add" +} +func (*SrPolicyAdd) GetCrcString() string { + return "4b6e2484" +} +func (*SrPolicyAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 +} + +func (*SrPolicyAddReply) GetMessageName() string { + return "sr_policy_add_reply" +} +func (*SrPolicyAddReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrPolicyAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr Srv6Sid + SrPolicyIndex uint32 +} + +func (*SrPolicyDel) GetMessageName() string { + return "sr_policy_del" +} +func (*SrPolicyDel) GetCrcString() string { + return "e4133171" +} +func (*SrPolicyDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 +} + +func (*SrPolicyDelReply) GetMessageName() string { + return "sr_policy_del_reply" +} +func (*SrPolicyDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrPolicyDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr []byte `struc:"[16]byte"` + SrPolicyIndex uint32 + FibTable uint32 + Operation uint8 + SlIndex uint32 + Weight uint32 + Sids Srv6SidList +} + +func (*SrPolicyMod) GetMessageName() string { + return "sr_policy_mod" +} +func (*SrPolicyMod) GetCrcString() string { + return "c1dfaee0" +} +func (*SrPolicyMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 +} + +func (*SrPolicyModReply) GetMessageName() string { + return "sr_policy_mod_reply" +} +func (*SrPolicyModReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrPolicyModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource []byte `struc:"[16]byte"` +} + +func (*SrSetEncapSource) GetMessageName() string { + return "sr_set_encap_source" +} +func (*SrSetEncapSource) GetCrcString() string { + return "d05bb4de" +} +func (*SrSetEncapSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 +} + +func (*SrSetEncapSourceReply) GetMessageName() string { + return "sr_set_encap_source_reply" +} +func (*SrSetEncapSourceReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel uint8 + BsidAddr []byte `struc:"[16]byte"` + SrPolicyIndex uint32 + TableID uint32 + PrefixAddr []byte `struc:"[16]byte"` + MaskWidth uint32 + SwIfIndex uint32 + TrafficType uint8 +} + +func (*SrSteeringAddDel) GetMessageName() string { + return "sr_steering_add_del" +} +func (*SrSteeringAddDel) GetCrcString() string { + return "28b5dcab" +} +func (*SrSteeringAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 +} + +func (*SrSteeringAddDelReply) GetMessageName() string { + return "sr_steering_add_del_reply" +} +func (*SrSteeringAddDelReply) GetCrcString() string { + return "e8d4e804" +} +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType uint8 + FibTable uint32 + PrefixAddr []byte `struc:"[16]byte"` + MaskWidth uint32 + SwIfIndex uint32 + Bsid Srv6Sid +} + +func (*SrSteeringPolDetails) GetMessageName() string { + return "sr_steering_pol_details" +} +func (*SrSteeringPolDetails) GetCrcString() string { + return "5627d483" +} +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (*SrSteeringPolDump) GetMessageName() string { + return "sr_steering_pol_dump" +} +func (*SrSteeringPolDump) GetCrcString() string { + return "51077d14" +} +func (*SrSteeringPolDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") + api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") + api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) +} + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/stn/stn.ba.go b/plugins/vpp/binapi/vpp1908/stn/stn.ba.go new file mode 100644 index 0000000000..da64adeabe --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/stn/stn.ba.go @@ -0,0 +1,172 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/stn.api.json + +/* +Package stn is a generated VPP binary API for 'stn' module. + +It consists of: + 4 messages + 2 services +*/ +package stn + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "stn" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x7bef82b9 +) + +// StnAddDelRule represents VPP binary API message 'stn_add_del_rule'. +type StnAddDelRule struct { + IsIP4 uint8 + IPAddress []byte `struc:"[16]byte"` + SwIfIndex uint32 + IsAdd uint8 +} + +func (*StnAddDelRule) GetMessageName() string { + return "stn_add_del_rule" +} +func (*StnAddDelRule) GetCrcString() string { + return "9f0bbe21" +} +func (*StnAddDelRule) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// StnAddDelRuleReply represents VPP binary API message 'stn_add_del_rule_reply'. +type StnAddDelRuleReply struct { + Retval int32 +} + +func (*StnAddDelRuleReply) GetMessageName() string { + return "stn_add_del_rule_reply" +} +func (*StnAddDelRuleReply) GetCrcString() string { + return "e8d4e804" +} +func (*StnAddDelRuleReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// StnRulesDetails represents VPP binary API message 'stn_rules_details'. +type StnRulesDetails struct { + IsIP4 uint8 + IPAddress []byte `struc:"[16]byte"` + SwIfIndex uint32 +} + +func (*StnRulesDetails) GetMessageName() string { + return "stn_rules_details" +} +func (*StnRulesDetails) GetCrcString() string { + return "5eafa31e" +} +func (*StnRulesDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// StnRulesDump represents VPP binary API message 'stn_rules_dump'. +type StnRulesDump struct{} + +func (*StnRulesDump) GetMessageName() string { + return "stn_rules_dump" +} +func (*StnRulesDump) GetCrcString() string { + return "51077d14" +} +func (*StnRulesDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*StnAddDelRule)(nil), "stn.StnAddDelRule") + api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn.StnAddDelRuleReply") + api.RegisterMessage((*StnRulesDetails)(nil), "stn.StnRulesDetails") + api.RegisterMessage((*StnRulesDump)(nil), "stn.StnRulesDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*StnAddDelRule)(nil), + (*StnAddDelRuleReply)(nil), + (*StnRulesDetails)(nil), + (*StnRulesDump)(nil), + } +} + +// RPCService represents RPC service API for stn module. +type RPCService interface { + DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) + StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpStnRules(ctx context.Context, in *StnRulesDump) (RPCService_DumpStnRulesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpStnRulesClient{stream} + return x, nil +} + +type RPCService_DumpStnRulesClient interface { + Recv() (*StnRulesDetails, error) +} + +type serviceClient_DumpStnRulesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpStnRulesClient) Recv() (*StnRulesDetails, error) { + m := new(StnRulesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) { + out := new(StnAddDelRuleReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/tapv2/tapv2.ba.go b/plugins/vpp/binapi/vpp1908/tapv2/tapv2.ba.go new file mode 100644 index 0000000000..8e6da266dc --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/tapv2/tapv2.ba.go @@ -0,0 +1,252 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/tapv2.api.json + +/* +Package tapv2 is a generated VPP binary API for 'tapv2' module. + +It consists of: + 6 messages + 3 services +*/ +package tapv2 + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "tapv2" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x25beb6c0 +) + +// SwInterfaceTapV2Details represents VPP binary API message 'sw_interface_tap_v2_details'. +type SwInterfaceTapV2Details struct { + SwIfIndex uint32 + ID uint32 + DevName []byte `struc:"[64]byte"` + TxRingSz uint16 + RxRingSz uint16 + HostMacAddr []byte `struc:"[6]byte"` + HostIfName []byte `struc:"[64]byte"` + HostNamespace []byte `struc:"[64]byte"` + HostBridge []byte `struc:"[64]byte"` + HostIP4Addr []byte `struc:"[4]byte"` + HostIP4PrefixLen uint8 + HostIP6Addr []byte `struc:"[16]byte"` + HostIP6PrefixLen uint8 + HostMtuSize uint32 + TapFlags uint32 +} + +func (*SwInterfaceTapV2Details) GetMessageName() string { + return "sw_interface_tap_v2_details" +} +func (*SwInterfaceTapV2Details) GetCrcString() string { + return "5ee87a5f" +} +func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// SwInterfaceTapV2Dump represents VPP binary API message 'sw_interface_tap_v2_dump'. +type SwInterfaceTapV2Dump struct{} + +func (*SwInterfaceTapV2Dump) GetMessageName() string { + return "sw_interface_tap_v2_dump" +} +func (*SwInterfaceTapV2Dump) GetCrcString() string { + return "51077d14" +} +func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// TapCreateV2 represents VPP binary API message 'tap_create_v2'. +type TapCreateV2 struct { + ID uint32 + UseRandomMac uint8 + MacAddress []byte `struc:"[6]byte"` + TxRingSz uint16 + RxRingSz uint16 + HostNamespaceSet uint8 + HostNamespace []byte `struc:"[64]byte"` + HostMacAddrSet uint8 + HostMacAddr []byte `struc:"[6]byte"` + HostIfNameSet uint8 + HostIfName []byte `struc:"[64]byte"` + HostBridgeSet uint8 + HostBridge []byte `struc:"[64]byte"` + HostIP4AddrSet uint8 + HostIP4Addr []byte `struc:"[4]byte"` + HostIP4PrefixLen uint8 + HostIP6AddrSet uint8 + HostIP6Addr []byte `struc:"[16]byte"` + HostIP6PrefixLen uint8 + HostIP4GwSet uint8 + HostIP4Gw []byte `struc:"[4]byte"` + HostIP6GwSet uint8 + HostIP6Gw []byte `struc:"[16]byte"` + HostMtuSet uint8 + HostMtuSize uint32 + Tag []byte `struc:"[64]byte"` + TapFlags uint32 +} + +func (*TapCreateV2) GetMessageName() string { + return "tap_create_v2" +} +func (*TapCreateV2) GetCrcString() string { + return "8fa99320" +} +func (*TapCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// TapCreateV2Reply represents VPP binary API message 'tap_create_v2_reply'. +type TapCreateV2Reply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*TapCreateV2Reply) GetMessageName() string { + return "tap_create_v2_reply" +} +func (*TapCreateV2Reply) GetCrcString() string { + return "fda5941f" +} +func (*TapCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// TapDeleteV2 represents VPP binary API message 'tap_delete_v2'. +type TapDeleteV2 struct { + SwIfIndex uint32 +} + +func (*TapDeleteV2) GetMessageName() string { + return "tap_delete_v2" +} +func (*TapDeleteV2) GetCrcString() string { + return "529cb13f" +} +func (*TapDeleteV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// TapDeleteV2Reply represents VPP binary API message 'tap_delete_v2_reply'. +type TapDeleteV2Reply struct { + Retval int32 +} + +func (*TapDeleteV2Reply) GetMessageName() string { + return "tap_delete_v2_reply" +} +func (*TapDeleteV2Reply) GetCrcString() string { + return "e8d4e804" +} +func (*TapDeleteV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "tapv2.SwInterfaceTapV2Details") + api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "tapv2.SwInterfaceTapV2Dump") + api.RegisterMessage((*TapCreateV2)(nil), "tapv2.TapCreateV2") + api.RegisterMessage((*TapCreateV2Reply)(nil), "tapv2.TapCreateV2Reply") + api.RegisterMessage((*TapDeleteV2)(nil), "tapv2.TapDeleteV2") + api.RegisterMessage((*TapDeleteV2Reply)(nil), "tapv2.TapDeleteV2Reply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceTapV2Details)(nil), + (*SwInterfaceTapV2Dump)(nil), + (*TapCreateV2)(nil), + (*TapCreateV2Reply)(nil), + (*TapDeleteV2)(nil), + (*TapDeleteV2Reply)(nil), + } +} + +// RPCService represents RPC service API for tapv2 module. +type RPCService interface { + DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) + TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) + TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterfaceTapV2(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_DumpSwInterfaceTapV2Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceTapV2Client{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceTapV2Client interface { + Recv() (*SwInterfaceTapV2Details, error) +} + +type serviceClient_DumpSwInterfaceTapV2Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceTapV2Client) Recv() (*SwInterfaceTapV2Details, error) { + m := new(SwInterfaceTapV2Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) { + out := new(TapCreateV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { + out := new(TapDeleteV2Reply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/vmxnet3/vmxnet3.ba.go b/plugins/vpp/binapi/vpp1908/vmxnet3/vmxnet3.ba.go new file mode 100644 index 0000000000..461fc6a052 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/vmxnet3/vmxnet3.ba.go @@ -0,0 +1,253 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/plugins/vmxnet3.api.json + +/* +Package vmxnet3 is a generated VPP binary API for 'vmxnet3' module. + +It consists of: + 2 types + 6 messages + 3 services +*/ +package vmxnet3 + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vmxnet3" + // APIVersion is the API version of this module. + APIVersion = "1.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xe9e9abb1 +) + +// Vmxnet3RxList represents VPP binary API type 'vmxnet3_rx_list'. +type Vmxnet3RxList struct { + RxQsize uint16 + RxFill []uint16 `struc:"[2]uint16"` + RxNext uint16 + RxProduce []uint16 `struc:"[2]uint16"` + RxConsume []uint16 `struc:"[2]uint16"` +} + +func (*Vmxnet3RxList) GetTypeName() string { + return "vmxnet3_rx_list" +} + +// Vmxnet3TxList represents VPP binary API type 'vmxnet3_tx_list'. +type Vmxnet3TxList struct { + TxQsize uint16 + TxNext uint16 + TxProduce uint16 + TxConsume uint16 +} + +func (*Vmxnet3TxList) GetTypeName() string { + return "vmxnet3_tx_list" +} + +// Vmxnet3Create represents VPP binary API message 'vmxnet3_create'. +type Vmxnet3Create struct { + PciAddr uint32 + EnableElog int32 + RxqSize uint16 + RxqNum uint16 + TxqSize uint16 + TxqNum uint16 + Bind uint8 +} + +func (*Vmxnet3Create) GetMessageName() string { + return "vmxnet3_create" +} +func (*Vmxnet3Create) GetCrcString() string { + return "6da613a5" +} +func (*Vmxnet3Create) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Vmxnet3CreateReply represents VPP binary API message 'vmxnet3_create_reply'. +type Vmxnet3CreateReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*Vmxnet3CreateReply) GetMessageName() string { + return "vmxnet3_create_reply" +} +func (*Vmxnet3CreateReply) GetCrcString() string { + return "fda5941f" +} +func (*Vmxnet3CreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Vmxnet3Delete represents VPP binary API message 'vmxnet3_delete'. +type Vmxnet3Delete struct { + SwIfIndex uint32 +} + +func (*Vmxnet3Delete) GetMessageName() string { + return "vmxnet3_delete" +} +func (*Vmxnet3Delete) GetCrcString() string { + return "529cb13f" +} +func (*Vmxnet3Delete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// Vmxnet3DeleteReply represents VPP binary API message 'vmxnet3_delete_reply'. +type Vmxnet3DeleteReply struct { + Retval int32 +} + +func (*Vmxnet3DeleteReply) GetMessageName() string { + return "vmxnet3_delete_reply" +} +func (*Vmxnet3DeleteReply) GetCrcString() string { + return "e8d4e804" +} +func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Vmxnet3Details represents VPP binary API message 'vmxnet3_details'. +type Vmxnet3Details struct { + SwIfIndex uint32 + IfName []byte `struc:"[64]byte"` + HwAddr []byte `struc:"[6]byte"` + PciAddr uint32 + Version uint8 + AdminUpDown uint8 + RxCount uint8 + RxList []Vmxnet3RxList `struc:"[16]Vmxnet3RxList"` + TxCount uint8 + TxList []Vmxnet3TxList `struc:"[8]Vmxnet3TxList"` +} + +func (*Vmxnet3Details) GetMessageName() string { + return "vmxnet3_details" +} +func (*Vmxnet3Details) GetCrcString() string { + return "25f4412f" +} +func (*Vmxnet3Details) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Vmxnet3Dump represents VPP binary API message 'vmxnet3_dump'. +type Vmxnet3Dump struct{} + +func (*Vmxnet3Dump) GetMessageName() string { + return "vmxnet3_dump" +} +func (*Vmxnet3Dump) GetCrcString() string { + return "51077d14" +} +func (*Vmxnet3Dump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*Vmxnet3Create)(nil), "vmxnet3.Vmxnet3Create") + api.RegisterMessage((*Vmxnet3CreateReply)(nil), "vmxnet3.Vmxnet3CreateReply") + api.RegisterMessage((*Vmxnet3Delete)(nil), "vmxnet3.Vmxnet3Delete") + api.RegisterMessage((*Vmxnet3DeleteReply)(nil), "vmxnet3.Vmxnet3DeleteReply") + api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3.Vmxnet3Details") + api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3.Vmxnet3Dump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Vmxnet3Create)(nil), + (*Vmxnet3CreateReply)(nil), + (*Vmxnet3Delete)(nil), + (*Vmxnet3DeleteReply)(nil), + (*Vmxnet3Details)(nil), + (*Vmxnet3Dump)(nil), + } +} + +// RPCService represents RPC service API for vmxnet3 module. +type RPCService interface { + DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) + Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) + Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVmxnet3(ctx context.Context, in *Vmxnet3Dump) (RPCService_DumpVmxnet3Client, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVmxnet3Client{stream} + return x, nil +} + +type RPCService_DumpVmxnet3Client interface { + Recv() (*Vmxnet3Details, error) +} + +type serviceClient_DumpVmxnet3Client struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVmxnet3Client) Recv() (*Vmxnet3Details, error) { + m := new(Vmxnet3Details) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) { + out := new(Vmxnet3CreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { + out := new(Vmxnet3DeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/vpe/vpe.ba.go b/plugins/vpp/binapi/vpp1908/vpe/vpe.ba.go new file mode 100644 index 0000000000..1d4e9dbd65 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/vpe/vpe.ba.go @@ -0,0 +1,757 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/vpe.api.json + +/* +Package vpe is a generated VPP binary API for 'vpe' module. + +It consists of: + 1 enum + 2 aliases + 2 types + 26 messages + 13 services +*/ +package vpe + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vpe" + // APIVersion is the API version of this module. + APIVersion = "1.5.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x2521f24d +) + +// LogLevel represents VPP binary API enum 'log_level'. +type LogLevel uint32 + +const ( + VPE_API_LOG_LEVEL_EMERG LogLevel = 0 + VPE_API_LOG_LEVEL_ALERT LogLevel = 1 + VPE_API_LOG_LEVEL_CRIT LogLevel = 2 + VPE_API_LOG_LEVEL_ERR LogLevel = 3 + VPE_API_LOG_LEVEL_WARNING LogLevel = 4 + VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 + VPE_API_LOG_LEVEL_INFO LogLevel = 6 + VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 + VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 +) + +var LogLevel_name = map[uint32]string{ + 0: "VPE_API_LOG_LEVEL_EMERG", + 1: "VPE_API_LOG_LEVEL_ALERT", + 2: "VPE_API_LOG_LEVEL_CRIT", + 3: "VPE_API_LOG_LEVEL_ERR", + 4: "VPE_API_LOG_LEVEL_WARNING", + 5: "VPE_API_LOG_LEVEL_NOTICE", + 6: "VPE_API_LOG_LEVEL_INFO", + 7: "VPE_API_LOG_LEVEL_DEBUG", + 8: "VPE_API_LOG_LEVEL_DISABLED", +} + +var LogLevel_value = map[string]uint32{ + "VPE_API_LOG_LEVEL_EMERG": 0, + "VPE_API_LOG_LEVEL_ALERT": 1, + "VPE_API_LOG_LEVEL_CRIT": 2, + "VPE_API_LOG_LEVEL_ERR": 3, + "VPE_API_LOG_LEVEL_WARNING": 4, + "VPE_API_LOG_LEVEL_NOTICE": 5, + "VPE_API_LOG_LEVEL_INFO": 6, + "VPE_API_LOG_LEVEL_DEBUG": 7, + "VPE_API_LOG_LEVEL_DISABLED": 8, +} + +func (x LogLevel) String() string { + s, ok := LogLevel_name[uint32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} + +// Timedelta represents VPP binary API alias 'timedelta'. +type Timedelta float64 + +// Timestamp represents VPP binary API alias 'timestamp'. +type Timestamp float64 + +// ThreadData represents VPP binary API type 'thread_data'. +type ThreadData struct { + ID uint32 + Name []byte `struc:"[64]byte"` + Type []byte `struc:"[64]byte"` + PID uint32 + CPUID uint32 + Core uint32 + CPUSocket uint32 +} + +func (*ThreadData) GetTypeName() string { + return "thread_data" +} + +// Version represents VPP binary API type 'version'. +type Version struct { + Major uint32 + Minor uint32 + Patch uint32 + PreRelease []byte `struc:"[17]byte"` + BuildMetadata []byte `struc:"[17]byte"` +} + +func (*Version) GetTypeName() string { + return "version" +} + +// AddNodeNext represents VPP binary API message 'add_node_next'. +type AddNodeNext struct { + NodeName []byte `struc:"[64]byte"` + NextName []byte `struc:"[64]byte"` +} + +func (*AddNodeNext) GetMessageName() string { + return "add_node_next" +} +func (*AddNodeNext) GetCrcString() string { + return "9ab92f7a" +} +func (*AddNodeNext) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. +type AddNodeNextReply struct { + Retval int32 + NextIndex uint32 +} + +func (*AddNodeNextReply) GetMessageName() string { + return "add_node_next_reply" +} +func (*AddNodeNextReply) GetCrcString() string { + return "2ed75f32" +} +func (*AddNodeNextReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// Cli represents VPP binary API message 'cli'. +type Cli struct { + CmdInShmem uint64 +} + +func (*Cli) GetMessageName() string { + return "cli" +} +func (*Cli) GetCrcString() string { + return "23bfbfff" +} +func (*Cli) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CliInband represents VPP binary API message 'cli_inband'. +type CliInband struct { + XXX_CmdLen uint32 `struc:"sizeof=Cmd"` + Cmd string +} + +func (*CliInband) GetMessageName() string { + return "cli_inband" +} +func (*CliInband) GetCrcString() string { + return "b1ad59b3" +} +func (*CliInband) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 + XXX_ReplyLen uint32 `struc:"sizeof=Reply"` + Reply string +} + +func (*CliInbandReply) GetMessageName() string { + return "cli_inband_reply" +} +func (*CliInbandReply) GetCrcString() string { + return "6d3c80a4" +} +func (*CliInbandReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// CliReply represents VPP binary API message 'cli_reply'. +type CliReply struct { + Retval int32 + ReplyInShmem uint64 +} + +func (*CliReply) GetMessageName() string { + return "cli_reply" +} +func (*CliReply) GetCrcString() string { + return "06d68297" +} +func (*CliReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ControlPing represents VPP binary API message 'control_ping'. +type ControlPing struct{} + +func (*ControlPing) GetMessageName() string { + return "control_ping" +} +func (*ControlPing) GetCrcString() string { + return "51077d14" +} +func (*ControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ControlPingReply represents VPP binary API message 'control_ping_reply'. +type ControlPingReply struct { + Retval int32 + ClientIndex uint32 + VpePID uint32 +} + +func (*ControlPingReply) GetMessageName() string { + return "control_ping_reply" +} +func (*ControlPingReply) GetCrcString() string { + return "f6b0b8ca" +} +func (*ControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. +type GetF64EndianValue struct { + F64One float64 +} + +func (*GetF64EndianValue) GetMessageName() string { + return "get_f64_endian_value" +} +func (*GetF64EndianValue) GetCrcString() string { + return "809fcd44" +} +func (*GetF64EndianValue) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. +type GetF64EndianValueReply struct { + Retval uint32 + F64OneResult float64 +} + +func (*GetF64EndianValueReply) GetMessageName() string { + return "get_f64_endian_value_reply" +} +func (*GetF64EndianValueReply) GetCrcString() string { + return "7e02e404" +} +func (*GetF64EndianValueReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. +type GetF64IncrementByOne struct { + F64Value float64 +} + +func (*GetF64IncrementByOne) GetMessageName() string { + return "get_f64_increment_by_one" +} +func (*GetF64IncrementByOne) GetCrcString() string { + return "b64f027e" +} +func (*GetF64IncrementByOne) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. +type GetF64IncrementByOneReply struct { + Retval uint32 + F64Value float64 +} + +func (*GetF64IncrementByOneReply) GetMessageName() string { + return "get_f64_increment_by_one_reply" +} +func (*GetF64IncrementByOneReply) GetCrcString() string { + return "d25dbaa3" +} +func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetNextIndex represents VPP binary API message 'get_next_index'. +type GetNextIndex struct { + NodeName []byte `struc:"[64]byte"` + NextName []byte `struc:"[64]byte"` +} + +func (*GetNextIndex) GetMessageName() string { + return "get_next_index" +} +func (*GetNextIndex) GetCrcString() string { + return "9ab92f7a" +} +func (*GetNextIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. +type GetNextIndexReply struct { + Retval int32 + NextIndex uint32 +} + +func (*GetNextIndexReply) GetMessageName() string { + return "get_next_index_reply" +} +func (*GetNextIndexReply) GetCrcString() string { + return "2ed75f32" +} +func (*GetNextIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetNodeGraph represents VPP binary API message 'get_node_graph'. +type GetNodeGraph struct{} + +func (*GetNodeGraph) GetMessageName() string { + return "get_node_graph" +} +func (*GetNodeGraph) GetCrcString() string { + return "51077d14" +} +func (*GetNodeGraph) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. +type GetNodeGraphReply struct { + Retval int32 + ReplyInShmem uint64 +} + +func (*GetNodeGraphReply) GetMessageName() string { + return "get_node_graph_reply" +} +func (*GetNodeGraphReply) GetCrcString() string { + return "06d68297" +} +func (*GetNodeGraphReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// GetNodeIndex represents VPP binary API message 'get_node_index'. +type GetNodeIndex struct { + NodeName []byte `struc:"[64]byte"` +} + +func (*GetNodeIndex) GetMessageName() string { + return "get_node_index" +} +func (*GetNodeIndex) GetCrcString() string { + return "6c9a495d" +} +func (*GetNodeIndex) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. +type GetNodeIndexReply struct { + Retval int32 + NodeIndex uint32 +} + +func (*GetNodeIndexReply) GetMessageName() string { + return "get_node_index_reply" +} +func (*GetNodeIndexReply) GetCrcString() string { + return "a8600b89" +} +func (*GetNodeIndexReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// LogDetails represents VPP binary API message 'log_details'. +type LogDetails struct { + Timestamp Timestamp + Level LogLevel + XXX_MsgClassLen uint32 `struc:"sizeof=MsgClass"` + MsgClass string `binapi:",limit=32"` + XXX_MessageLen uint32 `struc:"sizeof=Message"` + Message string `binapi:",limit=256"` +} + +func (*LogDetails) GetMessageName() string { + return "log_details" +} +func (*LogDetails) GetCrcString() string { + return "4aea1f4d" +} +func (*LogDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// LogDump represents VPP binary API message 'log_dump'. +type LogDump struct { + StartTimestamp Timestamp +} + +func (*LogDump) GetMessageName() string { + return "log_dump" +} +func (*LogDump) GetCrcString() string { + return "e4a022b6" +} +func (*LogDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ShowThreads represents VPP binary API message 'show_threads'. +type ShowThreads struct{} + +func (*ShowThreads) GetMessageName() string { + return "show_threads" +} +func (*ShowThreads) GetCrcString() string { + return "51077d14" +} +func (*ShowThreads) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. +type ShowThreadsReply struct { + Retval int32 + Count uint32 `struc:"sizeof=ThreadData"` + ThreadData []ThreadData +} + +func (*ShowThreadsReply) GetMessageName() string { + return "show_threads_reply" +} +func (*ShowThreadsReply) GetCrcString() string { + return "f5e0b66f" +} +func (*ShowThreadsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ShowVersion represents VPP binary API message 'show_version'. +type ShowVersion struct{} + +func (*ShowVersion) GetMessageName() string { + return "show_version" +} +func (*ShowVersion) GetCrcString() string { + return "51077d14" +} +func (*ShowVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ShowVersionReply represents VPP binary API message 'show_version_reply'. +type ShowVersionReply struct { + Retval int32 + XXX_ProgramLen uint32 `struc:"sizeof=Program"` + Program string `binapi:",limit=32"` + XXX_VersionLen uint32 `struc:"sizeof=Version"` + Version string `binapi:",limit=32"` + XXX_BuildDateLen uint32 `struc:"sizeof=BuildDate"` + BuildDate string `binapi:",limit=32"` + XXX_BuildDirectoryLen uint32 `struc:"sizeof=BuildDirectory"` + BuildDirectory string `binapi:",limit=256"` +} + +func (*ShowVersionReply) GetMessageName() string { + return "show_version_reply" +} +func (*ShowVersionReply) GetCrcString() string { + return "b9bcf6df" +} +func (*ShowVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. +type ShowVpeSystemTime struct{} + +func (*ShowVpeSystemTime) GetMessageName() string { + return "show_vpe_system_time" +} +func (*ShowVpeSystemTime) GetCrcString() string { + return "51077d14" +} +func (*ShowVpeSystemTime) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. +type ShowVpeSystemTimeReply struct { + Retval int32 + VpeSystemTime Timestamp +} + +func (*ShowVpeSystemTimeReply) GetMessageName() string { + return "show_vpe_system_time_reply" +} +func (*ShowVpeSystemTimeReply) GetCrcString() string { + return "3b12fb3f" +} +func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func init() { + api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") + api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") + api.RegisterMessage((*Cli)(nil), "vpe.Cli") + api.RegisterMessage((*CliInband)(nil), "vpe.CliInband") + api.RegisterMessage((*CliInbandReply)(nil), "vpe.CliInbandReply") + api.RegisterMessage((*CliReply)(nil), "vpe.CliReply") + api.RegisterMessage((*ControlPing)(nil), "vpe.ControlPing") + api.RegisterMessage((*ControlPingReply)(nil), "vpe.ControlPingReply") + api.RegisterMessage((*GetF64EndianValue)(nil), "vpe.GetF64EndianValue") + api.RegisterMessage((*GetF64EndianValueReply)(nil), "vpe.GetF64EndianValueReply") + api.RegisterMessage((*GetF64IncrementByOne)(nil), "vpe.GetF64IncrementByOne") + api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "vpe.GetF64IncrementByOneReply") + api.RegisterMessage((*GetNextIndex)(nil), "vpe.GetNextIndex") + api.RegisterMessage((*GetNextIndexReply)(nil), "vpe.GetNextIndexReply") + api.RegisterMessage((*GetNodeGraph)(nil), "vpe.GetNodeGraph") + api.RegisterMessage((*GetNodeGraphReply)(nil), "vpe.GetNodeGraphReply") + api.RegisterMessage((*GetNodeIndex)(nil), "vpe.GetNodeIndex") + api.RegisterMessage((*GetNodeIndexReply)(nil), "vpe.GetNodeIndexReply") + api.RegisterMessage((*LogDetails)(nil), "vpe.LogDetails") + api.RegisterMessage((*LogDump)(nil), "vpe.LogDump") + api.RegisterMessage((*ShowThreads)(nil), "vpe.ShowThreads") + api.RegisterMessage((*ShowThreadsReply)(nil), "vpe.ShowThreadsReply") + api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion") + api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") + api.RegisterMessage((*ShowVpeSystemTime)(nil), "vpe.ShowVpeSystemTime") + api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "vpe.ShowVpeSystemTimeReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetF64EndianValue)(nil), + (*GetF64EndianValueReply)(nil), + (*GetF64IncrementByOne)(nil), + (*GetF64IncrementByOneReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*LogDetails)(nil), + (*LogDump)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + (*ShowVpeSystemTime)(nil), + (*ShowVpeSystemTimeReply)(nil), + } +} + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) + ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpLogClient{stream} + return x, nil +} + +type RPCService_DumpLogClient interface { + Recv() (*LogDetails, error) +} + +type serviceClient_DumpLogClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { + m := new(LogDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { + out := new(ShowVpeSystemTimeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/binapi/vpp1908/vxlan/vxlan.ba.go b/plugins/vpp/binapi/vpp1908/vxlan/vxlan.ba.go new file mode 100644 index 0000000000..51f4235fe7 --- /dev/null +++ b/plugins/vpp/binapi/vpp1908/vxlan/vxlan.ba.go @@ -0,0 +1,278 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// source: /usr/share/vpp/api/core/vxlan.api.json + +/* +Package vxlan is a generated VPP binary API for 'vxlan' module. + +It consists of: + 8 messages + 4 services +*/ +package vxlan + +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) + +const ( + // ModuleName is the name of this module. + ModuleName = "vxlan" + // APIVersion is the API version of this module. + APIVersion = "1.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x467bd962 +) + +// SwInterfaceSetVxlanBypass represents VPP binary API message 'sw_interface_set_vxlan_bypass'. +type SwInterfaceSetVxlanBypass struct { + SwIfIndex uint32 + IsIPv6 uint8 + Enable uint8 +} + +func (*SwInterfaceSetVxlanBypass) GetMessageName() string { + return "sw_interface_set_vxlan_bypass" +} +func (*SwInterfaceSetVxlanBypass) GetCrcString() string { + return "e74ca095" +} +func (*SwInterfaceSetVxlanBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// SwInterfaceSetVxlanBypassReply represents VPP binary API message 'sw_interface_set_vxlan_bypass_reply'. +type SwInterfaceSetVxlanBypassReply struct { + Retval int32 +} + +func (*SwInterfaceSetVxlanBypassReply) GetMessageName() string { + return "sw_interface_set_vxlan_bypass_reply" +} +func (*SwInterfaceSetVxlanBypassReply) GetCrcString() string { + return "e8d4e804" +} +func (*SwInterfaceSetVxlanBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// VxlanAddDelTunnel represents VPP binary API message 'vxlan_add_del_tunnel'. +type VxlanAddDelTunnel struct { + IsAdd uint8 + IsIPv6 uint8 + Instance uint32 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + McastSwIfIndex uint32 + EncapVrfID uint32 + DecapNextIndex uint32 + Vni uint32 +} + +func (*VxlanAddDelTunnel) GetMessageName() string { + return "vxlan_add_del_tunnel" +} +func (*VxlanAddDelTunnel) GetCrcString() string { + return "00f4bdd0" +} +func (*VxlanAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// VxlanAddDelTunnelReply represents VPP binary API message 'vxlan_add_del_tunnel_reply'. +type VxlanAddDelTunnelReply struct { + Retval int32 + SwIfIndex uint32 +} + +func (*VxlanAddDelTunnelReply) GetMessageName() string { + return "vxlan_add_del_tunnel_reply" +} +func (*VxlanAddDelTunnelReply) GetCrcString() string { + return "fda5941f" +} +func (*VxlanAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// VxlanOffloadRx represents VPP binary API message 'vxlan_offload_rx'. +type VxlanOffloadRx struct { + HwIfIndex uint32 + SwIfIndex uint32 + Enable uint8 +} + +func (*VxlanOffloadRx) GetMessageName() string { + return "vxlan_offload_rx" +} +func (*VxlanOffloadRx) GetCrcString() string { + return "f0b08786" +} +func (*VxlanOffloadRx) GetMessageType() api.MessageType { + return api.RequestMessage +} + +// VxlanOffloadRxReply represents VPP binary API message 'vxlan_offload_rx_reply'. +type VxlanOffloadRxReply struct { + Retval int32 +} + +func (*VxlanOffloadRxReply) GetMessageName() string { + return "vxlan_offload_rx_reply" +} +func (*VxlanOffloadRxReply) GetCrcString() string { + return "e8d4e804" +} +func (*VxlanOffloadRxReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// VxlanTunnelDetails represents VPP binary API message 'vxlan_tunnel_details'. +type VxlanTunnelDetails struct { + SwIfIndex uint32 + Instance uint32 + SrcAddress []byte `struc:"[16]byte"` + DstAddress []byte `struc:"[16]byte"` + McastSwIfIndex uint32 + EncapVrfID uint32 + DecapNextIndex uint32 + Vni uint32 + IsIPv6 uint8 +} + +func (*VxlanTunnelDetails) GetMessageName() string { + return "vxlan_tunnel_details" +} +func (*VxlanTunnelDetails) GetCrcString() string { + return "ce38e127" +} +func (*VxlanTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +// VxlanTunnelDump represents VPP binary API message 'vxlan_tunnel_dump'. +type VxlanTunnelDump struct { + SwIfIndex uint32 +} + +func (*VxlanTunnelDump) GetMessageName() string { + return "vxlan_tunnel_dump" +} +func (*VxlanTunnelDump) GetCrcString() string { + return "529cb13f" +} +func (*VxlanTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func init() { + api.RegisterMessage((*SwInterfaceSetVxlanBypass)(nil), "vxlan.SwInterfaceSetVxlanBypass") + api.RegisterMessage((*SwInterfaceSetVxlanBypassReply)(nil), "vxlan.SwInterfaceSetVxlanBypassReply") + api.RegisterMessage((*VxlanAddDelTunnel)(nil), "vxlan.VxlanAddDelTunnel") + api.RegisterMessage((*VxlanAddDelTunnelReply)(nil), "vxlan.VxlanAddDelTunnelReply") + api.RegisterMessage((*VxlanOffloadRx)(nil), "vxlan.VxlanOffloadRx") + api.RegisterMessage((*VxlanOffloadRxReply)(nil), "vxlan.VxlanOffloadRxReply") + api.RegisterMessage((*VxlanTunnelDetails)(nil), "vxlan.VxlanTunnelDetails") + api.RegisterMessage((*VxlanTunnelDump)(nil), "vxlan.VxlanTunnelDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanBypass)(nil), + (*SwInterfaceSetVxlanBypassReply)(nil), + (*VxlanAddDelTunnel)(nil), + (*VxlanAddDelTunnelReply)(nil), + (*VxlanOffloadRx)(nil), + (*VxlanOffloadRxReply)(nil), + (*VxlanTunnelDetails)(nil), + (*VxlanTunnelDump)(nil), + } +} + +// RPCService represents RPC service API for vxlan module. +type RPCService interface { + DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) + SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) + VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) + VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpVxlanTunnel(ctx context.Context, in *VxlanTunnelDump) (RPCService_DumpVxlanTunnelClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpVxlanTunnelClient{stream} + return x, nil +} + +type RPCService_DumpVxlanTunnelClient interface { + Recv() (*VxlanTunnelDetails, error) +} + +type serviceClient_DumpVxlanTunnelClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpVxlanTunnelClient) Recv() (*VxlanTunnelDetails, error) { + m := new(VxlanTunnelDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) { + out := new(SwInterfaceSetVxlanBypassReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { + out := new(VxlanAddDelTunnelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { + out := new(VxlanOffloadRxReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack diff --git a/plugins/vpp/ifplugin/config.go b/plugins/vpp/ifplugin/config.go new file mode 100644 index 0000000000..54f1abd655 --- /dev/null +++ b/plugins/vpp/ifplugin/config.go @@ -0,0 +1,66 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ifplugin + +import ( + "os" + "time" +) + +var ( + // PeriodicPollingPeriod between statistics reads + // TODO should be configurable + PeriodicPollingPeriod = time.Second * 5 + + // StateUpdateDelay defines delay before dumping states + StateUpdateDelay = time.Second * 3 + + disableInterfaceStats = os.Getenv("DISABLE_INTERFACE_STATS") != "" + disableStatusPublishing = os.Getenv("DISABLE_STATUS_PUBLISHING") != "" +) + +// Config defines configuration for VPP ifplugin. +type Config struct { + MTU uint32 `json:"mtu"` + StatusPublishers []string `json:"status-publishers"` +} + +// DefaultConfig returns Config with default values. +func DefaultConfig() Config { + return Config{ + MTU: 0, + } +} + +func (p *IfPlugin) loadConfig() (*Config, error) { + cfg := DefaultConfig() + + found, err := p.Cfg.LoadValue(&cfg) + if err != nil { + return nil, err + } else if !found { + p.Log.Debugf("config %s not found", p.Cfg.GetConfigName()) + return nil, nil + } + p.Log.Debugf("config %s found: %+v", p.Cfg.GetConfigName(), cfg) + + // vppStatusPublishers can override state publishers from the configuration file. + if pubs := os.Getenv("VPP_STATUS_PUBLISHERS"); pubs != "" { + p.Log.Debugf("status publishers from env: %v", pubs) + cfg.StatusPublishers = append(cfg.StatusPublishers, pubs) + } + + return &cfg, err +} diff --git a/plugins/vpp/ifplugin/descriptor/adapter/interface.go b/plugins/vpp/ifplugin/descriptor/adapter/interface.go index edcdd85618..d7c7bb4173 100644 --- a/plugins/vpp/ifplugin/descriptor/adapter/interface.go +++ b/plugins/vpp/ifplugin/descriptor/adapter/interface.go @@ -4,9 +4,9 @@ package adapter import ( "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/api/models/vpp/interfaces" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/api/models/vpp/interfaces" ) ////////// type-safe key-value pair with metadata ////////// diff --git a/plugins/vpp/ifplugin/descriptor/adapter/rxmode.go b/plugins/vpp/ifplugin/descriptor/adapter/rxmode.go new file mode 100644 index 0000000000..93612a9c6a --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/adapter/rxmode.go @@ -0,0 +1,233 @@ +// Code generated by adapter-generator. DO NOT EDIT. + +package adapter + +import ( + "github.com/gogo/protobuf/proto" + . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/api/models/vpp/interfaces" +) + +////////// type-safe key-value pair with metadata ////////// + +type RxModeKVWithMetadata struct { + Key string + Value *vpp_interfaces.Interface + Metadata interface{} + Origin ValueOrigin +} + +////////// type-safe Descriptor structure ////////// + +type RxModeDescriptor struct { + Name string + KeySelector KeySelector + ValueTypeName string + KeyLabel func(key string) string + ValueComparator func(key string, oldValue, newValue *vpp_interfaces.Interface) bool + NBKeyPrefix string + WithMetadata bool + MetadataMapFactory MetadataMapFactory + Validate func(key string, value *vpp_interfaces.Interface) error + Create func(key string, value *vpp_interfaces.Interface) (metadata interface{}, err error) + Delete func(key string, value *vpp_interfaces.Interface, metadata interface{}) error + Update func(key string, oldValue, newValue *vpp_interfaces.Interface, oldMetadata interface{}) (newMetadata interface{}, err error) + UpdateWithRecreate func(key string, oldValue, newValue *vpp_interfaces.Interface, metadata interface{}) bool + Retrieve func(correlate []RxModeKVWithMetadata) ([]RxModeKVWithMetadata, error) + IsRetriableFailure func(err error) bool + DerivedValues func(key string, value *vpp_interfaces.Interface) []KeyValuePair + Dependencies func(key string, value *vpp_interfaces.Interface) []Dependency + RetrieveDependencies []string /* descriptor name */ +} + +////////// Descriptor adapter ////////// + +type RxModeDescriptorAdapter struct { + descriptor *RxModeDescriptor +} + +func NewRxModeDescriptor(typedDescriptor *RxModeDescriptor) *KVDescriptor { + adapter := &RxModeDescriptorAdapter{descriptor: typedDescriptor} + descriptor := &KVDescriptor{ + Name: typedDescriptor.Name, + KeySelector: typedDescriptor.KeySelector, + ValueTypeName: typedDescriptor.ValueTypeName, + KeyLabel: typedDescriptor.KeyLabel, + NBKeyPrefix: typedDescriptor.NBKeyPrefix, + WithMetadata: typedDescriptor.WithMetadata, + MetadataMapFactory: typedDescriptor.MetadataMapFactory, + IsRetriableFailure: typedDescriptor.IsRetriableFailure, + RetrieveDependencies: typedDescriptor.RetrieveDependencies, + } + if typedDescriptor.ValueComparator != nil { + descriptor.ValueComparator = adapter.ValueComparator + } + if typedDescriptor.Validate != nil { + descriptor.Validate = adapter.Validate + } + if typedDescriptor.Create != nil { + descriptor.Create = adapter.Create + } + if typedDescriptor.Delete != nil { + descriptor.Delete = adapter.Delete + } + if typedDescriptor.Update != nil { + descriptor.Update = adapter.Update + } + if typedDescriptor.UpdateWithRecreate != nil { + descriptor.UpdateWithRecreate = adapter.UpdateWithRecreate + } + if typedDescriptor.Retrieve != nil { + descriptor.Retrieve = adapter.Retrieve + } + if typedDescriptor.Dependencies != nil { + descriptor.Dependencies = adapter.Dependencies + } + if typedDescriptor.DerivedValues != nil { + descriptor.DerivedValues = adapter.DerivedValues + } + return descriptor +} + +func (da *RxModeDescriptorAdapter) ValueComparator(key string, oldValue, newValue proto.Message) bool { + typedOldValue, err1 := castRxModeValue(key, oldValue) + typedNewValue, err2 := castRxModeValue(key, newValue) + if err1 != nil || err2 != nil { + return false + } + return da.descriptor.ValueComparator(key, typedOldValue, typedNewValue) +} + +func (da *RxModeDescriptorAdapter) Validate(key string, value proto.Message) (err error) { + typedValue, err := castRxModeValue(key, value) + if err != nil { + return err + } + return da.descriptor.Validate(key, typedValue) +} + +func (da *RxModeDescriptorAdapter) Create(key string, value proto.Message) (metadata Metadata, err error) { + typedValue, err := castRxModeValue(key, value) + if err != nil { + return nil, err + } + return da.descriptor.Create(key, typedValue) +} + +func (da *RxModeDescriptorAdapter) Update(key string, oldValue, newValue proto.Message, oldMetadata Metadata) (newMetadata Metadata, err error) { + oldTypedValue, err := castRxModeValue(key, oldValue) + if err != nil { + return nil, err + } + newTypedValue, err := castRxModeValue(key, newValue) + if err != nil { + return nil, err + } + typedOldMetadata, err := castRxModeMetadata(key, oldMetadata) + if err != nil { + return nil, err + } + return da.descriptor.Update(key, oldTypedValue, newTypedValue, typedOldMetadata) +} + +func (da *RxModeDescriptorAdapter) Delete(key string, value proto.Message, metadata Metadata) error { + typedValue, err := castRxModeValue(key, value) + if err != nil { + return err + } + typedMetadata, err := castRxModeMetadata(key, metadata) + if err != nil { + return err + } + return da.descriptor.Delete(key, typedValue, typedMetadata) +} + +func (da *RxModeDescriptorAdapter) UpdateWithRecreate(key string, oldValue, newValue proto.Message, metadata Metadata) bool { + oldTypedValue, err := castRxModeValue(key, oldValue) + if err != nil { + return true + } + newTypedValue, err := castRxModeValue(key, newValue) + if err != nil { + return true + } + typedMetadata, err := castRxModeMetadata(key, metadata) + if err != nil { + return true + } + return da.descriptor.UpdateWithRecreate(key, oldTypedValue, newTypedValue, typedMetadata) +} + +func (da *RxModeDescriptorAdapter) Retrieve(correlate []KVWithMetadata) ([]KVWithMetadata, error) { + var correlateWithType []RxModeKVWithMetadata + for _, kvpair := range correlate { + typedValue, err := castRxModeValue(kvpair.Key, kvpair.Value) + if err != nil { + continue + } + typedMetadata, err := castRxModeMetadata(kvpair.Key, kvpair.Metadata) + if err != nil { + continue + } + correlateWithType = append(correlateWithType, + RxModeKVWithMetadata{ + Key: kvpair.Key, + Value: typedValue, + Metadata: typedMetadata, + Origin: kvpair.Origin, + }) + } + + typedValues, err := da.descriptor.Retrieve(correlateWithType) + if err != nil { + return nil, err + } + var values []KVWithMetadata + for _, typedKVWithMetadata := range typedValues { + kvWithMetadata := KVWithMetadata{ + Key: typedKVWithMetadata.Key, + Metadata: typedKVWithMetadata.Metadata, + Origin: typedKVWithMetadata.Origin, + } + kvWithMetadata.Value = typedKVWithMetadata.Value + values = append(values, kvWithMetadata) + } + return values, err +} + +func (da *RxModeDescriptorAdapter) DerivedValues(key string, value proto.Message) []KeyValuePair { + typedValue, err := castRxModeValue(key, value) + if err != nil { + return nil + } + return da.descriptor.DerivedValues(key, typedValue) +} + +func (da *RxModeDescriptorAdapter) Dependencies(key string, value proto.Message) []Dependency { + typedValue, err := castRxModeValue(key, value) + if err != nil { + return nil + } + return da.descriptor.Dependencies(key, typedValue) +} + +////////// Helper methods ////////// + +func castRxModeValue(key string, value proto.Message) (*vpp_interfaces.Interface, error) { + typedValue, ok := value.(*vpp_interfaces.Interface) + if !ok { + return nil, ErrInvalidValueType(key, value) + } + return typedValue, nil +} + +func castRxModeMetadata(key string, metadata Metadata) (interface{}, error) { + if metadata == nil { + return nil, nil + } + typedMetadata, ok := metadata.(interface{}) + if !ok { + return nil, ErrInvalidMetadataType(key) + } + return typedMetadata, nil +} diff --git a/plugins/vpp/ifplugin/descriptor/adapter/rxplacement.go b/plugins/vpp/ifplugin/descriptor/adapter/rxplacement.go new file mode 100644 index 0000000000..6eaca98a22 --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/adapter/rxplacement.go @@ -0,0 +1,233 @@ +// Code generated by adapter-generator. DO NOT EDIT. + +package adapter + +import ( + "github.com/gogo/protobuf/proto" + . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/api/models/vpp/interfaces" +) + +////////// type-safe key-value pair with metadata ////////// + +type RxPlacementKVWithMetadata struct { + Key string + Value *vpp_interfaces.Interface_RxPlacement + Metadata interface{} + Origin ValueOrigin +} + +////////// type-safe Descriptor structure ////////// + +type RxPlacementDescriptor struct { + Name string + KeySelector KeySelector + ValueTypeName string + KeyLabel func(key string) string + ValueComparator func(key string, oldValue, newValue *vpp_interfaces.Interface_RxPlacement) bool + NBKeyPrefix string + WithMetadata bool + MetadataMapFactory MetadataMapFactory + Validate func(key string, value *vpp_interfaces.Interface_RxPlacement) error + Create func(key string, value *vpp_interfaces.Interface_RxPlacement) (metadata interface{}, err error) + Delete func(key string, value *vpp_interfaces.Interface_RxPlacement, metadata interface{}) error + Update func(key string, oldValue, newValue *vpp_interfaces.Interface_RxPlacement, oldMetadata interface{}) (newMetadata interface{}, err error) + UpdateWithRecreate func(key string, oldValue, newValue *vpp_interfaces.Interface_RxPlacement, metadata interface{}) bool + Retrieve func(correlate []RxPlacementKVWithMetadata) ([]RxPlacementKVWithMetadata, error) + IsRetriableFailure func(err error) bool + DerivedValues func(key string, value *vpp_interfaces.Interface_RxPlacement) []KeyValuePair + Dependencies func(key string, value *vpp_interfaces.Interface_RxPlacement) []Dependency + RetrieveDependencies []string /* descriptor name */ +} + +////////// Descriptor adapter ////////// + +type RxPlacementDescriptorAdapter struct { + descriptor *RxPlacementDescriptor +} + +func NewRxPlacementDescriptor(typedDescriptor *RxPlacementDescriptor) *KVDescriptor { + adapter := &RxPlacementDescriptorAdapter{descriptor: typedDescriptor} + descriptor := &KVDescriptor{ + Name: typedDescriptor.Name, + KeySelector: typedDescriptor.KeySelector, + ValueTypeName: typedDescriptor.ValueTypeName, + KeyLabel: typedDescriptor.KeyLabel, + NBKeyPrefix: typedDescriptor.NBKeyPrefix, + WithMetadata: typedDescriptor.WithMetadata, + MetadataMapFactory: typedDescriptor.MetadataMapFactory, + IsRetriableFailure: typedDescriptor.IsRetriableFailure, + RetrieveDependencies: typedDescriptor.RetrieveDependencies, + } + if typedDescriptor.ValueComparator != nil { + descriptor.ValueComparator = adapter.ValueComparator + } + if typedDescriptor.Validate != nil { + descriptor.Validate = adapter.Validate + } + if typedDescriptor.Create != nil { + descriptor.Create = adapter.Create + } + if typedDescriptor.Delete != nil { + descriptor.Delete = adapter.Delete + } + if typedDescriptor.Update != nil { + descriptor.Update = adapter.Update + } + if typedDescriptor.UpdateWithRecreate != nil { + descriptor.UpdateWithRecreate = adapter.UpdateWithRecreate + } + if typedDescriptor.Retrieve != nil { + descriptor.Retrieve = adapter.Retrieve + } + if typedDescriptor.Dependencies != nil { + descriptor.Dependencies = adapter.Dependencies + } + if typedDescriptor.DerivedValues != nil { + descriptor.DerivedValues = adapter.DerivedValues + } + return descriptor +} + +func (da *RxPlacementDescriptorAdapter) ValueComparator(key string, oldValue, newValue proto.Message) bool { + typedOldValue, err1 := castRxPlacementValue(key, oldValue) + typedNewValue, err2 := castRxPlacementValue(key, newValue) + if err1 != nil || err2 != nil { + return false + } + return da.descriptor.ValueComparator(key, typedOldValue, typedNewValue) +} + +func (da *RxPlacementDescriptorAdapter) Validate(key string, value proto.Message) (err error) { + typedValue, err := castRxPlacementValue(key, value) + if err != nil { + return err + } + return da.descriptor.Validate(key, typedValue) +} + +func (da *RxPlacementDescriptorAdapter) Create(key string, value proto.Message) (metadata Metadata, err error) { + typedValue, err := castRxPlacementValue(key, value) + if err != nil { + return nil, err + } + return da.descriptor.Create(key, typedValue) +} + +func (da *RxPlacementDescriptorAdapter) Update(key string, oldValue, newValue proto.Message, oldMetadata Metadata) (newMetadata Metadata, err error) { + oldTypedValue, err := castRxPlacementValue(key, oldValue) + if err != nil { + return nil, err + } + newTypedValue, err := castRxPlacementValue(key, newValue) + if err != nil { + return nil, err + } + typedOldMetadata, err := castRxPlacementMetadata(key, oldMetadata) + if err != nil { + return nil, err + } + return da.descriptor.Update(key, oldTypedValue, newTypedValue, typedOldMetadata) +} + +func (da *RxPlacementDescriptorAdapter) Delete(key string, value proto.Message, metadata Metadata) error { + typedValue, err := castRxPlacementValue(key, value) + if err != nil { + return err + } + typedMetadata, err := castRxPlacementMetadata(key, metadata) + if err != nil { + return err + } + return da.descriptor.Delete(key, typedValue, typedMetadata) +} + +func (da *RxPlacementDescriptorAdapter) UpdateWithRecreate(key string, oldValue, newValue proto.Message, metadata Metadata) bool { + oldTypedValue, err := castRxPlacementValue(key, oldValue) + if err != nil { + return true + } + newTypedValue, err := castRxPlacementValue(key, newValue) + if err != nil { + return true + } + typedMetadata, err := castRxPlacementMetadata(key, metadata) + if err != nil { + return true + } + return da.descriptor.UpdateWithRecreate(key, oldTypedValue, newTypedValue, typedMetadata) +} + +func (da *RxPlacementDescriptorAdapter) Retrieve(correlate []KVWithMetadata) ([]KVWithMetadata, error) { + var correlateWithType []RxPlacementKVWithMetadata + for _, kvpair := range correlate { + typedValue, err := castRxPlacementValue(kvpair.Key, kvpair.Value) + if err != nil { + continue + } + typedMetadata, err := castRxPlacementMetadata(kvpair.Key, kvpair.Metadata) + if err != nil { + continue + } + correlateWithType = append(correlateWithType, + RxPlacementKVWithMetadata{ + Key: kvpair.Key, + Value: typedValue, + Metadata: typedMetadata, + Origin: kvpair.Origin, + }) + } + + typedValues, err := da.descriptor.Retrieve(correlateWithType) + if err != nil { + return nil, err + } + var values []KVWithMetadata + for _, typedKVWithMetadata := range typedValues { + kvWithMetadata := KVWithMetadata{ + Key: typedKVWithMetadata.Key, + Metadata: typedKVWithMetadata.Metadata, + Origin: typedKVWithMetadata.Origin, + } + kvWithMetadata.Value = typedKVWithMetadata.Value + values = append(values, kvWithMetadata) + } + return values, err +} + +func (da *RxPlacementDescriptorAdapter) DerivedValues(key string, value proto.Message) []KeyValuePair { + typedValue, err := castRxPlacementValue(key, value) + if err != nil { + return nil + } + return da.descriptor.DerivedValues(key, typedValue) +} + +func (da *RxPlacementDescriptorAdapter) Dependencies(key string, value proto.Message) []Dependency { + typedValue, err := castRxPlacementValue(key, value) + if err != nil { + return nil + } + return da.descriptor.Dependencies(key, typedValue) +} + +////////// Helper methods ////////// + +func castRxPlacementValue(key string, value proto.Message) (*vpp_interfaces.Interface_RxPlacement, error) { + typedValue, ok := value.(*vpp_interfaces.Interface_RxPlacement) + if !ok { + return nil, ErrInvalidValueType(key, value) + } + return typedValue, nil +} + +func castRxPlacementMetadata(key string, metadata Metadata) (interface{}, error) { + if metadata == nil { + return nil, nil + } + typedMetadata, ok := metadata.(interface{}) + if !ok { + return nil, ErrInvalidMetadataType(key) + } + return typedMetadata, nil +} diff --git a/plugins/vpp/ifplugin/descriptor/dhcp.go b/plugins/vpp/ifplugin/descriptor/dhcp.go index ca469820ed..06486e7b28 100644 --- a/plugins/vpp/ifplugin/descriptor/dhcp.go +++ b/plugins/vpp/ifplugin/descriptor/dhcp.go @@ -150,8 +150,11 @@ func (d *DHCPDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs } // notify about the unconfigured client by removing the lease notification - return d.kvscheduler.PushSBNotification( - interfaces.DHCPLeaseKey(ifName), nil, nil) + return d.kvscheduler.PushSBNotification(kvs.KVWithMetadata{ + Key: interfaces.DHCPLeaseKey(ifName), + Value: nil, + Metadata: nil, + }) } // Retrieve returns all existing DHCP leases. @@ -239,10 +242,11 @@ func (d *DHCPDescriptor) watchDHCPNotifications(ctx context.Context) { HostIpAddress: lease.HostAddress, RouterIpAddress: lease.RouterAddress, } - if err := d.kvscheduler.PushSBNotification( - interfaces.DHCPLeaseKey(ifName), - dhcpLease, - dhcpLease); err != nil { + if err := d.kvscheduler.PushSBNotification(kvs.KVWithMetadata{ + Key: interfaces.DHCPLeaseKey(ifName), + Value: dhcpLease, + Metadata: dhcpLease, + }); err != nil { d.log.Error(err) } case <-ctx.Done(): diff --git a/plugins/vpp/ifplugin/descriptor/interface.go b/plugins/vpp/ifplugin/descriptor/interface.go index 015c3f6490..f9c92a2edc 100644 --- a/plugins/vpp/ifplugin/descriptor/interface.go +++ b/plugins/vpp/ifplugin/descriptor/interface.go @@ -98,9 +98,8 @@ var ( // ErrInterfaceLinkMismatch is returned when interface type does not match the link configuration. ErrInterfaceLinkMismatch = errors.New("VPP interface type and link configuration do not match") - // ErrUnsupportedRxMode is returned when the given interface type does not support the chosen - // RX mode. - ErrUnsupportedRxMode = errors.New("unsupported RX Mode") + // ErrRedefinedRxPlacement is returned when Rx placement has multiple definitions for the same queue. + ErrRedefinedRxPlacement = errors.New("redefined RX Placement") // ErrSubInterfaceWithoutParent is returned when interface of type sub-interface is defined without parent. ErrSubInterfaceWithoutParent = errors.Errorf("subinterface with no parent interface defined") @@ -207,8 +206,7 @@ func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf oldIntf.SetDhcpClient != newIntf.SetDhcpClient { return false } - if !proto.Equal(oldIntf.Unnumbered, newIntf.Unnumbered) || - !proto.Equal(getRxPlacement(oldIntf), getRxPlacement(newIntf)) { + if !proto.Equal(oldIntf.Unnumbered, newIntf.Unnumbered) { return false } @@ -223,14 +221,6 @@ func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf } } - // TODO: for TAPv2 the RxMode dump is unstable - // (it goes between POLLING and INTERRUPT, maybe it should actually return ADAPTIVE?) - if oldIntf.Type != interfaces.Interface_TAP || oldIntf.GetTap().GetVersion() != 2 { - if !proto.Equal(getRxMode(oldIntf), getRxMode(newIntf)) { - return false - } - } - // handle default/unspecified MTU (except VxLAN and IPSec tunnel) if newIntf.Type != interfaces.Interface_VXLAN_TUNNEL && newIntf.Type != interfaces.Interface_IPSEC_TUNNEL { if d.getInterfaceMTU(newIntf) != 0 && d.getInterfaceMTU(oldIntf) != d.getInterfaceMTU(newIntf) { @@ -370,13 +360,13 @@ func (d *InterfaceDescriptor) Validate(key string, intf *interfaces.Interface) e } // validate interface type defined - if intf.Type == interfaces.Interface_UNDEFINED_TYPE { + if intf.GetType() == interfaces.Interface_UNDEFINED_TYPE { return kvs.NewInvalidValueError(ErrInterfaceWithoutType, "type") } // validate link with interface type linkMismatchErr := kvs.NewInvalidValueError(ErrInterfaceLinkMismatch, "link") - switch intf.Link.(type) { + switch intf.GetLink().(type) { case *interfaces.Interface_Sub: if intf.Type != interfaces.Interface_SUB_INTERFACE { return linkMismatchErr @@ -426,9 +416,6 @@ func (d *InterfaceDescriptor) Validate(key string, intf *interfaces.Interface) e if _, ok := d.ethernetIfs[intf.Name]; !ok { return kvs.NewInvalidValueError(ErrDPDKInterfaceMissing, "name") } - if getRxMode(intf).GetRxMode() != interfaces.Interface_RxModeSettings_POLLING { - return kvs.NewInvalidValueError(ErrUnsupportedRxMode, "rx_mode_settings.rx_mode") - } case interfaces.Interface_AF_PACKET: if intf.GetAfpacket().GetHostIfName() == "" { return kvs.NewInvalidValueError(ErrAfPacketWithoutHostName, "link.afpacket.host_if_name") @@ -446,6 +433,17 @@ func (d *InterfaceDescriptor) Validate(key string, intf *interfaces.Interface) e } } + // validate rx placements before before deriving + for i, rxPlacement1 := range intf.GetRxPlacements() { + for j := i + 1; j < len(intf.GetRxPlacements()); j++ { + rxPlacement2 := intf.GetRxPlacements()[j] + if rxPlacement1.Queue == rxPlacement2.Queue { + return kvs.NewInvalidValueError(ErrRedefinedRxPlacement, + fmt.Sprintf("rx_placement[.queue=%d]", rxPlacement1.Queue)) + } + } + } + return nil } @@ -536,7 +534,11 @@ func (d *InterfaceDescriptor) Dependencies(key string, intf *interfaces.Interfac // - empty value for enabled DHCP client // - configuration for every slave of a bonded interface // - one empty value for every IP address to be assigned to the interface -// - one empty value for VRF table to put the interface into. +// - one empty value for VRF table to put the interface into +// - one value with interface configuration reduced to RxMode if set +// - one Interface_RxPlacement for every queue with configured Rx placement +// - one empty value which will be created once at least one IP address is +// assigned to the interface. func (d *InterfaceDescriptor) DerivedValues(key string, intf *interfaces.Interface) (derValues []kvs.KeyValuePair) { // unnumbered interface if intf.GetUnnumbered() != nil { @@ -602,6 +604,34 @@ func (d *InterfaceDescriptor) DerivedValues(key string, intf *interfaces.Interfa } } + // Rx mode + if len(intf.GetRxModes()) > 0 { + derValues = append(derValues, kvs.KeyValuePair{ + Key: interfaces.RxModesKey(intf.GetName()), + Value: &interfaces.Interface{ + Name: intf.GetName(), + Type: intf.GetType(), + RxModes: intf.GetRxModes(), + }, + }) + } + + // Rx placement + for _, rxPlacement := range intf.GetRxPlacements() { + derValues = append(derValues, kvs.KeyValuePair{ + Key: interfaces.RxPlacementKey(intf.GetName(), rxPlacement.GetQueue()), + Value: rxPlacement, + }) + } + + // with-IP address (property) + if len(intf.GetIpAddresses()) > 0 { + derValues = append(derValues, kvs.KeyValuePair{ + Key: interfaces.InterfaceWithIPKey(intf.GetName()), + Value: &prototypes.Empty{}, + }) + } + // TODO: define derived value for UP/DOWN state (needed for subinterfaces) return derValues @@ -633,40 +663,6 @@ func (d *InterfaceDescriptor) resolveMemifSocketFilename(memifIf *interfaces.Mem return registeredID, nil } -// getRxMode returns the RX mode of the given interface. -// If the mode is not defined, it returns the default settings for the given -// interface type. -func getRxMode(intf *interfaces.Interface) *interfaces.Interface_RxModeSettings { - if rxModeSettings := intf.RxModeSettings; rxModeSettings != nil { - return rxModeSettings - } - - rxModeSettings := &interfaces.Interface_RxModeSettings{ - RxMode: interfaces.Interface_RxModeSettings_DEFAULT, - } - // return default mode for the given interface type - switch intf.GetType() { - case interfaces.Interface_DPDK: - rxModeSettings.RxMode = interfaces.Interface_RxModeSettings_POLLING - case interfaces.Interface_AF_PACKET: - rxModeSettings.RxMode = interfaces.Interface_RxModeSettings_INTERRUPT - case interfaces.Interface_TAP: - if intf.GetTap().GetVersion() == 2 { - // TAP v2 - rxModeSettings.RxMode = interfaces.Interface_RxModeSettings_INTERRUPT - } - } - return rxModeSettings -} - -// getRxPlacement returns the RX placement of the given interface. -func getRxPlacement(intf *interfaces.Interface) *interfaces.Interface_RxPlacementSettings { - if rxPlacementSettings := intf.GetRxPlacementSettings(); rxPlacementSettings != nil { - return rxPlacementSettings - } - return &interfaces.Interface_RxPlacementSettings{} -} - // getMemifSocketFilename returns the memif socket filename. func (d *InterfaceDescriptor) getMemifSocketFilename(memif *interfaces.MemifLink) string { if socketFilename := memif.GetSocketFilename(); socketFilename != "" { diff --git a/plugins/vpp/ifplugin/descriptor/interface_crud.go b/plugins/vpp/ifplugin/descriptor/interface_crud.go index 8bbd81b35b..9803727316 100644 --- a/plugins/vpp/ifplugin/descriptor/interface_crud.go +++ b/plugins/vpp/ifplugin/descriptor/interface_crud.go @@ -1,7 +1,6 @@ package descriptor import ( - "github.com/gogo/protobuf/proto" "github.com/pkg/errors" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" @@ -143,41 +142,6 @@ func (d *InterfaceDescriptor) Create(key string, intf *interfaces.Interface) (me d.bondIDs[intf.GetBond().GetId()] = intf.GetName() } - /* - Rx-mode - - Legend: - P - polling - I - interrupt - A - adaptive - - Interfaces - supported modes: - * tap interface - PIA - * memory interface - PIA - * vxlan tunnel - PIA - * software loopback - PIA - * ethernet csmad - P - * af packet - PIA - */ - if intf.RxModeSettings != nil { - rxMode := getRxMode(intf) - err = d.ifHandler.SetRxMode(ifIdx, rxMode) - if err != nil { - err = errors.Errorf("failed to set Rx-mode for interface %s: %v", intf.Name, err) - d.log.Error(err) - return nil, err - } - } - - // rx-placement - if intf.GetRxPlacementSettings() != nil { - if err = d.ifHandler.SetRxPlacement(ifIdx, intf.GetRxPlacementSettings()); err != nil { - err = errors.Errorf("failed to set rx-placement for interface %s: %v", intf.Name, err) - d.log.Error(err) - return nil, err - } - } - // MAC address. Note: physical interfaces cannot have the MAC address changed. The bond interface uses its own // binary API call to set MAC address. if intf.GetPhysAddress() != "" && @@ -287,27 +251,6 @@ func (d *InterfaceDescriptor) Delete(key string, intf *interfaces.Interface, met func (d *InterfaceDescriptor) Update(key string, oldIntf, newIntf *interfaces.Interface, oldMetadata *ifaceidx.IfaceMetadata) (newMetadata *ifaceidx.IfaceMetadata, err error) { ifIdx := oldMetadata.SwIfIndex - // rx-mode - oldRx := getRxMode(oldIntf) - newRx := getRxMode(newIntf) - if !proto.Equal(oldRx, newRx) { - err = d.ifHandler.SetRxMode(ifIdx, newRx) - if err != nil { - err = errors.Errorf("failed to modify rx-mode for interface %s: %v", newIntf.Name, err) - d.log.Error(err) - return oldMetadata, err - } - } - - // rx-placement - if newIntf.GetRxPlacementSettings() != nil && !proto.Equal(getRxPlacement(oldIntf), getRxPlacement(newIntf)) { - if err = d.ifHandler.SetRxPlacement(ifIdx, newIntf.GetRxPlacementSettings()); err != nil { - err = errors.Errorf("failed to modify rx-placement for interface %s: %v", newIntf.Name, err) - d.log.Error(err) - return oldMetadata, err - } - } - // admin status if newIntf.Enabled != oldIntf.Enabled { if newIntf.Enabled { @@ -460,6 +403,7 @@ func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetada // (seemingly uninitialized section of memory is returned) if intf.Interface.GetTap().GetVersion() == 2 { intf.Interface.GetTap().HostIfName = expCfg.GetTap().GetHostIfName() + tapHostIfName = expCfg.GetTap().GetHostIfName() } } @@ -476,6 +420,31 @@ func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetada intf.Interface.GetMemif().BufferSize = expCfg.GetMemif().GetBufferSize() } } + + // remove rx-placement entries for queues with configuration not defined by NB + rxPlacementDump := intf.Interface.GetRxPlacements() + rxPlacementCfg := expCfg.GetRxPlacements() + for i := 0; i < len(rxPlacementDump); { + queue := rxPlacementDump[i].Queue + found := false + for j := 0; j < len(rxPlacementCfg); j++ { + if rxPlacementCfg[j].Queue == queue { + found = true + break + } + } + if found { + i++ + } else { + rxPlacementDump = append(rxPlacementDump[:i], rxPlacementDump[i+1:]...) + } + } + intf.Interface.RxPlacements = rxPlacementDump + + // remove rx-mode from the dump if it is not configured by NB + if len(expCfg.GetRxModes()) == 0 { + intf.Interface.RxModes = []*interfaces.Interface_RxMode{} + } } // verify links between VPP and Linux side diff --git a/plugins/vpp/ifplugin/descriptor/interface_with_address.go b/plugins/vpp/ifplugin/descriptor/interface_with_address.go new file mode 100644 index 0000000000..ceac826f81 --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/interface_with_address.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package descriptor + +import ( + "github.com/gogo/protobuf/proto" + "github.com/ligato/cn-infra/logging" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" +) + +const ( + // InterfaceWithAddressDescriptorName is the name of the descriptor for marking + // interfaces with at least one IP address assigned. + InterfaceWithAddressDescriptorName = "vpp-interface-has-address" + + // dependency labels + interfaceHasIPDep = "interface-has-IP" +) + +// InterfaceWithAddrDescriptor assigns property key-value pairs to interfaces +// with at least one IP address. +type InterfaceWithAddrDescriptor struct { + log logging.Logger +} + +// NewInterfaceWithAddrDescriptor creates a new instance of InterfaceWithAddrDescriptor. +func NewInterfaceWithAddrDescriptor(log logging.PluginLogger) *kvs.KVDescriptor { + + descrCtx := &InterfaceWithAddrDescriptor{ + log: log.NewLogger("interface-has-address-descriptor"), + } + return &kvs.KVDescriptor{ + Name: InterfaceWithAddressDescriptorName, + KeySelector: descrCtx.IsInterfaceWithAddressKey, + Create: descrCtx.Create, + Delete: descrCtx.Delete, + Dependencies: descrCtx.Dependencies, + } +} + +// IsInterfaceWithAddressKey returns true if the key is a property assigned to interface +// with at least one IP address. +func (d *InterfaceWithAddrDescriptor) IsInterfaceWithAddressKey(key string) bool { + _, isIfaceWithIPKey := interfaces.ParseInterfaceWithIPKey(key) + return isIfaceWithIPKey +} + +// Create is NOOP (the key-value pair is a property). +func (d *InterfaceWithAddrDescriptor) Create(key string, emptyVal proto.Message) (metadata kvs.Metadata, err error) { + return nil, nil +} + +// Delete is NOOP (the key-value pair is a property) +func (d *InterfaceWithAddrDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) { + return nil +} + +// Dependencies ensures that the property is created only after at least one IP +// address is successfully assigned to the interface. +func (d *InterfaceWithAddrDescriptor) Dependencies(key string, emptyVal proto.Message) (deps []kvs.Dependency) { + ifaceName, _ := interfaces.ParseInterfaceWithIPKey(key) + return []kvs.Dependency{ + { + Label: interfaceHasIPDep, + AnyOf: kvs.AnyOfDependency{ + KeyPrefixes: []string{interfaces.InterfaceAddressPrefix(ifaceName)}, + }, + }, + } +} + diff --git a/plugins/vpp/ifplugin/descriptor/link_state.go b/plugins/vpp/ifplugin/descriptor/link_state.go new file mode 100644 index 0000000000..70285fc338 --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/link_state.go @@ -0,0 +1,153 @@ +// Copyright (c) 2018 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package descriptor + +import ( + "sync" + + prototypes "github.com/gogo/protobuf/types" + "github.com/ligato/cn-infra/logging" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +const ( + // LinkStateDescriptorName is the name of the descriptor notifying about the + // link state changes of VPP interfaces. + LinkStateDescriptorName = "vpp-interface-link-state" +) + +// LinkStateDescriptor notifies kvscheduler about the link state changes of VPP +// interfaces. +type LinkStateDescriptor struct { + // input arguments + log logging.Logger + kvscheduler kvs.KVScheduler + ifaceHandler vppcalls.InterfaceVppAPI + ifaceIdx ifaceidx.IfaceMetadataIndex + + linkStatesMx sync.Mutex + linkStates map[string]bool // interface name -> link is up +} + +// NewLinkStateDescriptor creates a new instance of the Link-State descriptor. +func NewLinkStateDescriptor(kvscheduler kvs.KVScheduler, ifaceHandler vppcalls.InterfaceVppAPI, + ifaceIdx ifaceidx.IfaceMetadataIndex, log logging.PluginLogger) (descr *kvs.KVDescriptor, ctx *LinkStateDescriptor) { + + descrCtx := &LinkStateDescriptor{ + log: log.NewLogger("interface-link-state"), + kvscheduler: kvscheduler, + ifaceHandler: ifaceHandler, + ifaceIdx: ifaceIdx, + linkStates: make(map[string]bool), + } + return &kvs.KVDescriptor{ + Name: LinkStateDescriptorName, + KeySelector: descrCtx.IsInterfaceLinkStateKey, + Retrieve: descrCtx.Retrieve, + // Retrieve depends on the interface descriptor: interface index is used + // to convert sw_if_index to logical interface name + RetrieveDependencies: []string{InterfaceDescriptorName}, + }, descrCtx +} + +// IsInterfaceLinkStateKey returns for keys representing +// link-state of VPP interfaces. +func (w *LinkStateDescriptor) IsInterfaceLinkStateKey(key string) bool { + _, _, isLinkStateKey := interfaces.ParseLinkStateKey(key) + return isLinkStateKey +} + +// Retrieve returns key for every VPP interface describing the state of the link +// (value is empty). +func (w *LinkStateDescriptor) Retrieve(correlate []kvs.KVWithMetadata) (values []kvs.KVWithMetadata, err error) { + // TODO: avoid dumping interface details when it was already done in the interface + // descriptor within the same Refresh (e.g. during full resync) + // - e.g. add context to allow sharing of information across Retrieve(s) of the same Refresh + + ifaceStates, err := w.ifaceHandler.DumpInterfaceStates() + if err != nil { + w.log.Error(err) + return nil, err + } + + w.linkStatesMx.Lock() + defer w.linkStatesMx.Unlock() + w.linkStates = make(map[string]bool) // clear the map + + for ifaceIdx, ifaceState := range ifaceStates { + ifaceName, _, found := w.ifaceIdx.LookupBySwIfIndex(ifaceIdx) + if !found { + // skip interface not configured by NB (e.g. untouched Gbe interface) + continue + } + linkIsUp := ifaceState.LinkState == interfaces.InterfaceState_UP + w.linkStates[ifaceName] = linkIsUp + values = append(values, kvs.KVWithMetadata{ + Key: interfaces.LinkStateKey(ifaceName, linkIsUp), + Value: &prototypes.Empty{}, + Origin: kvs.FromSB, + }) + } + + return values, nil +} + +// UpdateLinkState notifies scheduler about a change in the link state of an interface. +func (w *LinkStateDescriptor) UpdateLinkState(ifaceState *interfaces.InterfaceNotification) { + w.linkStatesMx.Lock() + defer w.linkStatesMx.Unlock() + + var notifs []kvs.KVWithMetadata + + operStatus := ifaceState.State.OperStatus + ifaceName := ifaceState.State.Name + linkWasUp, hadLinkState := w.linkStates[ifaceName] + linkIsUp := operStatus == interfaces.InterfaceState_UP + toDelete := operStatus == interfaces.InterfaceState_DELETED || + operStatus == interfaces.InterfaceState_UNKNOWN_STATUS + + if toDelete || (hadLinkState && (linkIsUp != linkWasUp)) { + if hadLinkState { + // remove now obsolete key-value pair + notifs = append(notifs, kvs.KVWithMetadata{ + Key: interfaces.LinkStateKey(ifaceState.State.Name, linkWasUp), + Value: nil, + Metadata: nil, + }) + delete(w.linkStates, ifaceName) + } + } + + if !toDelete && (!hadLinkState || (linkIsUp != linkWasUp)) { + // push new key-value pair + notifs = append(notifs, kvs.KVWithMetadata{ + Key: interfaces.LinkStateKey(ifaceState.State.Name, linkIsUp), + Value: &prototypes.Empty{}, + Metadata: nil, + }) + w.linkStates[ifaceName] = linkIsUp + } + + if len(notifs) != 0 { + err := w.kvscheduler.PushSBNotification(notifs...) + if err != nil { + w.log.Errorf("failed to send notifications to KVScheduler: %v", err) + } + } +} diff --git a/plugins/vpp/ifplugin/descriptor/rx_mode.go b/plugins/vpp/ifplugin/descriptor/rx_mode.go new file mode 100644 index 0000000000..3a9a6ccd68 --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/rx_mode.go @@ -0,0 +1,307 @@ +// Copyright (c) 2018 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package descriptor + +import ( + "fmt" + + "github.com/gogo/protobuf/proto" + "github.com/ligato/cn-infra/logging" + "github.com/pkg/errors" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/descriptor/adapter" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +const ( + // RxModeDescriptorName is the name of the descriptor for the unnumbered + // config-subsection of VPP interfaces. + RxModeDescriptorName = "vpp-interface-rx-mode" + + // dependency labels + linkIsUpDep = "interface-link-is-UP" +) + +// A list of non-retriable errors: +var ( + // ErrUnsupportedRxMode is returned when the given interface type does not support the chosen + // RX mode. + ErrUnsupportedRxMode = errors.New("unsupported RX Mode") + + // ErrUndefinedRxMode is returned when the Rx mode is not defined. + ErrUndefinedRxMode = errors.New("undefined RX Mode") + + // ErrUnsupportedRxMode is returned when Rx mode has multiple definitions for the same queue. + ErrRedefinedRxMode = errors.New("redefined RX Mode") +) + +// RxModeDescriptor configures Rx mode for VPP interface queues. +type RxModeDescriptor struct { + log logging.Logger + ifHandler vppcalls.InterfaceVppAPI + ifIndex ifaceidx.IfaceMetadataIndex +} + +// NewRxModeDescriptor creates a new instance of RxModeDescriptor. +func NewRxModeDescriptor(ifHandler vppcalls.InterfaceVppAPI, ifIndex ifaceidx.IfaceMetadataIndex, + log logging.PluginLogger) *kvs.KVDescriptor { + + ctx := &RxModeDescriptor{ + ifHandler: ifHandler, + ifIndex: ifIndex, + log: log.NewLogger("rx-mode-descriptor"), + } + + typedDescr := &adapter.RxModeDescriptor{ + Name: RxModeDescriptorName, + KeySelector: ctx.IsInterfaceRxModeKey, + // proto message Interface is only used as container for RxMode + ValueTypeName: proto.MessageName(&interfaces.Interface{}), + ValueComparator: ctx.EquivalentRxMode, + Validate: ctx.Validate, + Create: ctx.Create, + Update: ctx.Update, + Delete: ctx.Delete, + Dependencies: ctx.Dependencies, + } + + return adapter.NewRxModeDescriptor(typedDescr) +} + +// IsInterfaceRxModeKey returns true if the key is identifying RxMode configuration. +func (d *RxModeDescriptor) IsInterfaceRxModeKey(key string) bool { + _, isValid := interfaces.ParseRxModesKey(key) + return isValid +} + +// EquivalentRxMode compares Rx modes for equivalency. +func (d *RxModeDescriptor) EquivalentRxMode(key string, oldIntf, newIntf *interfaces.Interface) bool { + /* Note: default Rx mode cannot be dumped - compare only if these are two NB + configurations (not a refreshed, i.e. dumped, value). + */ + oldDefMode := getDefaultRxMode(oldIntf) + newDefMode := getDefaultRxMode(newIntf) + if oldDefMode != interfaces.Interface_RxMode_UNKNOWN && + newDefMode != interfaces.Interface_RxMode_UNKNOWN { + if oldDefMode != newDefMode { + return false + } + } + // compare queue-specific RX modes + for _, rxMode := range oldIntf.GetRxModes() { + if rxMode.DefaultMode { + continue + } + oldMode := normalizeRxMode(rxMode.Mode, oldIntf) + newMode := getQueueRxMode(rxMode.Queue, newIntf) + if oldMode != newMode { + return false + } + } + for _, rxMode := range newIntf.GetRxModes() { + if rxMode.DefaultMode { + continue + } + newMode := normalizeRxMode(rxMode.Mode, newIntf) + oldMode := getQueueRxMode(rxMode.Queue, oldIntf) + if oldMode != newMode { + return false + } + } + return true +} + +// Validate validates Rx mode configuration. +func (d *RxModeDescriptor) Validate(key string, ifaceWithRxMode *interfaces.Interface) error { + for i, rxMode1 := range ifaceWithRxMode.GetRxModes() { + if rxMode1.Mode == interfaces.Interface_RxMode_UNKNOWN { + if rxMode1.DefaultMode { + return kvs.NewInvalidValueError(ErrUndefinedRxMode, "rx_mode[default]") + } + return kvs.NewInvalidValueError(ErrUndefinedRxMode, + fmt.Sprintf("rx_mode[.queue=%d]", rxMode1.Queue)) + } + for j := i + 1; j < len(ifaceWithRxMode.GetRxModes()); j++ { + rxMode2 := ifaceWithRxMode.GetRxModes()[j] + if rxMode1.DefaultMode != rxMode2.DefaultMode { + continue + } + if rxMode1.DefaultMode { + return kvs.NewInvalidValueError(ErrRedefinedRxMode, "rx_mode[default]") + } + if rxMode1.Queue == rxMode2.Queue { + return kvs.NewInvalidValueError(ErrRedefinedRxMode, + fmt.Sprintf("rx_mode[.queue=%d]", rxMode1.Queue)) + } + } + } + + if ifaceWithRxMode.GetType() == interfaces.Interface_DPDK { + for _, rxMode := range ifaceWithRxMode.GetRxModes() { + mode := normalizeRxMode(rxMode.Mode, ifaceWithRxMode) + if mode != interfaces.Interface_RxMode_POLLING { + if rxMode.DefaultMode { + return kvs.NewInvalidValueError(ErrUnsupportedRxMode, + "rx_mode[default]") + } + return kvs.NewInvalidValueError(ErrUnsupportedRxMode, + fmt.Sprintf("rx_mode[.queue=%d]", rxMode.Queue)) + } + } + } + return nil +} + +// Create configures RxMode for a given interface. +// Please note the proto message Interface is only used as container for RxMode. +// Only interface name, type and Rx mode are set. +func (d *RxModeDescriptor) Create(key string, ifaceWithRxMode *interfaces.Interface) (metadata interface{}, err error) { + err = d.configureRxMode(ifaceWithRxMode, kvs.TxnOperation_CREATE) + return nil, err +} + +// Update modifies Rx mode configuration. +func (d *RxModeDescriptor) Update(key string, _, ifaceWithRxMode *interfaces.Interface, + oldMetadata interface{}) (newMetadata interface{}, err error) { + + err = d.configureRxMode(ifaceWithRxMode, kvs.TxnOperation_UPDATE) + return nil, err +} + +// Delete reverts back to the default rx mode configuration. +func (d *RxModeDescriptor) Delete(key string, ifaceWithRxMode *interfaces.Interface, metadata interface{}) error { + return d.configureRxMode(ifaceWithRxMode, kvs.TxnOperation_DELETE) +} + +// configureRxMode (re-)configures Rx mode for the interface. +func (d *RxModeDescriptor) configureRxMode(iface *interfaces.Interface, op kvs.TxnOperation) (err error) { + + ifMeta, found := d.ifIndex.LookupByName(iface.Name) + if !found { + err = errors.Errorf("failed to find interface %s", iface.Name) + d.log.Error(err) + return err + } + ifIdx := ifMeta.SwIfIndex + + defRxMode := getDefaultRxMode(iface) + + // first, revert back to default for all queues + revertToDefault := op == kvs.TxnOperation_DELETE || + (op == kvs.TxnOperation_UPDATE && defRxMode == interfaces.Interface_RxMode_UNKNOWN) + if revertToDefault { + err = d.ifHandler.SetRxMode(ifIdx, &interfaces.Interface_RxMode{ + DefaultMode: true, + Mode: normalizeRxMode(interfaces.Interface_RxMode_DEFAULT, iface), + }) + if err != nil { + // treat error as warning here + d.log.Warnf("failed to un-configure Rx-mode (%v) - most likely "+ + "the interface is already without a link", err) + err = nil + } + } + + if op == kvs.TxnOperation_DELETE { + return + } + + // configure the requested default Rx mode + if defRxMode != interfaces.Interface_RxMode_UNKNOWN { + err = d.ifHandler.SetRxMode(ifIdx, &interfaces.Interface_RxMode{ + DefaultMode: true, + Mode: defRxMode, + }) + if err != nil { + err = errors.Errorf("failed to set default Rx-mode for interface %s: %v", iface.Name, err) + d.log.Error(err) + return err + } + } + + // configure per-queue RX mode + for _, rxMode := range iface.GetRxModes() { + if rxMode.DefaultMode || rxMode.Mode == defRxMode { + continue + } + err = d.ifHandler.SetRxMode(ifIdx, rxMode) + if err != nil { + err = errors.Errorf("failed to set Rx-mode for queue %d of the interface %s: %v", + rxMode.Queue, iface.Name, err) + d.log.Error(err) + return err + } + } + + return nil +} + +// Dependencies informs scheduler that Rx mode configuration cannot be applied +// until the interface link is UP. +func (d *RxModeDescriptor) Dependencies(key string, ifaceWithRxMode *interfaces.Interface) (deps []kvs.Dependency) { + return []kvs.Dependency{ + { + Label: linkIsUpDep, + Key: interfaces.LinkStateKey(ifaceWithRxMode.Name, true), + }, + } +} + +// getDefaultRxMode reads default RX mode from the interface configuration. +func getDefaultRxMode(iface *interfaces.Interface) (rxMode interfaces.Interface_RxMode_Type) { + for _, rxMode := range iface.GetRxModes() { + if rxMode.DefaultMode { + return normalizeRxMode(rxMode.Mode, iface) + } + } + return interfaces.Interface_RxMode_UNKNOWN +} + +// getQueueRxMode reads RX mode for the given queue from the interface configuration. +func getQueueRxMode(queue uint32, iface *interfaces.Interface) (mode interfaces.Interface_RxMode_Type) { + for _, rxMode := range iface.GetRxModes() { + if rxMode.DefaultMode { + mode = rxMode.Mode + continue // keep looking for a queue-specific RX mode + } + if rxMode.Queue == queue { + mode = rxMode.Mode + break + } + } + return normalizeRxMode(mode, iface) +} + +// normalizeRxMode resolves default/undefined Rx mode for specific interfaces. +func normalizeRxMode(mode interfaces.Interface_RxMode_Type, iface *interfaces.Interface) interfaces.Interface_RxMode_Type { + if mode != interfaces.Interface_RxMode_DEFAULT { + return mode + } + switch iface.GetType() { + case interfaces.Interface_DPDK: + return interfaces.Interface_RxMode_POLLING + case interfaces.Interface_AF_PACKET: + return interfaces.Interface_RxMode_INTERRUPT + case interfaces.Interface_TAP: + if iface.GetTap().GetVersion() == 2 { + // TAP v2 + return interfaces.Interface_RxMode_INTERRUPT + } + } + return mode +} diff --git a/plugins/vpp/ifplugin/descriptor/rx_placement.go b/plugins/vpp/ifplugin/descriptor/rx_placement.go new file mode 100644 index 0000000000..e51e416bd5 --- /dev/null +++ b/plugins/vpp/ifplugin/descriptor/rx_placement.go @@ -0,0 +1,118 @@ +// Copyright (c) 2018 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package descriptor + +import ( + "github.com/gogo/protobuf/proto" + "github.com/ligato/cn-infra/logging" + "github.com/pkg/errors" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/descriptor/adapter" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +const ( + // RxPlacementDescriptorName is the name of the descriptor for the rx-placement + // config-subsection of VPP interfaces. + RxPlacementDescriptorName = "vpp-interface-rx-placement" +) + +// RxPlacementDescriptor configures Rx placement for VPP interface queues. +type RxPlacementDescriptor struct { + log logging.Logger + ifHandler vppcalls.InterfaceVppAPI + ifIndex ifaceidx.IfaceMetadataIndex +} + +// NewRxPlacementDescriptor creates a new instance of RxPlacementDescriptor. +func NewRxPlacementDescriptor(ifHandler vppcalls.InterfaceVppAPI, ifIndex ifaceidx.IfaceMetadataIndex, + log logging.PluginLogger) *kvs.KVDescriptor { + + ctx := &RxPlacementDescriptor{ + ifHandler: ifHandler, + ifIndex: ifIndex, + log: log.NewLogger("rx-placement-descriptor"), + } + + typedDescr := &adapter.RxPlacementDescriptor{ + Name: RxPlacementDescriptorName, + KeySelector: ctx.IsInterfaceRxPlacementKey, + ValueComparator: ctx.EquivalentRxPlacement, + ValueTypeName: proto.MessageName(&interfaces.Interface{}), + Create: ctx.Create, + Delete: ctx.Delete, + Dependencies: ctx.Dependencies, + } + + return adapter.NewRxPlacementDescriptor(typedDescr) +} + +// IsInterfaceRxPlacementKey returns true if the key is identifying RxPlacement +// configuration. +func (d *RxPlacementDescriptor) IsInterfaceRxPlacementKey(key string) bool { + _, _, isValid := interfaces.ParseRxPlacementKey(key) + return isValid +} + +// EquivalentRxMode compares Rx placements for equivalency. +func (d *RxPlacementDescriptor) EquivalentRxPlacement(key string, oldRxPl, newRxPl *interfaces.Interface_RxPlacement) bool { + + if (oldRxPl.MainThread != newRxPl.MainThread) || + (!oldRxPl.MainThread && oldRxPl.Worker != newRxPl.Worker) { + return false + } + return true +} + +// Create configures RxPlacement for a given interface queue. +// Please note the proto message Interface is only used as container for RxMode. +// Only interface name, type and Rx mode are set. +func (d *RxPlacementDescriptor) Create(key string, rxPlacement *interfaces.Interface_RxPlacement) (md interface{}, err error) { + ifaceName, _, _ := interfaces.ParseRxPlacementKey(key) + ifMeta, found := d.ifIndex.LookupByName(ifaceName) + if !found { + err = errors.Errorf("failed to find interface %s", ifaceName) + d.log.Error(err) + return nil, err + } + + if err = d.ifHandler.SetRxPlacement(ifMeta.SwIfIndex, rxPlacement); err != nil { + err = errors.Errorf("failed to set rx-placement for queue %d of the interface %s: %v", + rxPlacement.Queue, ifaceName, err) + d.log.Error(err) + return nil, err + } + return nil, err +} + +// Delete is NOOP (Rx placement cannot be returned back to default). +func (d *RxPlacementDescriptor) Delete(key string, rxPlacement *interfaces.Interface_RxPlacement, metadata interface{}) error { + return nil +} + +// Dependencies informs scheduler that Rx placement configuration cannot be applied +// until the interface link is UP. +func (d *RxPlacementDescriptor) Dependencies(key string, rxPlacement *interfaces.Interface_RxPlacement) []kvs.Dependency { + ifaceName, _, _ := interfaces.ParseRxPlacementKey(key) + return []kvs.Dependency{ + { + Label: linkIsUpDep, + Key: interfaces.LinkStateKey(ifaceName, true), + }, + } +} diff --git a/plugins/vpp/ifplugin/descriptor/unnumbered.go b/plugins/vpp/ifplugin/descriptor/unnumbered.go index ae33e13762..c6af5f3853 100644 --- a/plugins/vpp/ifplugin/descriptor/unnumbered.go +++ b/plugins/vpp/ifplugin/descriptor/unnumbered.go @@ -125,9 +125,7 @@ func (d *UnnumberedIfDescriptor) Dependencies(key string, unIntf *interfaces.Int deps = []kvs.Dependency{ { Label: unnumberedInterfaceHasIPDep, - AnyOf: kvs.AnyOfDependency{ - KeyPrefixes: []string{interfaces.InterfaceAddressPrefix(unIntf.InterfaceWithIp)}, - }, + Key: interfaces.InterfaceWithIPKey(unIntf.InterfaceWithIp), }, } diff --git a/plugins/vpp/ifplugin/ifplugin.go b/plugins/vpp/ifplugin/ifplugin.go index 1e0193a3b4..c183bb3ba9 100644 --- a/plugins/vpp/ifplugin/ifplugin.go +++ b/plugins/vpp/ifplugin/ifplugin.go @@ -14,13 +14,14 @@ //go:generate descriptor-adapter --descriptor-name Interface --value-type *vpp_interfaces.Interface --meta-type *ifaceidx.IfaceMetadata --import "ifaceidx" --import "github.com/ligato/vpp-agent/api/models/vpp/interfaces" --output-dir "descriptor" //go:generate descriptor-adapter --descriptor-name Unnumbered --value-type *vpp_interfaces.Interface_Unnumbered --import "github.com/ligato/vpp-agent/api/models/vpp/interfaces" --output-dir "descriptor" +//go:generate descriptor-adapter --descriptor-name RxMode --value-type *vpp_interfaces.Interface --import "github.com/ligato/vpp-agent/api/models/vpp/interfaces" --output-dir "descriptor" +//go:generate descriptor-adapter --descriptor-name RxPlacement --value-type *vpp_interfaces.Interface_RxPlacement --import "github.com/ligato/vpp-agent/api/models/vpp/interfaces" --output-dir "descriptor" //go:generate descriptor-adapter --descriptor-name BondedInterface --value-type *vpp_interfaces.BondLink_BondedInterface --import "github.com/ligato/vpp-agent/api/models/vpp/interfaces" --output-dir "descriptor" package ifplugin import ( "context" - "os" "sync" "time" @@ -44,22 +45,7 @@ import ( _ "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1904" -) - -const ( - // vppStatusPublishersEnv is the name of the environment variable used to - // override state publishers from the configuration file. - vppStatusPublishersEnv = "VPP_STATUS_PUBLISHERS" -) - -var ( - // noopWriter (no operation writer) helps avoiding NIL pointer based segmentation fault. - // It is used as default if some dependency was not injected. - noopWriter = datasync.KVProtoWriters{} - - // noopWatcher (no operation watcher) helps avoiding NIL pointer based segmentation fault. - // It is used as default if some dependency was not injected. - noopWatcher = datasync.KVProtoWatchers{} + _ "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1908" ) // IfPlugin configures VPP interfaces using GoVPP. @@ -78,7 +64,8 @@ type IfPlugin struct { dhcpIndex idxmap.NamedMapping // descriptors - dhcpDescriptor *descriptor.DHCPDescriptor + linkStateDescriptor *descriptor.LinkStateDescriptor + dhcpDescriptor *descriptor.DHCPDescriptor // from config file defaultMtu uint32 @@ -119,21 +106,15 @@ type Deps struct { PushNotification func(notification *vpp.Notification) } -// Config holds the vpp-plugin configuration. -type Config struct { - MTU uint32 `json:"mtu"` - StatusPublishers []string `json:"status-publishers"` -} - // Init loads configuration file and registers interface-related descriptors. -func (p *IfPlugin) Init() error { - var err error - +func (p *IfPlugin) Init() (err error) { // Create plugin context, save cancel function into the plugin handle. p.ctx, p.cancel = context.WithCancel(context.Background()) // Read config file and set all related fields - p.fromConfigFile() + if err := p.fromConfigFile(); err != nil { + return err + } // Fills nil dependencies with default values p.publishStats = p.PublishStatistics != nil || p.NotifyStates != nil @@ -167,21 +148,34 @@ func (p *IfPlugin) Init() error { } ifaceDescrCtx.SetInterfaceIndex(p.intfIndex) - // -> descriptors for derived values - var dhcpDescriptor *kvs.KVDescriptor + // -> descriptors for derived values / notifications + var ( + linkStateDescriptor *kvs.KVDescriptor + dhcpDescriptor *kvs.KVDescriptor + ) dhcpDescriptor, p.dhcpDescriptor = descriptor.NewDHCPDescriptor(p.KVScheduler, p.ifHandler, p.intfIndex, p.Log) + linkStateDescriptor, p.linkStateDescriptor = descriptor.NewLinkStateDescriptor( + p.KVScheduler, p.ifHandler, p.intfIndex, p.Log) + + rxModeDescriptor := descriptor.NewRxModeDescriptor(p.ifHandler, p.intfIndex, p.Log) + rxPlacementDescriptor := descriptor.NewRxPlacementDescriptor(p.ifHandler, p.intfIndex, p.Log) addrDescriptor := descriptor.NewInterfaceAddressDescriptor(p.ifHandler, p.intfIndex, p.Log) unIfDescriptor := descriptor.NewUnnumberedIfDescriptor(p.ifHandler, p.intfIndex, p.Log) bondIfDescriptor, _ := descriptor.NewBondedInterfaceDescriptor(p.ifHandler, p.intfIndex, p.Log) vrfDescriptor := descriptor.NewInterfaceVrfDescriptor(p.ifHandler, p.intfIndex, p.Log) + withAddrDescriptor := descriptor.NewInterfaceWithAddrDescriptor(p.Log) err = p.KVScheduler.RegisterKVDescriptor( dhcpDescriptor, + linkStateDescriptor, + rxModeDescriptor, + rxPlacementDescriptor, addrDescriptor, unIfDescriptor, bondIfDescriptor, vrfDescriptor, + withAddrDescriptor, ) if err != nil { return err @@ -201,43 +195,46 @@ func (p *IfPlugin) Init() error { p.wg.Add(1) go p.watchStatusEvents() + } - // start interface state publishing - p.wg.Add(1) - go p.publishIfStateEvents() - - // start interface state updater - p.ifStateChan = make(chan *interfaces.InterfaceNotification, 1000) - // Interface state updater - p.ifStateUpdater = &InterfaceStateUpdater{} - - var n int - var t time.Time - ifNotifHandler := func(state *interfaces.InterfaceNotification) { - select { - case p.ifStateChan <- state: - // OK - default: - // full - if time.Since(t) > time.Second { - p.Log.Debugf("ifStateChan channel is full (%d)", n) - n = 0 - } else { - n++ - } - t = time.Now() + // start interface state updater + p.ifStateChan = make(chan *interfaces.InterfaceNotification, 1000) + + // start interface state publishing + p.wg.Add(1) + go p.publishIfStateEvents() + + // Interface state updater + p.ifStateUpdater = &InterfaceStateUpdater{} + + var n int + var t time.Time + ifNotifHandler := func(state *interfaces.InterfaceNotification) { + select { + case p.ifStateChan <- state: + // OK + default: + // full + if time.Since(t) > time.Second { + p.Log.Debugf("ifStateChan channel is full (%d)", n) + n = 0 + } else { + n++ } + t = time.Now() } + } - if err := p.ifStateUpdater.Init(p.ctx, p.Log, p.KVScheduler, p.GoVppmux, p.intfIndex, ifNotifHandler); err != nil { - return err - } + err = p.ifStateUpdater.Init(p.ctx, p.Log, p.KVScheduler, p.GoVppmux, p.intfIndex, + ifNotifHandler, p.publishStats) + if err != nil { + return err + } + if p.publishStats { if err = p.subscribeWatcher(); err != nil { return err } - - p.Log.Debug("ifStateUpdater Initialized") } return nil @@ -259,11 +256,9 @@ func (p *IfPlugin) subscribeWatcher() (err error) { // AfterInit delegates the call to ifStateUpdater. func (p *IfPlugin) AfterInit() error { - if p.publishStats { - err := p.ifStateUpdater.AfterInit() - if err != nil { - return err - } + err := p.ifStateUpdater.AfterInit() + if err != nil { + return err } if p.StatusCheck != nil { @@ -312,11 +307,11 @@ func (p *IfPlugin) SetNotifyService(notify func(notification *vpp.Notification)) } // fromConfigFile loads plugin attributes from the configuration file. -func (p *IfPlugin) fromConfigFile() { +func (p *IfPlugin) fromConfigFile() error { config, err := p.loadConfig() if err != nil { p.Log.Errorf("Error reading %v config file: %v", p.PluginName, err) - return + return err } if config != nil { publishers := datasync.KVProtoWriters{} @@ -335,28 +330,18 @@ func (p *IfPlugin) fromConfigFile() { p.Log.Infof("Default MTU set to %v", p.defaultMtu) } } + return nil } -// loadConfig loads configuration file. -func (p *IfPlugin) loadConfig() (*Config, error) { - config := &Config{} - - found, err := p.Cfg.LoadValue(config) - if err != nil { - return nil, err - } else if !found { - p.Log.Debugf("%v config not found", p.PluginName) - return nil, nil - } - p.Log.Debugf("%v config found: %+v", p.PluginName, config) - - if pubs := os.Getenv(vppStatusPublishersEnv); pubs != "" { - p.Log.Debugf("status publishers from env: %v", pubs) - config.StatusPublishers = append(config.StatusPublishers, pubs) - } +var ( + // noopWriter (no operation writer) helps avoiding NIL pointer based segmentation fault. + // It is used as default if some dependency was not injected. + noopWriter = datasync.KVProtoWriters{} - return config, err -} + // noopWatcher (no operation watcher) helps avoiding NIL pointer based segmentation fault. + // It is used as default if some dependency was not injected. + noopWatcher = datasync.KVProtoWatchers{} +) // fixNilPointers sets noopWriter & nooWatcher for nil dependencies. func (p *IfPlugin) fixNilPointers() { diff --git a/plugins/vpp/ifplugin/interface_state.go b/plugins/vpp/ifplugin/interface_state.go index 14031f56ec..3c3d522bb9 100644 --- a/plugins/vpp/ifplugin/interface_state.go +++ b/plugins/vpp/ifplugin/interface_state.go @@ -16,6 +16,7 @@ package ifplugin import ( "context" + "os" "sync" "time" @@ -31,12 +32,7 @@ import ( ) var ( - // PeriodicPollingPeriod between statistics reads - // TODO should be configurable - PeriodicPollingPeriod = time.Second * 5 - - // StateUpdateDelay defines delay before dumping states - StateUpdateDelay = time.Second * 3 + debugIfStates = os.Getenv("DEBUG_IFSTATES") != "" ) // InterfaceStateUpdater holds state data of all VPP interfaces. @@ -47,8 +43,9 @@ type InterfaceStateUpdater struct { swIfIndexes ifaceidx.IfaceMetadataIndex publishIfState func(notification *intf.InterfaceNotification) - access sync.Mutex // lock for the state data map - ifState map[uint32]*intf.InterfaceState // swIfIndex to state data map + // access guards access to ifState map + access sync.Mutex + ifState map[uint32]*intf.InterfaceState // swIfIndex goVppMux govppmux.StatsAPI @@ -69,9 +66,11 @@ type InterfaceStateUpdater struct { } // Init members (channels, maps...) and start go routines -func (c *InterfaceStateUpdater) Init(ctx context.Context, logger logging.PluginLogger, kvScheduler kvs.KVScheduler, +func (c *InterfaceStateUpdater) Init(ctx context.Context, + logger logging.PluginLogger, kvScheduler kvs.KVScheduler, goVppMux govppmux.StatsAPI, swIfIndexes ifaceidx.IfaceMetadataIndex, - publishIfState func(notification *intf.InterfaceNotification)) (err error) { + publishIfState func(*intf.InterfaceNotification), readCounters bool, +) (err error) { // Logger c.log = logger.NewLogger("if-state") @@ -109,13 +108,19 @@ func (c *InterfaceStateUpdater) Init(ctx context.Context, logger logging.PluginL go c.watchVPPNotifications(childCtx) // Periodically read VPP counters and combined counters for VPP statistics - c.wg.Add(1) - go c.startReadingCounters(childCtx) - - c.wg.Add(1) - go c.startUpdatingIfStateDetails(childCtx) + if disableInterfaceStats { + c.log.Warnf("reading interface stats is DISABLED!") + } else if readCounters { + c.wg.Add(1) + go c.startReadingCounters(childCtx) + } - c.log.Info("Interface state updater initialized") + if disableStatusPublishing { + c.log.Warnf("publishing interface status is DISABLED!") + } else { + c.wg.Add(1) + go c.startUpdatingIfStateDetails(childCtx) + } return nil } @@ -246,24 +251,27 @@ func (c *InterfaceStateUpdater) doUpdatesIfStateDetails() { // we dont want to lock during potentionally long dump call c.access.Unlock() - c.log.Debugf("running update for interface state details (%d)", len(c.ifsForUpdate)) + c.log.Debugf("updating interface states for %d interfaces", len(c.ifsForUpdate)) + + var ifIdxs []uint32 + c.access.Lock() + for ifIdx := range c.ifsForUpdate { + ifIdxs = append(ifIdxs, ifIdx) + } + // clear interfaces for update + c.ifsForUpdate = make(map[uint32]struct{}) + c.access.Unlock() - ifaces, err := c.ifHandler.DumpInterfaces() + ifaces, err := c.ifHandler.DumpInterfaceStates(ifIdxs...) if err != nil { - c.log.Warnf("dump interfaces failed: %v", err) + c.log.Warnf("dumping interface states failed: %v", err) return } c.access.Lock() for _, ifaceDetails := range ifaces { - if _, ok := c.ifsForUpdate[ifaceDetails.Meta.SwIfIndex]; !ok { - // not interface for update - continue - } c.updateIfStateDetails(ifaceDetails) } - // clear interfaces for update - c.ifsForUpdate = make(map[uint32]struct{}) c.access.Unlock() } @@ -299,7 +307,6 @@ func (c *InterfaceStateUpdater) doInterfaceStatsRead() { // processInterfaceStatEntry fills state data for every registered interface and publishes them func (c *InterfaceStateUpdater) processInterfaceStatEntry(ifCounters govppapi.InterfaceCounters) { - ifState, found := c.getIfStateDataWLookup(ifCounters.InterfaceIndex) if !found { return @@ -321,12 +328,13 @@ func (c *InterfaceStateUpdater) processInterfaceStatEntry(ifCounters govppapi.In } c.publishIfState(&intf.InterfaceNotification{ - Type: intf.InterfaceNotification_COUNTERS, State: ifState}) + Type: intf.InterfaceNotification_COUNTERS, + State: ifState, + }) } // processIfStateEvent process a VPP state event notification. func (c *InterfaceStateUpdater) processIfStateEvent(notif *vppcalls.InterfaceEvent) { - c.access.Lock() defer c.access.Unlock() @@ -337,26 +345,28 @@ func (c *InterfaceStateUpdater) processIfStateEvent(notif *vppcalls.InterfaceEve if !found { return } - c.log.Debugf("Interface state notification for %s (idx: %d): %+v", - ifState.Name, ifState.IfIndex, notif) + + if debugIfStates { + c.log.Debugf("Interface state notification for %s (idx: %d): %+v", + ifState.Name, ifState.IfIndex, notif) + } // store data in ETCD c.publishIfState(&intf.InterfaceNotification{ - Type: intf.InterfaceNotification_UPDOWN, State: ifState}) + Type: intf.InterfaceNotification_UPDOWN, + State: ifState, + }) } // getIfStateData returns interface state data structure for the specified interface index and interface name. // NOTE: plugin.ifStateData needs to be locked when calling this function! func (c *InterfaceStateUpdater) getIfStateData(swIfIndex uint32, ifName string) (*intf.InterfaceState, bool) { - ifState, ok := c.ifState[swIfIndex] - // check also if the provided logical name c the same as the one associated // with swIfIndex, because swIfIndexes might be reused if ok && ifState.Name == ifName { return ifState, true } - return nil, false } @@ -386,8 +396,8 @@ func (c *InterfaceStateUpdater) getIfStateDataWLookup(ifIdx uint32) (*intf.Inter // updateIfStateFlags updates the interface state data in memory from provided VPP flags message and returns updated state data. // NOTE: plugin.ifStateData needs to be locked when calling this function! func (c *InterfaceStateUpdater) updateIfStateFlags(vppMsg *vppcalls.InterfaceEvent) ( - iface *intf.InterfaceState, found bool) { - + iface *intf.InterfaceState, found bool, +) { ifState, found := c.getIfStateDataWLookup(vppMsg.SwIfIndex) if !found { return nil, false @@ -412,71 +422,26 @@ func (c *InterfaceStateUpdater) updateIfStateFlags(vppMsg *vppcalls.InterfaceEve return ifState, true } -const megabit = 1000000 // One megabit in bytes - // updateIfStateDetails updates the interface state data in memory from provided VPP details message. -func (c *InterfaceStateUpdater) updateIfStateDetails(ifDetails *vppcalls.InterfaceDetails) { - - ifState, found := c.getIfStateDataWLookup(ifDetails.Meta.SwIfIndex) +func (c *InterfaceStateUpdater) updateIfStateDetails(ifDetails *vppcalls.InterfaceState) { + ifState, found := c.getIfStateDataWLookup(ifDetails.SwIfIndex) if !found { return } - ifState.InternalName = ifDetails.Meta.InternalName - - if ifDetails.Meta.AdminState == 1 { - ifState.AdminStatus = intf.InterfaceState_UP - } else if ifDetails.Meta.AdminState == 0 { - ifState.AdminStatus = intf.InterfaceState_DOWN - } else { - ifState.AdminStatus = intf.InterfaceState_UNKNOWN_STATUS - } - - if ifDetails.Meta.LinkState == 1 { - ifState.OperStatus = intf.InterfaceState_UP - } else if ifDetails.Meta.LinkState == 0 { - ifState.OperStatus = intf.InterfaceState_DOWN - } else { - ifState.OperStatus = intf.InterfaceState_UNKNOWN_STATUS - } - - ifState.PhysAddress = ifDetails.Interface.PhysAddress - - ifState.Mtu = uint32(ifDetails.Meta.LinkMTU) - - switch ifDetails.Meta.LinkSpeed { - case 1: - ifState.Speed = 10 * megabit // 10M - case 2: - ifState.Speed = 100 * megabit // 100M - case 4: - ifState.Speed = 1000 * megabit // 1G - case 8: - ifState.Speed = 10000 * megabit // 10G - case 16: - ifState.Speed = 40000 * megabit // 40G - case 32: - ifState.Speed = 100000 * megabit // 100G - default: - ifState.Speed = 0 - } - - switch ifDetails.Meta.LinkSpeed { - case 1: - ifState.Duplex = intf.InterfaceState_HALF - case 2: - ifState.Duplex = intf.InterfaceState_FULL - default: - ifState.Duplex = intf.InterfaceState_UNKNOWN_DUPLEX - } + ifState.InternalName = ifDetails.InternalName + ifState.PhysAddress = ifDetails.PhysAddress.String() + ifState.AdminStatus = ifDetails.AdminState + ifState.OperStatus = ifDetails.LinkState + ifState.Speed = ifDetails.LinkSpeed + ifState.Duplex = ifDetails.LinkDuplex + ifState.Mtu = uint32(ifDetails.LinkMTU) - c.publishIfState(&intf.InterfaceNotification{ - Type: intf.InterfaceNotification_UNKNOWN, State: ifState}) + c.publishIfState(&intf.InterfaceNotification{State: ifState}) } // setIfStateDeleted marks the interface as deleted in the state data structure in memory. func (c *InterfaceStateUpdater) setIfStateDeleted(swIfIndex uint32, ifName string) { - c.access.Lock() defer c.access.Unlock() @@ -489,6 +454,5 @@ func (c *InterfaceStateUpdater) setIfStateDeleted(swIfIndex uint32, ifName strin ifState.LastChange = time.Now().Unix() // this can be post-processed by multiple plugins - c.publishIfState(&intf.InterfaceNotification{ - Type: intf.InterfaceNotification_UNKNOWN, State: ifState}) + c.publishIfState(&intf.InterfaceNotification{State: ifState}) } diff --git a/plugins/vpp/ifplugin/publish_state.go b/plugins/vpp/ifplugin/publish_state.go index bfca6c1de2..273ff8aa08 100644 --- a/plugins/vpp/ifplugin/publish_state.go +++ b/plugins/vpp/ifplugin/publish_state.go @@ -99,6 +99,10 @@ func (p *IfPlugin) publishIfStateEvents() { p.publishLock.Lock() key := interfaces.InterfaceStateKey(ifState.State.Name) + if debugIfStates { + p.Log.Debugf("Publishing interface state: %+v", ifState) + } + if p.PublishStatistics != nil { err := p.PublishStatistics.Put(key, ifState.State) if err != nil { @@ -130,12 +134,17 @@ func (p *IfPlugin) publishIfStateEvents() { }) } - if p.PushNotification != nil && - (ifState.Type == interfaces.InterfaceNotification_UPDOWN || - ifState.State.OperStatus == interfaces.InterfaceState_DELETED) { - p.PushNotification(&vpp.Notification{ - Interface: ifState, - }) + if ifState.Type == interfaces.InterfaceNotification_UPDOWN || + ifState.State.OperStatus == interfaces.InterfaceState_DELETED { + if debugIfStates { + p.Log.Debugf("Updating link state: %+v", ifState) + } + p.linkStateDescriptor.UpdateLinkState(ifState) + if p.PushNotification != nil { + p.PushNotification(&vpp.Notification{ + Interface: ifState, + }) + } } p.publishLock.Unlock() diff --git a/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go index 35b2a65441..de2205a7dd 100644 --- a/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/if_vppcalls.go @@ -87,6 +87,19 @@ type Lease struct { HostMac string } +// InterfaceState is a helper function grouping interface state data. +type InterfaceState struct { + SwIfIndex uint32 + InternalName string + PhysAddress net.HardwareAddr + + AdminState interfaces.InterfaceState_Status + LinkState interfaces.InterfaceState_Status + LinkDuplex interfaces.InterfaceState_Duplex + LinkSpeed uint64 + LinkMTU uint16 +} + // InterfaceVppAPI provides methods for creating and managing interface plugin type InterfaceVppAPI interface { InterfaceVppRead @@ -153,10 +166,10 @@ type InterfaceVppAPI interface { RegisterMemifSocketFilename(filename []byte, id uint32) error // SetInterfaceMtu calls HwInterfaceSetMtu bin API with desired MTU value. SetInterfaceMtu(ifIdx uint32, mtu uint32) error - // SetRxMode calls SwInterfaceSetRxMode bin - SetRxMode(ifIdx uint32, rxModeSettings *interfaces.Interface_RxModeSettings) error + // SetRxMode calls SwInterfaceSetRxMode bin API + SetRxMode(ifIdx uint32, rxMode *interfaces.Interface_RxMode) error // SetRxPlacement configures rx-placement for interface - SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacementSettings) error + SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacement) error // SetInterfaceVrf sets VRF table for the interface SetInterfaceVrf(ifaceIndex, vrfID uint32) error // SetInterfaceVrfIPv6 sets IPV6 VRF table for the interface @@ -169,7 +182,7 @@ type InterfaceVppAPI interface { AttachInterfaceToBond(ifIdx, bondIfIdx uint32, isPassive, isLongTimeout bool) error // DetachInterfaceFromBond removes interface slave status from any bond interfaces. DetachInterfaceFromBond(ifIdx uint32) error - // SetVLanTagRewrite sets VLan tag rewrite rule for given sub-interface + // SetVLanTagRewrite sets VLan tag rewrite rule for given sub-interface SetVLanTagRewrite(ifIdx uint32, subIf *interfaces.SubInterface) error } @@ -183,6 +196,8 @@ type InterfaceVppRead interface { DumpInterfaces() (map[uint32]*InterfaceDetails, error) // DumpInterfacesByType returns all VPP interfaces of the specified type DumpInterfacesByType(reqType interfaces.Interface_Type) (map[uint32]*InterfaceDetails, error) + // DumpInterfaceStates dumps link and administrative state of every interface. + DumpInterfaceStates(ifIdxs ...uint32) (map[uint32]*InterfaceState, error) // GetInterfaceVrf reads VRF table to interface GetInterfaceVrf(ifIdx uint32) (vrfID uint32, err error) // GetInterfaceVrfIPv6 reads IPv6 VRF table to interface diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go index 83dd09ac6e..f085bf9d1a 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls.go @@ -188,7 +188,7 @@ func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDe ifData.Meta.SwIfIndex, err) } ifData.Meta.VrfIPv6 = ipv6Vrf - if isIPv6If, err := h.isIpv6Interface(ifData.Interface); err != nil { + if isIPv6If, err := isIpv6Interface(ifData.Interface); err != nil { return ifs, err } else if isIPv6If { ifData.Interface.Vrf = ipv6Vrf @@ -336,9 +336,100 @@ func (h *InterfaceVppHandler) DumpDhcpClients() (map[uint32]*vppcalls.Dhcp, erro return dhcpData, nil } +// DumpInterfaceStates dumps link and administrative state of every interface. +func (h *InterfaceVppHandler) DumpInterfaceStates(ifIdxs ...uint32) (map[uint32]*vppcalls.InterfaceState, error) { + ifs := make(map[uint32]*vppcalls.InterfaceState) + + // initialize the requested interface indexes to nil + for _, ifIdx := range ifIdxs { + ifs[ifIdx] = nil + } + + reqCtx := h.callsChannel.SendMultiRequest(&binapi_interface.SwInterfaceDump{}) + for { + ifDetails := &binapi_interface.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(ifDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return nil, fmt.Errorf("failed to dump interface: %v", err) + } + + // when dumping specific list of interfaces.. + if len(ifIdxs) != 0 { + // and current ifIdx was not initialized.. + if _, ok := ifs[ifDetails.SwIfIndex]; !ok { + // then skip processing it to omit it from results + continue + } + } + + physAddr := make(net.HardwareAddr, ifDetails.L2AddressLength) + copy(physAddr, ifDetails.L2Address[:]) + + ifaceState := vppcalls.InterfaceState{ + SwIfIndex: ifDetails.SwIfIndex, + InternalName: cleanString(ifDetails.InterfaceName), + PhysAddress: physAddr, + AdminState: toInterfaceStatus(ifDetails.AdminUpDown), + LinkState: toInterfaceStatus(ifDetails.LinkUpDown), + LinkDuplex: toLinkDuplex(ifDetails.LinkDuplex), + LinkSpeed: toLinkSpeed(ifDetails.LinkSpeed), + LinkMTU: ifDetails.LinkMtu, + } + ifs[ifDetails.SwIfIndex] = &ifaceState + } + + return ifs, nil +} + +func toInterfaceStatus(upDown uint8) interfaces.InterfaceState_Status { + switch upDown { + case 0: + return interfaces.InterfaceState_DOWN + case 1: + return interfaces.InterfaceState_UP + default: + return interfaces.InterfaceState_UNKNOWN_STATUS + } +} + +func toLinkDuplex(duplex uint8) interfaces.InterfaceState_Duplex { + switch duplex { + case 1: + return interfaces.InterfaceState_HALF + case 2: + return interfaces.InterfaceState_FULL + default: + return interfaces.InterfaceState_UNKNOWN_DUPLEX + } +} + +const megabit = 1000000 // one megabit in bytes + +func toLinkSpeed(speed uint32) uint64 { + switch speed { + case 1: + return 10 * megabit // 10M + case 2: + return 100 * megabit // 100M + case 4: + return 1000 * megabit // 1G + case 8: + return 10000 * megabit // 10G + case 16: + return 40000 * megabit // 40G + case 32: + return 100000 * megabit // 100G + default: + return 0 + } +} + // Returns true if given interface contains at least one IPv6 address. For VxLAN, source and destination // addresses are also checked -func (h *InterfaceVppHandler) isIpv6Interface(iface *interfaces.Interface) (bool, error) { +func isIpv6Interface(iface *interfaces.Interface) (bool, error) { if iface.Type == interfaces.Interface_VXLAN_TUNNEL && iface.GetVxlan() != nil { if ipAddress := net.ParseIP(iface.GetVxlan().SrcAddress); ipAddress.To4() == nil { return true, nil @@ -749,19 +840,29 @@ func (h *InterfaceVppHandler) dumpRxPlacement(ifs map[uint32]*vppcalls.Interface if stop { break } + ifData, ok := ifs[rxDetails.SwIfIndex] if !ok { h.log.Warnf("Received rx-placement data for unknown interface with index %d", rxDetails.SwIfIndex) continue } - ifData.Interface.RxModeSettings = &interfaces.Interface_RxModeSettings{ - RxMode: getRxModeType(rxDetails.Mode), - QueueId: rxDetails.QueueID, - } - ifData.Interface.RxPlacementSettings = &interfaces.Interface_RxPlacementSettings{ - Queue: rxDetails.QueueID, - Worker: rxDetails.WorkerID, + + ifData.Interface.RxModes = append(ifData.Interface.RxModes, + &interfaces.Interface_RxMode{ + Queue: rxDetails.QueueID, + Mode: getRxModeType(rxDetails.Mode), + }) + + var worker uint32 + if rxDetails.WorkerID > 0 { + worker = rxDetails.WorkerID - 1 } + ifData.Interface.RxPlacements = append(ifData.Interface.RxPlacements, + &interfaces.Interface_RxPlacement{ + Queue: rxDetails.QueueID, + Worker: worker, + MainThread: rxDetails.WorkerID == 0, + }) } return nil } @@ -816,18 +917,18 @@ func memifModetoNB(mode uint8) interfaces.MemifLink_MemifMode { } // Convert binary API rx-mode to northbound representation -func getRxModeType(mode uint8) interfaces.Interface_RxModeSettings_RxModeType { +func getRxModeType(mode uint8) interfaces.Interface_RxMode_Type { switch mode { case 1: - return interfaces.Interface_RxModeSettings_POLLING + return interfaces.Interface_RxMode_POLLING case 2: - return interfaces.Interface_RxModeSettings_INTERRUPT + return interfaces.Interface_RxMode_INTERRUPT case 3: - return interfaces.Interface_RxModeSettings_ADAPTIVE + return interfaces.Interface_RxMode_ADAPTIVE case 4: - return interfaces.Interface_RxModeSettings_DEFAULT + return interfaces.Interface_RxMode_DEFAULT default: - return interfaces.Interface_RxModeSettings_UNKNOWN + return interfaces.Interface_RxMode_UNKNOWN } } diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls_test.go index c460b9015d..e19c1d2e27 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/dump_interface_vppcalls_test.go @@ -18,6 +18,8 @@ import ( "net" "testing" + govppapi "git.fd.io/govpp.git/api" + interfaces2 "github.com/ligato/vpp-agent/api/models/vpp/interfaces" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/dhcp" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/interfaces" @@ -399,3 +401,117 @@ func TestDumpMemifSocketDetails(t *testing.T) { Expect(ok).To(BeTrue()) Expect(socketID).To(Equal(uint32(1))) } + +func TestDumpInterfacesRxPlacement(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("memif1"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifSocketFilenameDetails{ + SocketID: 1, + SocketFilename: []byte("test"), + }, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifDetails{ + ID: 2, + SwIfIndex: 0, + Role: 1, // Slave + Mode: 1, // IP + SocketID: 1, + RingSize: 0, + BufferSize: 0, + }, + }, + { + Name: (&tap.SwInterfaceTapDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&interfaces.SwInterfaceRxPlacementDump{}).GetMessageName(), + Ping: true, + Messages: []govppapi.Message{ + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 0, + WorkerID: 0, // main thread + Mode: 3, // adaptive + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 1, + WorkerID: 1, // worker 0 + Mode: 2, // interrupt + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 2, + WorkerID: 2, // worker 1 + Mode: 1, // polling + }, + }, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check memif + Expect(intface.GetMemif().SocketFilename).To(Equal("test")) + Expect(intface.GetMemif().Id).To(Equal(uint32(2))) + Expect(intface.GetMemif().Mode).To(Equal(interfaces2.MemifLink_IP)) + Expect(intface.GetMemif().Master).To(BeFalse()) + + rxMode := intface.GetRxModes() + Expect(rxMode).To(HaveLen(3)) + Expect(rxMode[0].Queue).To(BeEquivalentTo(0)) + Expect(rxMode[0].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_ADAPTIVE)) + Expect(rxMode[1].Queue).To(BeEquivalentTo(1)) + Expect(rxMode[1].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_INTERRUPT)) + Expect(rxMode[2].Queue).To(BeEquivalentTo(2)) + Expect(rxMode[2].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_POLLING)) + + rxPlacement := intface.GetRxPlacements() + Expect(rxPlacement).To(HaveLen(3)) + Expect(rxPlacement[0].Queue).To(BeEquivalentTo(0)) + Expect(rxPlacement[0].MainThread).To(BeTrue()) + Expect(rxPlacement[0].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[1].Queue).To(BeEquivalentTo(1)) + Expect(rxPlacement[1].MainThread).To(BeFalse()) + Expect(rxPlacement[1].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[2].Queue).To(BeEquivalentTo(2)) + Expect(rxPlacement[2].MainThread).To(BeFalse()) + Expect(rxPlacement[2].Worker).To(BeEquivalentTo(1)) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls.go index b28a34be1c..4d1fe84cca 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls.go @@ -20,12 +20,13 @@ import ( ) // SetRxMode implements interface handler. -func (h *InterfaceVppHandler) SetRxMode(ifIdx uint32, rxModeSettings *interfaces.Interface_RxModeSettings) error { +func (h *InterfaceVppHandler) SetRxMode(ifIdx uint32,rxMode *interfaces.Interface_RxMode) error { + req := &binapi_interface.SwInterfaceSetRxMode{ SwIfIndex: ifIdx, - Mode: uint8(rxModeSettings.RxMode), - QueueID: rxModeSettings.QueueId, - QueueIDValid: uint8(rxModeSettings.QueueIdValid), + Mode: uint8(rxMode.Mode), + QueueID: rxMode.Queue, + QueueIDValid: boolToUint(!rxMode.DefaultMode), } reply := &binapi_interface.SwInterfaceSetRxModeReply{} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls_test.go index 09ad96048f..5b6eae7fbd 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_mode_vppcalls_test.go @@ -28,10 +28,10 @@ func TestSetRxMode(t *testing.T) { ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).To(BeNil()) @@ -40,7 +40,7 @@ func TestSetRxMode(t *testing.T) { Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) Expect(vppMsg.Mode).To(BeEquivalentTo(4)) Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) - Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(2)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(1)) } func TestSetRxModeError(t *testing.T) { @@ -49,10 +49,10 @@ func TestSetRxModeError(t *testing.T) { ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxMode{}) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).ToNot(BeNil()) @@ -66,11 +66,33 @@ func TestSetRxModeRetval(t *testing.T) { Retval: 1, }) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).ToNot(BeNil()) } + + +func TestSetDefaultRxMode(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) + + err := ifHandler.SetRxMode(5, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_POLLING, + Queue: 10, // ignored on the VPP side + DefaultMode: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetRxMode) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(5)) + Expect(vppMsg.Mode).To(BeEquivalentTo(1)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(10)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(0)) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls.go index 479e75b253..ef8ce09420 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls.go @@ -15,17 +15,17 @@ package vpp1901 import ( - interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/interfaces" + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" ) // SetRxPlacement implements interface handler. -func (h *InterfaceVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacementSettings) error { +func (h *InterfaceVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacement) error { req := &binapi_interface.SwInterfaceSetRxPlacement{ SwIfIndex: ifIdx, QueueID: rxPlacement.Queue, WorkerID: rxPlacement.Worker, - IsMain: boolToUint(rxPlacement.IsMain), + IsMain: boolToUint(rxPlacement.MainThread), } reply := &binapi_interface.SwInterfaceSetRxPlacementReply{} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls_test.go index 3985d7049b..5886d5db2d 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/rx_placement_vppcalls_test.go @@ -23,23 +23,45 @@ import ( . "github.com/onsi/gomega" ) -func TestSetRxPlacement(t *testing.T) { +func TestSetRxPlacementForWorker(t *testing.T) { ctx, ifHandler := ifTestSetup(t) defer ctx.TeardownTestCtx() ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, - IsMain: true, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).To(BeNil()) vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) + Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(0))) +} + +func TestSetRxPlacementForMainThread(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) + + err := ifHandler.SetRxPlacement(3, &interfaces.Interface_RxPlacement{ + Queue: 6, + Worker: 2, // ignored on the VPP side + MainThread: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(3)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(6)) + Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(1))) } @@ -51,9 +73,10 @@ func TestSetRxPlacementRetval(t *testing.T) { Retval: 1, }) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).ToNot(BeNil()) @@ -65,9 +88,10 @@ func TestSetRxPlacementError(t *testing.T) { ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacement{}) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).ToNot(BeNil()) diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/vppcalls_handler.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/vppcalls_handler.go index 5e5edae958..605db0b4f9 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/vppcalls_handler.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/vppcalls_handler.go @@ -35,18 +35,18 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, af_packet.Messages...) - msgs = append(msgs, bond.Messages...) - msgs = append(msgs, dhcp.Messages...) - msgs = append(msgs, interfaces.Messages...) - msgs = append(msgs, ip.Messages...) - msgs = append(msgs, ipsec.Messages...) - msgs = append(msgs, l2.Messages...) - msgs = append(msgs, memif.Messages...) - msgs = append(msgs, tap.Messages...) - msgs = append(msgs, tapv2.Messages...) - msgs = append(msgs, vmxnet3.Messages...) - msgs = append(msgs, vxlan.Messages...) + msgs = append(msgs, af_packet.AllMessages()...) + msgs = append(msgs, bond.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) + msgs = append(msgs, interfaces.AllMessages()...) + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, ipsec.AllMessages()...) + msgs = append(msgs, l2.AllMessages()...) + msgs = append(msgs, memif.AllMessages()...) + msgs = append(msgs, tap.AllMessages()...) + msgs = append(msgs, tapv2.AllMessages()...) + msgs = append(msgs, vmxnet3.AllMessages()...) + msgs = append(msgs, vxlan.AllMessages()...) vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ Msgs: msgs, diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1901/watch_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1901/watch_vppcalls.go index b374a35e6f..1ef3af3865 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1901/watch_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1901/watch_vppcalls.go @@ -32,7 +32,7 @@ import ( var InterfaceEventTimeout = time.Second func (h *InterfaceVppHandler) WatchInterfaceEvents(events chan<- *vppcalls.InterfaceEvent) error { - notifChan := make(chan govppapi.Message) + notifChan := make(chan govppapi.Message, 10) // subscribe for receiving SwInterfaceEvents notifications vppNotifSubs, err := h.callsChannel.SubscribeNotification(notifChan, &binapi_interfaces.SwInterfaceEvent{}) diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go index 090e4ec8c2..896d1dd1c1 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls.go @@ -187,7 +187,7 @@ func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDe ifData.Meta.SwIfIndex, err) } ifData.Meta.VrfIPv6 = ipv6Vrf - if isIPv6If, err := h.isIpv6Interface(ifData.Interface); err != nil { + if isIPv6If, err := isIpv6Interface(ifData.Interface); err != nil { return ifs, err } else if isIPv6If { ifData.Interface.Vrf = ipv6Vrf @@ -335,9 +335,100 @@ func (h *InterfaceVppHandler) DumpDhcpClients() (map[uint32]*vppcalls.Dhcp, erro return dhcpData, nil } +// DumpInterfaceStates dumps link and administrative state of every interface. +func (h *InterfaceVppHandler) DumpInterfaceStates(ifIdxs ...uint32) (map[uint32]*vppcalls.InterfaceState, error) { + ifs := make(map[uint32]*vppcalls.InterfaceState) + + // initialize the requested interface indexes to nil + for _, ifIdx := range ifIdxs { + ifs[ifIdx] = nil + } + + reqCtx := h.callsChannel.SendMultiRequest(&binapi_interface.SwInterfaceDump{}) + for { + ifDetails := &binapi_interface.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(ifDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return nil, fmt.Errorf("failed to dump interface: %v", err) + } + + // when dumping specific list of interfaces.. + if len(ifIdxs) != 0 { + // and current ifIdx was not initialized.. + if _, ok := ifs[ifDetails.SwIfIndex]; !ok { + // then skip processing it to omit it from results + continue + } + } + + physAddr := make(net.HardwareAddr, ifDetails.L2AddressLength) + copy(physAddr, ifDetails.L2Address[:]) + + ifaceState := vppcalls.InterfaceState{ + SwIfIndex: ifDetails.SwIfIndex, + InternalName: cleanString(ifDetails.InterfaceName), + PhysAddress: physAddr, + AdminState: toInterfaceStatus(ifDetails.AdminUpDown), + LinkState: toInterfaceStatus(ifDetails.LinkUpDown), + LinkDuplex: toLinkDuplex(ifDetails.LinkDuplex), + LinkSpeed: toLinkSpeed(ifDetails.LinkSpeed), + LinkMTU: ifDetails.LinkMtu, + } + ifs[ifDetails.SwIfIndex] = &ifaceState + } + + return ifs, nil +} + +func toInterfaceStatus(upDown uint8) interfaces.InterfaceState_Status { + switch upDown { + case 0: + return interfaces.InterfaceState_DOWN + case 1: + return interfaces.InterfaceState_UP + default: + return interfaces.InterfaceState_UNKNOWN_STATUS + } +} + +func toLinkDuplex(duplex uint8) interfaces.InterfaceState_Duplex { + switch duplex { + case 1: + return interfaces.InterfaceState_HALF + case 2: + return interfaces.InterfaceState_FULL + default: + return interfaces.InterfaceState_UNKNOWN_DUPLEX + } +} + +const megabit = 1000000 // one megabit in bytes + +func toLinkSpeed(speed uint32) uint64 { + switch speed { + case 1: + return 10 * megabit // 10M + case 2: + return 100 * megabit // 100M + case 4: + return 1000 * megabit // 1G + case 8: + return 10000 * megabit // 10G + case 16: + return 40000 * megabit // 40G + case 32: + return 100000 * megabit // 100G + default: + return 0 + } +} + // Returns true if given interface contains at least one IPv6 address. For VxLAN, source and destination // addresses are also checked -func (h *InterfaceVppHandler) isIpv6Interface(iface *interfaces.Interface) (bool, error) { +func isIpv6Interface(iface *interfaces.Interface) (bool, error) { if iface.Type == interfaces.Interface_VXLAN_TUNNEL && iface.GetVxlan() != nil { if ipAddress := net.ParseIP(iface.GetVxlan().SrcAddress); ipAddress.To4() == nil { return true, nil @@ -632,8 +723,8 @@ func verifyIPSecTunnelDetails(local, remote *ipsec.IpsecSaDetails) error { localIsTunnel, remoteIsTunnel) } - localSrc, localDst := local.Entry.TunnelSrc.Un.Union_data, local.Entry.TunnelDst.Un.Union_data - remoteSrc, remoteDst := remote.Entry.TunnelSrc.Un.Union_data, remote.Entry.TunnelDst.Un.Union_data + localSrc, localDst := local.Entry.TunnelSrc.Un.XXX_UnionData, local.Entry.TunnelDst.Un.XXX_UnionData + remoteSrc, remoteDst := remote.Entry.TunnelSrc.Un.XXX_UnionData, remote.Entry.TunnelDst.Un.XXX_UnionData if (local.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6) != (remote.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6) || !bytes.Equal(localSrc[:], remoteDst[:]) || !bytes.Equal(localDst[:], remoteSrc[:]) { @@ -765,19 +856,29 @@ func (h *InterfaceVppHandler) dumpRxPlacement(ifs map[uint32]*vppcalls.Interface if stop { break } + ifData, ok := ifs[rxDetails.SwIfIndex] if !ok { h.log.Warnf("Received rx-placement data for unknown interface with index %d", rxDetails.SwIfIndex) continue } - ifData.Interface.RxModeSettings = &interfaces.Interface_RxModeSettings{ - RxMode: getRxModeType(rxDetails.Mode), - QueueId: rxDetails.QueueID, - } - ifData.Interface.RxPlacementSettings = &interfaces.Interface_RxPlacementSettings{ - Queue: rxDetails.QueueID, - Worker: rxDetails.WorkerID, + + ifData.Interface.RxModes = append(ifData.Interface.RxModes, + &interfaces.Interface_RxMode{ + Queue: rxDetails.QueueID, + Mode: getRxModeType(rxDetails.Mode), + }) + + var worker uint32 + if rxDetails.WorkerID > 0 { + worker = rxDetails.WorkerID - 1 } + ifData.Interface.RxPlacements = append(ifData.Interface.RxPlacements, + &interfaces.Interface_RxPlacement{ + Queue: rxDetails.QueueID, + Worker: worker, + MainThread: rxDetails.WorkerID == 0, + }) } return nil } @@ -832,18 +933,18 @@ func memifModetoNB(mode uint8) interfaces.MemifLink_MemifMode { } // Convert binary API rx-mode to northbound representation -func getRxModeType(mode uint8) interfaces.Interface_RxModeSettings_RxModeType { +func getRxModeType(mode uint8) interfaces.Interface_RxMode_Type { switch mode { case 1: - return interfaces.Interface_RxModeSettings_POLLING + return interfaces.Interface_RxMode_POLLING case 2: - return interfaces.Interface_RxModeSettings_INTERRUPT + return interfaces.Interface_RxMode_INTERRUPT case 3: - return interfaces.Interface_RxModeSettings_ADAPTIVE + return interfaces.Interface_RxMode_ADAPTIVE case 4: - return interfaces.Interface_RxModeSettings_DEFAULT + return interfaces.Interface_RxMode_DEFAULT default: - return interfaces.Interface_RxModeSettings_UNKNOWN + return interfaces.Interface_RxMode_UNKNOWN } } diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls_test.go index b137fd8903..402e099b08 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/dump_interface_vppcalls_test.go @@ -18,6 +18,8 @@ import ( "net" "testing" + govppapi "git.fd.io/govpp.git/api" + interfaces2 "github.com/ligato/vpp-agent/api/models/vpp/interfaces" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/dhcp" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/interfaces" @@ -304,3 +306,113 @@ func TestDumpMemifSocketDetails(t *testing.T) { Expect(ok).To(BeTrue()) Expect(socketID).To(Equal(uint32(1))) } + +func TestDumpInterfacesRxPlacement(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("memif1"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifSocketFilenameDetails{ + SocketID: 1, + SocketFilename: []byte("test"), + }, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifDetails{ + ID: 2, + SwIfIndex: 0, + Role: 1, // Slave + Mode: 1, // IP + SocketID: 1, + RingSize: 0, + BufferSize: 0, + }, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&interfaces.SwInterfaceRxPlacementDump{}).GetMessageName(), + Ping: true, + Messages: []govppapi.Message{ + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 0, + WorkerID: 0, // main thread + Mode: 3, // adaptive + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 1, + WorkerID: 1, // worker 0 + Mode: 2, // interrupt + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 2, + WorkerID: 2, // worker 1 + Mode: 1, // polling + }, + }, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check memif + Expect(intface.GetMemif().SocketFilename).To(Equal("test")) + Expect(intface.GetMemif().Id).To(Equal(uint32(2))) + Expect(intface.GetMemif().Mode).To(Equal(interfaces2.MemifLink_IP)) + Expect(intface.GetMemif().Master).To(BeFalse()) + + rxMode := intface.GetRxModes() + Expect(rxMode).To(HaveLen(3)) + Expect(rxMode[0].Queue).To(BeEquivalentTo(0)) + Expect(rxMode[0].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_ADAPTIVE)) + Expect(rxMode[1].Queue).To(BeEquivalentTo(1)) + Expect(rxMode[1].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_INTERRUPT)) + Expect(rxMode[2].Queue).To(BeEquivalentTo(2)) + Expect(rxMode[2].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_POLLING)) + + rxPlacement := intface.GetRxPlacements() + Expect(rxPlacement).To(HaveLen(3)) + Expect(rxPlacement[0].Queue).To(BeEquivalentTo(0)) + Expect(rxPlacement[0].MainThread).To(BeTrue()) + Expect(rxPlacement[0].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[1].Queue).To(BeEquivalentTo(1)) + Expect(rxPlacement[1].MainThread).To(BeFalse()) + Expect(rxPlacement[1].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[2].Queue).To(BeEquivalentTo(2)) + Expect(rxPlacement[2].MainThread).To(BeFalse()) + Expect(rxPlacement[2].Worker).To(BeEquivalentTo(1)) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/ip_container_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/ip_container_vppcalls.go index 6b39009866..8d244d814b 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/ip_container_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/ip_container_vppcalls.go @@ -38,10 +38,10 @@ func (h *InterfaceVppHandler) sendAndLogMessageForVpp(ifIdx uint32, addr string, prefix, _ := IPaddr.Mask.Size() req.Pfx.AddressLength = byte(prefix) if isIPv6 { - copy(req.Pfx.Address.Un.Union_data[:], IPaddr.IP.To16()) + copy(req.Pfx.Address.Un.XXX_UnionData[:], IPaddr.IP.To16()) req.Pfx.Address.Af = ip.ADDRESS_IP6 } else { - copy(req.Pfx.Address.Un.Union_data[:], IPaddr.IP.To4()) + copy(req.Pfx.Address.Un.XXX_UnionData[:], IPaddr.IP.To4()) req.Pfx.Address.Af = ip.ADDRESS_IP4 } reply := &ip.IPContainerProxyAddDelReply{} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go index e5f5a4dab4..71331ebfb1 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go @@ -20,7 +20,7 @@ import ( . "github.com/onsi/gomega" - "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + vpp_interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/ipsec" ) @@ -66,7 +66,7 @@ func TestAddIPSecTunnelInterface(t *testing.T) { Expect(vppMsg.IsAdd).To(Equal(uint8(1))) Expect(vppMsg.AntiReplay).To(Equal(uint8(1))) Expect(vppMsg.LocalIP.Af).To(Equal(ipsec.AddressFamily(0))) - Expect(vppMsg.LocalIP.Un).To(BeEquivalentTo(ipsec.AddressUnion{Union_data: [16]byte{10, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}})) + Expect(vppMsg.LocalIP.Un).To(BeEquivalentTo(ipsec.AddressUnion{XXX_UnionData: [16]byte{10, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}})) Expect(vppMsg.LocalSpi).To(Equal(uint32(1500))) Expect(vppMsg.RemoteSpi).To(Equal(uint32(2000))) Expect(vppMsg.CryptoAlg).To(Equal(uint8(9))) diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls.go index 64fab34580..24a89df425 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls.go @@ -20,12 +20,13 @@ import ( ) // SetRxMode implements interface handler. -func (h *InterfaceVppHandler) SetRxMode(ifIdx uint32, rxModeSettings *interfaces.Interface_RxModeSettings) error { +func (h *InterfaceVppHandler) SetRxMode(ifIdx uint32,rxMode *interfaces.Interface_RxMode) error { + req := &binapi_interface.SwInterfaceSetRxMode{ SwIfIndex: ifIdx, - Mode: uint8(rxModeSettings.RxMode), - QueueID: rxModeSettings.QueueId, - QueueIDValid: uint8(rxModeSettings.QueueIdValid), + Mode: uint8(rxMode.Mode), + QueueID: rxMode.Queue, + QueueIDValid: boolToUint(!rxMode.DefaultMode), } reply := &binapi_interface.SwInterfaceSetRxModeReply{} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls_test.go index 974676a5eb..a486b941f5 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_mode_vppcalls_test.go @@ -28,10 +28,10 @@ func TestSetRxMode(t *testing.T) { ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).To(BeNil()) @@ -40,7 +40,7 @@ func TestSetRxMode(t *testing.T) { Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) Expect(vppMsg.Mode).To(BeEquivalentTo(4)) Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) - Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(2)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(1)) } func TestSetRxModeError(t *testing.T) { @@ -49,10 +49,10 @@ func TestSetRxModeError(t *testing.T) { ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxMode{}) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).ToNot(BeNil()) @@ -66,11 +66,33 @@ func TestSetRxModeRetval(t *testing.T) { Retval: 1, }) - err := ifHandler.SetRxMode(1, &ifModel.Interface_RxModeSettings{ - RxMode: ifModel.Interface_RxModeSettings_DEFAULT, - QueueId: 1, - QueueIdValid: 2, + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, }) Expect(err).ToNot(BeNil()) } + + +func TestSetDefaultRxMode(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) + + err := ifHandler.SetRxMode(5, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_POLLING, + Queue: 10, // ignored on the VPP side + DefaultMode: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetRxMode) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(5)) + Expect(vppMsg.Mode).To(BeEquivalentTo(1)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(10)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(0)) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls.go index 0ce1468285..cc5779b70f 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls.go @@ -15,17 +15,17 @@ package vpp1904 import ( - interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/interfaces" + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" ) // SetRxPlacement implements interface handler. -func (h *InterfaceVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacementSettings) error { +func (h *InterfaceVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacement) error { req := &binapi_interface.SwInterfaceSetRxPlacement{ SwIfIndex: ifIdx, QueueID: rxPlacement.Queue, WorkerID: rxPlacement.Worker, - IsMain: boolToUint(rxPlacement.IsMain), + IsMain: boolToUint(rxPlacement.MainThread), } reply := &binapi_interface.SwInterfaceSetRxPlacementReply{} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls_test.go index d86f544d36..d1db7af174 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls_test.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/rx_placement_vppcalls_test.go @@ -23,23 +23,45 @@ import ( . "github.com/onsi/gomega" ) -func TestSetRxPlacement(t *testing.T) { +func TestSetRxPlacementForWorker(t *testing.T) { ctx, ifHandler := ifTestSetup(t) defer ctx.TeardownTestCtx() ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, - IsMain: true, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).To(BeNil()) vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) + Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(0))) +} + +func TestSetRxPlacementForMainThread(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) + + err := ifHandler.SetRxPlacement(3, &interfaces.Interface_RxPlacement{ + Queue: 6, + Worker: 2, // ignored on the VPP side + MainThread: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(3)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(6)) + Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(1))) } @@ -51,9 +73,10 @@ func TestSetRxPlacementRetval(t *testing.T) { Retval: 1, }) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).ToNot(BeNil()) @@ -65,9 +88,10 @@ func TestSetRxPlacementError(t *testing.T) { ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacement{}) - err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacementSettings{ - Queue: 1, - Worker: 2, + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, }) Expect(err).ToNot(BeNil()) diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/vppcalls_handler.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/vppcalls_handler.go index 07e7fa34c9..676dd5a1ba 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/vppcalls_handler.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/vppcalls_handler.go @@ -37,17 +37,17 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, af_packet.Messages...) - msgs = append(msgs, bond.Messages...) - msgs = append(msgs, dhcp.Messages...) - msgs = append(msgs, interfaces.Messages...) - msgs = append(msgs, ip.Messages...) - msgs = append(msgs, ipsec.Messages...) - msgs = append(msgs, l2.Messages...) - msgs = append(msgs, memif.Messages...) - msgs = append(msgs, tapv2.Messages...) - msgs = append(msgs, vmxnet3.Messages...) - msgs = append(msgs, vxlan.Messages...) + msgs = append(msgs, af_packet.AllMessages()...) + msgs = append(msgs, bond.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) + msgs = append(msgs, interfaces.AllMessages()...) + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, ipsec.AllMessages()...) + msgs = append(msgs, l2.AllMessages()...) + msgs = append(msgs, memif.AllMessages()...) + msgs = append(msgs, tapv2.AllMessages()...) + msgs = append(msgs, vmxnet3.AllMessages()...) + msgs = append(msgs, vxlan.AllMessages()...) vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ Msgs: msgs, diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1904/watch_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1904/watch_vppcalls.go index c34fb864e2..ea363244e4 100644 --- a/plugins/vpp/ifplugin/vppcalls/vpp1904/watch_vppcalls.go +++ b/plugins/vpp/ifplugin/vppcalls/vpp1904/watch_vppcalls.go @@ -32,7 +32,7 @@ import ( var InterfaceEventTimeout = time.Second func (h *InterfaceVppHandler) WatchInterfaceEvents(events chan<- *vppcalls.InterfaceEvent) error { - notifChan := make(chan govppapi.Message) + notifChan := make(chan govppapi.Message, 10) // subscribe for receiving SwInterfaceEvents notifications vppNotifSubs, err := h.callsChannel.SubscribeNotification(notifChan, &binapi_interfaces.SwInterfaceEvent{}) diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls.go new file mode 100644 index 0000000000..2e3f367973 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls.go @@ -0,0 +1,79 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// InterfaceAdminDown implements interface handler. +func (h *InterfaceVppHandler) InterfaceAdminDown(ifIdx uint32) error { + return h.interfaceSetFlags(ifIdx, false) +} + +// InterfaceAdminUp implements interface handler. +func (h *InterfaceVppHandler) InterfaceAdminUp(ifIdx uint32) error { + return h.interfaceSetFlags(ifIdx, true) +} + +// SetInterfaceTag implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceTag(tag string, ifIdx uint32) error { + return h.handleInterfaceTag(tag, ifIdx, true) +} + +// RemoveInterfaceTag implements interface handler. +func (h *InterfaceVppHandler) RemoveInterfaceTag(tag string, ifIdx uint32) error { + return h.handleInterfaceTag(tag, ifIdx, false) +} + +func (h *InterfaceVppHandler) interfaceSetFlags(ifIdx uint32, adminUp bool) error { + req := &interfaces.SwInterfaceSetFlags{ + SwIfIndex: ifIdx, + AdminUpDown: boolToUint(adminUp), + } + reply := &interfaces.SwInterfaceSetFlagsReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func (h *InterfaceVppHandler) handleInterfaceTag(tag string, ifIdx uint32, isAdd bool) error { + req := &interfaces.SwInterfaceTagAddDel{ + Tag: []byte(tag), + IsAdd: boolToUint(isAdd), + } + // For some reason, if deleting tag, the software interface index has to be 0 and only name should be set. + // Otherwise reply returns with error core -2 (incorrect sw_if_idx) + if isAdd { + req.SwIfIndex = ifIdx + } + reply := &interfaces.SwInterfaceTagAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func boolToUint(input bool) uint8 { + if input { + return 1 + } + return 0 +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls_test.go new file mode 100644 index 0000000000..0e7bb81647 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/admin_vppcalls_test.go @@ -0,0 +1,181 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +func TestInterfaceAdminDown(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetFlagsReply{}) + err := ifHandler.InterfaceAdminDown(1) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetFlags) + Expect(ok).To(BeTrue()) + Expect(vppMsg).NotTo(BeNil()) + Expect(vppMsg.SwIfIndex).To(Equal(uint32(1))) + Expect(vppMsg.AdminUpDown).To(Equal(uint8(0))) +} + +func TestInterfaceAdminDownError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{}) + err := ifHandler.InterfaceAdminDown(1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceAdminDownRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetFlagsReply{ + Retval: 1, + }) + err := ifHandler.InterfaceAdminDown(1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceAdminUp(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetFlagsReply{}) + err := ifHandler.InterfaceAdminUp(1) + + Expect(err).ShouldNot(HaveOccurred()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetFlags) + Expect(ok).To(BeTrue()) + Expect(vppMsg).NotTo(BeNil()) + Expect(vppMsg.SwIfIndex).To(Equal(uint32(1))) + Expect(vppMsg.AdminUpDown).To(Equal(uint8(1))) +} + +func TestInterfaceAdminUpError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{}) + err := ifHandler.InterfaceAdminDown(1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceAdminUpRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetFlagsReply{ + Retval: 1, + }) + err := ifHandler.InterfaceAdminDown(1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceSetTag(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + err := ifHandler.SetInterfaceTag("tag", 1) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceTagAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg).NotTo(BeNil()) + Expect(vppMsg.Tag).To(BeEquivalentTo("tag")) + Expect(vppMsg.SwIfIndex).To(Equal(uint32(1))) +} + +func TestInterfaceSetTagError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{}) + err := ifHandler.SetInterfaceTag("tag", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceSetTagRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{ + Retval: 1, + }) + err := ifHandler.SetInterfaceTag("tag", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceRemoveTag(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + err := ifHandler.RemoveInterfaceTag("tag", 1) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceTagAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg).NotTo(BeNil()) + Expect(vppMsg.Tag).To(BeEquivalentTo("tag")) + Expect(vppMsg.IsAdd).To(Equal(uint8(0))) +} + +func TestInterfaceRemoveTagError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{}) + err := ifHandler.RemoveInterfaceTag("tag", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestInterfaceRemoveTagRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{ + Retval: 1, + }) + err := ifHandler.RemoveInterfaceTag("tag", 1) + + Expect(err).ToNot(BeNil()) +} + +func ifTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.InterfaceVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifHandler := vpp1908.NewInterfaceVppHandler(ctx.MockChannel, log) + return ctx, ifHandler +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls.go new file mode 100644 index 0000000000..20336e56c5 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls.go @@ -0,0 +1,59 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/af_packet" +) + +// AddAfPacketInterface implements AfPacket handler. +func (h *InterfaceVppHandler) AddAfPacketInterface(ifName string, hwAddr string, afPacketIntf *interfaces.AfpacketLink) (swIndex uint32, err error) { + req := &af_packet.AfPacketCreate{ + HostIfName: []byte(afPacketIntf.HostIfName), + } + if hwAddr == "" { + req.UseRandomHwAddr = 1 + } else { + mac, err := net.ParseMAC(hwAddr) + if err != nil { + return 0, err + } + req.HwAddr = mac + } + reply := &af_packet.AfPacketCreateReply{} + + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, h.SetInterfaceTag(ifName, reply.SwIfIndex) +} + +// DeleteAfPacketInterface implements AfPacket handler. +func (h *InterfaceVppHandler) DeleteAfPacketInterface(ifName string, idx uint32, afPacketIntf *interfaces.AfpacketLink) error { + req := &af_packet.AfPacketDelete{ + HostIfName: []byte(afPacketIntf.HostIfName), + } + reply := &af_packet.AfPacketDeleteReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return h.RemoveInterfaceTag(ifName, idx) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls_test.go new file mode 100644 index 0000000000..f4cf391bed --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/afpacket_vppcalls_test.go @@ -0,0 +1,165 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "net" + "testing" + + if_api "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/af_packet" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestAddAfPacketInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketCreateReply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + ifIndex, err := ifHandler.AddAfPacketInterface("if1", "", &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).To(BeNil()) + Expect(ifIndex).ToNot(BeNil()) + Expect(len(ctx.MockChannel.Msgs)).To(BeEquivalentTo(2)) + for i, msg := range ctx.MockChannel.Msgs { + if i == 0 { + vppMsg, ok := msg.(*af_packet.AfPacketCreate) + Expect(ok).To(BeTrue()) + Expect(vppMsg).To(Equal(&af_packet.AfPacketCreate{ + HostIfName: []byte("host1"), + HwAddr: nil, + UseRandomHwAddr: 1, + })) + } + } +} + +func TestAddAfPacketInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketDeleteReply{}) + + _, err := ifHandler.AddAfPacketInterface("if1", "", &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).ToNot(BeNil()) +} + +func TestAddAfPacketInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketCreateReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddAfPacketInterface("if1", "", &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteAfPacketInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketDeleteReply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteAfPacketInterface("if1", 0, &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).To(BeNil()) + Expect(len(ctx.MockChannel.Msgs)).To(BeEquivalentTo(2)) + for i, msg := range ctx.MockChannel.Msgs { + if i == 0 { + vppMsg, ok := msg.(*af_packet.AfPacketDelete) + Expect(ok).To(BeTrue()) + Expect(vppMsg).To(Equal(&af_packet.AfPacketDelete{ + HostIfName: []byte("host1"), + })) + } + } +} + +func TestDeleteAfPacketInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketCreateReply{}) + + err := ifHandler.DeleteAfPacketInterface("if1", 0, &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteAfPacketInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketDeleteReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteAfPacketInterface("if1", 0, &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).ToNot(BeNil()) +} + +func TestAddAfPacketInterfaceMac(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&af_packet.AfPacketCreateReply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + ifIndex, err := ifHandler.AddAfPacketInterface("if1", "a2:01:01:01:01:01", &if_api.AfpacketLink{ + HostIfName: "host1", + }) + + Expect(err).To(BeNil()) + Expect(ifIndex).ToNot(BeNil()) + Expect(len(ctx.MockChannel.Msgs)).To(BeEquivalentTo(2)) + + mac, err := net.ParseMAC("a2:01:01:01:01:01") + Expect(err).To(BeNil()) + + for i, msg := range ctx.MockChannel.Msgs { + if i == 0 { + vppMsg, ok := msg.(*af_packet.AfPacketCreate) + Expect(ok).To(BeTrue()) + Expect(vppMsg).To(Equal(&af_packet.AfPacketCreate{ + HostIfName: []byte("host1"), + HwAddr: mac, + UseRandomHwAddr: 0, + })) + } + } +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/bond_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/bond_vppcalls.go new file mode 100644 index 0000000000..c0125a76f3 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/bond_vppcalls.go @@ -0,0 +1,117 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + if_model "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/bond" +) + +// AddBondInterface implements interface handler. +func (h *InterfaceVppHandler) AddBondInterface(ifName string, mac string, bondLink *if_model.BondLink) (uint32, error) { + req := &bond.BondCreate{ + ID: bondLink.Id, + Mode: getBondMode(bondLink.Mode), + Lb: getLoadBalance(bondLink.Lb), + } + if mac != "" { + parsedMac, err := net.ParseMAC(mac) + if err != nil { + return 0, err + } + req.UseCustomMac = 1 + req.MacAddress = parsedMac + } + + reply := &bond.BondCreateReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, h.SetInterfaceTag(ifName, reply.SwIfIndex) +} + +// DeleteBondInterface implements interface handler. +func (h *InterfaceVppHandler) DeleteBondInterface(ifName string, ifIdx uint32) error { + req := &bond.BondDelete{ + SwIfIndex: ifIdx, + } + reply := &bond.BondDeleteReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return h.RemoveInterfaceTag(ifName, ifIdx) +} + +func getBondMode(mode if_model.BondLink_Mode) uint8 { + switch mode { + case if_model.BondLink_ROUND_ROBIN: + return 1 + case if_model.BondLink_ACTIVE_BACKUP: + return 2 + case if_model.BondLink_XOR: + return 3 + case if_model.BondLink_BROADCAST: + return 4 + case if_model.BondLink_LACP: + return 5 + default: + // UNKNOWN + return 0 + } +} + +// AttachInterfaceToBond implements interface handler. +func (h *InterfaceVppHandler) AttachInterfaceToBond(ifIdx, bondIfIdx uint32, isPassive, isLongTimeout bool) error { + req := &bond.BondEnslave{ + SwIfIndex: ifIdx, + BondSwIfIndex: bondIfIdx, + IsPassive: boolToUint(isPassive), + IsLongTimeout: boolToUint(isLongTimeout), + } + reply := &bond.BondEnslaveReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// DetachInterfaceFromBond implements interface handler +func (h *InterfaceVppHandler) DetachInterfaceFromBond(ifIdx uint32) error { + req := &bond.BondDetachSlave{ + SwIfIndex: ifIdx, + } + reply := &bond.BondDetachSlaveReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + return nil +} + +func getLoadBalance(lb if_model.BondLink_LoadBalance) uint8 { + switch lb { + case if_model.BondLink_L34: + return 1 + case if_model.BondLink_L23: + return 2 + default: + // L2 + return 0 + } +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls.go new file mode 100644 index 0000000000..86f4859ee8 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls.go @@ -0,0 +1,47 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" +) + +func (h *InterfaceVppHandler) handleInterfaceDHCP(ifIdx uint32, hostName string, isAdd bool) error { + req := &dhcp.DHCPClientConfig{ + IsAdd: boolToUint(isAdd), + Client: dhcp.DHCPClient{ + SwIfIndex: ifIdx, + Hostname: []byte(hostName), + WantDHCPEvent: 1, + }, + } + reply := &dhcp.DHCPClientConfigReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// SetInterfaceAsDHCPClient implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error { + return h.handleInterfaceDHCP(ifIdx, hostName, true) +} + +// UnsetInterfaceAsDHCPClient implements interface handler. +func (h *InterfaceVppHandler) UnsetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error { + return h.handleInterfaceDHCP(ifIdx, hostName, false) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls_test.go new file mode 100644 index 0000000000..ec99fd1433 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/dhcp_vppcalls_test.go @@ -0,0 +1,104 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + . "github.com/onsi/gomega" +) + +func TestSetInterfaceAsDHCPClient(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPClientConfigReply{}) + + err := ifHandler.SetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*dhcp.DHCPClientConfig) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Client.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Client.Hostname).To(BeEquivalentTo([]byte("hostName"))) + Expect(vppMsg.Client.WantDHCPEvent).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestSetInterfaceAsDHCPClientError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPComplEvent{}) + + err := ifHandler.SetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).ToNot(BeNil()) +} + +func TestSetInterfaceAsDHCPClientRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPClientConfigReply{ + Retval: 1, + }) + + err := ifHandler.SetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).ToNot(BeNil()) +} + +func TestUnsetInterfaceAsDHCPClient(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPClientConfigReply{}) + + err := ifHandler.UnsetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*dhcp.DHCPClientConfig) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Client.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Client.Hostname).To(BeEquivalentTo([]byte("hostName"))) + Expect(vppMsg.Client.WantDHCPEvent).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestUnsetInterfaceAsDHCPClientError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPComplEvent{}) + + err := ifHandler.UnsetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).ToNot(BeNil()) +} + +func TestUnsetInterfaceAsDHCPClientRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&dhcp.DHCPClientConfigReply{ + Retval: 1, + }) + + err := ifHandler.UnsetInterfaceAsDHCPClient(1, "hostName") + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/doc.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/doc.go new file mode 100644 index 0000000000..475f8dfe7b --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/doc.go @@ -0,0 +1,17 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package vppcalls contains wrappers over VPP binary APIs for all supported +// interface types and for dumping all interfaces configured in VPP. +package vpp1908 diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go new file mode 100644 index 0000000000..123dca2402 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls.go @@ -0,0 +1,1022 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + "encoding/hex" + "fmt" + "net" + "strings" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + vpp_ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/bond" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memif" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/tapv2" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vmxnet3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vxlan" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +const ( + // allInterfaces defines unspecified interface index + allInterfaces = ^uint32(0) +) + +// Default VPP MTU value +const defaultVPPMtu = 9216 + +func getMtu(vppMtu uint16) uint32 { + // If default VPP MTU value is set, return 0 (it means MTU was not set in the NB config) + if vppMtu == defaultVPPMtu { + return 0 + } + return uint32(vppMtu) +} + +// DumpInterfacesByType implements interface handler. +func (h *InterfaceVppHandler) DumpInterfacesByType(reqType interfaces.Interface_Type) (map[uint32]*vppcalls.InterfaceDetails, error) { + // Dump all + ifs, err := h.DumpInterfaces() + if err != nil { + return nil, err + } + // Filter by type + for ifIdx, ifData := range ifs { + if ifData.Interface.Type != reqType { + delete(ifs, ifIdx) + } + } + + return ifs, nil +} + +func (h *InterfaceVppHandler) dumpInterfaces(ifIdxs ...uint32) (map[uint32]*vppcalls.InterfaceDetails, error) { + // map for the resulting interfaces + ifs := make(map[uint32]*vppcalls.InterfaceDetails) + + ifIdx := allInterfaces + if len(ifIdxs) > 0 { + ifIdx = ifIdxs[0] + } + // First, dump all interfaces to create initial data. + reqCtx := h.callsChannel.SendMultiRequest(&binapi_interface.SwInterfaceDump{ + SwIfIndex: binapi_interface.InterfaceIndex(ifIdx), + }) + for { + ifDetails := &binapi_interface.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(ifDetails) + if stop { + break + } + if err != nil { + return nil, fmt.Errorf("failed to dump interface: %v", err) + } + + ifaceName := cleanString(ifDetails.InterfaceName) + l2addr := net.HardwareAddr(ifDetails.L2Address[:ifDetails.L2AddressLength]) + + details := &vppcalls.InterfaceDetails{ + Interface: &interfaces.Interface{ + Name: cleanString(ifDetails.Tag), + // the type may be amended later by further dumps + Type: guessInterfaceType(ifaceName), + Enabled: ifDetails.AdminUpDown > 0, + PhysAddress: net.HardwareAddr(ifDetails.L2Address[:ifDetails.L2AddressLength]).String(), + Mtu: getMtu(ifDetails.LinkMtu), + }, + Meta: &vppcalls.InterfaceMeta{ + SwIfIndex: ifDetails.SwIfIndex, + SupSwIfIndex: ifDetails.SupSwIfIndex, + L2Address: l2addr, + InternalName: ifaceName, + AdminState: ifDetails.AdminUpDown, + LinkState: ifDetails.LinkUpDown, + LinkDuplex: ifDetails.LinkDuplex, + LinkMTU: ifDetails.LinkMtu, + LinkSpeed: ifDetails.LinkSpeed, + SubID: ifDetails.SubID, + Tag: cleanString(ifDetails.Tag), + }, + } + + // sub interface + if ifDetails.SupSwIfIndex != ifDetails.SwIfIndex { + details.Interface.Type = interfaces.Interface_SUB_INTERFACE + details.Interface.Link = &interfaces.Interface_Sub{ + Sub: &interfaces.SubInterface{ + ParentName: ifs[ifDetails.SupSwIfIndex].Interface.Name, + SubId: ifDetails.SubID, + TagRwOption: getTagRwOption(ifDetails.VtrOp), + PushDot1Q: uintToBool(uint8(ifDetails.VtrPushDot1q)), + Tag1: ifDetails.VtrTag1, + Tag2: ifDetails.VtrTag2, + }, + } + } + // Fill name for physical interfaces (they are mostly without tag) + switch details.Interface.Type { + case interfaces.Interface_DPDK: + details.Interface.Name = ifaceName + case interfaces.Interface_AF_PACKET: + details.Interface.Link = &interfaces.Interface_Afpacket{ + Afpacket: &interfaces.AfpacketLink{ + HostIfName: strings.TrimPrefix(ifaceName, "host-"), + }, + } + } + ifs[ifDetails.SwIfIndex] = details + } + + return ifs, nil +} + +// DumpInterfaces implements interface handler. +func (h *InterfaceVppHandler) DumpInterfaces() (map[uint32]*vppcalls.InterfaceDetails, error) { + ifs, err := h.dumpInterfaces() + if err != nil { + return nil, err + } + + // Get DHCP clients + dhcpClients, err := h.DumpDhcpClients() + if err != nil { + return nil, fmt.Errorf("failed to dump interface DHCP clients: %v", err) + } + + // Get IP addresses before VRF + err = h.dumpIPAddressDetails(ifs, false, dhcpClients) + if err != nil { + return nil, err + } + err = h.dumpIPAddressDetails(ifs, true, dhcpClients) + if err != nil { + return nil, err + } + + // Get unnumbered interfaces + unnumbered, err := h.dumpUnnumberedDetails() + if err != nil { + return nil, fmt.Errorf("failed to dump unnumbered interfaces: %v", err) + } + + // dump VXLAN details before VRFs (used by isIpv6Interface) + err = h.dumpVxlanDetails(ifs) + if err != nil { + return nil, err + } + + // Get interface VRF for every IP family, fill DHCP if set and resolve unnumbered interface setup + for _, ifData := range ifs { + // VRF is stored in metadata for both, IPv4 and IPv6. If the interface is an IPv6 interface (it contains at least + // one IPv6 address), appropriate VRF is stored also in modelled data + ipv4Vrf, err := h.GetInterfaceVrf(ifData.Meta.SwIfIndex) + if err != nil { + return nil, fmt.Errorf("interface dump: failed to get IPv4 VRF from interface %d: %v", + ifData.Meta.SwIfIndex, err) + } + ifData.Meta.VrfIPv4 = ipv4Vrf + ipv6Vrf, err := h.GetInterfaceVrfIPv6(ifData.Meta.SwIfIndex) + if err != nil { + return nil, fmt.Errorf("interface dump: failed to get IPv6 VRF from interface %d: %v", + ifData.Meta.SwIfIndex, err) + } + ifData.Meta.VrfIPv6 = ipv6Vrf + if isIPv6If, err := isIpv6Interface(ifData.Interface); err != nil { + return ifs, err + } else if isIPv6If { + ifData.Interface.Vrf = ipv6Vrf + } else { + ifData.Interface.Vrf = ipv4Vrf + } + + // DHCP + dhcpData, ok := dhcpClients[ifData.Meta.SwIfIndex] + if ok { + ifData.Interface.SetDhcpClient = true + ifData.Meta.Dhcp = dhcpData + } + // Unnumbered + ifWithIPIdx, ok := unnumbered[ifData.Meta.SwIfIndex] + if ok { + // Find unnumbered interface + var ifWithIPName string + ifWithIP, ok := ifs[ifWithIPIdx] + if ok { + ifWithIPName = ifWithIP.Interface.Name + } else { + h.log.Debugf("cannot find name of the ip-interface for unnumbered %s", ifData.Interface.Name) + ifWithIPName = "" + } + ifData.Interface.Unnumbered = &interfaces.Interface_Unnumbered{ + InterfaceWithIp: ifWithIPName, + } + } + } + + err = h.dumpMemifDetails(ifs) + if err != nil { + return nil, err + } + + err = h.dumpTapDetails(ifs) + if err != nil { + return nil, err + } + + err = h.dumpIPSecTunnelDetails(ifs) + if err != nil { + return nil, err + } + + err = h.dumpVmxNet3Details(ifs) + if err != nil { + return nil, err + } + + err = h.dumpBondDetails(ifs) + if err != nil { + return nil, err + } + + // Rx-placement dump is last since it uses interface type-specific data + err = h.dumpRxPlacement(ifs) + if err != nil { + return nil, err + } + + return ifs, nil +} + +// DumpMemifSocketDetails implements interface handler. +func (h *InterfaceVppHandler) DumpMemifSocketDetails() (map[string]uint32, error) { + memifSocketMap := make(map[string]uint32) + + reqCtx := h.callsChannel.SendMultiRequest(&memif.MemifSocketFilenameDump{}) + for { + socketDetails := &memif.MemifSocketFilenameDetails{} + stop, err := reqCtx.ReceiveReply(socketDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return memifSocketMap, fmt.Errorf("failed to dump memif socket filename details: %v", err) + } + + filename := string(bytes.SplitN(socketDetails.SocketFilename, []byte{0x00}, 2)[0]) + memifSocketMap[filename] = socketDetails.SocketID + } + + h.log.Debugf("Memif socket dump completed, found %d entries: %v", len(memifSocketMap), memifSocketMap) + + return memifSocketMap, nil +} + +// DumpDhcpClients returns a slice of DhcpMeta with all interfaces and other DHCP-related information available +func (h *InterfaceVppHandler) DumpDhcpClients() (map[uint32]*vppcalls.Dhcp, error) { + dhcpData := make(map[uint32]*vppcalls.Dhcp) + reqCtx := h.callsChannel.SendMultiRequest(&dhcp.DHCPClientDump{}) + + for { + dhcpDetails := &dhcp.DHCPClientDetails{} + last, err := reqCtx.ReceiveReply(dhcpDetails) + if last { + break + } + if err != nil { + return nil, err + } + client := dhcpDetails.Client + lease := dhcpDetails.Lease + + var hostMac net.HardwareAddr = lease.HostMac + var hostAddr, routerAddr string + if uintToBool(lease.IsIPv6) { + hostAddr = fmt.Sprintf("%s/%d", net.IP(lease.HostAddress).To16().String(), uint32(lease.MaskWidth)) + routerAddr = fmt.Sprintf("%s/%d", net.IP(lease.RouterAddress).To16().String(), uint32(lease.MaskWidth)) + } else { + hostAddr = fmt.Sprintf("%s/%d", net.IP(lease.HostAddress[:4]).To4().String(), uint32(lease.MaskWidth)) + routerAddr = fmt.Sprintf("%s/%d", net.IP(lease.RouterAddress[:4]).To4().String(), uint32(lease.MaskWidth)) + } + + // DHCP client data + dhcpClient := &vppcalls.Client{ + SwIfIndex: client.SwIfIndex, + Hostname: string(bytes.SplitN(client.Hostname, []byte{0x00}, 2)[0]), + ID: string(bytes.SplitN(client.ID, []byte{0x00}, 2)[0]), + WantDhcpEvent: uintToBool(client.WantDHCPEvent), + SetBroadcastFlag: uintToBool(client.SetBroadcastFlag), + PID: client.PID, + } + + // DHCP lease data + dhcpLease := &vppcalls.Lease{ + SwIfIndex: lease.SwIfIndex, + State: lease.State, + Hostname: string(bytes.SplitN(lease.Hostname, []byte{0x00}, 2)[0]), + IsIPv6: uintToBool(lease.IsIPv6), + HostAddress: hostAddr, + RouterAddress: routerAddr, + HostMac: hostMac.String(), + } + + // DHCP metadata + dhcpData[client.SwIfIndex] = &vppcalls.Dhcp{ + Client: dhcpClient, + Lease: dhcpLease, + } + } + + return dhcpData, nil +} + +// DumpInterfaceStates dumps link and administrative state of every interface. +func (h *InterfaceVppHandler) DumpInterfaceStates(ifIdxs ...uint32) (map[uint32]*vppcalls.InterfaceState, error) { + // Dump all interface states if not specified. + if len(ifIdxs) == 0 { + ifIdxs = []uint32{allInterfaces} + } + + ifs := make(map[uint32]*vppcalls.InterfaceState) + for _, ifIdx := range ifIdxs { + reqCtx := h.callsChannel.SendMultiRequest(&binapi_interface.SwInterfaceDump{ + SwIfIndex: binapi_interface.InterfaceIndex(ifIdx), + }) + for { + ifDetails := &binapi_interface.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(ifDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return nil, fmt.Errorf("failed to dump interface states: %v", err) + } + + physAddr := make(net.HardwareAddr, ifDetails.L2AddressLength) + copy(physAddr, ifDetails.L2Address[:]) + + ifaceState := vppcalls.InterfaceState{ + SwIfIndex: ifDetails.SwIfIndex, + InternalName: cleanString(ifDetails.InterfaceName), + PhysAddress: physAddr, + AdminState: toInterfaceStatus(ifDetails.AdminUpDown), + LinkState: toInterfaceStatus(ifDetails.LinkUpDown), + LinkDuplex: toLinkDuplex(ifDetails.LinkDuplex), + LinkSpeed: toLinkSpeed(ifDetails.LinkSpeed), + LinkMTU: ifDetails.LinkMtu, + } + ifs[ifDetails.SwIfIndex] = &ifaceState + } + } + + return ifs, nil +} + +func toInterfaceStatus(upDown uint8) interfaces.InterfaceState_Status { + switch upDown { + case 0: + return interfaces.InterfaceState_DOWN + case 1: + return interfaces.InterfaceState_UP + default: + return interfaces.InterfaceState_UNKNOWN_STATUS + } +} + +func toLinkDuplex(duplex uint8) interfaces.InterfaceState_Duplex { + switch duplex { + case 1: + return interfaces.InterfaceState_HALF + case 2: + return interfaces.InterfaceState_FULL + default: + return interfaces.InterfaceState_UNKNOWN_DUPLEX + } +} + +const megabit = 1000000 // one megabit in bytes + +func toLinkSpeed(speed uint32) uint64 { + switch speed { + case 1: + return 10 * megabit // 10M + case 2: + return 100 * megabit // 100M + case 4: + return 1000 * megabit // 1G + case 8: + return 10000 * megabit // 10G + case 16: + return 40000 * megabit // 40G + case 32: + return 100000 * megabit // 100G + default: + return 0 + } +} + +// Returns true if given interface contains at least one IPv6 address. For VxLAN, source and destination +// addresses are also checked +func isIpv6Interface(iface *interfaces.Interface) (bool, error) { + if iface.Type == interfaces.Interface_VXLAN_TUNNEL && iface.GetVxlan() != nil { + if ipAddress := net.ParseIP(iface.GetVxlan().SrcAddress); ipAddress.To4() == nil { + return true, nil + } + if ipAddress := net.ParseIP(iface.GetVxlan().DstAddress); ipAddress.To4() == nil { + return true, nil + } + } + for _, ifAddress := range iface.IpAddresses { + if ipAddress, _, err := net.ParseCIDR(ifAddress); err != nil { + return false, err + } else if ipAddress.To4() == nil { + return true, nil + } + } + return false, nil +} + +// dumpIPAddressDetails dumps IP address details of interfaces from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpIPAddressDetails(ifs map[uint32]*vppcalls.InterfaceDetails, isIPv6 bool, dhcpClients map[uint32]*vppcalls.Dhcp) error { + // Dump IP addresses of each interface. + for idx := range ifs { + reqCtx := h.callsChannel.SendMultiRequest(&ip.IPAddressDump{ + SwIfIndex: idx, + IsIPv6: boolToUint(isIPv6), + }) + for { + ipDetails := &ip.IPAddressDetails{} + stop, err := reqCtx.ReceiveReply(ipDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return fmt.Errorf("failed to dump interface %d IP address details: %v", idx, err) + } + h.processIPDetails(ifs, ipDetails, dhcpClients) + } + } + + return nil +} + +// processIPDetails processes ip.IPAddressDetails binary API message and fills the details into the provided interface map. +func (h *InterfaceVppHandler) processIPDetails(ifs map[uint32]*vppcalls.InterfaceDetails, ipDetails *ip.IPAddressDetails, dhcpClients map[uint32]*vppcalls.Dhcp) { + ifDetails, ifIdxExists := ifs[ipDetails.SwIfIndex] + if !ifIdxExists { + return + } + + var ipAddr string + ipByte := make([]byte, 16) + copy(ipByte[:], ipDetails.Prefix.Address.Un.XXX_UnionData[:]) + if ipDetails.Prefix.Address.Af == ip.ADDRESS_IP6 { + ipAddr = fmt.Sprintf("%s/%d", net.IP(ipByte).To16().String(), uint32(ipDetails.Prefix.Len)) + } else { + ipAddr = fmt.Sprintf("%s/%d", net.IP(ipByte[:4]).To4().String(), uint32(ipDetails.Prefix.Len)) + } + + // skip IP addresses given by DHCP + if dhcpClient, hasDhcpClient := dhcpClients[ipDetails.SwIfIndex]; hasDhcpClient { + if dhcpClient.Lease != nil && dhcpClient.Lease.HostAddress == ipAddr { + return + } + } + + ifDetails.Interface.IpAddresses = append(ifDetails.Interface.IpAddresses, ipAddr) +} + +// dumpMemifDetails dumps memif interface details from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpMemifDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + // Dump all memif sockets + memifSocketMap, err := h.DumpMemifSocketDetails() + if err != nil { + return err + } + + reqCtx := h.callsChannel.SendMultiRequest(&memif.MemifDump{}) + for { + memifDetails := &memif.MemifDetails{} + stop, err := reqCtx.ReceiveReply(memifDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return fmt.Errorf("failed to dump memif interface: %v", err) + } + _, ifIdxExists := ifs[memifDetails.SwIfIndex] + if !ifIdxExists { + continue + } + ifs[memifDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Memif{ + Memif: &interfaces.MemifLink{ + Master: memifDetails.Role == 0, + Mode: memifModetoNB(memifDetails.Mode), + Id: memifDetails.ID, + //Secret: // TODO: Secret - not available in the binary API + SocketFilename: func(socketMap map[string]uint32) (filename string) { + for filename, id := range socketMap { + if memifDetails.SocketID == id { + return filename + } + } + // Socket for configured memif should exist + h.log.Warnf("Socket ID not found for memif %v", memifDetails.SwIfIndex) + return + }(memifSocketMap), + RingSize: memifDetails.RingSize, + BufferSize: uint32(memifDetails.BufferSize), + // TODO: RxQueues, TxQueues - not available in the binary API + //RxQueues: + //TxQueues: + }, + } + ifs[memifDetails.SwIfIndex].Interface.Type = interfaces.Interface_MEMIF + } + + return nil +} + +// dumpTapDetails dumps tap interface details from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpTapDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + // Original TAP v1 was DEPRECATED + + // TAP v2 + reqCtx := h.callsChannel.SendMultiRequest(&tapv2.SwInterfaceTapV2Dump{}) + for { + tapDetails := &tapv2.SwInterfaceTapV2Details{} + stop, err := reqCtx.ReceiveReply(tapDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return fmt.Errorf("failed to dump TAPv2 interface details: %v", err) + } + _, ifIdxExists := ifs[tapDetails.SwIfIndex] + if !ifIdxExists { + continue + } + ifs[tapDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Tap{ + Tap: &interfaces.TapLink{ + Version: 2, + HostIfName: cleanString(tapDetails.HostIfName), + RxRingSize: uint32(tapDetails.RxRingSz), + TxRingSize: uint32(tapDetails.TxRingSz), + EnableGso: tapDetails.TapFlags&TapFlagGSO == TapFlagGSO, + }, + } + ifs[tapDetails.SwIfIndex].Interface.Type = interfaces.Interface_TAP + } + + return nil +} + +// dumpVxlanDetails dumps VXLAN interface details from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpVxlanDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + reqCtx := h.callsChannel.SendMultiRequest(&vxlan.VxlanTunnelDump{ + SwIfIndex: ^uint32(0), + }) + for { + vxlanDetails := &vxlan.VxlanTunnelDetails{} + stop, err := reqCtx.ReceiveReply(vxlanDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return fmt.Errorf("failed to dump VxLAN tunnel interface details: %v", err) + } + _, ifIdxExists := ifs[vxlanDetails.SwIfIndex] + if !ifIdxExists { + continue + } + // Multicast interface + var multicastIfName string + _, exists := ifs[vxlanDetails.McastSwIfIndex] + if exists { + multicastIfName = ifs[vxlanDetails.McastSwIfIndex].Interface.Name + } + + if vxlanDetails.IsIPv6 == 1 { + ifs[vxlanDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Vxlan{ + Vxlan: &interfaces.VxlanLink{ + Multicast: multicastIfName, + SrcAddress: net.IP(vxlanDetails.SrcAddress).To16().String(), + DstAddress: net.IP(vxlanDetails.DstAddress).To16().String(), + Vni: vxlanDetails.Vni, + }, + } + } else { + ifs[vxlanDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Vxlan{ + Vxlan: &interfaces.VxlanLink{ + Multicast: multicastIfName, + SrcAddress: net.IP(vxlanDetails.SrcAddress[:4]).To4().String(), + DstAddress: net.IP(vxlanDetails.DstAddress[:4]).To4().String(), + Vni: vxlanDetails.Vni, + }, + } + } + ifs[vxlanDetails.SwIfIndex].Interface.Type = interfaces.Interface_VXLAN_TUNNEL + } + + return nil +} + +// dumpIPSecTunnelDetails dumps IPSec tunnel interfaces from the VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpIPSecTunnelDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + // tunnel interfaces are a part of security association dump + var tunnels []*ipsec.IpsecSaDetails + req := &ipsec.IpsecSaDump{ + SaID: ^uint32(0), + } + requestCtx := h.callsChannel.SendMultiRequest(req) + + for { + saDetails := &ipsec.IpsecSaDetails{} + stop, err := requestCtx.ReceiveReply(saDetails) + if stop { + break + } + if err != nil { + return err + } + // skip non-tunnel security associations + if saDetails.SwIfIndex != ^uint32(0) { + tunnels = append(tunnels, saDetails) + } + } + + // every tunnel interface is returned in two API calls. To reconstruct the correct proto-modelled data, + // first appearance is cached, and when the second part arrives, data are completed and stored. + tunnelParts := make(map[uint32]*ipsec.IpsecSaDetails) + + for _, tunnel := range tunnels { + // first appearance is stored in the map, the second one is used in configuration. + firstSaData, ok := tunnelParts[tunnel.SwIfIndex] + if !ok { + tunnelParts[tunnel.SwIfIndex] = tunnel + continue + } + + local := firstSaData + remote := tunnel + + // verify data for local & remote + if err := verifyIPSecTunnelDetails(local, remote); err != nil { + h.log.Warnf("IPSec SA dump for tunnel interface data does not match: %v", err) + continue + } + + var localIP, remoteIP net.IP + if tunnel.Entry.TunnelDst.Af == ipsec.ADDRESS_IP6 { + localSrc := local.Entry.TunnelSrc.Un.GetIP6() + remoteSrc := remote.Entry.TunnelSrc.Un.GetIP6() + localIP, remoteIP = net.IP(localSrc[:]), net.IP(remoteSrc[:]) + } else { + localSrc := local.Entry.TunnelSrc.Un.GetIP4() + remoteSrc := remote.Entry.TunnelSrc.Un.GetIP4() + localIP, remoteIP = net.IP(localSrc[:]), net.IP(remoteSrc[:]) + } + + ifDetails, ok := ifs[tunnel.SwIfIndex] + if !ok { + h.log.Warnf("ipsec SA dump returned unrecognized swIfIndex: %v", tunnel.SwIfIndex) + continue + } + ifDetails.Interface.Type = interfaces.Interface_IPSEC_TUNNEL + ifDetails.Interface.Link = &interfaces.Interface_Ipsec{ + Ipsec: &interfaces.IPSecLink{ + Esn: (tunnel.Entry.Flags & ipsec.IPSEC_API_SAD_FLAG_USE_ESN) != 0, + AntiReplay: (tunnel.Entry.Flags & ipsec.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY) != 0, + LocalIp: localIP.String(), + RemoteIp: remoteIP.String(), + LocalSpi: local.Entry.Spi, + RemoteSpi: remote.Entry.Spi, + CryptoAlg: vpp_ipsec.CryptoAlg(tunnel.Entry.CryptoAlgorithm), + LocalCryptoKey: hex.EncodeToString(local.Entry.CryptoKey.Data[:local.Entry.CryptoKey.Length]), + RemoteCryptoKey: hex.EncodeToString(remote.Entry.CryptoKey.Data[:remote.Entry.CryptoKey.Length]), + IntegAlg: vpp_ipsec.IntegAlg(tunnel.Entry.IntegrityAlgorithm), + LocalIntegKey: hex.EncodeToString(local.Entry.IntegrityKey.Data[:local.Entry.IntegrityKey.Length]), + RemoteIntegKey: hex.EncodeToString(remote.Entry.IntegrityKey.Data[:remote.Entry.IntegrityKey.Length]), + EnableUdpEncap: (tunnel.Entry.Flags & ipsec.IPSEC_API_SAD_FLAG_UDP_ENCAP) != 0, + }, + } + } + + return nil +} + +func verifyIPSecTunnelDetails(local, remote *ipsec.IpsecSaDetails) error { + if local.SwIfIndex != remote.SwIfIndex { + return fmt.Errorf("swIfIndex data mismatch (local: %v, remote: %v)", + local.SwIfIndex, remote.SwIfIndex) + } + localIsTunnel, remoteIsTunnel := local.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL, remote.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL + if localIsTunnel != remoteIsTunnel { + return fmt.Errorf("tunnel data mismatch (local: %v, remote: %v)", + localIsTunnel, remoteIsTunnel) + } + + localSrc, localDst := local.Entry.TunnelSrc.Un.XXX_UnionData, local.Entry.TunnelDst.Un.XXX_UnionData + remoteSrc, remoteDst := remote.Entry.TunnelSrc.Un.XXX_UnionData, remote.Entry.TunnelDst.Un.XXX_UnionData + if (local.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6) != (remote.Entry.Flags&ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6) || + !bytes.Equal(localSrc[:], remoteDst[:]) || + !bytes.Equal(localDst[:], remoteSrc[:]) { + return fmt.Errorf("src/dst IP mismatch (local: %+v, remote: %+v)", + local.Entry, remote.Entry) + } + + return nil +} + +// dumpVmxNet3Details dumps VmxNet3 interface details from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpVmxNet3Details(ifs map[uint32]*vppcalls.InterfaceDetails) error { + reqCtx := h.callsChannel.SendMultiRequest(&vmxnet3.Vmxnet3Dump{}) + for { + vmxnet3Details := &vmxnet3.Vmxnet3Details{} + stop, err := reqCtx.ReceiveReply(vmxnet3Details) + if stop { + break // Break from the loop. + } + if err != nil { + return fmt.Errorf("failed to dump VmxNet3 tunnel interface details: %v", err) + } + _, ifIdxExists := ifs[vmxnet3Details.SwIfIndex] + if !ifIdxExists { + continue + } + ifs[vmxnet3Details.SwIfIndex].Interface.Link = &interfaces.Interface_VmxNet3{ + VmxNet3: &interfaces.VmxNet3Link{ + RxqSize: uint32(vmxnet3Details.RxCount), + TxqSize: uint32(vmxnet3Details.TxCount), + }, + } + ifs[vmxnet3Details.SwIfIndex].Interface.Type = interfaces.Interface_VMXNET3_INTERFACE + ifs[vmxnet3Details.SwIfIndex].Meta.Pci = vmxnet3Details.PciAddr + } + return nil +} + +// dumpBondDetails dumps bond interface details from VPP and fills them into the provided interface map. +func (h *InterfaceVppHandler) dumpBondDetails(ifs map[uint32]*vppcalls.InterfaceDetails) error { + bondIndexes := make([]uint32, 0) + reqCtx := h.callsChannel.SendMultiRequest(&bond.SwInterfaceBondDump{}) + for { + bondDetails := &bond.SwInterfaceBondDetails{} + stop, err := reqCtx.ReceiveReply(bondDetails) + if err != nil { + return fmt.Errorf("failed to dump bond interface details: %v", err) + } + if stop { + break + } + _, ifIdxExists := ifs[bondDetails.SwIfIndex] + if !ifIdxExists { + continue + } + ifs[bondDetails.SwIfIndex].Interface.Link = &interfaces.Interface_Bond{ + Bond: &interfaces.BondLink{ + Id: bondDetails.ID, + Mode: getBondIfMode(bondDetails.Mode), + Lb: getBondLoadBalance(bondDetails.Lb), + }, + } + ifs[bondDetails.SwIfIndex].Interface.Type = interfaces.Interface_BOND_INTERFACE + bondIndexes = append(bondIndexes, bondDetails.SwIfIndex) + } + + // get slave interfaces for bonds + for _, bondIdx := range bondIndexes { + var bondSlaves []*interfaces.BondLink_BondedInterface + reqSlCtx := h.callsChannel.SendMultiRequest(&bond.SwInterfaceSlaveDump{SwIfIndex: bondIdx}) + for { + slaveDetails := &bond.SwInterfaceSlaveDetails{} + stop, err := reqSlCtx.ReceiveReply(slaveDetails) + if err != nil { + return fmt.Errorf("failed to dump bond slave details: %v", err) + } + if stop { + break + } + slaveIf, ifIdxExists := ifs[slaveDetails.SwIfIndex] + if !ifIdxExists { + continue + } + bondSlaves = append(bondSlaves, &interfaces.BondLink_BondedInterface{ + Name: slaveIf.Interface.Name, + IsPassive: uintToBool(slaveDetails.IsPassive), + IsLongTimeout: uintToBool(slaveDetails.IsLongTimeout), + }) + ifs[bondIdx].Interface.GetBond().BondedInterfaces = bondSlaves + } + } + + return nil +} + +// dumpUnnumberedDetails returns a map of unnumbered interface indexes, every with interface index of element with IP +func (h *InterfaceVppHandler) dumpUnnumberedDetails() (map[uint32]uint32, error) { + unIfMap := make(map[uint32]uint32) // unnumbered/ip-interface + reqCtx := h.callsChannel.SendMultiRequest(&ip.IPUnnumberedDump{ + SwIfIndex: ^uint32(0), + }) + + for { + unDetails := &ip.IPUnnumberedDetails{} + last, err := reqCtx.ReceiveReply(unDetails) + if last { + break + } + if err != nil { + return nil, err + } + + unIfMap[unDetails.SwIfIndex] = unDetails.IPSwIfIndex + } + + return unIfMap, nil +} + +func (h *InterfaceVppHandler) dumpRxPlacement(ifs map[uint32]*vppcalls.InterfaceDetails) error { + reqCtx := h.callsChannel.SendMultiRequest(&binapi_interface.SwInterfaceRxPlacementDump{ + SwIfIndex: ^uint32(0), + }) + for { + rxDetails := &binapi_interface.SwInterfaceRxPlacementDetails{} + stop, err := reqCtx.ReceiveReply(rxDetails) + if err != nil { + return fmt.Errorf("failed to dump rx-placement details: %v", err) + } + if stop { + break + } + + ifData, ok := ifs[rxDetails.SwIfIndex] + if !ok { + h.log.Warnf("Received rx-placement data for unknown interface with index %d", rxDetails.SwIfIndex) + continue + } + + ifData.Interface.RxModes = append(ifData.Interface.RxModes, + &interfaces.Interface_RxMode{ + Queue: rxDetails.QueueID, + Mode: getRxModeType(rxDetails.Mode), + }) + + var worker uint32 + if rxDetails.WorkerID > 0 { + worker = rxDetails.WorkerID - 1 + } + ifData.Interface.RxPlacements = append(ifData.Interface.RxPlacements, + &interfaces.Interface_RxPlacement{ + Queue: rxDetails.QueueID, + Worker: worker, + MainThread: rxDetails.WorkerID == 0, + }) + } + return nil +} + +// guessInterfaceType attempts to guess the correct interface type from its internal name (as given by VPP). +// This is required mainly for those interface types, that do not provide dump binary API, +// such as loopback of af_packet. +func guessInterfaceType(ifName string) interfaces.Interface_Type { + switch { + case strings.HasPrefix(ifName, "loop"), + strings.HasPrefix(ifName, "local"): + return interfaces.Interface_SOFTWARE_LOOPBACK + + case strings.HasPrefix(ifName, "memif"): + return interfaces.Interface_MEMIF + + case strings.HasPrefix(ifName, "tap"): + return interfaces.Interface_TAP + + case strings.HasPrefix(ifName, "host"): + return interfaces.Interface_AF_PACKET + + case strings.HasPrefix(ifName, "vxlan"): + return interfaces.Interface_VXLAN_TUNNEL + + case strings.HasPrefix(ifName, "ipsec"): + return interfaces.Interface_IPSEC_TUNNEL + + case strings.HasPrefix(ifName, "vmxnet3"): + return interfaces.Interface_VMXNET3_INTERFACE + + case strings.HasPrefix(ifName, "Bond"): + return interfaces.Interface_BOND_INTERFACE + + default: + return interfaces.Interface_DPDK + } +} + +// memifModetoNB converts binary API type of memif mode to the northbound API type memif mode. +func memifModetoNB(mode uint8) interfaces.MemifLink_MemifMode { + switch mode { + case 0: + return interfaces.MemifLink_ETHERNET + case 1: + return interfaces.MemifLink_IP + case 2: + return interfaces.MemifLink_PUNT_INJECT + default: + return interfaces.MemifLink_ETHERNET + } +} + +// Convert binary API rx-mode to northbound representation +func getRxModeType(mode uint8) interfaces.Interface_RxMode_Type { + switch mode { + case 1: + return interfaces.Interface_RxMode_POLLING + case 2: + return interfaces.Interface_RxMode_INTERRUPT + case 3: + return interfaces.Interface_RxMode_ADAPTIVE + case 4: + return interfaces.Interface_RxMode_DEFAULT + default: + return interfaces.Interface_RxMode_UNKNOWN + } +} + +func getBondIfMode(mode uint8) interfaces.BondLink_Mode { + switch mode { + case 1: + return interfaces.BondLink_ROUND_ROBIN + case 2: + return interfaces.BondLink_ACTIVE_BACKUP + case 3: + return interfaces.BondLink_XOR + case 4: + return interfaces.BondLink_BROADCAST + case 5: + return interfaces.BondLink_LACP + default: + // UNKNOWN + return 0 + } +} + +func getBondLoadBalance(lb uint8) interfaces.BondLink_LoadBalance { + switch lb { + case 1: + return interfaces.BondLink_L34 + case 2: + return interfaces.BondLink_L23 + default: + return interfaces.BondLink_L2 + } +} + +func getTagRwOption(op uint32) interfaces.SubInterface_TagRewriteOptions { + switch op { + case 1: + return interfaces.SubInterface_PUSH1 + case 2: + return interfaces.SubInterface_PUSH2 + case 3: + return interfaces.SubInterface_POP1 + case 4: + return interfaces.SubInterface_POP2 + case 5: + return interfaces.SubInterface_TRANSLATE11 + case 6: + return interfaces.SubInterface_TRANSLATE12 + case 7: + return interfaces.SubInterface_TRANSLATE21 + case 8: + return interfaces.SubInterface_TRANSLATE22 + default: // disabled + return interfaces.SubInterface_DISABLED + } +} + +func uintToBool(value uint8) bool { + if value == 0 { + return false + } + return true +} + +func cleanString(b []byte) string { + return string(bytes.SplitN(b, []byte{0x00}, 2)[0]) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls_test.go new file mode 100644 index 0000000000..571e7edbf0 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/dump_interface_vppcalls_test.go @@ -0,0 +1,418 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "net" + "testing" + + govppapi "git.fd.io/govpp.git/api" + + interfaces2 "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memif" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/tapv2" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vxlan" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +// Test dump of interfaces with vxlan type +func TestDumpInterfacesVxLan(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ipv61Parse := net.ParseIP("dead:beef:feed:face:cafe:babe:baad:c0de").To16() + ipv62Parse := net.ParseIP("d3ad:beef:feed:face:cafe:babe:baad:c0de").To16() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("vxlan1"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + Message: &vxlan.VxlanTunnelDetails{ + IsIPv6: 1, + SwIfIndex: 0, + SrcAddress: ipv61Parse, + DstAddress: ipv62Parse, + }, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check vxlan + Expect(intface.GetVxlan().SrcAddress).To(Equal("dead:beef:feed:face:cafe:babe:baad:c0de")) + Expect(intface.GetVxlan().DstAddress).To(Equal("d3ad:beef:feed:face:cafe:babe:baad:c0de")) +} + +// Test dump of interfaces with host type +func TestDumpInterfacesHost(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("host-localhost"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check interface data + Expect(intface.GetAfpacket().HostIfName).To(Equal("localhost")) +} + +// Test dump of interfaces with memif type +func TestDumpInterfacesMemif(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("memif1"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifSocketFilenameDetails{ + SocketID: 1, + SocketFilename: []byte("test"), + }, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifDetails{ + ID: 2, + SwIfIndex: 0, + Role: 1, // Slave + Mode: 1, // IP + SocketID: 1, + RingSize: 0, + BufferSize: 0, + }, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check memif + Expect(intface.GetMemif().SocketFilename).To(Equal("test")) + Expect(intface.GetMemif().Id).To(Equal(uint32(2))) + Expect(intface.GetMemif().Mode).To(Equal(interfaces2.MemifLink_IP)) + Expect(intface.GetMemif().Master).To(BeFalse()) +} + +func TestDumpInterfacesTap2(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + hwAddr1Parse, err := net.ParseMAC("01:23:45:67:89:ab") + Expect(err).To(BeNil()) + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + SwIfIndex: 0, + InterfaceName: []byte("tap2"), + Tag: []byte("mytap2"), + AdminUpDown: 1, + LinkMtu: 9216, // Default MTU + L2Address: hwAddr1Parse, + L2AddressLength: uint32(len(hwAddr1Parse)), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{ + Retval: 0, + VrfID: 42, + }, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&dhcp.DHCPClientDump{}).GetMessageName(), + Ping: true, + Message: &dhcp.DHCPClientDetails{ + Client: dhcp.DHCPClient{ + SwIfIndex: 0, + }, + }, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + Message: &tapv2.SwInterfaceTapV2Details{ + SwIfIndex: 0, + HostIfName: []byte("taptap2"), + }, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + + intface := intfs[0].Interface + intMeta := intfs[0].Meta + + // This is last checked type, so it will be equal to that + Expect(intface.Type).To(Equal(interfaces2.Interface_TAP)) + Expect(intface.PhysAddress).To(Equal("01:23:45:67:89:ab")) + Expect(intface.Name).To(Equal("mytap2")) + Expect(intface.Mtu).To(Equal(uint32(0))) // default mtu + Expect(intface.Enabled).To(BeTrue()) + Expect(intface.Vrf).To(Equal(uint32(42))) + Expect(intface.SetDhcpClient).To(BeTrue()) + Expect(intface.GetTap().HostIfName).To(Equal("taptap2")) + Expect(intface.GetTap().Version).To(Equal(uint32(2))) + Expect(intMeta.VrfIPv4).To(Equal(uint32(42))) + Expect(intMeta.VrfIPv6).To(Equal(uint32(42))) +} + +// Test dump of memif socket details using standard reply mocking +func TestDumpMemifSocketDetails(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifSocketFilenameDetails{ + SocketID: 1, + SocketFilename: []byte("test"), + }) + + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + result, err := ifHandler.DumpMemifSocketDetails() + Expect(err).To(BeNil()) + Expect(result).To(Not(BeEmpty())) + + socketID, ok := result["test"] + Expect(ok).To(BeTrue()) + Expect(socketID).To(Equal(uint32(1))) +} + +func TestDumpInterfacesRxPlacement(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&interfaces.SwInterfaceDump{}).GetMessageName(), + Ping: true, + Message: &interfaces.SwInterfaceDetails{ + InterfaceName: []byte("memif1"), + }, + }, + { + Name: (&interfaces.SwInterfaceGetTable{}).GetMessageName(), + Ping: false, + Message: &interfaces.SwInterfaceGetTableReply{}, + }, + { + Name: (&ip.IPAddressDump{}).GetMessageName(), + Ping: true, + Message: &ip.IPAddressDetails{}, + }, + { + Name: (&memif.MemifSocketFilenameDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifSocketFilenameDetails{ + SocketID: 1, + SocketFilename: []byte("test"), + }, + }, + { + Name: (&memif.MemifDump{}).GetMessageName(), + Ping: true, + Message: &memif.MemifDetails{ + ID: 2, + SwIfIndex: 0, + Role: 1, // Slave + Mode: 1, // IP + SocketID: 1, + RingSize: 0, + BufferSize: 0, + }, + }, + { + Name: (&tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&vxlan.VxlanTunnelDump{}).GetMessageName(), + Ping: true, + }, + { + Name: (&interfaces.SwInterfaceRxPlacementDump{}).GetMessageName(), + Ping: true, + Messages: []govppapi.Message{ + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 0, + WorkerID: 0, // main thread + Mode: 3, // adaptive + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 1, + WorkerID: 1, // worker 0 + Mode: 2, // interrupt + }, + &interfaces.SwInterfaceRxPlacementDetails{ + SwIfIndex: 0, + QueueID: 2, + WorkerID: 2, // worker 1 + Mode: 1, // polling + }, + }, + }, + }) + + intfs, err := ifHandler.DumpInterfaces() + Expect(err).To(BeNil()) + Expect(intfs).To(HaveLen(1)) + intface := intfs[0].Interface + + // Check memif + Expect(intface.GetMemif().SocketFilename).To(Equal("test")) + Expect(intface.GetMemif().Id).To(Equal(uint32(2))) + Expect(intface.GetMemif().Mode).To(Equal(interfaces2.MemifLink_IP)) + Expect(intface.GetMemif().Master).To(BeFalse()) + + rxMode := intface.GetRxModes() + Expect(rxMode).To(HaveLen(3)) + Expect(rxMode[0].Queue).To(BeEquivalentTo(0)) + Expect(rxMode[0].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_ADAPTIVE)) + Expect(rxMode[1].Queue).To(BeEquivalentTo(1)) + Expect(rxMode[1].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_INTERRUPT)) + Expect(rxMode[2].Queue).To(BeEquivalentTo(2)) + Expect(rxMode[2].Mode).To(BeEquivalentTo(interfaces2.Interface_RxMode_POLLING)) + + rxPlacement := intface.GetRxPlacements() + Expect(rxPlacement).To(HaveLen(3)) + Expect(rxPlacement[0].Queue).To(BeEquivalentTo(0)) + Expect(rxPlacement[0].MainThread).To(BeTrue()) + Expect(rxPlacement[0].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[1].Queue).To(BeEquivalentTo(1)) + Expect(rxPlacement[1].MainThread).To(BeFalse()) + Expect(rxPlacement[1].Worker).To(BeEquivalentTo(0)) + Expect(rxPlacement[2].Queue).To(BeEquivalentTo(2)) + Expect(rxPlacement[2].MainThread).To(BeFalse()) + Expect(rxPlacement[2].Worker).To(BeEquivalentTo(1)) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls.go new file mode 100644 index 0000000000..4a3b4b0085 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls.go @@ -0,0 +1,64 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/cn-infra/utils/addrs" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" +) + +const ( + addContainerIP uint8 = 1 + removeContainerIP uint8 = 0 +) + +func (h *InterfaceVppHandler) sendAndLogMessageForVpp(ifIdx uint32, addr string, isAdd uint8) error { + req := &ip.IPContainerProxyAddDel{ + SwIfIndex: ifIdx, + IsAdd: isAdd, + } + + IPaddr, isIPv6, err := addrs.ParseIPWithPrefix(addr) + if err != nil { + return err + } + + prefix, _ := IPaddr.Mask.Size() + req.Pfx.Len = byte(prefix) + if isIPv6 { + copy(req.Pfx.Address.Un.XXX_UnionData[:], IPaddr.IP.To16()) + req.Pfx.Address.Af = ip.ADDRESS_IP6 + } else { + copy(req.Pfx.Address.Un.XXX_UnionData[:], IPaddr.IP.To4()) + req.Pfx.Address.Af = ip.ADDRESS_IP4 + } + reply := &ip.IPContainerProxyAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// AddContainerIP implements interface handler. +func (h *InterfaceVppHandler) AddContainerIP(ifIdx uint32, addr string) error { + return h.sendAndLogMessageForVpp(ifIdx, addr, addContainerIP) +} + +// DelContainerIP implements interface handler. +func (h *InterfaceVppHandler) DelContainerIP(ifIdx uint32, addr string) error { + return h.sendAndLogMessageForVpp(ifIdx, addr, removeContainerIP) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls_test.go new file mode 100644 index 0000000000..f070578ad0 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_container_vppcalls_test.go @@ -0,0 +1,167 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "fmt" + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1908" + . "github.com/onsi/gomega" +) + +func ipToAddr(ip string) ip.Address { + addr, err := vpp1908.IPToAddress(ip) + if err != nil { + panic(fmt.Sprintf("invalid IP: %s", ip)) + } + return addr +} + +func TestAddContainerIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{}) + + err := ifHandler.AddContainerIP(1, "10.0.0.1/24") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPContainerProxyAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Pfx).To(BeEquivalentTo(ip.Prefix{ + Address: ipToAddr("10.0.0.1"), + Len: 24, + })) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestAddContainerIPv6(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{}) + + err := ifHandler.AddContainerIP(1, "2001:db8:0:1:1:1:1:1/128") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPContainerProxyAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Pfx).To(BeEquivalentTo(ip.Prefix{ + Address: ipToAddr("2001:db8:0:1:1:1:1:1"), + Len: 128, + })) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestAddContainerIPInvalidIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPAddressDetails{}) + + err := ifHandler.AddContainerIP(1, "invalid-ip") + + Expect(err).ToNot(BeNil()) +} + +func TestAddContainerIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPAddressDetails{}) + + err := ifHandler.AddContainerIP(1, "10.0.0.1/24") + + Expect(err).ToNot(BeNil()) +} + +func TestAddContainerIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{ + Retval: 1, + }) + + err := ifHandler.AddContainerIP(1, "10.0.0.1/24") + + Expect(err).ToNot(BeNil()) +} + +func TestDelContainerIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{}) + + err := ifHandler.DelContainerIP(1, "10.0.0.1/24") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPContainerProxyAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Pfx).To(BeEquivalentTo(ip.Prefix{ + Address: ipToAddr("10.0.0.1"), + Len: 24, + })) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestDelContainerIPv6(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{}) + + err := ifHandler.DelContainerIP(1, "2001:db8:0:1:1:1:1:1/128") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPContainerProxyAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Pfx).To(BeEquivalentTo(ip.Prefix{ + Address: ipToAddr("2001:db8:0:1:1:1:1:1"), + Len: 128, + })) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestDelContainerIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPAddressDetails{}) + + err := ifHandler.DelContainerIP(1, "10.0.0.1/24") + + Expect(err).ToNot(BeNil()) +} + +func TestDelContainerIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPContainerProxyAddDelReply{ + Retval: 1, + }) + + err := ifHandler.DelContainerIP(1, "10.0.0.1/24") + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls.go new file mode 100644 index 0000000000..da1fe734a3 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls.go @@ -0,0 +1,97 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + "github.com/ligato/cn-infra/utils/addrs" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +const ( + addInterfaceIP uint8 = 1 + delInterfaceIP uint8 = 0 +) + +func (h *InterfaceVppHandler) addDelInterfaceIP(ifIdx uint32, addr *net.IPNet, isAdd uint8) error { + req := &interfaces.SwInterfaceAddDelAddress{ + SwIfIndex: ifIdx, + IsAdd: isAdd, + } + + prefix, _ := addr.Mask.Size() + req.AddressLength = byte(prefix) + + isIPv6, err := addrs.IsIPv6(addr.IP.String()) + if err != nil { + return err + } + if isIPv6 { + req.Address = []byte(addr.IP.To16()) + req.IsIPv6 = 1 + } else { + req.Address = []byte(addr.IP.To4()) + req.IsIPv6 = 0 + } + reply := &interfaces.SwInterfaceAddDelAddressReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// AddInterfaceIP implements interface handler. +func (h *InterfaceVppHandler) AddInterfaceIP(ifIdx uint32, addr *net.IPNet) error { + return h.addDelInterfaceIP(ifIdx, addr, addInterfaceIP) +} + +// DelInterfaceIP implements interface handler. +func (h *InterfaceVppHandler) DelInterfaceIP(ifIdx uint32, addr *net.IPNet) error { + return h.addDelInterfaceIP(ifIdx, addr, delInterfaceIP) +} + +const ( + setUnnumberedIP uint8 = 1 + unsetUnnumberedIP uint8 = 0 +) + +func (h *InterfaceVppHandler) setUnsetUnnumberedIP(uIfIdx uint32, ifIdxWithIP uint32, isAdd uint8) error { + // Prepare the message. + req := &interfaces.SwInterfaceSetUnnumbered{ + SwIfIndex: ifIdxWithIP, + UnnumberedSwIfIndex: uIfIdx, + IsAdd: isAdd, + } + reply := &interfaces.SwInterfaceSetUnnumberedReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// SetUnnumberedIP implements interface handler. +func (h *InterfaceVppHandler) SetUnnumberedIP(uIfIdx uint32, ifIdxWithIP uint32) error { + return h.setUnsetUnnumberedIP(uIfIdx, ifIdxWithIP, setUnnumberedIP) +} + +// UnsetUnnumberedIP implements interface handler. +func (h *InterfaceVppHandler) UnsetUnnumberedIP(uIfIdx uint32) error { + return h.setUnsetUnnumberedIP(uIfIdx, 0, unsetUnnumberedIP) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls_test.go new file mode 100644 index 0000000000..891946c7cd --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ip_vppcalls_test.go @@ -0,0 +1,269 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "net" + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestAddInterfaceIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + err = ifHandler.AddInterfaceIP(1, ipNet) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceAddDelAddress) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(0)) + Expect(vppMsg.Address).To(BeEquivalentTo(net.ParseIP("10.0.0.0").To4())) + Expect(vppMsg.AddressLength).To(BeEquivalentTo(24)) + Expect(vppMsg.DelAll).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestAddInterfaceIPv6(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + _, ipNet, err := net.ParseCIDR("2001:db8:0:1:1:1:1:1/128") + Expect(err).To(BeNil()) + err = ifHandler.AddInterfaceIP(1, ipNet) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceAddDelAddress) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Address).To(BeEquivalentTo(net.ParseIP("2001:db8:0:1:1:1:1:1").To16())) + Expect(vppMsg.AddressLength).To(BeEquivalentTo(128)) + Expect(vppMsg.DelAll).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestAddInterfaceInvalidIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + err := ifHandler.AddInterfaceIP(1, &net.IPNet{ + IP: []byte("invalid-ip"), + }) + + Expect(err).ToNot(BeNil()) +} + +func TestAddInterfaceIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddress{}) + + err = ifHandler.AddInterfaceIP(1, ipNet) + + Expect(err).ToNot(BeNil()) +} + +func TestAddInterfaceIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{ + Retval: 1, + }) + + err = ifHandler.AddInterfaceIP(1, ipNet) + + Expect(err).ToNot(BeNil()) +} + +func TestDelInterfaceIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + err = ifHandler.DelInterfaceIP(1, ipNet) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceAddDelAddress) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(0)) + Expect(vppMsg.Address).To(BeEquivalentTo(net.ParseIP("10.0.0.0").To4())) + Expect(vppMsg.AddressLength).To(BeEquivalentTo(24)) + Expect(vppMsg.DelAll).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestDelInterfaceIPv6(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + _, ipNet, err := net.ParseCIDR("2001:db8:0:1:1:1:1:1/128") + Expect(err).To(BeNil()) + err = ifHandler.DelInterfaceIP(1, ipNet) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceAddDelAddress) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + Expect(vppMsg.Address).To(BeEquivalentTo(net.ParseIP("2001:db8:0:1:1:1:1:1").To16())) + Expect(vppMsg.AddressLength).To(BeEquivalentTo(128)) + Expect(vppMsg.DelAll).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestDelInterfaceInvalidIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{}) + + err := ifHandler.DelInterfaceIP(1, &net.IPNet{ + IP: []byte("invalid-ip"), + }) + + Expect(err).ToNot(BeNil()) +} + +func TestDelInterfaceIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddress{}) + + err = ifHandler.DelInterfaceIP(1, ipNet) + + Expect(err).ToNot(BeNil()) +} + +func TestDelInterfaceIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + _, ipNet, err := net.ParseCIDR("10.0.0.1/24") + Expect(err).To(BeNil()) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceAddDelAddressReply{ + Retval: 1, + }) + + err = ifHandler.DelInterfaceIP(1, ipNet) + + Expect(err).ToNot(BeNil()) +} + +func TestSetUnnumberedIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumberedReply{}) + + err := ifHandler.SetUnnumberedIP(1, 2) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetUnnumbered) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(2)) + Expect(vppMsg.UnnumberedSwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) +} + +func TestSetUnnumberedIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumbered{}) + + err := ifHandler.SetUnnumberedIP(1, 2) + + Expect(err).ToNot(BeNil()) +} + +func TestSetUnnumberedIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumberedReply{ + Retval: 1, + }) + + err := ifHandler.SetUnnumberedIP(1, 2) + + Expect(err).ToNot(BeNil()) +} + +func TestUnsetUnnumberedIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumberedReply{}) + + err := ifHandler.UnsetUnnumberedIP(1) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetUnnumbered) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(0)) + Expect(vppMsg.UnnumberedSwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) +} + +func TestUnsetUnnumberedIPError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumbered{}) + + err := ifHandler.UnsetUnnumberedIP(1) + + Expect(err).ToNot(BeNil()) +} + +func TestUnsetUnnumberedIPRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetUnnumberedReply{ + Retval: 1, + }) + + err := ifHandler.UnsetUnnumberedIP(1) + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls.go new file mode 100644 index 0000000000..60aca1ae81 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls.go @@ -0,0 +1,111 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "encoding/hex" + "fmt" + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" +) + +// AddIPSecTunnelInterface adds a new IPSec tunnel interface. +func (h *InterfaceVppHandler) AddIPSecTunnelInterface(ifName string, ipSecLink *interfaces.IPSecLink) (uint32, error) { + return h.tunnelIfAddDel(ifName, ipSecLink, true) +} + +// DeleteIPSecTunnelInterface removes existing IPSec tunnel interface. +func (h *InterfaceVppHandler) DeleteIPSecTunnelInterface(ifName string, ipSecLink *interfaces.IPSecLink) error { + // Note: ifIdx is not used now, tunnel should be matched based on parameters + _, err := h.tunnelIfAddDel(ifName, ipSecLink, false) + return err +} + +func (h *InterfaceVppHandler) tunnelIfAddDel(ifName string, ipSecLink *interfaces.IPSecLink, isAdd bool) (uint32, error) { + localCryptoKey, err := hex.DecodeString(ipSecLink.LocalCryptoKey) + if err != nil { + return 0, err + } + remoteCryptoKey, err := hex.DecodeString(ipSecLink.RemoteCryptoKey) + if err != nil { + return 0, err + } + localIntegKey, err := hex.DecodeString(ipSecLink.LocalIntegKey) + if err != nil { + return 0, err + } + remoteIntegKey, err := hex.DecodeString(ipSecLink.RemoteIntegKey) + if err != nil { + return 0, err + } + + localIP, err := ipToIPSecAddress(ipSecLink.LocalIp) + if err != nil { + return 0, err + } + remoteIP, err := ipToIPSecAddress(ipSecLink.RemoteIp) + if err != nil { + return 0, err + } + + req := &api.IpsecTunnelIfAddDel{ + IsAdd: boolToUint(isAdd), + Esn: boolToUint(ipSecLink.Esn), + AntiReplay: boolToUint(ipSecLink.AntiReplay), + LocalIP: localIP, + RemoteIP: remoteIP, + LocalSpi: ipSecLink.LocalSpi, + RemoteSpi: ipSecLink.RemoteSpi, + CryptoAlg: uint8(ipSecLink.CryptoAlg), + LocalCryptoKey: localCryptoKey, + LocalCryptoKeyLen: uint8(len(localCryptoKey)), + RemoteCryptoKey: remoteCryptoKey, + RemoteCryptoKeyLen: uint8(len(remoteCryptoKey)), + IntegAlg: uint8(ipSecLink.IntegAlg), + LocalIntegKey: localIntegKey, + LocalIntegKeyLen: uint8(len(localIntegKey)), + RemoteIntegKey: remoteIntegKey, + RemoteIntegKeyLen: uint8(len(remoteIntegKey)), + UDPEncap: boolToUint(ipSecLink.EnableUdpEncap), + } + reply := &api.IpsecTunnelIfAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, nil +} + +func ipToIPSecAddress(ipstr string) (addr api.Address, err error) { + netIP := net.ParseIP(ipstr) + if netIP == nil { + return api.Address{}, fmt.Errorf("invalid IP: %q", ipstr) + } + if ip4 := netIP.To4(); ip4 == nil { + addr.Af = api.ADDRESS_IP6 + var ip6addr api.IP6Address + copy(ip6addr[:], netIP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = api.ADDRESS_IP4 + var ip4addr api.IP4Address + copy(ip4addr[:], ip4) + addr.Un.SetIP4(ip4addr) + } + return +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go new file mode 100644 index 0000000000..7646de800b --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go @@ -0,0 +1,134 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "encoding/hex" + "testing" + + . "github.com/onsi/gomega" + + "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" +) + +func TestAddIPSecTunnelInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&ipsec.IpsecTunnelIfAddDelReply{ + SwIfIndex: 2, + }) + + index, err := ifHandler.AddIPSecTunnelInterface("if1", &vpp_interfaces.IPSecLink{ + Esn: true, + AntiReplay: true, + LocalIp: "10.10.0.1", + RemoteIp: "10.10.0.2", + LocalSpi: 1500, + RemoteSpi: 2000, + CryptoAlg: 9, + LocalCryptoKey: "4a506a794f574265564551694d653768", + RemoteCryptoKey: "9a506a794f574265564551694d653456", + IntegAlg: 4, + LocalIntegKey: "3a506a794f574265564551694d653769", + RemoteIntegKey: "8a506a794f574265564551694d653457", + EnableUdpEncap: true, + }) + Expect(err).To(BeNil()) + Expect(index).To(Equal(uint32(2))) + + vppMsg, ok := ctx.MockChannel.Msg.(*ipsec.IpsecTunnelIfAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg).ToNot(BeNil()) + localCryptoKey, err := hex.DecodeString("4a506a794f574265564551694d653768") + Expect(err).To(BeNil()) + remoteCryptoKey, err := hex.DecodeString("9a506a794f574265564551694d653456") + Expect(err).To(BeNil()) + localIntegKey, err := hex.DecodeString("3a506a794f574265564551694d653769") + Expect(err).To(BeNil()) + remoteIntegKey, err := hex.DecodeString("8a506a794f574265564551694d653457") + Expect(err).To(BeNil()) + + Expect(vppMsg.Esn).To(Equal(uint8(1))) + Expect(vppMsg.IsAdd).To(Equal(uint8(1))) + Expect(vppMsg.AntiReplay).To(Equal(uint8(1))) + Expect(vppMsg.LocalIP.Af).To(Equal(ipsec.AddressFamily(0))) + Expect(vppMsg.LocalIP.Un).To(BeEquivalentTo(ipsec.AddressUnion{XXX_UnionData: [16]byte{10, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}})) + Expect(vppMsg.LocalSpi).To(Equal(uint32(1500))) + Expect(vppMsg.RemoteSpi).To(Equal(uint32(2000))) + Expect(vppMsg.CryptoAlg).To(Equal(uint8(9))) + Expect(vppMsg.LocalCryptoKey).To(BeEquivalentTo(localCryptoKey)) + Expect(vppMsg.LocalCryptoKeyLen).To(Equal(uint8(16))) + Expect(vppMsg.RemoteCryptoKey).To(BeEquivalentTo(remoteCryptoKey)) + Expect(vppMsg.RemoteCryptoKeyLen).To(Equal(uint8(16))) + Expect(vppMsg.IntegAlg).To(Equal(uint8(4))) + Expect(vppMsg.LocalIntegKey).To(BeEquivalentTo(localIntegKey)) + Expect(vppMsg.LocalIntegKeyLen).To(Equal(uint8(16))) + Expect(vppMsg.RemoteIntegKey).To(BeEquivalentTo(remoteIntegKey)) + Expect(vppMsg.RemoteIntegKeyLen).To(Equal(uint8(16))) + Expect(vppMsg.UDPEncap).To(Equal(uint8(1))) +} + +func TestAddIPSecTunnelInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&ipsec.IpsecTunnelIfAddDelReply{ + SwIfIndex: 2, + Retval: 9, + }) + + index, err := ifHandler.AddIPSecTunnelInterface("if1", &vpp_interfaces.IPSecLink{ + Esn: true, + LocalIp: "10.10.0.1", + LocalCryptoKey: "4a506a794f574265564551694d653768", + }) + Expect(err).ToNot(BeNil()) + Expect(index).To(Equal(uint32(0))) +} + +func TestDeleteIPSecTunnelInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&ipsec.IpsecTunnelIfAddDelReply{ + SwIfIndex: 2, + }) + + err := ifHandler.DeleteIPSecTunnelInterface("if1", &vpp_interfaces.IPSecLink{ + Esn: true, + LocalIp: "10.10.0.1", + RemoteIp: "10.10.0.2", + LocalCryptoKey: "4a506a794f574265564551694d653768", + RemoteCryptoKey: "9a506a794f574265564551694d653456", + }) + + Expect(err).To(BeNil()) +} + +func TestDeleteIPSecTunnelInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&ipsec.IpsecTunnelIfAddDelReply{ + SwIfIndex: 2, + Retval: 9, + }) + + err := ifHandler.DeleteIPSecTunnelInterface("if1", &vpp_interfaces.IPSecLink{ + Esn: true, + LocalIp: "10.10.0.1", + LocalCryptoKey: "4a506a794f574265564551694d653768", + }) + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/l2_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/l2_vppcalls.go new file mode 100644 index 0000000000..9b67f545ad --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/l2_vppcalls.go @@ -0,0 +1,64 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// TODO: more suitable for the l2 plugin, but the tag-rewrite retrieve is a part of the vpp interface api + +// SetInterfaceTagRewrite sets an interface tag rewrite +func (h *InterfaceVppHandler) SetVLanTagRewrite(ifIdx uint32, subIf *interfaces.SubInterface) error { + req := &l2.L2InterfaceVlanTagRewrite{ + SwIfIndex: ifIdx, + VtrOp: getTagRewriteOption(subIf.TagRwOption), + PushDot1q: uint32(boolToUint(subIf.PushDot1Q)), + Tag1: subIf.Tag1, + Tag2: subIf.Tag2, + } + reply := &l2.L2InterfaceVlanTagRewriteReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("%s returned error: %v", reply.GetMessageName(), err) + } + + return nil +} + +func getTagRewriteOption(op interfaces.SubInterface_TagRewriteOptions) uint32 { + switch op { + case interfaces.SubInterface_PUSH1: + return 1 + case interfaces.SubInterface_PUSH2: + return 2 + case interfaces.SubInterface_POP1: + return 3 + case interfaces.SubInterface_POP2: + return 4 + case interfaces.SubInterface_TRANSLATE11: + return 5 + case interfaces.SubInterface_TRANSLATE12: + return 6 + case interfaces.SubInterface_TRANSLATE21: + return 7 + case interfaces.SubInterface_TRANSLATE22: + return 8 + default: // disabled + return 0 + } +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls.go new file mode 100644 index 0000000000..0731aff368 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls.go @@ -0,0 +1,46 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// AddLoopbackInterface implements interface handler. +func (h *InterfaceVppHandler) AddLoopbackInterface(ifName string) (swIndex uint32, err error) { + req := &interfaces.CreateLoopback{} + reply := &interfaces.CreateLoopbackReply{} + + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, h.SetInterfaceTag(ifName, reply.SwIfIndex) +} + +// DeleteLoopbackInterface implements interface handler. +func (h *InterfaceVppHandler) DeleteLoopbackInterface(ifName string, idx uint32) error { + // Prepare the message. + req := &interfaces.DeleteLoopback{ + SwIfIndex: idx, + } + reply := &interfaces.DeleteLoopbackReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return h.RemoveInterfaceTag(ifName, idx) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls_test.go new file mode 100644 index 0000000000..8e7f5f0742 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/loopback_vppcalls_test.go @@ -0,0 +1,99 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestAddLoopbackInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.CreateLoopbackReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddLoopbackInterface("loopback") + + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) +} + +func TestAddLoopbackInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.CreateLoopback{}) + + swIfIdx, err := ifHandler.AddLoopbackInterface("loopback") + + Expect(err).ToNot(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(0)) +} + +func TestAddLoopbackInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.CreateLoopbackReply{ + Retval: 1, + }) + + swIfIdx, err := ifHandler.AddLoopbackInterface("loopback") + + Expect(err).ToNot(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(0)) +} + +func TestDeleteLoopbackInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.DeleteLoopbackReply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteLoopbackInterface("loopback", 1) + + Expect(err).To(BeNil()) +} + +func TestDeleteLoopbackInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.DeleteLoopback{}) + + err := ifHandler.DeleteLoopbackInterface("loopback", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteLoopbackInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.DeleteLoopbackReply{ + Retval: 1, + }) + + err := ifHandler.DeleteLoopbackInterface("loopback", 1) + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls.go new file mode 100644 index 0000000000..39d065dbbc --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls.go @@ -0,0 +1,41 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// SetInterfaceMac implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceMac(ifIdx uint32, macAddress string) error { + mac, err := net.ParseMAC(macAddress) + if err != nil { + return err + } + + req := &interfaces.SwInterfaceSetMacAddress{ + SwIfIndex: ifIdx, + MacAddress: mac, + } + reply := &interfaces.SwInterfaceSetMacAddressReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls_test.go new file mode 100644 index 0000000000..2756044169 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/mac_vppcalls_test.go @@ -0,0 +1,74 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "net" + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestSetInterfaceMac(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetMacAddressReply{}) + + mac, _ := net.ParseMAC("65:77:BF:72:C9:8D") + err := ifHandler.SetInterfaceMac(1, "65:77:BF:72:C9:8D") + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetMacAddress) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.MacAddress).To(BeEquivalentTo(mac)) +} + +func TestSetInterfaceInvalidMac(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetMacAddress{}) + + err := ifHandler.SetInterfaceMac(1, "invalid-mac") + + Expect(err).ToNot(BeNil()) +} + +func TestSetInterfaceMacError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetMacAddress{}) + + err := ifHandler.SetInterfaceMac(1, "65:77:BF:72:C9:8D") + + Expect(err).ToNot(BeNil()) +} + +func TestSetInterfaceMacRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetMacAddressReply{ + Retval: 1, + }) + + err := ifHandler.SetInterfaceMac(1, "65:77:BF:72:C9:8D") + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls.go new file mode 100644 index 0000000000..adb65526d6 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls.go @@ -0,0 +1,83 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memif" +) + +// AddMemifInterface implements interface handler. +func (h *InterfaceVppHandler) AddMemifInterface(ifName string, memIface *interfaces.MemifLink, socketID uint32) (swIdx uint32, err error) { + req := &memif.MemifCreate{ + ID: memIface.Id, + Mode: uint8(memIface.Mode), + Secret: []byte(memIface.Secret), + SocketID: socketID, + BufferSize: uint16(memIface.BufferSize), + RingSize: memIface.RingSize, + RxQueues: uint8(memIface.RxQueues), + TxQueues: uint8(memIface.TxQueues), + } + if memIface.Master { + req.Role = 0 + } else { + req.Role = 1 + } + // TODO: temporary fix, waiting for https://gerrit.fd.io/r/#/c/7266/ + if req.RxQueues == 0 { + req.RxQueues = 1 + } + if req.TxQueues == 0 { + req.TxQueues = 1 + } + reply := &memif.MemifCreateReply{} + + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, h.SetInterfaceTag(ifName, reply.SwIfIndex) +} + +// DeleteMemifInterface implements interface handler. +func (h *InterfaceVppHandler) DeleteMemifInterface(ifName string, idx uint32) error { + req := &memif.MemifDelete{ + SwIfIndex: idx, + } + reply := &memif.MemifDeleteReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return h.RemoveInterfaceTag(ifName, idx) +} + +// RegisterMemifSocketFilename implements interface handler. +func (h *InterfaceVppHandler) RegisterMemifSocketFilename(filename []byte, id uint32) error { + req := &memif.MemifSocketFilenameAddDel{ + SocketFilename: filename, + SocketID: id, + IsAdd: 1, // sockets can be added only + } + reply := &memif.MemifSocketFilenameAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls_test.go new file mode 100644 index 0000000000..19d7a366e2 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/memif_vppcalls_test.go @@ -0,0 +1,201 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + ifModel "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memif" + . "github.com/onsi/gomega" +) + +func TestAddMasterMemifInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifCreateReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddMemifInterface("memif", &ifModel.MemifLink{ + Id: 1, + Mode: ifModel.MemifLink_IP, + Secret: "secret", + Master: true, + }, 5) + + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*memif.MemifCreate) + if ok { + Expect(vppMsg.ID).To(BeEquivalentTo(1)) + Expect(vppMsg.Mode).To(BeEquivalentTo(1)) + Expect(vppMsg.Role).To(BeEquivalentTo(0)) + Expect(vppMsg.SocketID).To(BeEquivalentTo(5)) + Expect(vppMsg.RxQueues).To(BeEquivalentTo(1)) + Expect(vppMsg.TxQueues).To(BeEquivalentTo(1)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddMasterMemifInterfaceAsSlave(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifCreateReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddMemifInterface("memif", &ifModel.MemifLink{ + Id: 1, + Mode: ifModel.MemifLink_IP, + Secret: "secret", + Master: false, + }, 5) + + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*memif.MemifCreate) + if ok { + Expect(vppMsg.Role).To(BeEquivalentTo(1)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddMasterMemifInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifCreate{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddMemifInterface("memif", &ifModel.MemifLink{ + Id: 1, + Mode: ifModel.MemifLink_IP, + Secret: "secret", + Master: false, + }, 5) + + Expect(err).ToNot(BeNil()) +} + +func TestAddMasterMemifInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifCreateReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddMemifInterface("memif", &ifModel.MemifLink{ + Id: 1, + Mode: ifModel.MemifLink_IP, + Secret: "secret", + Master: false, + }, 5) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteMemifInterface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifDeleteReply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteMemifInterface("memif", 1) + + Expect(err).To(BeNil()) +} + +func TestDeleteMemifInterfaceError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifDelete{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteMemifInterface("memif", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestDeleteMemifInterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifDeleteReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteMemifInterface("memif", 1) + + Expect(err).ToNot(BeNil()) +} + +func TestRegisterMemifSocketFilename(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifSocketFilenameAddDelReply{}) + + err := ifHandler.RegisterMemifSocketFilename([]byte("filename"), 1) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*memif.MemifSocketFilenameAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.SocketID).To(BeEquivalentTo(1)) + Expect(vppMsg.SocketFilename).To(BeEquivalentTo([]byte("filename"))) +} + +func TestRegisterMemifSocketFilenameError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifSocketFilenameAddDel{}) + + err := ifHandler.RegisterMemifSocketFilename([]byte("filename"), 1) + + Expect(err).ToNot(BeNil()) +} + +func TestRegisterMemifSocketFilenameRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&memif.MemifSocketFilenameAddDelReply{ + Retval: 1, + }) + + err := ifHandler.RegisterMemifSocketFilename([]byte("filename"), 1) + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls.go new file mode 100644 index 0000000000..fdfe0f69e5 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls.go @@ -0,0 +1,34 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// SetInterfaceMtu implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceMtu(ifIdx uint32, mtu uint32) error { + req := &interfaces.HwInterfaceSetMtu{ + SwIfIndex: ifIdx, + Mtu: uint16(mtu), + } + reply := &interfaces.HwInterfaceSetMtuReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls_test.go new file mode 100644 index 0000000000..8bf2be00bc --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/mtu_vppcalls_test.go @@ -0,0 +1,61 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestSetInterfaceMtu(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{}) + + err := ifHandler.SetInterfaceMtu(1, 1500) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.HwInterfaceSetMtu) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Mtu).To(BeEquivalentTo(1500)) +} + +func TestSetInterfaceMtuError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtu{}) + + err := ifHandler.SetInterfaceMtu(1, 1500) + + Expect(err).ToNot(BeNil()) +} + +func TestSetInterfaceMtuRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.HwInterfaceSetMtuReply{ + Retval: 1, + }) + + err := ifHandler.SetInterfaceMtu(1, 1500) + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls.go new file mode 100644 index 0000000000..7c320f8fc2 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls.go @@ -0,0 +1,38 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// SetRxMode implements interface handler. +func (h *InterfaceVppHandler) SetRxMode(ifIdx uint32,rxMode *interfaces.Interface_RxMode) error { + + req := &binapi_interface.SwInterfaceSetRxMode{ + SwIfIndex: ifIdx, + Mode: uint8(rxMode.Mode), + QueueID: rxMode.Queue, + QueueIDValid: boolToUint(!rxMode.DefaultMode), + } + reply := &binapi_interface.SwInterfaceSetRxModeReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls_test.go new file mode 100644 index 0000000000..be5e38f96f --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_mode_vppcalls_test.go @@ -0,0 +1,98 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + ifModel "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestSetRxMode(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) + + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetRxMode) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Mode).To(BeEquivalentTo(4)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(1)) +} + +func TestSetRxModeError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxMode{}) + + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, + }) + + Expect(err).ToNot(BeNil()) +} + +func TestSetRxModeRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{ + Retval: 1, + }) + + err := ifHandler.SetRxMode(1, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_DEFAULT, + Queue: 1, + DefaultMode: false, + }) + + Expect(err).ToNot(BeNil()) +} + + +func TestSetDefaultRxMode(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetRxModeReply{}) + + err := ifHandler.SetRxMode(5, &ifModel.Interface_RxMode{ + Mode: ifModel.Interface_RxMode_POLLING, + Queue: 10, // ignored on the VPP side + DefaultMode: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetRxMode) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(5)) + Expect(vppMsg.Mode).To(BeEquivalentTo(1)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(10)) + Expect(vppMsg.QueueIDValid).To(BeEquivalentTo(0)) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls.go new file mode 100644 index 0000000000..c5a171e669 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls.go @@ -0,0 +1,37 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + binapi_interface "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" +) + +// SetRxPlacement implements interface handler. +func (h *InterfaceVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacement) error { + req := &binapi_interface.SwInterfaceSetRxPlacement{ + SwIfIndex: ifIdx, + QueueID: rxPlacement.Queue, + WorkerID: rxPlacement.Worker, + IsMain: boolToUint(rxPlacement.MainThread), + } + reply := &binapi_interface.SwInterfaceSetRxPlacementReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls_test.go new file mode 100644 index 0000000000..e2965f987a --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/rx_placement_vppcalls_test.go @@ -0,0 +1,98 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + ifApi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + . "github.com/onsi/gomega" +) + +func TestSetRxPlacementForWorker(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) + + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(1)) + Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) + Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(0))) +} + +func TestSetRxPlacementForMainThread(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{}) + + err := ifHandler.SetRxPlacement(3, &interfaces.Interface_RxPlacement{ + Queue: 6, + Worker: 2, // ignored on the VPP side + MainThread: true, + }) + + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*ifApi.SwInterfaceSetRxPlacement) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(3)) + Expect(vppMsg.QueueID).To(BeEquivalentTo(6)) + Expect(vppMsg.WorkerID).To(BeEquivalentTo(uint32(2))) + Expect(vppMsg.IsMain).To(BeEquivalentTo(uint32(1))) +} + +func TestSetRxPlacementRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacementReply{ + Retval: 1, + }) + + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, + }) + + Expect(err).ToNot(BeNil()) +} + +func TestSetRxPlacementError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ifApi.SwInterfaceSetRxPlacement{}) + + err := ifHandler.SetRxPlacement(1, &interfaces.Interface_RxPlacement{ + Queue: 1, + Worker: 2, + MainThread: false, + }) + + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls.go new file mode 100644 index 0000000000..3681a23b98 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls.go @@ -0,0 +1,48 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// CreateSubif creates sub interface. +func (h *InterfaceVppHandler) CreateSubif(ifIdx, vlanID uint32) (uint32, error) { + req := &interfaces.CreateVlanSubif{ + SwIfIndex: ifIdx, + VlanID: vlanID, + } + + reply := &interfaces.CreateVlanSubifReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, nil +} + +// DeleteSubif deletes sub interface. +func (h *InterfaceVppHandler) DeleteSubif(ifIdx uint32) error { + req := &interfaces.DeleteSubif{ + SwIfIndex: ifIdx, + } + + reply := &interfaces.DeleteSubifReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls_test.go new file mode 100644 index 0000000000..c5ae76b657 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/subif_vppcalls_test.go @@ -0,0 +1,74 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestCreateSubif(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&interfaces.CreateVlanSubifReply{ + SwIfIndex: 2, + }) + swifindex, err := ifHandler.CreateSubif(5, 32) + Expect(err).To(BeNil()) + Expect(swifindex).To(Equal(uint32(2))) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.CreateVlanSubif) + Expect(ok).To(BeTrue()) + Expect(vppMsg).ToNot(BeNil()) + Expect(vppMsg.SwIfIndex).To(Equal(uint32(5))) + Expect(vppMsg.VlanID).To(Equal(uint32(32))) +} + +func TestCreateSubifError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&interfaces.CreateVlanSubifReply{ + SwIfIndex: 2, + Retval: 9, + }) + swifindex, err := ifHandler.CreateSubif(5, 32) + Expect(err).ToNot(BeNil()) + Expect(swifindex).To(Equal(uint32(0))) +} + +func TestDeleteSubif(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&interfaces.DeleteSubifReply{ + Retval: 2, + }) + err := ifHandler.DeleteSubif(5) + Expect(err).ToNot(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.DeleteSubif) + Expect(ok).To(BeTrue()) + Expect(vppMsg).ToNot(BeNil()) + Expect(vppMsg.SwIfIndex).To(Equal(uint32(5))) +} + +func TestDeleteSubifError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&interfaces.DeleteSubifReply{ + Retval: 2, + }) + err := ifHandler.DeleteSubif(5) + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls.go new file mode 100644 index 0000000000..4a58a295c9 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "errors" + "fmt" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/tapv2" +) + +// TapFlags definitions from https://github.com/FDio/vpp/blob/stable/1908/src/vnet/devices/tap/tap.h#L33 +const ( + TapFlagGSO uint32 = 1 << iota +) + +// AddTapInterface implements interface handler. +func (h *InterfaceVppHandler) AddTapInterface(ifName string, tapIf *interfaces.TapLink) (swIfIdx uint32, err error) { + if tapIf == nil || tapIf.HostIfName == "" { + return 0, errors.New("host interface name was not provided for the TAP interface") + } + + if tapIf.Version == 1 { + return 0, errors.New("tap version 1 has been deprecated") + } else if tapIf.Version == 2 { + var flags uint32 + if tapIf.EnableGso { + flags |= TapFlagGSO + } + + // Configure fast virtio-based TAP interface + req := &tapv2.TapCreateV2{ + ID: ^uint32(0), + HostIfName: []byte(tapIf.HostIfName), + HostIfNameSet: 1, + UseRandomMac: 1, + RxRingSz: uint16(tapIf.RxRingSize), + TxRingSz: uint16(tapIf.TxRingSize), + TapFlags: flags, + } + + reply := &tapv2.TapCreateV2Reply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + swIfIdx = reply.SwIfIndex + } else { + return 0, fmt.Errorf("invalid tap version (%v)", tapIf.Version) + } + + return swIfIdx, h.SetInterfaceTag(ifName, swIfIdx) +} + +// DeleteTapInterface implements interface handler. +func (h *InterfaceVppHandler) DeleteTapInterface(ifName string, idx uint32, version uint32) error { + if version == 1 { + return errors.New("tap version 1 has been deprecated") + } else if version == 2 { + req := &tapv2.TapDeleteV2{ + SwIfIndex: idx, + } + + reply := &tapv2.TapDeleteV2Reply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + } else { + return fmt.Errorf("invalid tap version (%v)", version) + } + + return h.RemoveInterfaceTag(ifName, idx) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls_test.go new file mode 100644 index 0000000000..e3c5b4ceb1 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/tap_vppcalls_test.go @@ -0,0 +1,73 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + ifModel "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/tapv2" + . "github.com/onsi/gomega" +) + +func TestAddTapInterfaceV2(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&tapv2.TapCreateV2Reply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddTapInterface("tapIf", &ifModel.TapLink{ + Version: 2, + HostIfName: "hostIf", + RxRingSize: 1, + TxRingSize: 1, + }) + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*tapv2.TapCreateV2) + if ok { + Expect(vppMsg.UseRandomMac).To(BeEquivalentTo(1)) + Expect(vppMsg.HostIfName).To(BeEquivalentTo([]byte("hostIf"))) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestDeleteTapInterfaceV2(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&tapv2.TapDeleteV2Reply{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteTapInterface("tapIf", 1, 2) + Expect(err).To(BeNil()) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*tapv2.TapDeleteV2) + if ok { + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls.go new file mode 100644 index 0000000000..821c17f8b3 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + + "github.com/pkg/errors" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vmxnet3" +) + +// AddVmxNet3 implements interface handler +func (h *InterfaceVppHandler) AddVmxNet3(ifName string, vmxNet3 *interfaces.VmxNet3Link) (swIdx uint32, err error) { + var pci uint32 + pci, err = derivePCI(ifName) + if err != nil { + return 0, err + } + + req := &vmxnet3.Vmxnet3Create{ + PciAddr: pci, + } + // Optional arguments + if vmxNet3 != nil { + req.EnableElog = int32(boolToUint(vmxNet3.EnableElog)) + req.RxqSize = uint16(vmxNet3.RxqSize) + req.TxqSize = uint16(vmxNet3.TxqSize) + } + + reply := &vmxnet3.Vmxnet3CreateReply{} + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, errors.Errorf(err.Error()) + } + + return reply.SwIfIndex, h.SetInterfaceTag(ifName, reply.SwIfIndex) +} + +// DeleteVmxNet3 implements interface handler +func (h *InterfaceVppHandler) DeleteVmxNet3(ifName string, ifIdx uint32) error { + req := &vmxnet3.Vmxnet3Delete{ + SwIfIndex: ifIdx, + } + reply := &vmxnet3.Vmxnet3DeleteReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return errors.Errorf(err.Error()) + } + + return h.RemoveInterfaceTag(ifName, ifIdx) +} + +func derivePCI(ifName string) (uint32, error) { + var function, slot, bus, domain, pci uint32 + + numLen, err := fmt.Sscanf(ifName, "vmxnet3-%x/%x/%x/%x", &domain, &bus, &slot, &function) + if err != nil { + err = errors.Errorf("cannot parse PCI address from the vmxnet3 interface name %s: %v", ifName, err) + return 0, err + } + if numLen != 4 { + err = errors.Errorf("cannot parse PCI address from the interface name %s: expected 4 address elements, received %d", + ifName, numLen) + return 0, err + } + + pci |= function << 29 + pci |= slot << 24 + pci |= bus << 16 + pci |= domain + + return pci, nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls_test.go new file mode 100644 index 0000000000..dbe09ce5a5 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vmxnet3_vppcalls_test.go @@ -0,0 +1,114 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + ifModel "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vmxnet3" + . "github.com/onsi/gomega" +) + +func TestAddVmxNet3Interface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vmxnet3.Vmxnet3CreateReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddVmxNet3("vmxnet3-face/be/1c/4", &ifModel.VmxNet3Link{ + EnableElog: true, + RxqSize: 2048, + TxqSize: 512, + }) + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*vmxnet3.Vmxnet3Create) + if ok { + Expect(vppMsg.PciAddr).To(BeEquivalentTo(2629761742)) + Expect(vppMsg.EnableElog).To(BeEquivalentTo(1)) + Expect(vppMsg.RxqSize).To(BeEquivalentTo(2048)) + Expect(vppMsg.TxqSize).To(BeEquivalentTo(512)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddVmxNet3InterfacePCIErr(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vmxnet3.Vmxnet3CreateReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + // Name in incorrect format + _, err := ifHandler.AddVmxNet3("vmxnet3-a/14/19", nil) + Expect(err).ToNot(BeNil()) +} + +func TestAddVmxNet3InterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vmxnet3.Vmxnet3CreateReply{ + Retval: 1, + }) + + _, err := ifHandler.AddVmxNet3("vmxnet3-a/14/19/1e", nil) + Expect(err).ToNot(BeNil()) +} + +func TestDelVmxNet3Interface(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vmxnet3.Vmxnet3DeleteReply{ + Retval: 0, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteVmxNet3("vmxnet3-a/14/19/1e", 1) + Expect(err).To(BeNil()) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*vmxnet3.Vmxnet3Delete) + if ok { + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestDelVmxNet3InterfaceRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vmxnet3.Vmxnet3DeleteReply{ + Retval: 1, + }) + + err := ifHandler.DeleteVmxNet3("vmxnet3-a/14/19/1e", 1) + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vppcalls_handler.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vppcalls_handler.go new file mode 100644 index 0000000000..a68298750e --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vppcalls_handler.go @@ -0,0 +1,88 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/af_packet" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/bond" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/memif" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/tapv2" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vmxnet3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vxlan" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, af_packet.AllMessages()...) + msgs = append(msgs, bond.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) + msgs = append(msgs, interfaces.AllMessages()...) + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, ipsec.AllMessages()...) + msgs = append(msgs, l2.AllMessages()...) + msgs = append(msgs, memif.AllMessages()...) + msgs = append(msgs, tapv2.AllMessages()...) + msgs = append(msgs, vmxnet3.AllMessages()...) + msgs = append(msgs, vxlan.AllMessages()...) + + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, log logging.Logger) vppcalls.InterfaceVppAPI { + return NewInterfaceVppHandler(ch, log) + }, + } +} + +// InterfaceVppHandler is accessor for interface-related vppcalls methods +type InterfaceVppHandler struct { + callsChannel govppapi.Channel + log logging.Logger +} + +// NewInterfaceVppHandler returns new InterfaceVppHandler. +func NewInterfaceVppHandler(ch govppapi.Channel, log logging.Logger) *InterfaceVppHandler { + return &InterfaceVppHandler{ch, log} +} + +func IPToAddress(ipstr string) (addr ip.Address, err error) { + netIP := net.ParseIP(ipstr) + if netIP == nil { + return ip.Address{}, fmt.Errorf("invalid IP: %q", ipstr) + } + if ip4 := netIP.To4(); ip4 == nil { + addr.Af = ip.ADDRESS_IP6 + var ip6addr ip.IP6Address + copy(ip6addr[:], netIP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = ip.ADDRESS_IP4 + var ip4addr ip.IP4Address + copy(ip4addr[:], ip4) + addr.Un.SetIP4(ip4addr) + } + return +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls.go new file mode 100644 index 0000000000..ea0fd99123 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls.go @@ -0,0 +1,72 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" +) + +// SetInterfaceVrf implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceVrf(ifIdx, vrfID uint32) error { + return h.setInterfaceVrf(ifIdx, vrfID, false) +} + +// SetInterfaceVrfIPv6 implements interface handler. +func (h *InterfaceVppHandler) SetInterfaceVrfIPv6(ifIdx, vrfID uint32) error { + return h.setInterfaceVrf(ifIdx, vrfID, true) +} + +// GetInterfaceVrf implements interface handler. +func (h *InterfaceVppHandler) GetInterfaceVrf(ifIdx uint32) (vrfID uint32, err error) { + return h.getInterfaceVrf(ifIdx, false) +} + +// GetInterfaceVrfIPv6 implements interface handler. +func (h *InterfaceVppHandler) GetInterfaceVrfIPv6(ifIdx uint32) (vrfID uint32, err error) { + return h.getInterfaceVrf(ifIdx, true) +} + +// Interface is set to VRF table. Table IP version has to be defined. +func (h *InterfaceVppHandler) setInterfaceVrf(ifIdx, vrfID uint32, isIPv6 bool) error { + req := &interfaces.SwInterfaceSetTable{ + SwIfIndex: ifIdx, + VrfID: vrfID, + IsIPv6: boolToUint(isIPv6), + } + reply := &interfaces.SwInterfaceSetTableReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + h.log.Debugf("Interface %d set to VRF %d", ifIdx, vrfID) + + return nil +} + +// Returns VRF ID for provided interface. +func (h *InterfaceVppHandler) getInterfaceVrf(ifIdx uint32, isIPv6 bool) (vrfID uint32, err error) { + req := &interfaces.SwInterfaceGetTable{ + SwIfIndex: ifIdx, + IsIPv6: boolToUint(isIPv6), + } + reply := &interfaces.SwInterfaceGetTableReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.VrfID, nil +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls_test.go new file mode 100644 index 0000000000..0b8811e1d2 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vrf_vppcalls_test.go @@ -0,0 +1,121 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + . "github.com/onsi/gomega" +) + +func TestGetInterfaceVRF(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceGetTableReply{ + VrfID: 1, + }) + + vrfID, err := ifHandler.GetInterfaceVrf(1) + Expect(err).To(BeNil()) + Expect(vrfID).To(BeEquivalentTo(1)) +} + +func TestGetInterfaceIPv6VRF(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceGetTableReply{ + VrfID: 1, + }) + + vrfID, err := ifHandler.GetInterfaceVrfIPv6(1) + Expect(err).To(BeNil()) + Expect(vrfID).To(BeEquivalentTo(1)) +} + +func TestGetInterfaceVRFError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceGetTable{}) + + _, err := ifHandler.GetInterfaceVrf(1) + Expect(err).ToNot(BeNil()) +} + +func TestGetInterfaceVRFRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceGetTableReply{ + Retval: 1, + }) + + _, err := ifHandler.GetInterfaceVrf(1) + Expect(err).ToNot(BeNil()) +} + +func TestSetInterfaceVRF(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetTableReply{}) + + err := ifHandler.SetInterfaceVrf(1, 2) + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetTable) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.VrfID).To(BeEquivalentTo(2)) +} + +func TestSetInterfaceIPv6VRF(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetTableReply{}) + + err := ifHandler.SetInterfaceVrfIPv6(1, 2) + Expect(err).To(BeNil()) + vppMsg, ok := ctx.MockChannel.Msg.(*interfaces.SwInterfaceSetTable) + Expect(ok).To(BeTrue()) + Expect(vppMsg.SwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.VrfID).To(BeEquivalentTo(2)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) +} + +func TestSetInterfaceVRFError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetTable{}) + + err := ifHandler.SetInterfaceVrf(1, 2) + Expect(err).To(HaveOccurred()) +} + +func TestSetInterfaceVRFRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&interfaces.SwInterfaceSetTableReply{ + Retval: 1, + }) + + err := ifHandler.SetInterfaceVrf(1, 2) + Expect(err).ToNot(BeNil()) +} \ No newline at end of file diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls.go new file mode 100644 index 0000000000..42419c93a9 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls.go @@ -0,0 +1,75 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vxlan" +) + +func (h *InterfaceVppHandler) addDelVxLanTunnel(vxLan *interfaces.VxlanLink, vrf, multicastIf uint32, isAdd bool) (swIdx uint32, err error) { + req := &vxlan.VxlanAddDelTunnel{ + IsAdd: boolToUint(isAdd), + Vni: vxLan.Vni, + DecapNextIndex: 0xFFFFFFFF, + Instance: ^uint32(0), + EncapVrfID: vrf, + McastSwIfIndex: multicastIf, + } + + srcAddr := net.ParseIP(vxLan.SrcAddress).To4() + dstAddr := net.ParseIP(vxLan.DstAddress).To4() + if srcAddr == nil && dstAddr == nil { + srcAddr = net.ParseIP(vxLan.SrcAddress).To16() + dstAddr = net.ParseIP(vxLan.DstAddress).To16() + req.IsIPv6 = 1 + if srcAddr == nil || dstAddr == nil { + return 0, fmt.Errorf("invalid VXLAN address, src: %s, dst: %s", srcAddr, dstAddr) + } + } else if srcAddr == nil && dstAddr != nil || srcAddr != nil && dstAddr == nil { + return 0, fmt.Errorf("IP version mismatch for VXLAN destination and source IP addresses") + } + + req.SrcAddress = []byte(srcAddr) + req.DstAddress = []byte(dstAddr) + + reply := &vxlan.VxlanAddDelTunnelReply{} + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return 0, err + } + + return reply.SwIfIndex, nil +} + +// AddVxLanTunnel implements VxLan handler. +func (h *InterfaceVppHandler) AddVxLanTunnel(ifName string, vrf, multicastIf uint32, vxLan *interfaces.VxlanLink) (swIndex uint32, err error) { + swIfIdx, err := h.addDelVxLanTunnel(vxLan, vrf, multicastIf, true) + if err != nil { + return 0, err + } + return swIfIdx, h.SetInterfaceTag(ifName, swIfIdx) +} + +// DeleteVxLanTunnel implements VxLan handler. +func (h *InterfaceVppHandler) DeleteVxLanTunnel(ifName string, idx, vrf uint32, vxLan *interfaces.VxlanLink) error { + // Multicast does not need to be set + if _, err := h.addDelVxLanTunnel(vxLan, vrf, 0, false); err != nil { + return err + } + return h.RemoveInterfaceTag(ifName, idx) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls_test.go new file mode 100644 index 0000000000..3c5fd06081 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/vxlan_vppcalls_test.go @@ -0,0 +1,236 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "net" + "testing" + + ifModel "github.com/ligato/vpp-agent/api/models/vpp/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vxlan" + . "github.com/onsi/gomega" +) + +func TestAddVxlanTunnel(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddVxLanTunnel("ifName", 0, 2, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.1", + Vni: 1, + }) + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*vxlan.VxlanAddDelTunnel) + if ok { + Expect(vppMsg.SrcAddress).To(BeEquivalentTo(net.ParseIP("10.0.0.1").To4())) + Expect(vppMsg.DstAddress).To(BeEquivalentTo(net.ParseIP("20.0.0.1").To4())) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.EncapVrfID).To(BeEquivalentTo(0)) + Expect(vppMsg.McastSwIfIndex).To(BeEquivalentTo(2)) + Expect(vppMsg.Vni).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(0)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddVxlanTunnelWithVrf(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + // VxLAN resolution + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddVxLanTunnel("ifName", 1, 1, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.1", + Vni: 1, + }) + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*vxlan.VxlanAddDelTunnel) + if ok { + Expect(vppMsg.SrcAddress).To(BeEquivalentTo(net.ParseIP("10.0.0.1").To4())) + Expect(vppMsg.DstAddress).To(BeEquivalentTo(net.ParseIP("20.0.0.1").To4())) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.EncapVrfID).To(BeEquivalentTo(1)) + Expect(vppMsg.McastSwIfIndex).To(BeEquivalentTo(1)) + Expect(vppMsg.Vni).To(BeEquivalentTo(1)) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(0)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddVxlanTunnelIPv6(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + swIfIdx, err := ifHandler.AddVxLanTunnel("ifName", 0, 0, &ifModel.VxlanLink{ + SrcAddress: "2001:db8:0:1:1:1:1:1", + DstAddress: "2002:db8:0:1:1:1:1:1", + Vni: 1, + }) + Expect(err).To(BeNil()) + Expect(swIfIdx).To(BeEquivalentTo(1)) + var msgCheck bool + for _, msg := range ctx.MockChannel.Msgs { + vppMsg, ok := msg.(*vxlan.VxlanAddDelTunnel) + if ok { + Expect(vppMsg.SrcAddress).To(BeEquivalentTo(net.ParseIP("2001:db8:0:1:1:1:1:1").To16())) + Expect(vppMsg.DstAddress).To(BeEquivalentTo(net.ParseIP("2002:db8:0:1:1:1:1:1").To16())) + Expect(vppMsg.IsIPv6).To(BeEquivalentTo(1)) + msgCheck = true + } + } + Expect(msgCheck).To(BeTrue()) +} + +func TestAddVxlanTunnelIPMismatch(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddVxLanTunnel("ifName", 0, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "2001:db8:0:1:1:1:1:1", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} + +func TestAddVxlanTunnelInvalidIP(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddVxLanTunnel("ifName", 0, 0, &ifModel.VxlanLink{ + SrcAddress: "invalid-ip", + DstAddress: "2001:db8:0:1:1:1:1:1", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} + +func TestAddVxlanTunnelError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnel{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddVxLanTunnel("ifName", 0, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.2", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} + +func TestAddVxlanTunnelRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + _, err := ifHandler.AddVxLanTunnel("ifName", 0, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.2", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} + +func TestDeleteVxlanTunnel(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + SwIfIndex: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteVxLanTunnel("ifName", 1, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.1", + Vni: 1, + }) + Expect(err).To(BeNil()) +} + +func TestDeleteVxlanTunnelError(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnel{}) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteVxLanTunnel("ifName", 1, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.1", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} + +func TestDeleteVxlanTunnelRetval(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vxlan.VxlanAddDelTunnelReply{ + Retval: 1, + }) + ctx.MockVpp.MockReply(&interfaces.SwInterfaceTagAddDelReply{}) + + err := ifHandler.DeleteVxLanTunnel("ifName", 1, 0, &ifModel.VxlanLink{ + SrcAddress: "10.0.0.1", + DstAddress: "20.0.0.1", + Vni: 1, + }) + Expect(err).ToNot(BeNil()) +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls.go new file mode 100644 index 0000000000..a625f23e73 --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls.go @@ -0,0 +1,133 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + "fmt" + "net" + "os" + "time" + + govppapi "git.fd.io/govpp.git/api" + "github.com/pkg/errors" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + binapi_interfaces "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" +) + +var InterfaceEventTimeout = time.Second + +func (h *InterfaceVppHandler) WatchInterfaceEvents(events chan<- *vppcalls.InterfaceEvent) error { + notifChan := make(chan govppapi.Message, 10) + + // subscribe for receiving SwInterfaceEvents notifications + vppNotifSubs, err := h.callsChannel.SubscribeNotification(notifChan, &binapi_interfaces.SwInterfaceEvent{}) + if err != nil { + return errors.Errorf("failed to subscribe VPP notification (sw_interface_event): %v", err) + } + _ = vppNotifSubs + + go func() { + for { + select { + case e, ok := <-notifChan: + if !ok { + h.log.Debugf("interface notification channel was closed") + return + } + ifEvent, ok := e.(*binapi_interfaces.SwInterfaceEvent) + if !ok { + continue + } + event := &vppcalls.InterfaceEvent{ + SwIfIndex: ifEvent.SwIfIndex, + AdminState: ifEvent.AdminUpDown, + LinkState: ifEvent.LinkUpDown, + Deleted: ifEvent.Deleted != 0, + } + // send event in goroutine for quick processing + go func() { + select { + case events <- event: + // sent ok + case <-time.After(InterfaceEventTimeout): + h.log.Warnf("unable to deliver interface event, dropping it") + } + }() + } + } + }() + + // enable interface state notifications from VPP + wantIfEventsReply := &binapi_interfaces.WantInterfaceEventsReply{} + err = h.callsChannel.SendRequest(&binapi_interfaces.WantInterfaceEvents{ + PID: uint32(os.Getpid()), + EnableDisable: 1, + }).ReceiveReply(wantIfEventsReply) + if err != nil { + if err == govppapi.VPPApiError(govppapi.INVALID_REGISTRATION) { + h.log.Warnf("already registered for watch interface events: %v", err) + return nil + } + return errors.Errorf("failed to watch interface events: %v", err) + } + + return nil +} + +func (h *InterfaceVppHandler) WatchDHCPLeases(leasesCh chan<- *vppcalls.Lease) error { + notifChan := make(chan govppapi.Message) + + // subscribe for receiving SwInterfaceEvents notifications + vppNotifSubs, err := h.callsChannel.SubscribeNotification(notifChan, &dhcp.DHCPComplEvent{}) + if err != nil { + return errors.Errorf("failed to subscribe VPP notification (sw_interface_event): %v", err) + } + _ = vppNotifSubs + + go func() { + for { + select { + case e := <-notifChan: + dhcpEvent, ok := e.(*dhcp.DHCPComplEvent) + if !ok { + continue + } + lease := dhcpEvent.Lease + var hostAddr, routerAddr string + if uintToBool(lease.IsIPv6) { + hostAddr = fmt.Sprintf("%s/%d", net.IP(lease.HostAddress).To16().String(), uint32(lease.MaskWidth)) + routerAddr = fmt.Sprintf("%s/%d", net.IP(lease.RouterAddress).To16().String(), uint32(lease.MaskWidth)) + } else { + hostAddr = fmt.Sprintf("%s/%d", net.IP(lease.HostAddress[:4]).To4().String(), uint32(lease.MaskWidth)) + routerAddr = fmt.Sprintf("%s/%d", net.IP(lease.RouterAddress[:4]).To4().String(), uint32(lease.MaskWidth)) + } + leasesCh <- &vppcalls.Lease{ + SwIfIndex: lease.SwIfIndex, + State: lease.State, + Hostname: string(bytes.SplitN(lease.Hostname, []byte{0x00}, 2)[0]), + IsIPv6: uintToBool(lease.IsIPv6), + HostAddress: hostAddr, + RouterAddress: routerAddr, + HostMac: net.HardwareAddr(lease.HostMac).String(), + } + } + } + }() + + return nil +} diff --git a/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls_test.go b/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls_test.go new file mode 100644 index 0000000000..baa3630f8c --- /dev/null +++ b/plugins/vpp/ifplugin/vppcalls/vpp1908/watch_vppcalls_test.go @@ -0,0 +1,138 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/interfaces" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" + + . "github.com/onsi/gomega" +) + +func TestWatchInterfaceEvents(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + ctx.MockVpp.MockReply(&interfaces.WantInterfaceEventsReply{}) + eventsChan := make(chan *vppcalls.InterfaceEvent) + err := ifHandler.WatchInterfaceEvents(eventsChan) + notifChan := ctx.MockChannel.GetChannel() + Expect(notifChan).ToNot(BeNil()) + Expect(err).To(BeNil()) + + notifChan <- &interfaces.SwInterfaceEvent{ + SwIfIndex: 1, + AdminUpDown: 1, + LinkUpDown: 1, + Deleted: 1, + } + var result *vppcalls.InterfaceEvent + Eventually(eventsChan, 2).Should(Receive(&result)) + Expect(result).To(Equal(&vppcalls.InterfaceEvent{ + SwIfIndex: 1, + AdminState: 1, + LinkState: 1, + Deleted: true, + })) + + notifChan <- &interfaces.SwInterfaceEvent{ + SwIfIndex: 2, + AdminUpDown: 1, + LinkUpDown: 0, + Deleted: 1, + } + result = &vppcalls.InterfaceEvent{} + Eventually(eventsChan, 2).Should(Receive(&result)) + Expect(result).To(Equal(&vppcalls.InterfaceEvent{SwIfIndex: 2, AdminState: 1, LinkState: 0, Deleted: true})) + + notifChan <- &interfaces.SwInterfaceEvent{ + SwIfIndex: 3, + AdminUpDown: 0, + LinkUpDown: 1, + Deleted: 0, + } + result = &vppcalls.InterfaceEvent{} + Eventually(eventsChan, 2).Should(Receive(&result)) + Expect(result).To(Equal(&vppcalls.InterfaceEvent{ + SwIfIndex: 3, + AdminState: 0, + LinkState: 1, + Deleted: false, + })) + + close(notifChan) +} + +func TestWatchDHCPLeases(t *testing.T) { + ctx, ifHandler := ifTestSetup(t) + defer ctx.TeardownTestCtx() + leasesChChan := make(chan *vppcalls.Lease) + err := ifHandler.WatchDHCPLeases(leasesChChan) + notifChan := ctx.MockChannel.GetChannel() + Expect(notifChan).ToNot(BeNil()) + Expect(err).To(BeNil()) + + notifChan <- &dhcp.DHCPComplEvent{ + PID: 50, + Lease: dhcp.DHCPLease{ + SwIfIndex: 1, + State: 1, + Hostname: []byte("host1"), + IsIPv6: 0, + MaskWidth: 24, + HostAddress: []byte{10, 10, 10, 5}, + RouterAddress: []byte{10, 10, 10, 1}, + HostMac: []byte{16, 16, 32, 32, 48, 48}, + }, + } + var result *vppcalls.Lease + Eventually(leasesChChan, 2).Should(Receive(&result)) + Expect(result).To(Equal(&vppcalls.Lease{ + SwIfIndex: 1, + State: 1, + Hostname: "host1", + HostAddress: "10.10.10.5/24", + RouterAddress: "10.10.10.1/24", + HostMac: "10:10:20:20:30:30", + })) + + notifChan <- &dhcp.DHCPComplEvent{ + PID: 50, + Lease: dhcp.DHCPLease{ + SwIfIndex: 2, + State: 0, + Hostname: []byte("host2"), + IsIPv6: 1, + MaskWidth: 24, + HostAddress: []byte{10, 10, 10, 6}, + RouterAddress: []byte{10, 10, 10, 1}, + HostMac: []byte{16, 16, 32, 32, 64, 64}, + }, + } + Eventually(leasesChChan, 2).Should(Receive(&result)) + Expect(result).To(Equal(&vppcalls.Lease{ + SwIfIndex: 2, + Hostname: "host2", + IsIPv6: true, + HostAddress: "10.10.10.6/24", + RouterAddress: "10.10.10.1/24", + HostMac: "10:10:20:20:40:40", + })) + + close(leasesChChan) +} diff --git a/plugins/vpp/ipsecplugin/descriptor/adapter/spd.go b/plugins/vpp/ipsecplugin/descriptor/adapter/spd.go index 83621da9a9..542db3c8fa 100644 --- a/plugins/vpp/ipsecplugin/descriptor/adapter/spd.go +++ b/plugins/vpp/ipsecplugin/descriptor/adapter/spd.go @@ -4,9 +4,9 @@ package adapter import ( "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/api/models/vpp/ipsec" - "github.com/ligato/vpp-agent/pkg/idxvpp" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/pkg/idxvpp" + "github.com/ligato/vpp-agent/api/models/vpp/ipsec" ) ////////// type-safe key-value pair with metadata ////////// diff --git a/plugins/vpp/ipsecplugin/ipsecplugin.go b/plugins/vpp/ipsecplugin/ipsecplugin.go index 2a29a29604..4e0f42eef1 100644 --- a/plugins/vpp/ipsecplugin/ipsecplugin.go +++ b/plugins/vpp/ipsecplugin/ipsecplugin.go @@ -34,6 +34,7 @@ import ( _ "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls/vpp1908" ) // IPSecPlugin configures VPP security policy databases and security associations using GoVPP. diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1901/vppcalls_handlers.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1901/vppcalls_handlers.go index b0d8895bba..37de9a3d3d 100644 --- a/plugins/vpp/ipsecplugin/vppcalls/vpp1901/vppcalls_handlers.go +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1901/vppcalls_handlers.go @@ -25,7 +25,7 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, ipsec.Messages...) + msgs = append(msgs, ipsec.AllMessages()...) vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ Msgs: msgs, diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls.go index 21559f7902..ce93012187 100644 --- a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls.go +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls.go @@ -183,6 +183,25 @@ func (h *IPSecVppHandler) sadAddDelEntry(sa *ipsec.SecurityAssociation, isAdd bo if sa.EnableUdpEncap { flags |= api.IPSEC_API_SAD_FLAG_UDP_ENCAP } + var tunnelSrc, tunnelDst api.Address + if sa.TunnelSrcAddr != "" { + flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL + isIPv6, err := addrs.IsIPv6(sa.TunnelSrcAddr) + if err != nil { + return err + } + if isIPv6 { + flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 + } + tunnelSrc, err = IPToAddress(sa.TunnelSrcAddr) + if err != nil { + return err + } + tunnelDst, err = IPToAddress(sa.TunnelDstAddr) + if err != nil { + return err + } + } req := &api.IpsecSadEntryAddDel{ IsAdd: boolToUint(isAdd), @@ -200,27 +219,11 @@ func (h *IPSecVppHandler) sadAddDelEntry(sa *ipsec.SecurityAssociation, isAdd bo Data: integKey, Length: uint8(len(integKey)), }, - Flags: flags, + TunnelSrc: tunnelSrc, + TunnelDst: tunnelDst, + Flags: flags, }, } - if sa.TunnelSrcAddr != "" { - flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL - isIPv6, err := addrs.IsIPv6(sa.TunnelSrcAddr) - if err != nil { - return err - } - if isIPv6 { - flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 - } - req.Entry.TunnelSrc, err = IPToAddress(sa.TunnelSrcAddr) - if err != nil { - return err - } - req.Entry.TunnelDst, err = IPToAddress(sa.TunnelDstAddr) - if err != nil { - return err - } - } reply := &api.IpsecSadEntryAddDelReply{} if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go index dd80bbe0ef..8e944c71b3 100644 --- a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/ipsec_vppcalls_test.go @@ -244,3 +244,89 @@ func TestVppDelSA(t *testing.T) { }, })) } + +func TestVppAddSATunnelMode(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.AddSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + TunnelSrcAddr: "10.1.0.1", + TunnelDstAddr: "20.1.0.1", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + TunnelSrc: ipsec.Address{ + Af: ipsec.ADDRESS_IP4, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{10, 1, 0, 1}}, + }, + TunnelDst: ipsec.Address{ + Af: ipsec.ADDRESS_IP4, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{20, 1, 0, 1}}, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL, + }, + })) +} + +func TestVppAddSATunnelModeIPv6(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.AddSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + TunnelSrcAddr: "1234::", + TunnelDstAddr: "abcd::", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + TunnelSrc: ipsec.Address{ + Af: ipsec.ADDRESS_IP6, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{18, 52}}, + }, + TunnelDst: ipsec.Address{ + Af: ipsec.ADDRESS_IP6, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{171, 205}}, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL | ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6, + }, + })) +} diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/vppcalls_handlers.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/vppcalls_handlers.go index 4e508af9a0..441f2b947e 100644 --- a/plugins/vpp/ipsecplugin/vppcalls/vpp1904/vppcalls_handlers.go +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1904/vppcalls_handlers.go @@ -28,7 +28,7 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, ipsec.Messages...) + msgs = append(msgs, ipsec.AllMessages()...) vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ Msgs: msgs, diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1908/dump_vppcalls.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/dump_vppcalls.go new file mode 100644 index 0000000000..7df62c380a --- /dev/null +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/dump_vppcalls.go @@ -0,0 +1,224 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "encoding/hex" + "net" + "strconv" + + "github.com/pkg/errors" + + ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + ipsecapi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" +) + +// DumpIPSecSA implements IPSec handler. +func (h *IPSecVppHandler) DumpIPSecSA() (saList []*vppcalls.IPSecSaDetails, err error) { + return h.DumpIPSecSAWithIndex(^uint32(0)) // Get everything +} + +// DumpIPSecSAWithIndex implements IPSec handler. +func (h *IPSecVppHandler) DumpIPSecSAWithIndex(saID uint32) (saList []*vppcalls.IPSecSaDetails, err error) { + saDetails, err := h.dumpSecurityAssociations(saID) + if err != nil { + return nil, err + } + + for _, saData := range saDetails { + // Skip tunnel interfaces + if saData.SwIfIndex != ^uint32(0) { + continue + } + + var tunnelSrcAddr, tunnelDstAddr net.IP + if saData.Entry.TunnelDst.Af == ipsecapi.ADDRESS_IP6 { + src := saData.Entry.TunnelSrc.Un.GetIP6() + dst := saData.Entry.TunnelDst.Un.GetIP6() + tunnelSrcAddr, tunnelDstAddr = net.IP(src[:]), net.IP(dst[:]) + } else { + src := saData.Entry.TunnelSrc.Un.GetIP4() + dst := saData.Entry.TunnelDst.Un.GetIP4() + tunnelSrcAddr, tunnelDstAddr = net.IP(src[:]), net.IP(dst[:]) + } + + sa := &ipsec.SecurityAssociation{ + Index: strconv.Itoa(int(saData.Entry.SadID)), + Spi: saData.Entry.Spi, + Protocol: ipsec.SecurityAssociation_IPSecProtocol(saData.Entry.Protocol), + CryptoAlg: ipsec.CryptoAlg(saData.Entry.CryptoAlgorithm), + CryptoKey: hex.EncodeToString(saData.Entry.CryptoKey.Data[:saData.Entry.CryptoKey.Length]), + IntegAlg: ipsec.IntegAlg(saData.Entry.IntegrityAlgorithm), + IntegKey: hex.EncodeToString(saData.Entry.IntegrityKey.Data[:saData.Entry.IntegrityKey.Length]), + UseEsn: (saData.Entry.Flags & ipsecapi.IPSEC_API_SAD_FLAG_USE_ESN) != 0, + UseAntiReplay: (saData.Entry.Flags & ipsecapi.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY) != 0, + TunnelSrcAddr: tunnelSrcAddr.String(), + TunnelDstAddr: tunnelDstAddr.String(), + EnableUdpEncap: (saData.Entry.Flags & ipsecapi.IPSEC_API_SAD_FLAG_UDP_ENCAP) != 0, + } + meta := &vppcalls.IPSecSaMeta{ + SaID: saData.Entry.SadID, + IfIdx: saData.SwIfIndex, + Salt: saData.Salt, + SeqOutbound: saData.SeqOutbound, + LastSeqInbound: saData.LastSeqInbound, + ReplayWindow: saData.ReplayWindow, + TotalDataSize: saData.TotalDataSize, + } + saList = append(saList, &vppcalls.IPSecSaDetails{ + Sa: sa, + Meta: meta, + }) + } + + return saList, nil +} + +// DumpIPSecSPD implements IPSec handler. +func (h *IPSecVppHandler) DumpIPSecSPD() (spdList []*vppcalls.IPSecSpdDetails, err error) { + metadata := make(map[string]*vppcalls.SpdMeta) + + // TODO dump IPSec SPD interfaces is not available in current VPP version + + // Get all VPP SPD indexes + spdIndexes, err := h.dumpSpdIndexes() + if err != nil { + return nil, errors.Errorf("failed to dump SPD indexes: %v", err) + } + for spdIdx, numPolicies := range spdIndexes { + spd := &ipsec.SecurityPolicyDatabase{ + Index: strconv.Itoa(spdIdx), + } + + req := &ipsecapi.IpsecSpdDump{ + SpdID: uint32(spdIdx), + SaID: ^uint32(0), + } + requestCtx := h.callsChannel.SendMultiRequest(req) + + for { + spdDetails := &ipsecapi.IpsecSpdDetails{} + stop, err := requestCtx.ReceiveReply(spdDetails) + if stop { + break + } + if err != nil { + return nil, err + } + + // Addresses + remoteStartAddr, remoteStopAddr := ipsecAddrToIP(spdDetails.Entry.RemoteAddressStart), ipsecAddrToIP(spdDetails.Entry.RemoteAddressStop) + localStartAddr, localStopAddr := ipsecAddrToIP(spdDetails.Entry.LocalAddressStart), ipsecAddrToIP(spdDetails.Entry.LocalAddressStop) + + // Prepare policy entry and put to the SPD + policyEntry := &ipsec.SecurityPolicyDatabase_PolicyEntry{ + SaIndex: strconv.Itoa(int(spdDetails.Entry.SaID)), + Priority: spdDetails.Entry.Priority, + IsOutbound: uintToBool(spdDetails.Entry.IsOutbound), + RemoteAddrStart: remoteStartAddr.String(), + RemoteAddrStop: remoteStopAddr.String(), + LocalAddrStart: localStartAddr.String(), + LocalAddrStop: localStopAddr.String(), + Protocol: uint32(spdDetails.Entry.Protocol), + RemotePortStart: uint32(spdDetails.Entry.RemotePortStart), + RemotePortStop: resetPort(spdDetails.Entry.RemotePortStop), + LocalPortStart: uint32(spdDetails.Entry.LocalPortStart), + LocalPortStop: resetPort(spdDetails.Entry.LocalPortStop), + Action: ipsec.SecurityPolicyDatabase_PolicyEntry_Action(spdDetails.Entry.Policy), + } + spd.PolicyEntries = append(spd.PolicyEntries, policyEntry) + + // Prepare meta and put to the metadata map + meta := &vppcalls.SpdMeta{ + SaID: spdDetails.Entry.SaID, + Policy: uint8(spdDetails.Entry.Policy), + //Bytes: spdDetails.Bytes, + //Packets: spdDetails.Packets, + } + metadata[strconv.Itoa(int(spdDetails.Entry.SaID))] = meta + } + // Store SPD in list + spdList = append(spdList, &vppcalls.IPSecSpdDetails{ + Spd: spd, + PolicyMeta: metadata, + NumPolicies: numPolicies, + }) + } + + return spdList, nil +} + +// Get all indexes of SPD configured on the VPP +func (h *IPSecVppHandler) dumpSpdIndexes() (map[int]uint32, error) { + // SPD index to number of policies + spdIndexes := make(map[int]uint32) + + req := &ipsecapi.IpsecSpdsDump{} + reqCtx := h.callsChannel.SendMultiRequest(req) + + for { + spdDetails := &ipsecapi.IpsecSpdsDetails{} + stop, err := reqCtx.ReceiveReply(spdDetails) + if stop { + break + } + if err != nil { + return nil, err + } + + spdIndexes[int(spdDetails.SpdID)] = spdDetails.Npolicies + } + + return spdIndexes, nil +} + +// Get all security association (used also for tunnel interfaces) in binary api format +func (h *IPSecVppHandler) dumpSecurityAssociations(saID uint32) (saList []*ipsecapi.IpsecSaDetails, err error) { + req := &ipsecapi.IpsecSaDump{ + SaID: saID, + } + requestCtx := h.callsChannel.SendMultiRequest(req) + + for { + saDetails := &ipsecapi.IpsecSaDetails{} + stop, err := requestCtx.ReceiveReply(saDetails) + if stop { + break + } + if err != nil { + return nil, err + } + + saList = append(saList, saDetails) + } + + return saList, nil +} + +// ResetPort returns 0 if stop port has maximum value (default VPP value if stop port is not defined) +func resetPort(port uint16) uint32 { + if port == ^uint16(0) { + return 0 + } + return uint32(port) +} + +func uintToBool(input uint8) bool { + if input == 1 { + return true + } + return false +} diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls.go new file mode 100644 index 0000000000..476ec37b34 --- /dev/null +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls.go @@ -0,0 +1,241 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "encoding/hex" + "strconv" + + "github.com/ligato/cn-infra/utils/addrs" + "github.com/pkg/errors" + + ipsec "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + api "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" +) + +// AddSPD implements IPSec handler. +func (h *IPSecVppHandler) AddSPD(spdID uint32) error { + return h.spdAddDel(spdID, true) +} + +// DeleteSPD implements IPSec handler. +func (h *IPSecVppHandler) DeleteSPD(spdID uint32) error { + return h.spdAddDel(spdID, false) +} + +// AddSPDEntry implements IPSec handler. +func (h *IPSecVppHandler) AddSPDEntry(spdID, saID uint32, spd *ipsec.SecurityPolicyDatabase_PolicyEntry) error { + return h.spdAddDelEntry(spdID, saID, spd, true) +} + +// DeleteSPDEntry implements IPSec handler. +func (h *IPSecVppHandler) DeleteSPDEntry(spdID, saID uint32, spd *ipsec.SecurityPolicyDatabase_PolicyEntry) error { + return h.spdAddDelEntry(spdID, saID, spd, false) +} + +// AddSPDInterface implements IPSec handler. +func (h *IPSecVppHandler) AddSPDInterface(spdID uint32, ifaceCfg *ipsec.SecurityPolicyDatabase_Interface) error { + ifaceMeta, found := h.ifIndexes.LookupByName(ifaceCfg.Name) + if !found { + return errors.New("failed to get interface metadata") + } + return h.interfaceAddDelSpd(spdID, ifaceMeta.SwIfIndex, true) +} + +// DeleteSPDInterface implements IPSec handler. +func (h *IPSecVppHandler) DeleteSPDInterface(spdID uint32, ifaceCfg *ipsec.SecurityPolicyDatabase_Interface) error { + ifaceMeta, found := h.ifIndexes.LookupByName(ifaceCfg.Name) + if !found { + return errors.New("failed to get interface metadata") + } + return h.interfaceAddDelSpd(spdID, ifaceMeta.SwIfIndex, false) +} + +// AddSA implements IPSec handler. +func (h *IPSecVppHandler) AddSA(sa *ipsec.SecurityAssociation) error { + return h.sadAddDelEntry(sa, true) +} + +// DeleteSA implements IPSec handler. +func (h *IPSecVppHandler) DeleteSA(sa *ipsec.SecurityAssociation) error { + return h.sadAddDelEntry(sa, false) +} + +func (h *IPSecVppHandler) spdAddDel(spdID uint32, isAdd bool) error { + req := &api.IpsecSpdAddDel{ + IsAdd: boolToUint(isAdd), + SpdID: spdID, + } + reply := &api.IpsecSpdAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func (h *IPSecVppHandler) spdAddDelEntry(spdID, saID uint32, spd *ipsec.SecurityPolicyDatabase_PolicyEntry, isAdd bool) error { + req := &api.IpsecSpdEntryAddDel{ + IsAdd: boolToUint(isAdd), + Entry: api.IpsecSpdEntry{ + SpdID: spdID, + Priority: spd.Priority, + IsOutbound: boolToUint(spd.IsOutbound), + Protocol: uint8(spd.Protocol), + RemotePortStart: uint16(spd.RemotePortStart), + RemotePortStop: uint16(spd.RemotePortStop), + LocalPortStart: uint16(spd.LocalPortStart), + LocalPortStop: uint16(spd.LocalPortStop), + Policy: api.IpsecSpdAction(spd.Action), + SaID: saID, + }, + } + if req.Entry.RemotePortStop == 0 { + req.Entry.RemotePortStop = ^req.Entry.RemotePortStop + } + if req.Entry.LocalPortStop == 0 { + req.Entry.LocalPortStop = ^req.Entry.LocalPortStop + } + + var err error + req.Entry.RemoteAddressStart, err = IPToAddress(ipOr(spd.RemoteAddrStart, "0.0.0.0")) + if err != nil { + return err + } + req.Entry.RemoteAddressStop, err = IPToAddress(ipOr(spd.RemoteAddrStop, "255.255.255.255")) + if err != nil { + return err + } + req.Entry.LocalAddressStart, err = IPToAddress(ipOr(spd.LocalAddrStart, "0.0.0.0")) + if err != nil { + return err + } + req.Entry.LocalAddressStop, err = IPToAddress(ipOr(spd.LocalAddrStop, "255.255.255.255")) + if err != nil { + return err + } + + reply := &api.IpsecSpdEntryAddDelReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func ipOr(s, o string) string { + if s != "" { + return s + } + return o +} + +func (h *IPSecVppHandler) interfaceAddDelSpd(spdID, swIfIdx uint32, isAdd bool) error { + req := &api.IpsecInterfaceAddDelSpd{ + IsAdd: boolToUint(isAdd), + SwIfIndex: swIfIdx, + SpdID: spdID, + } + reply := &api.IpsecInterfaceAddDelSpdReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func (h *IPSecVppHandler) sadAddDelEntry(sa *ipsec.SecurityAssociation, isAdd bool) error { + cryptoKey, err := hex.DecodeString(sa.CryptoKey) + if err != nil { + return err + } + integKey, err := hex.DecodeString(sa.IntegKey) + if err != nil { + return err + } + + saID, err := strconv.Atoi(sa.Index) + if err != nil { + return err + } + + var flags api.IpsecSadFlags + if sa.UseEsn { + flags |= api.IPSEC_API_SAD_FLAG_USE_ESN + } + if sa.UseAntiReplay { + flags |= api.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY + } + if sa.EnableUdpEncap { + flags |= api.IPSEC_API_SAD_FLAG_UDP_ENCAP + } + var tunnelSrc, tunnelDst api.Address + if sa.TunnelSrcAddr != "" { + flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL + isIPv6, err := addrs.IsIPv6(sa.TunnelSrcAddr) + if err != nil { + return err + } + if isIPv6 { + flags |= api.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 + } + tunnelSrc, err = IPToAddress(sa.TunnelSrcAddr) + if err != nil { + return err + } + tunnelDst, err = IPToAddress(sa.TunnelDstAddr) + if err != nil { + return err + } + } + + req := &api.IpsecSadEntryAddDel{ + IsAdd: boolToUint(isAdd), + Entry: api.IpsecSadEntry{ + SadID: uint32(saID), + Spi: sa.Spi, + Protocol: api.IpsecProto(sa.Protocol), + CryptoAlgorithm: api.IpsecCryptoAlg(sa.CryptoAlg), + CryptoKey: api.Key{ + Data: cryptoKey, + Length: uint8(len(cryptoKey)), + }, + IntegrityAlgorithm: api.IpsecIntegAlg(sa.IntegAlg), + IntegrityKey: api.Key{ + Data: integKey, + Length: uint8(len(integKey)), + }, + TunnelSrc: tunnelSrc, + TunnelDst: tunnelDst, + Flags: flags, + }, + } + reply := &api.IpsecSadEntryAddDelReply{} + + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func boolToUint(value bool) uint8 { + if value { + return 1 + } + return 0 +} diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go new file mode 100644 index 0000000000..af52cf6949 --- /dev/null +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/ipsec_vppcalls_test.go @@ -0,0 +1,332 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "encoding/hex" + "fmt" + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + ipsec2 "github.com/ligato/vpp-agent/api/models/vpp/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +func ipToAddr(ip string) ipsec.Address { + addr, err := vpp1908.IPToAddress(ip) + if err != nil { + panic(fmt.Sprintf("invalid IP: %s", ip)) + } + return addr +} + +func TestVppAddSPD(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSpdAddDelReply{}) + + err := ipSecHandler.AddSPD(10) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSpdAddDel{ + IsAdd: 1, + SpdID: 10, + })) +} + +func TestVppDelSPD(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSpdAddDelReply{}) + + err := ipSecHandler.DeleteSPD(10) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSpdAddDel{ + IsAdd: 0, + SpdID: 10, + })) +} + +func TestVppAddSPDEntry(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSpdEntryAddDelReply{}) + + err := ipSecHandler.AddSPDEntry(10, 5, &ipsec2.SecurityPolicyDatabase_PolicyEntry{ + SaIndex: "5", + Priority: 10, + IsOutbound: true, + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSpdEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSpdEntry{ + SpdID: 10, + SaID: 5, + Priority: 10, + IsOutbound: 1, + RemoteAddressStart: ipToAddr("0.0.0.0"), + RemoteAddressStop: ipToAddr("255.255.255.255"), + LocalAddressStart: ipToAddr("0.0.0.0"), + LocalAddressStop: ipToAddr("255.255.255.255"), + RemotePortStop: 65535, + LocalPortStop: 65535, + }, + })) +} + +func TestVppDelSPDEntry(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSpdEntryAddDelReply{}) + + err := ipSecHandler.DeleteSPDEntry(10, 2, &ipsec2.SecurityPolicyDatabase_PolicyEntry{ + SaIndex: "2", + Priority: 5, + IsOutbound: true, + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSpdEntryAddDel{ + IsAdd: 0, + Entry: ipsec.IpsecSpdEntry{ + SpdID: 10, + SaID: 2, + Priority: 5, + IsOutbound: 1, + RemoteAddressStart: ipToAddr("0.0.0.0"), + RemoteAddressStop: ipToAddr("255.255.255.255"), + LocalAddressStart: ipToAddr("0.0.0.0"), + LocalAddressStop: ipToAddr("255.255.255.255"), + RemotePortStop: 65535, + LocalPortStop: 65535, + }, + })) +} + +func TestVppInterfaceAddSPD(t *testing.T) { + ctx, ipSecHandler, ifIndex := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecInterfaceAddDelSpdReply{}) + + ifIndex.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 2}) + + err := ipSecHandler.AddSPDInterface(10, &ipsec2.SecurityPolicyDatabase_Interface{ + Name: "if1", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecInterfaceAddDelSpd{ + IsAdd: 1, + SpdID: 10, + SwIfIndex: 2, + })) +} + +func TestVppInterfaceDelSPD(t *testing.T) { + ctx, ipSecHandler, ifIndex := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecInterfaceAddDelSpdReply{}) + + ifIndex.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 2}) + + err := ipSecHandler.DeleteSPDInterface(10, &ipsec2.SecurityPolicyDatabase_Interface{ + Name: "if1", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecInterfaceAddDelSpd{ + IsAdd: 0, + SpdID: 10, + SwIfIndex: 2, + })) +} + +func ipSecTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.IPSecVppAPI, ifaceidx.IfaceMetadataIndexRW) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifIndex := ifaceidx.NewIfaceIndex(log, "ipsec-test-ifidx") + ipSecHandler := vpp1908.NewIPSecVppHandler(ctx.MockChannel, ifIndex, log) + return ctx, ipSecHandler, ifIndex +} + +func TestVppAddSA(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.AddSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + UseEsn: true, + UseAntiReplay: true, + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_USE_ESN | ipsec.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY, + }, + })) +} + +func TestVppDelSA(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.DeleteSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + UseEsn: true, + UseAntiReplay: true, + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 0, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_USE_ESN | ipsec.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY, + }, + })) +} + +func TestVppAddSATunnelMode(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.AddSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + TunnelSrcAddr: "10.1.0.1", + TunnelDstAddr: "20.1.0.1", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + TunnelSrc: ipsec.Address{ + Af: ipsec.ADDRESS_IP4, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{10, 1, 0, 1}}, + }, + TunnelDst: ipsec.Address{ + Af: ipsec.ADDRESS_IP4, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{20, 1, 0, 1}}, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL, + }, + })) +} + +func TestVppAddSATunnelModeIPv6(t *testing.T) { + ctx, ipSecHandler, _ := ipSecTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ipsec.IpsecSadEntryAddDelReply{}) + + cryptoKey, err := hex.DecodeString("") + Expect(err).To(BeNil()) + + err = ipSecHandler.AddSA(&ipsec2.SecurityAssociation{ + Index: "1", + Spi: uint32(1001), + TunnelSrcAddr: "1234::", + TunnelDstAddr: "abcd::", + }) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(BeEquivalentTo(&ipsec.IpsecSadEntryAddDel{ + IsAdd: 1, + Entry: ipsec.IpsecSadEntry{ + SadID: 1, + Spi: 1001, + CryptoKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + IntegrityKey: ipsec.Key{ + Length: uint8(len(cryptoKey)), + Data: cryptoKey, + }, + TunnelSrc: ipsec.Address{ + Af: ipsec.ADDRESS_IP6, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{18, 52}}, + }, + TunnelDst: ipsec.Address{ + Af: ipsec.ADDRESS_IP6, + Un: ipsec.AddressUnion{XXX_UnionData: [16]byte{171, 205}}, + }, + Flags: ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL | ipsec.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6, + }, + })) +} diff --git a/plugins/vpp/ipsecplugin/vppcalls/vpp1908/vppcalls_handlers.go b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/vppcalls_handlers.go new file mode 100644 index 0000000000..4bdc5a4422 --- /dev/null +++ b/plugins/vpp/ipsecplugin/vppcalls/vpp1908/vppcalls_handlers.go @@ -0,0 +1,78 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ipsec" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/ipsecplugin/vppcalls" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, ipsec.AllMessages()...) + + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) vppcalls.IPSecVppAPI { + return NewIPSecVppHandler(ch, ifIdx, log) + }, + } +} + +// IPSecVppHandler is accessor for IPSec-related vppcalls methods +type IPSecVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +func NewIPSecVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *IPSecVppHandler { + return &IPSecVppHandler{ch, ifIdx, log} +} + +func ipsecAddrToIP(addr ipsec.Address) net.IP { + if addr.Af == ipsec.ADDRESS_IP6 { + addrIP := addr.Un.GetIP6() + return net.IP(addrIP[:]) + } + addrIP := addr.Un.GetIP4() + return net.IP(addrIP[:]) +} + +func IPToAddress(ipstr string) (addr ipsec.Address, err error) { + netIP := net.ParseIP(ipstr) + if netIP == nil { + return ipsec.Address{}, fmt.Errorf("invalid IP: %q", ipstr) + } + if ip4 := netIP.To4(); ip4 == nil { + addr.Af = ipsec.ADDRESS_IP6 + var ip6addr ipsec.IP6Address + copy(ip6addr[:], netIP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = ipsec.ADDRESS_IP4 + var ip4addr ipsec.IP4Address + copy(ip4addr[:], ip4) + addr.Un.SetIP4(ip4addr) + } + return +} diff --git a/plugins/vpp/l2plugin/descriptor/adapter/bridgedomain.go b/plugins/vpp/l2plugin/descriptor/adapter/bridgedomain.go index 4e49aefe59..83fb6cfdac 100644 --- a/plugins/vpp/l2plugin/descriptor/adapter/bridgedomain.go +++ b/plugins/vpp/l2plugin/descriptor/adapter/bridgedomain.go @@ -4,9 +4,9 @@ package adapter import ( "github.com/gogo/protobuf/proto" - "github.com/ligato/vpp-agent/api/models/vpp/l2" - "github.com/ligato/vpp-agent/pkg/idxvpp" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/pkg/idxvpp" + "github.com/ligato/vpp-agent/api/models/vpp/l2" ) ////////// type-safe key-value pair with metadata ////////// diff --git a/plugins/vpp/l2plugin/l2plugin.go b/plugins/vpp/l2plugin/l2plugin.go index 0d271258a7..d2348e0a35 100644 --- a/plugins/vpp/l2plugin/l2plugin.go +++ b/plugins/vpp/l2plugin/l2plugin.go @@ -35,6 +35,7 @@ import ( _ "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1908" ) // L2Plugin configures VPP bridge domains, L2 FIBs and xConnects using GoVPP. diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1901/vppcalls_handler.go b/plugins/vpp/l2plugin/vppcalls/vpp1901/vppcalls_handler.go index 6ad679726e..3f62153baf 100644 --- a/plugins/vpp/l2plugin/vppcalls/vpp1901/vppcalls_handler.go +++ b/plugins/vpp/l2plugin/vppcalls/vpp1901/vppcalls_handler.go @@ -29,7 +29,7 @@ import ( func init() { vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ - Msgs: l2ba.Messages, + Msgs: l2ba.AllMessages(), New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, bdIdx idxvpp.NameToIndex, log logging.Logger, ) vppcalls.L2VppAPI { diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1904/vppcalls_handler.go b/plugins/vpp/l2plugin/vppcalls/vpp1904/vppcalls_handler.go index befdb9ddbb..d219dda2e1 100644 --- a/plugins/vpp/l2plugin/vppcalls/vpp1904/vppcalls_handler.go +++ b/plugins/vpp/l2plugin/vppcalls/vpp1904/vppcalls_handler.go @@ -29,7 +29,7 @@ import ( func init() { vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ - Msgs: l2ba.Messages, + Msgs: l2ba.AllMessages(), New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, bdIdx idxvpp.NameToIndex, log logging.Logger, ) vppcalls.L2VppAPI { diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls.go new file mode 100644 index 0000000000..6317efb4e3 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls.go @@ -0,0 +1,67 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +func (h *BridgeDomainVppHandler) callBdIPMacAddDel(isAdd bool, bdID uint32, mac string, ip string) error { + ipAddr, err := ipToAddress(ip) + if err != nil { + return err + } + macAddr, err := net.ParseMAC(mac) + if err != nil { + return err + } + bdEntry := l2ba.BdIPMac{ + BdID: bdID, + IP: ipAddr, + } + copy(bdEntry.Mac[:], macAddr) + + req := &l2ba.BdIPMacAddDel{ + IsAdd: boolToUint(isAdd), + Entry: bdEntry, + } + + reply := &l2ba.BdIPMacAddDelReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// AddArpTerminationTableEntry creates ARP termination entry for bridge domain. +func (h *BridgeDomainVppHandler) AddArpTerminationTableEntry(bdID uint32, mac string, ip string) error { + err := h.callBdIPMacAddDel(true, bdID, mac, ip) + if err != nil { + return err + } + return nil +} + +// RemoveArpTerminationTableEntry removes ARP termination entry from bridge domain. +func (h *BridgeDomainVppHandler) RemoveArpTerminationTableEntry(bdID uint32, mac string, ip string) error { + err := h.callBdIPMacAddDel(false, bdID, mac, ip) + if err != nil { + return err + } + return nil +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls_test.go new file mode 100644 index 0000000000..9ca53e8e12 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/arp_term_vppcalls_test.go @@ -0,0 +1,138 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + . "github.com/onsi/gomega" +) + +func TestVppAddArpTerminationTableEntry(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{}) + + err := bdHandler.AddArpTerminationTableEntry( + 4, "FF:FF:FF:FF:FF:FF", "192.168.4.4") + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(Equal(&l2ba.BdIPMacAddDel{ + Entry: l2ba.BdIPMac{ + BdID: 4, + IP: l2ba.Address{ + Af: l2ba.ADDRESS_IP4, + Un: l2ba.AddressUnionIP4( + l2ba.IP4Address{192, 168, 4, 4}, + ), + }, + Mac: l2ba.MacAddress{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + IsAdd: 1, + })) +} + +func TestVppAddArpTerminationTableEntryIPv6(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{}) + + err := bdHandler.AddArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "2001:db9::54") + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(Equal(&l2ba.BdIPMacAddDel{ + Entry: l2ba.BdIPMac{ + BdID: 4, + IP: l2ba.Address{ + Af: l2ba.ADDRESS_IP6, + Un: l2ba.AddressUnionIP6( + l2ba.IP6Address{32, 1, 13, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84}, + ), + }, + Mac: l2ba.MacAddress{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + IsAdd: 1, + })) +} + +func TestVppRemoveArpTerminationTableEntry(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{}) + + err := bdHandler.RemoveArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "192.168.4.4") + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(Equal(&l2ba.BdIPMacAddDel{ + Entry: l2ba.BdIPMac{ + BdID: 4, + IP: l2ba.Address{ + Af: l2ba.ADDRESS_IP4, + Un: l2ba.AddressUnionIP4( + l2ba.IP4Address{192, 168, 4, 4}, + ), + }, + Mac: l2ba.MacAddress{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + }, + IsAdd: 0, + })) +} + +func TestVppArpTerminationTableEntryMacError(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{}) + + err := bdHandler.AddArpTerminationTableEntry(4, "in:va:li:d:ma:c", "192.168.4.4") + Expect(err).Should(HaveOccurred()) + + err = bdHandler.RemoveArpTerminationTableEntry(4, "in:va:li:d:ma:c", "192.168.4.4") + Expect(err).Should(HaveOccurred()) +} + +func TestVppArpTerminationTableEntryIpError(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{}) + + err := bdHandler.AddArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "") + Expect(err).Should(HaveOccurred()) + + err = bdHandler.RemoveArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "") + Expect(err).Should(HaveOccurred()) +} + +func TestVppArpTerminationTableEntryError(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BdIPMacAddDelReply{ + Retval: 1, + }) + + err := bdHandler.AddArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "192.168.4.4") + Expect(err).Should(HaveOccurred()) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + + err = bdHandler.RemoveArpTerminationTableEntry(4, "FF:FF:FF:FF:FF:FF", "192.168.4.4") + Expect(err).Should(HaveOccurred()) +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls.go new file mode 100644 index 0000000000..8d091ec03e --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls.go @@ -0,0 +1,64 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// AddBridgeDomain adds new bridge domain. +func (h *BridgeDomainVppHandler) AddBridgeDomain(bdIdx uint32, bd *l2.BridgeDomain) error { + req := &l2ba.BridgeDomainAddDel{ + IsAdd: 1, + BdID: bdIdx, + Learn: boolToUint(bd.Learn), + ArpTerm: boolToUint(bd.ArpTermination), + Flood: boolToUint(bd.Flood), + UuFlood: boolToUint(bd.UnknownUnicastFlood), + Forward: boolToUint(bd.Forward), + MacAge: uint8(bd.MacAge), + BdTag: []byte(bd.Name), + } + reply := &l2ba.BridgeDomainAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// DeleteBridgeDomain removes existing bridge domain. +func (h *BridgeDomainVppHandler) DeleteBridgeDomain(bdIdx uint32) error { + req := &l2ba.BridgeDomainAddDel{ + IsAdd: 0, + BdID: bdIdx, + } + reply := &l2ba.BridgeDomainAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +func boolToUint(value bool) uint8 { + if value { + return 1 + } + return 0 +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls_test.go new file mode 100644 index 0000000000..108ea38a16 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/bridge_domain_vppcalls_test.go @@ -0,0 +1,144 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +const ( + dummyBridgeDomain = 4 + dummyBridgeDomainName = "bridge_domain" +) + +// Input test data for creating bridge domain +var createTestDataInBD *l2.BridgeDomain = &l2.BridgeDomain{ + Name: dummyBridgeDomainName, + Flood: true, + UnknownUnicastFlood: true, + Forward: true, + Learn: true, + ArpTermination: true, + MacAge: 45, +} + +// Output test data for creating bridge domain +var createTestDataOutBD *l2ba.BridgeDomainAddDel = &l2ba.BridgeDomainAddDel{ + BdID: dummyBridgeDomain, + Flood: 1, + UuFlood: 1, + Forward: 1, + Learn: 1, + ArpTerm: 1, + MacAge: 45, + BdTag: []byte(dummyBridgeDomainName), + IsAdd: 1, +} + +// Input test data for updating bridge domain +var updateTestDataInBd *l2.BridgeDomain = &l2.BridgeDomain{ + Name: dummyBridgeDomainName, + Flood: false, + UnknownUnicastFlood: false, + Forward: false, + Learn: false, + ArpTermination: false, + MacAge: 50, +} + +// Output test data for updating bridge domain +var updateTestDataOutBd *l2ba.BridgeDomainAddDel = &l2ba.BridgeDomainAddDel{ + BdID: dummyBridgeDomain, + Flood: 0, + UuFlood: 0, + Forward: 0, + Learn: 0, + ArpTerm: 0, + MacAge: 50, + IsAdd: 1, +} + +// Output test data for deleting bridge domain +var deleteTestDataOutBd *l2ba.BridgeDomainAddDel = &l2ba.BridgeDomainAddDel{ + BdID: dummyBridgeDomain, + IsAdd: 0, +} + +func TestVppAddBridgeDomain(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + err := bdHandler.AddBridgeDomain(dummyBridgeDomain, createTestDataInBD) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(Equal(createTestDataOutBD)) +} + +func TestVppAddBridgeDomainError(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{Retval: 1}) + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2Bridge{}) + + err := bdHandler.AddBridgeDomain(dummyBridgeDomain, createTestDataInBD) + Expect(err).Should(HaveOccurred()) + + err = bdHandler.AddBridgeDomain(dummyBridgeDomain, createTestDataInBD) + Expect(err).Should(HaveOccurred()) +} + +func TestVppDeleteBridgeDomain(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + err := bdHandler.DeleteBridgeDomain(dummyBridgeDomain) + + Expect(err).ShouldNot(HaveOccurred()) + Expect(ctx.MockChannel.Msg).To(Equal(deleteTestDataOutBd)) +} + +func TestVppDeleteBridgeDomainError(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{Retval: 1}) + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2Bridge{}) + + err := bdHandler.DeleteBridgeDomain(dummyBridgeDomain) + Expect(err).Should(HaveOccurred()) + + err = bdHandler.DeleteBridgeDomain(dummyBridgeDomain) + Expect(err).Should(HaveOccurred()) +} + +func bdTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.BridgeDomainVppAPI, ifaceidx.IfaceMetadataIndexRW) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifIndex := ifaceidx.NewIfaceIndex(log, "bd-test-ifidx") + bdHandler := vpp1908.NewL2VppHandler(ctx.MockChannel, ifIndex, nil, log) + return ctx, bdHandler, ifIndex +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/doc.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/doc.go new file mode 100644 index 0000000000..2c2d56e63c --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/doc.go @@ -0,0 +1,17 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package vppcalls contains wrappers over VPP binary APIs for bridge-domains, +// and L2 FIBs and XConnect pairs and helpers for dumping them. +package vpp1908 diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls.go new file mode 100644 index 0000000000..f09a295b61 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls.go @@ -0,0 +1,243 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + "net" + + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/pkg/errors" + + l2nb "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// DumpBridgeDomains implements bridge domain handler. +func (h *BridgeDomainVppHandler) DumpBridgeDomains() ([]*vppcalls.BridgeDomainDetails, error) { + // At first prepare bridge domain ARP termination table which needs to be dumped separately. + bdArpTab, err := h.dumpBridgeDomainMacTable() + if err != nil { + return nil, errors.Errorf("failed to dump arp termination table: %v", err) + } + + // list of resulting BDs + var bds []*vppcalls.BridgeDomainDetails + + // dump bridge domains + reqCtx := h.callsChannel.SendMultiRequest(&l2ba.BridgeDomainDump{BdID: ^uint32(0)}) + + for { + bdDetails := &l2ba.BridgeDomainDetails{} + stop, err := reqCtx.ReceiveReply(bdDetails) + if stop { + break + } + if err != nil { + return nil, err + } + + // bridge domain metadata + bdData := &vppcalls.BridgeDomainDetails{ + Bd: &l2nb.BridgeDomain{ + Name: string(bytes.Replace(bdDetails.BdTag, []byte{0x00}, []byte{}, -1)), + Flood: bdDetails.Flood > 0, + UnknownUnicastFlood: bdDetails.UuFlood > 0, + Forward: bdDetails.Forward > 0, + Learn: bdDetails.Learn > 0, + ArpTermination: bdDetails.ArpTerm > 0, + MacAge: uint32(bdDetails.MacAge), + }, + Meta: &vppcalls.BridgeDomainMeta{ + BdID: bdDetails.BdID, + }, + } + + // bridge domain interfaces + for _, iface := range bdDetails.SwIfDetails { + ifaceName, _, exists := h.ifIndexes.LookupBySwIfIndex(iface.SwIfIndex) + if !exists { + h.log.Warnf("Bridge domain dump: interface name for index %d not found", iface.SwIfIndex) + continue + } + // Bvi + var bvi bool + if iface.SwIfIndex == bdDetails.BviSwIfIndex { + bvi = true + } + // add interface entry + bdData.Bd.Interfaces = append(bdData.Bd.Interfaces, &l2nb.BridgeDomain_Interface{ + Name: ifaceName, + BridgedVirtualInterface: bvi, + SplitHorizonGroup: uint32(iface.Shg), + }) + } + + // Add ARP termination entries. + arpTable, ok := bdArpTab[bdDetails.BdID] + if ok { + bdData.Bd.ArpTerminationTable = arpTable + } + + bds = append(bds, bdData) + } + + return bds, nil +} + +// Reads ARP termination table from all bridge domains. Result is then added to bridge domains. +func (h *BridgeDomainVppHandler) dumpBridgeDomainMacTable() (map[uint32][]*l2nb.BridgeDomain_ArpTerminationEntry, error) { + bdArpTable := make(map[uint32][]*l2nb.BridgeDomain_ArpTerminationEntry) + req := &l2ba.BdIPMacDump{BdID: ^uint32(0)} + + reqCtx := h.callsChannel.SendMultiRequest(req) + for { + msg := &l2ba.BdIPMacDetails{} + stop, err := reqCtx.ReceiveReply(msg) + if err != nil { + return nil, err + } + if stop { + break + } + + // Prepare ARP entry + arpEntry := &l2nb.BridgeDomain_ArpTerminationEntry{} + arpEntry.IpAddress = parseAddressToString(msg.Entry.IP) + arpEntry.PhysAddress = net.HardwareAddr(msg.Entry.Mac[:]).String() + + // Add ARP entry to result map + bdArpTable[msg.Entry.BdID] = append(bdArpTable[msg.Entry.BdID], arpEntry) + } + + return bdArpTable, nil +} + +// DumpL2FIBs dumps VPP L2 FIB table entries into the northbound API +// data structure map indexed by destination MAC address. +func (h *FIBVppHandler) DumpL2FIBs() (map[string]*vppcalls.FibTableDetails, error) { + // map for the resulting FIBs + fibs := make(map[string]*vppcalls.FibTableDetails) + + reqCtx := h.callsChannel.SendMultiRequest(&l2ba.L2FibTableDump{BdID: ^uint32(0)}) + for { + fibDetails := &l2ba.L2FibTableDetails{} + stop, err := reqCtx.ReceiveReply(fibDetails) + if stop { + break // Break from the loop. + } + if err != nil { + return nil, err + } + + mac := net.HardwareAddr(fibDetails.Mac).String() + var action l2nb.FIBEntry_Action + if fibDetails.FilterMac > 0 { + action = l2nb.FIBEntry_DROP + } else { + action = l2nb.FIBEntry_FORWARD + } + + // Interface name (only for FORWARD entries) + var ifName string + if action == l2nb.FIBEntry_FORWARD { + var exists bool + ifName, _, exists = h.ifIndexes.LookupBySwIfIndex(fibDetails.SwIfIndex) + if !exists { + h.log.Warnf("FIB dump: interface name for index %d not found", fibDetails.SwIfIndex) + continue + } + } + // Bridge domain name + bdName, _, exists := h.bdIndexes.LookupByIndex(fibDetails.BdID) + if !exists { + h.log.Warnf("FIB dump: bridge domain name for index %d not found", fibDetails.BdID) + continue + } + + fibs[mac] = &vppcalls.FibTableDetails{ + Fib: &l2nb.FIBEntry{ + PhysAddress: mac, + BridgeDomain: bdName, + Action: action, + OutgoingInterface: ifName, + StaticConfig: fibDetails.StaticMac > 0, + BridgedVirtualInterface: fibDetails.BviMac > 0, + }, + Meta: &vppcalls.FibMeta{ + BdID: fibDetails.BdID, + IfIdx: fibDetails.SwIfIndex, + }, + } + } + + return fibs, nil +} + +// DumpXConnectPairs implements xconnect handler. +func (h *XConnectVppHandler) DumpXConnectPairs() (map[uint32]*vppcalls.XConnectDetails, error) { + // map for the resulting xconnect pairs + xpairs := make(map[uint32]*vppcalls.XConnectDetails) + + reqCtx := h.callsChannel.SendMultiRequest(&l2ba.L2XconnectDump{}) + for { + pairs := &l2ba.L2XconnectDetails{} + stop, err := reqCtx.ReceiveReply(pairs) + if stop { + break + } + if err != nil { + return nil, err + } + + // Find interface names + rxIfaceName, _, exists := h.ifIndexes.LookupBySwIfIndex(pairs.RxSwIfIndex) + if !exists { + h.log.Warnf("XConnect dump: rx interface name for index %d not found", pairs.RxSwIfIndex) + continue + } + txIfaceName, _, exists := h.ifIndexes.LookupBySwIfIndex(pairs.TxSwIfIndex) + if !exists { + h.log.Warnf("XConnect dump: tx interface name for index %d not found", pairs.TxSwIfIndex) + continue + } + + xpairs[pairs.RxSwIfIndex] = &vppcalls.XConnectDetails{ + Xc: &l2nb.XConnectPair{ + ReceiveInterface: rxIfaceName, + TransmitInterface: txIfaceName, + }, + Meta: &vppcalls.XcMeta{ + ReceiveInterfaceSwIfIdx: pairs.RxSwIfIndex, + TransmitInterfaceSwIfIdx: pairs.TxSwIfIndex, + }, + } + } + + return xpairs, nil +} + +func parseAddressToString(address l2ba.Address) string { + var nhIP net.IP = make([]byte, 16) + copy(nhIP[:], address.Un.XXX_UnionData[:]) + if address.Af == l2ba.ADDRESS_IP4 { + return nhIP[:4].To4().String() + } + if address.Af == l2ba.ADDRESS_IP6 { + return nhIP.To16().String() + } + + return "" +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls_test.go new file mode 100644 index 0000000000..1c00012f96 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/dump_vppcalls_test.go @@ -0,0 +1,304 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + govppapi "git.fd.io/govpp.git/api" + . "github.com/onsi/gomega" + + l2nb "github.com/ligato/vpp-agent/api/models/vpp/l2" + "github.com/ligato/vpp-agent/pkg/idxvpp" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" +) + +var testDataInMessagesBDs = []govppapi.Message{ + &l2ba.BridgeDomainDetails{ + BdID: 4, + Flood: 1, UuFlood: 1, Forward: 1, Learn: 1, ArpTerm: 1, MacAge: 140, + SwIfDetails: []l2ba.BridgeDomainSwIf{ + {SwIfIndex: 5}, + {SwIfIndex: 7}, + }, + }, + &l2ba.BridgeDomainDetails{ + BdID: 5, + Flood: 0, UuFlood: 0, Forward: 0, Learn: 0, ArpTerm: 0, MacAge: 141, + SwIfDetails: []l2ba.BridgeDomainSwIf{ + {SwIfIndex: 5}, + {SwIfIndex: 8}, + }, + }, +} + +var testDataOutMessage = []*vppcalls.BridgeDomainDetails{ + { + Bd: &l2nb.BridgeDomain{ + Flood: true, + UnknownUnicastFlood: true, + Forward: true, + Learn: true, + ArpTermination: true, + MacAge: 140, + Interfaces: []*l2nb.BridgeDomain_Interface{ + { + Name: "if1", + }, + { + Name: "if2", + }, + }, + }, + Meta: &vppcalls.BridgeDomainMeta{ + BdID: 4, + }, + }, { + Bd: &l2nb.BridgeDomain{ + Flood: false, + UnknownUnicastFlood: false, + Forward: false, + Learn: false, + ArpTermination: false, + MacAge: 141, + Interfaces: []*l2nb.BridgeDomain_Interface{ + { + Name: "if1", + }, + { + Name: "if3", + }, + }, + ArpTerminationTable: []*l2nb.BridgeDomain_ArpTerminationEntry{ + { + IpAddress: "192.168.0.1", + PhysAddress: "aa:aa:aa:aa:aa:aa", + }, + }, + }, + Meta: &vppcalls.BridgeDomainMeta{ + BdID: 5, + }, + }, +} + +// TestDumpBridgeDomains tests DumpBridgeDomains method +func TestDumpBridgeDomains(t *testing.T) { + ctx, bdHandler, ifIndexes := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 5}) + ifIndexes.Put("if2", &ifaceidx.IfaceMetadata{SwIfIndex: 7}) + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&l2ba.BdIPMacDump{}).GetMessageName(), + Ping: true, + Message: &l2ba.BdIPMacDetails{}, + }, + { + Name: (&l2ba.BridgeDomainDump{}).GetMessageName(), + Ping: true, + Message: testDataInMessagesBDs[0], + }, + }) + + bridgeDomains, err := bdHandler.DumpBridgeDomains() + + Expect(err).To(BeNil()) + Expect(bridgeDomains).To(HaveLen(1)) + Expect(bridgeDomains[0]).To(Equal(testDataOutMessage[0])) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + _, err = bdHandler.DumpBridgeDomains() + Expect(err).Should(HaveOccurred()) +} + +// TestDumpBridgeDomains tests DumpBridgeDomains method +func TestDumpBridgeDomainsWithARP(t *testing.T) { + ctx, bdHandler, ifIndexes := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 5}) + ifIndexes.Put("if3", &ifaceidx.IfaceMetadata{SwIfIndex: 8}) + + ctx.MockReplies([]*vppcallmock.HandleReplies{ + { + Name: (&l2ba.BdIPMacDump{}).GetMessageName(), + Ping: true, + Message: &l2ba.BdIPMacDetails{ + Entry: l2ba.BdIPMac{ + BdID: 5, + IP: l2ba.Address{ + Af: l2ba.ADDRESS_IP4, + Un: l2ba.AddressUnionIP4( + l2ba.IP4Address{192, 168, 0, 1}, + ), + }, + Mac: l2ba.MacAddress{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, + }, + }, + }, + { + Name: (&l2ba.BridgeDomainDump{}).GetMessageName(), + Ping: true, + Message: testDataInMessagesBDs[1], + }, + }) + + bridgeDomains, err := bdHandler.DumpBridgeDomains() + + Expect(err).To(BeNil()) + Expect(bridgeDomains).To(HaveLen(1)) + Expect(bridgeDomains[0]).To(Equal(testDataOutMessage[1])) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + _, err = bdHandler.DumpBridgeDomains() + Expect(err).Should(HaveOccurred()) +} + +var testDataInMessagesFIBs = []govppapi.Message{ + &l2ba.L2FibTableDetails{ + BdID: 10, + Mac: []byte{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, + BviMac: 0, SwIfIndex: ^uint32(0), FilterMac: 1, StaticMac: 0, + }, + &l2ba.L2FibTableDetails{ + BdID: 20, + Mac: []byte{0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB}, + BviMac: 1, SwIfIndex: 1, FilterMac: 0, StaticMac: 1, + }, +} + +var testDataOutFIBs = []*vppcalls.FibTableDetails{ + { + Fib: &l2nb.FIBEntry{ + PhysAddress: "aa:aa:aa:aa:aa:aa", + BridgeDomain: "bd1", + Action: l2nb.FIBEntry_DROP, + StaticConfig: false, + BridgedVirtualInterface: false, + OutgoingInterface: "", + }, + Meta: &vppcalls.FibMeta{ + BdID: 10, + IfIdx: ^uint32(0), + }, + }, + { + Fib: &l2nb.FIBEntry{ + PhysAddress: "bb:bb:bb:bb:bb:bb", + BridgeDomain: "bd2", + Action: l2nb.FIBEntry_FORWARD, + StaticConfig: true, + BridgedVirtualInterface: true, + OutgoingInterface: "if1", + }, + Meta: &vppcalls.FibMeta{ + BdID: 20, + IfIdx: 1, + }, + }, +} + +// Scenario: +// - 2 FIB entries in VPP +// TestDumpFIBTableEntries tests DumpFIBTableEntries method +func TestDumpFIBTableEntries(t *testing.T) { + ctx, fibHandler, ifIndexes, bdIndexes := fibTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + bdIndexes.Put("bd1", &idxvpp.OnlyIndex{Index: 10}) + bdIndexes.Put("bd2", &idxvpp.OnlyIndex{Index: 20}) + + ctx.MockVpp.MockReply(testDataInMessagesFIBs...) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + fibTable, err := fibHandler.DumpL2FIBs() + Expect(err).To(BeNil()) + Expect(fibTable).To(HaveLen(2)) + Expect(fibTable["aa:aa:aa:aa:aa:aa"]).To(Equal(testDataOutFIBs[0])) + Expect(fibTable["bb:bb:bb:bb:bb:bb"]).To(Equal(testDataOutFIBs[1])) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + _, err = fibHandler.DumpL2FIBs() + Expect(err).Should(HaveOccurred()) +} + +var testDataInXConnect = []govppapi.Message{ + &l2ba.L2XconnectDetails{ + RxSwIfIndex: 1, + TxSwIfIndex: 2, + }, + &l2ba.L2XconnectDetails{ + RxSwIfIndex: 3, + TxSwIfIndex: 4, + }, +} + +var testDataOutXconnect = []*vppcalls.XConnectDetails{ + { + Xc: &l2nb.XConnectPair{ + ReceiveInterface: "if1", + TransmitInterface: "if2", + }, + Meta: &vppcalls.XcMeta{ + ReceiveInterfaceSwIfIdx: 1, + TransmitInterfaceSwIfIdx: 2, + }, + }, + { + Xc: &l2nb.XConnectPair{ + ReceiveInterface: "if3", + TransmitInterface: "if4", + }, + Meta: &vppcalls.XcMeta{ + ReceiveInterfaceSwIfIdx: 3, + TransmitInterfaceSwIfIdx: 4, + }, + }, +} + +// Scenario: +// - 2 Xconnect entries in VPP +// TestDumpXConnectPairs tests DumpXConnectPairs method +func TestDumpXConnectPairs(t *testing.T) { + ctx, xcHandler, ifIndex := xcTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndex.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + ifIndex.Put("if2", &ifaceidx.IfaceMetadata{SwIfIndex: 2}) + ifIndex.Put("if3", &ifaceidx.IfaceMetadata{SwIfIndex: 3}) + ifIndex.Put("if4", &ifaceidx.IfaceMetadata{SwIfIndex: 4}) + + ctx.MockVpp.MockReply(testDataInXConnect...) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + xConnectPairs, err := xcHandler.DumpXConnectPairs() + + Expect(err).To(BeNil()) + Expect(xConnectPairs).To(HaveLen(2)) + Expect(xConnectPairs[1]).To(Equal(testDataOutXconnect[0])) + Expect(xConnectPairs[3]).To(Equal(testDataOutXconnect[1])) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + _, err = xcHandler.DumpXConnectPairs() + Expect(err).Should(HaveOccurred()) +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls.go new file mode 100644 index 0000000000..8a63ac2d6d --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls.go @@ -0,0 +1,69 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + + "github.com/pkg/errors" + + l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// AddInterfaceToBridgeDomain puts interface into bridge domain. +func (h *BridgeDomainVppHandler) AddInterfaceToBridgeDomain(bdIdx uint32, ifaceCfg *l2.BridgeDomain_Interface) error { + ifaceMeta, found := h.ifIndexes.LookupByName(ifaceCfg.Name) + if !found { + return errors.New("failed to get interface metadata") + } + if err := h.addDelInterfaceToBridgeDomain(bdIdx, ifaceCfg, ifaceMeta.GetIndex(), true); err != nil { + return err + } + return nil +} + +// DeleteInterfaceFromBridgeDomain removes interface from bridge domain. +func (h *BridgeDomainVppHandler) DeleteInterfaceFromBridgeDomain(bdIdx uint32, ifaceCfg *l2.BridgeDomain_Interface) error { + ifaceMeta, found := h.ifIndexes.LookupByName(ifaceCfg.Name) + if !found { + return errors.New("failed to get interface metadata") + } + if err := h.addDelInterfaceToBridgeDomain(bdIdx, ifaceCfg, ifaceMeta.GetIndex(), false); err != nil { + return err + } + return nil +} + +func (h *BridgeDomainVppHandler) addDelInterfaceToBridgeDomain(bdIdx uint32, ifaceCfg *l2.BridgeDomain_Interface, + ifIdx uint32, add bool) error { + req := &l2ba.SwInterfaceSetL2Bridge{ + BdID: bdIdx, + RxSwIfIndex: ifIdx, + Shg: uint8(ifaceCfg.SplitHorizonGroup), + Enable: boolToUint(add), + } + // Set as BVI. + if ifaceCfg.BridgedVirtualInterface { + req.PortType = l2ba.L2_API_PORT_TYPE_BVI + } + reply := &l2ba.SwInterfaceSetL2BridgeReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return fmt.Errorf("%s returned error: %v", reply.GetMessageName(), err) + } + + return nil +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls_test.go new file mode 100644 index 0000000000..4bc5baedbb --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/interface_vppcalls_test.go @@ -0,0 +1,143 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + . "github.com/onsi/gomega" + + l2 "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" +) + +func TestAddInterfaceToBridgeDomain(t *testing.T) { + ctx, bdHandler, ifaceIdx := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2BridgeReply{}) + err := bdHandler.AddInterfaceToBridgeDomain(1, &l2.BridgeDomain_Interface{ + Name: "if1", + BridgedVirtualInterface: true, + SplitHorizonGroup: 0, + }) + + Expect(err).To(BeNil()) + Expect(ctx.MockChannel.Msgs).To(HaveLen(1)) + msg := ctx.MockChannel.Msgs[0] + Expect(msg).To(BeEquivalentTo(&l2ba.SwInterfaceSetL2Bridge{ + RxSwIfIndex: uint32(1), + BdID: 1, + Shg: uint8(0), + PortType: l2ba.L2_API_PORT_TYPE_BVI, + Enable: 1, + })) +} + +func TestAddMissingInterfaceToBridgeDomain(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + // missing: ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2BridgeReply{}) + err := bdHandler.AddInterfaceToBridgeDomain(1, &l2.BridgeDomain_Interface{ + Name: "if1", + BridgedVirtualInterface: true, + SplitHorizonGroup: 0, + }) + + Expect(err).ToNot(BeNil()) + Expect(ctx.MockChannel.Msgs).To(BeEmpty()) +} + +func TestAddInterfaceToBridgeDomainWithError(t *testing.T) { + ctx, bdHandler, ifaceIdx := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2Bridge{}) // wrong reply message type + err := bdHandler.AddInterfaceToBridgeDomain(1, &l2.BridgeDomain_Interface{ + Name: "if1", + BridgedVirtualInterface: true, + SplitHorizonGroup: 0, + }) + + Expect(err).ToNot(BeNil()) + Expect(ctx.MockChannel.Msgs).To(HaveLen(1)) +} + +func TestAddInterfaceToBridgeDomainWithNonZeroRetval(t *testing.T) { + ctx, bdHandler, ifaceIdx := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2BridgeReply{ + Retval: 1, + }) + err := bdHandler.AddInterfaceToBridgeDomain(1, &l2.BridgeDomain_Interface{ + Name: "if1", + BridgedVirtualInterface: true, + SplitHorizonGroup: 0, + }) + + Expect(err).ToNot(BeNil()) + Expect(ctx.MockChannel.Msgs).To(HaveLen(1)) +} + +func TestDeleteInterfaceFromBridgeDomain(t *testing.T) { + ctx, bdHandler, ifaceIdx := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 10}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2BridgeReply{}) + err := bdHandler.DeleteInterfaceFromBridgeDomain(4, &l2.BridgeDomain_Interface{ + Name: "if1", + SplitHorizonGroup: 12, + }) + + Expect(err).To(BeNil()) + Expect(ctx.MockChannel.Msgs).To(HaveLen(1)) + msg := ctx.MockChannel.Msgs[0] + Expect(msg).To(BeEquivalentTo(&l2ba.SwInterfaceSetL2Bridge{ + RxSwIfIndex: uint32(10), + BdID: 4, + Shg: uint8(12), + PortType: l2ba.L2_API_PORT_TYPE_NORMAL, + Enable: 0, + })) +} + +func TestDeleteMissingInterfaceFromBridgeDomain(t *testing.T) { + ctx, bdHandler, _ := bdTestSetup(t) + defer ctx.TeardownTestCtx() + + // missing: ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 10}) + + ctx.MockVpp.MockReply(&l2ba.SwInterfaceSetL2BridgeReply{}) + err := bdHandler.DeleteInterfaceFromBridgeDomain(4, &l2.BridgeDomain_Interface{ + Name: "if1", + SplitHorizonGroup: 12, + }) + + Expect(err).ToNot(BeNil()) + Expect(ctx.MockChannel.Msgs).To(BeEmpty()) +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls.go new file mode 100644 index 0000000000..69089334ea --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls.go @@ -0,0 +1,78 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "errors" + "net" + + l2nb "github.com/ligato/vpp-agent/api/models/vpp/l2" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// AddL2FIB creates L2 FIB table entry. +func (h *FIBVppHandler) AddL2FIB(fib *l2nb.FIBEntry) error { + return h.l2fibAddDel(fib, true) +} + +// DeleteL2FIB removes existing L2 FIB table entry. +func (h *FIBVppHandler) DeleteL2FIB(fib *l2nb.FIBEntry) error { + return h.l2fibAddDel(fib, false) +} + +func (h *FIBVppHandler) l2fibAddDel(fib *l2nb.FIBEntry, isAdd bool) (err error) { + // get bridge domain metadata + bdMeta, found := h.bdIndexes.LookupByName(fib.BridgeDomain) + if !found { + return errors.New("failed to get bridge domain metadata") + } + + // get outgoing interface index + swIfIndex := ^uint32(0) // ~0 is used by DROP entries + if fib.Action == l2nb.FIBEntry_FORWARD { + ifaceMeta, found := h.ifIndexes.LookupByName(fib.OutgoingInterface) + if !found { + return errors.New("failed to get interface metadata") + } + swIfIndex = ifaceMeta.GetIndex() + } + + // parse MAC address + var mac []byte + if fib.PhysAddress != "" { + mac, err = net.ParseMAC(fib.PhysAddress) + if err != nil { + return err + } + } + + // add L2 FIB + req := &l2ba.L2fibAddDel{ + IsAdd: boolToUint(isAdd), + Mac: mac, + BdID: bdMeta.GetIndex(), + SwIfIndex: swIfIndex, + BviMac: boolToUint(fib.BridgedVirtualInterface), + StaticMac: boolToUint(fib.StaticConfig), + FilterMac: boolToUint(fib.Action == l2nb.FIBEntry_DROP), + } + reply := &l2ba.L2fibAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls_test.go new file mode 100644 index 0000000000..cc8a5b0ba2 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/l2fib_vppcalls_test.go @@ -0,0 +1,110 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1908" + + l2nb "github.com/ligato/vpp-agent/api/models/vpp/l2" + "github.com/ligato/vpp-agent/pkg/idxvpp" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +var testDataInFib = []*l2nb.FIBEntry{ + {PhysAddress: "FF:FF:FF:FF:FF:FF", BridgeDomain: "bd1", OutgoingInterface: "if1", Action: l2nb.FIBEntry_FORWARD, StaticConfig: true, BridgedVirtualInterface: true}, + {PhysAddress: "AA:AA:AA:AA:AA:AA", BridgeDomain: "bd1", OutgoingInterface: "if1", Action: l2nb.FIBEntry_FORWARD, StaticConfig: true}, + {PhysAddress: "BB:BB:BB:BB:BB:BB", BridgeDomain: "bd1", Action: l2nb.FIBEntry_DROP}, + {PhysAddress: "CC:CC:CC:CC:CC:CC", BridgeDomain: "bd1", OutgoingInterface: "if1", Action: l2nb.FIBEntry_FORWARD}, +} + +var testDatasOutFib = []*l2ba.L2fibAddDel{ + {BdID: 5, SwIfIndex: 55, BviMac: 1, Mac: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, StaticMac: 1, FilterMac: 0}, + {BdID: 5, SwIfIndex: 55, BviMac: 0, Mac: []byte{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, StaticMac: 1, FilterMac: 0}, + {BdID: 5, SwIfIndex: ^uint32(0), BviMac: 0, Mac: []byte{0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB}, StaticMac: 0, FilterMac: 1}, + {BdID: 5, SwIfIndex: 55, BviMac: 0, Mac: []byte{0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC}, StaticMac: 0, FilterMac: 0}, +} + +func TestL2FibAdd(t *testing.T) { + ctx, fibHandler, ifaceIdx, bdIndexes := fibTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 55}) + bdIndexes.Put("bd1", &idxvpp.OnlyIndex{Index: 5}) + + for i := 0; i < len(testDataInFib); i++ { + ctx.MockVpp.MockReply(&l2ba.L2fibAddDelReply{}) + err := fibHandler.AddL2FIB(testDataInFib[i]) + Expect(err).ShouldNot(HaveOccurred()) + testDatasOutFib[i].IsAdd = 1 + Expect(ctx.MockChannel.Msg).To(Equal(testDatasOutFib[i])) + } +} + +func TestL2FibAddError(t *testing.T) { + ctx, fibHandler, ifaceIdx, bdIndexes := fibTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 55}) + bdIndexes.Put("bd1", &idxvpp.OnlyIndex{Index: 5}) + + err := fibHandler.AddL2FIB(&l2nb.FIBEntry{PhysAddress: "not:mac:addr", BridgeDomain: "bd1", OutgoingInterface: "if1"}) + Expect(err).Should(HaveOccurred()) + + ctx.MockVpp.MockReply(&l2ba.L2fibAddDelReply{Retval: 1}) + err = fibHandler.AddL2FIB(testDataInFib[0]) + Expect(err).Should(HaveOccurred()) + + ctx.MockVpp.MockReply(&l2ba.BridgeDomainAddDelReply{}) + err = fibHandler.AddL2FIB(testDataInFib[0]) + Expect(err).Should(HaveOccurred()) + + err = fibHandler.AddL2FIB(&l2nb.FIBEntry{PhysAddress: "CC:CC:CC:CC:CC:CC", BridgeDomain: "non-existing-bd", OutgoingInterface: "if1"}) + Expect(err).Should(HaveOccurred()) + + err = fibHandler.AddL2FIB(&l2nb.FIBEntry{PhysAddress: "CC:CC:CC:CC:CC:CC", BridgeDomain: "bd1", OutgoingInterface: "non-existing-iface"}) + Expect(err).Should(HaveOccurred()) +} + +func TestL2FibDelete(t *testing.T) { + ctx, fibHandler, ifaceIdx, bdIndexes := fibTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 55}) + bdIndexes.Put("bd1", &idxvpp.OnlyIndex{Index: 5}) + + for i := 0; i < len(testDataInFib); i++ { + ctx.MockVpp.MockReply(&l2ba.L2fibAddDelReply{}) + err := fibHandler.DeleteL2FIB(testDataInFib[i]) + Expect(err).ShouldNot(HaveOccurred()) + testDatasOutFib[i].IsAdd = 0 + Expect(ctx.MockChannel.Msg).To(Equal(testDatasOutFib[i])) + } +} + +func fibTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.FIBVppAPI, ifaceidx.IfaceMetadataIndexRW, idxvpp.NameToIndexRW) { + ctx := vppcallmock.SetupTestCtx(t) + logger := logrus.NewLogger("test-log") + ifaceIdx := ifaceidx.NewIfaceIndex(logger, "fib-if-idx") + bdIndexes := idxvpp.NewNameToIndex(logger, "fib-bd-idx", nil) + fibHandler := vpp1908.NewL2VppHandler(ctx.MockChannel, ifaceIdx, bdIndexes, logger) + return ctx, fibHandler, ifaceIdx, bdIndexes +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/vppcalls_handler.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/vppcalls_handler.go new file mode 100644 index 0000000000..92bbe89b79 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/vppcalls_handler.go @@ -0,0 +1,124 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging" + + "github.com/ligato/vpp-agent/pkg/idxvpp" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" +) + +func init() { + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: l2ba.AllMessages(), + New: func(ch govppapi.Channel, + ifIdx ifaceidx.IfaceMetadataIndex, bdIdx idxvpp.NameToIndex, log logging.Logger, + ) vppcalls.L2VppAPI { + return NewL2VppHandler(ch, ifIdx, bdIdx, log) + }, + } +} + +type L2VppHandler struct { + *BridgeDomainVppHandler + *FIBVppHandler + *XConnectVppHandler +} + +func NewL2VppHandler(ch govppapi.Channel, + ifIdx ifaceidx.IfaceMetadataIndex, bdIdx idxvpp.NameToIndex, log logging.Logger, +) *L2VppHandler { + return &L2VppHandler{ + BridgeDomainVppHandler: newBridgeDomainVppHandler(ch, ifIdx, log), + FIBVppHandler: newFIBVppHandler(ch, ifIdx, bdIdx, log), + XConnectVppHandler: newXConnectVppHandler(ch, ifIdx, log), + } +} + +// BridgeDomainVppHandler is accessor for bridge domain-related vppcalls methods. +type BridgeDomainVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +// FIBVppHandler is accessor for FIB-related vppcalls methods. +type FIBVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + bdIndexes idxvpp.NameToIndex + log logging.Logger +} + +// XConnectVppHandler is accessor for cross-connect-related vppcalls methods. +type XConnectVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +// NewBridgeDomainVppHandler creates new instance of bridge domain vppcalls handler. +func newBridgeDomainVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *BridgeDomainVppHandler { + return &BridgeDomainVppHandler{ + callsChannel: ch, + ifIndexes: ifIdx, + log: log, + } +} + +// NewFIBVppHandler creates new instance of FIB vppcalls handler. +func newFIBVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, bdIndexes idxvpp.NameToIndex, log logging.Logger) *FIBVppHandler { + return &FIBVppHandler{ + callsChannel: ch, + ifIndexes: ifIdx, + bdIndexes: bdIndexes, + log: log, + } +} + +// NewXConnectVppHandler creates new instance of cross connect vppcalls handler. +func newXConnectVppHandler(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger) *XConnectVppHandler { + return &XConnectVppHandler{ + callsChannel: ch, + ifIndexes: ifIdx, + log: log, + } +} + +func ipToAddress(ipstr string) (addr l2ba.Address, err error) { + netIP := net.ParseIP(ipstr) + if netIP == nil { + return l2ba.Address{}, fmt.Errorf("invalid IP: %q", ipstr) + } + if ip4 := netIP.To4(); ip4 == nil { + addr.Af = l2ba.ADDRESS_IP6 + var ip6addr l2ba.IP6Address + copy(ip6addr[:], netIP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = l2ba.ADDRESS_IP4 + var ip4addr l2ba.IP4Address + copy(ip4addr[:], ip4) + addr.Un.SetIP4(ip4addr) + } + return +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls.go new file mode 100644 index 0000000000..e0155e3de8 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls.go @@ -0,0 +1,59 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "errors" + + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" +) + +// AddL2XConnect creates xConnect between two existing interfaces. +func (h *XConnectVppHandler) AddL2XConnect(rxIface, txIface string) error { + return h.addDelXConnect(rxIface, txIface, true) +} + +// DeleteL2XConnect removes xConnect between two interfaces. +func (h *XConnectVppHandler) DeleteL2XConnect(rxIface, txIface string) error { + return h.addDelXConnect(rxIface, txIface, false) +} + +func (h *XConnectVppHandler) addDelXConnect(rxIface, txIface string, enable bool) error { + // get Rx interface metadata + rxIfaceMeta, found := h.ifIndexes.LookupByName(rxIface) + if !found { + return errors.New("failed to get Rx interface metadata") + } + + // get Tx interface metadata + txIfaceMeta, found := h.ifIndexes.LookupByName(txIface) + if !found { + return errors.New("failed to get Tx interface metadata") + } + + // add/del xConnect pair + req := &l2ba.SwInterfaceSetL2Xconnect{ + Enable: boolToUint(enable), + TxSwIfIndex: txIfaceMeta.GetIndex(), + RxSwIfIndex: rxIfaceMeta.GetIndex(), + } + reply := &l2ba.SwInterfaceSetL2XconnectReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls_test.go b/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls_test.go new file mode 100644 index 0000000000..756d3a4be0 --- /dev/null +++ b/plugins/vpp/l2plugin/vppcalls/vpp1908/xconnect_vppcalls_test.go @@ -0,0 +1,128 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging/logrus" + l2ba "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/l2" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l2plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +var inTestDataXConnect = []struct { + receiveIfaceIndex string + transmitIfaceIndex string + message govppapi.Message +}{ + {"rxIf1", "txIf1", &l2ba.SwInterfaceSetL2XconnectReply{}}, + {"rxIf2", "txIf2", &l2ba.SwInterfaceSetL2XconnectReply{Retval: 1}}, + {"rxIf2", "txIf2", &l2ba.BridgeDomainAddDelReply{}}, +} + +var outTestDataXConnect = []struct { + outData *l2ba.SwInterfaceSetL2Xconnect + isResultOk bool +}{ + {&l2ba.SwInterfaceSetL2Xconnect{ + RxSwIfIndex: 100, + TxSwIfIndex: 200, + }, true}, + {&l2ba.SwInterfaceSetL2Xconnect{ + RxSwIfIndex: 101, + TxSwIfIndex: 201, + }, false}, + {&l2ba.SwInterfaceSetL2Xconnect{ + RxSwIfIndex: 101, + TxSwIfIndex: 201, + }, false}, +} + +/** +scenarios: +- enabling xconnect + - ok + - retvalue != 0 + - returned VPP message != what is expected +*/ +// TestVppSetL2XConnect tests VppSetL2XConnect method +func TestVppSetL2XConnect(t *testing.T) { + ctx, xcHandler, ifaceIdx := xcTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("rxIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 100}) + ifaceIdx.Put("rxIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 101}) + ifaceIdx.Put("txIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 200}) + ifaceIdx.Put("txIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 201}) + + for i := 0; i < len(inTestDataXConnect); i++ { + ctx.MockVpp.MockReply(inTestDataXConnect[i].message) + err := xcHandler.AddL2XConnect(inTestDataXConnect[i].receiveIfaceIndex, + inTestDataXConnect[i].transmitIfaceIndex) + + if outTestDataXConnect[i].isResultOk { + Expect(err).To(BeNil()) + } else { + Expect(err).NotTo(BeNil()) + } + outTestDataXConnect[i].outData.Enable = 1 + Expect(ctx.MockChannel.Msg).To(Equal(outTestDataXConnect[i].outData)) + } +} + +/** +scenarios: +- disabling xconnect + - ok + - retvalue != 0 + - returned VPP message != what is expected +*/ +// TestVppUnsetL2XConnect tests VppUnsetL2XConnect method +func TestVppUnsetL2XConnect(t *testing.T) { + ctx, xcHandler, ifaceIdx := xcTestSetup(t) + defer ctx.TeardownTestCtx() + + ifaceIdx.Put("rxIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 100}) + ifaceIdx.Put("rxIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 101}) + ifaceIdx.Put("txIf1", &ifaceidx.IfaceMetadata{SwIfIndex: 200}) + ifaceIdx.Put("txIf2", &ifaceidx.IfaceMetadata{SwIfIndex: 201}) + + for i := 0; i < len(inTestDataXConnect); i++ { + ctx.MockVpp.MockReply(inTestDataXConnect[i].message) + err := xcHandler.DeleteL2XConnect(inTestDataXConnect[i].receiveIfaceIndex, + inTestDataXConnect[i].transmitIfaceIndex) + + if outTestDataXConnect[i].isResultOk { + Expect(err).To(BeNil()) + } else { + Expect(err).NotTo(BeNil()) + } + outTestDataXConnect[i].outData.Enable = 0 + Expect(ctx.MockChannel.Msg).To(Equal(outTestDataXConnect[i].outData)) + } +} + +func xcTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.XConnectVppAPI, ifaceidx.IfaceMetadataIndexRW) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifaceIdx := ifaceidx.NewIfaceIndex(log, "xc-if-idx") + xcHandler := vpp1908.NewL2VppHandler(ctx.MockChannel, ifaceIdx, nil, log) + return ctx, xcHandler, ifaceIdx +} diff --git a/plugins/vpp/l3plugin/descriptor/adapter/dhcpproxy.go b/plugins/vpp/l3plugin/descriptor/adapter/dhcpproxy.go new file mode 100644 index 0000000000..dc63ff2859 --- /dev/null +++ b/plugins/vpp/l3plugin/descriptor/adapter/dhcpproxy.go @@ -0,0 +1,233 @@ +// Code generated by adapter-generator. DO NOT EDIT. + +package adapter + +import ( + "github.com/gogo/protobuf/proto" + . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/api/models/vpp/l3" +) + +////////// type-safe key-value pair with metadata ////////// + +type DHCPProxyKVWithMetadata struct { + Key string + Value *vpp_l3.DHCPProxy + Metadata interface{} + Origin ValueOrigin +} + +////////// type-safe Descriptor structure ////////// + +type DHCPProxyDescriptor struct { + Name string + KeySelector KeySelector + ValueTypeName string + KeyLabel func(key string) string + ValueComparator func(key string, oldValue, newValue *vpp_l3.DHCPProxy) bool + NBKeyPrefix string + WithMetadata bool + MetadataMapFactory MetadataMapFactory + Validate func(key string, value *vpp_l3.DHCPProxy) error + Create func(key string, value *vpp_l3.DHCPProxy) (metadata interface{}, err error) + Delete func(key string, value *vpp_l3.DHCPProxy, metadata interface{}) error + Update func(key string, oldValue, newValue *vpp_l3.DHCPProxy, oldMetadata interface{}) (newMetadata interface{}, err error) + UpdateWithRecreate func(key string, oldValue, newValue *vpp_l3.DHCPProxy, metadata interface{}) bool + Retrieve func(correlate []DHCPProxyKVWithMetadata) ([]DHCPProxyKVWithMetadata, error) + IsRetriableFailure func(err error) bool + DerivedValues func(key string, value *vpp_l3.DHCPProxy) []KeyValuePair + Dependencies func(key string, value *vpp_l3.DHCPProxy) []Dependency + RetrieveDependencies []string /* descriptor name */ +} + +////////// Descriptor adapter ////////// + +type DHCPProxyDescriptorAdapter struct { + descriptor *DHCPProxyDescriptor +} + +func NewDHCPProxyDescriptor(typedDescriptor *DHCPProxyDescriptor) *KVDescriptor { + adapter := &DHCPProxyDescriptorAdapter{descriptor: typedDescriptor} + descriptor := &KVDescriptor{ + Name: typedDescriptor.Name, + KeySelector: typedDescriptor.KeySelector, + ValueTypeName: typedDescriptor.ValueTypeName, + KeyLabel: typedDescriptor.KeyLabel, + NBKeyPrefix: typedDescriptor.NBKeyPrefix, + WithMetadata: typedDescriptor.WithMetadata, + MetadataMapFactory: typedDescriptor.MetadataMapFactory, + IsRetriableFailure: typedDescriptor.IsRetriableFailure, + RetrieveDependencies: typedDescriptor.RetrieveDependencies, + } + if typedDescriptor.ValueComparator != nil { + descriptor.ValueComparator = adapter.ValueComparator + } + if typedDescriptor.Validate != nil { + descriptor.Validate = adapter.Validate + } + if typedDescriptor.Create != nil { + descriptor.Create = adapter.Create + } + if typedDescriptor.Delete != nil { + descriptor.Delete = adapter.Delete + } + if typedDescriptor.Update != nil { + descriptor.Update = adapter.Update + } + if typedDescriptor.UpdateWithRecreate != nil { + descriptor.UpdateWithRecreate = adapter.UpdateWithRecreate + } + if typedDescriptor.Retrieve != nil { + descriptor.Retrieve = adapter.Retrieve + } + if typedDescriptor.Dependencies != nil { + descriptor.Dependencies = adapter.Dependencies + } + if typedDescriptor.DerivedValues != nil { + descriptor.DerivedValues = adapter.DerivedValues + } + return descriptor +} + +func (da *DHCPProxyDescriptorAdapter) ValueComparator(key string, oldValue, newValue proto.Message) bool { + typedOldValue, err1 := castDHCPProxyValue(key, oldValue) + typedNewValue, err2 := castDHCPProxyValue(key, newValue) + if err1 != nil || err2 != nil { + return false + } + return da.descriptor.ValueComparator(key, typedOldValue, typedNewValue) +} + +func (da *DHCPProxyDescriptorAdapter) Validate(key string, value proto.Message) (err error) { + typedValue, err := castDHCPProxyValue(key, value) + if err != nil { + return err + } + return da.descriptor.Validate(key, typedValue) +} + +func (da *DHCPProxyDescriptorAdapter) Create(key string, value proto.Message) (metadata Metadata, err error) { + typedValue, err := castDHCPProxyValue(key, value) + if err != nil { + return nil, err + } + return da.descriptor.Create(key, typedValue) +} + +func (da *DHCPProxyDescriptorAdapter) Update(key string, oldValue, newValue proto.Message, oldMetadata Metadata) (newMetadata Metadata, err error) { + oldTypedValue, err := castDHCPProxyValue(key, oldValue) + if err != nil { + return nil, err + } + newTypedValue, err := castDHCPProxyValue(key, newValue) + if err != nil { + return nil, err + } + typedOldMetadata, err := castDHCPProxyMetadata(key, oldMetadata) + if err != nil { + return nil, err + } + return da.descriptor.Update(key, oldTypedValue, newTypedValue, typedOldMetadata) +} + +func (da *DHCPProxyDescriptorAdapter) Delete(key string, value proto.Message, metadata Metadata) error { + typedValue, err := castDHCPProxyValue(key, value) + if err != nil { + return err + } + typedMetadata, err := castDHCPProxyMetadata(key, metadata) + if err != nil { + return err + } + return da.descriptor.Delete(key, typedValue, typedMetadata) +} + +func (da *DHCPProxyDescriptorAdapter) UpdateWithRecreate(key string, oldValue, newValue proto.Message, metadata Metadata) bool { + oldTypedValue, err := castDHCPProxyValue(key, oldValue) + if err != nil { + return true + } + newTypedValue, err := castDHCPProxyValue(key, newValue) + if err != nil { + return true + } + typedMetadata, err := castDHCPProxyMetadata(key, metadata) + if err != nil { + return true + } + return da.descriptor.UpdateWithRecreate(key, oldTypedValue, newTypedValue, typedMetadata) +} + +func (da *DHCPProxyDescriptorAdapter) Retrieve(correlate []KVWithMetadata) ([]KVWithMetadata, error) { + var correlateWithType []DHCPProxyKVWithMetadata + for _, kvpair := range correlate { + typedValue, err := castDHCPProxyValue(kvpair.Key, kvpair.Value) + if err != nil { + continue + } + typedMetadata, err := castDHCPProxyMetadata(kvpair.Key, kvpair.Metadata) + if err != nil { + continue + } + correlateWithType = append(correlateWithType, + DHCPProxyKVWithMetadata{ + Key: kvpair.Key, + Value: typedValue, + Metadata: typedMetadata, + Origin: kvpair.Origin, + }) + } + + typedValues, err := da.descriptor.Retrieve(correlateWithType) + if err != nil { + return nil, err + } + var values []KVWithMetadata + for _, typedKVWithMetadata := range typedValues { + kvWithMetadata := KVWithMetadata{ + Key: typedKVWithMetadata.Key, + Metadata: typedKVWithMetadata.Metadata, + Origin: typedKVWithMetadata.Origin, + } + kvWithMetadata.Value = typedKVWithMetadata.Value + values = append(values, kvWithMetadata) + } + return values, err +} + +func (da *DHCPProxyDescriptorAdapter) DerivedValues(key string, value proto.Message) []KeyValuePair { + typedValue, err := castDHCPProxyValue(key, value) + if err != nil { + return nil + } + return da.descriptor.DerivedValues(key, typedValue) +} + +func (da *DHCPProxyDescriptorAdapter) Dependencies(key string, value proto.Message) []Dependency { + typedValue, err := castDHCPProxyValue(key, value) + if err != nil { + return nil + } + return da.descriptor.Dependencies(key, typedValue) +} + +////////// Helper methods ////////// + +func castDHCPProxyValue(key string, value proto.Message) (*vpp_l3.DHCPProxy, error) { + typedValue, ok := value.(*vpp_l3.DHCPProxy) + if !ok { + return nil, ErrInvalidValueType(key, value) + } + return typedValue, nil +} + +func castDHCPProxyMetadata(key string, metadata Metadata) (interface{}, error) { + if metadata == nil { + return nil, nil + } + typedMetadata, ok := metadata.(interface{}) + if !ok { + return nil, ErrInvalidMetadataType(key) + } + return typedMetadata, nil +} diff --git a/plugins/vpp/l3plugin/descriptor/adapter/vrftable.go b/plugins/vpp/l3plugin/descriptor/adapter/vrftable.go index 69036cfaac..9361840217 100644 --- a/plugins/vpp/l3plugin/descriptor/adapter/vrftable.go +++ b/plugins/vpp/l3plugin/descriptor/adapter/vrftable.go @@ -5,6 +5,7 @@ package adapter import ( "github.com/gogo/protobuf/proto" . "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" "github.com/ligato/vpp-agent/api/models/vpp/l3" ) @@ -13,7 +14,7 @@ import ( type VrfTableKVWithMetadata struct { Key string Value *vpp_l3.VrfTable - Metadata interface{} + Metadata *vrfidx.VRFMetadata Origin ValueOrigin } @@ -29,10 +30,10 @@ type VrfTableDescriptor struct { WithMetadata bool MetadataMapFactory MetadataMapFactory Validate func(key string, value *vpp_l3.VrfTable) error - Create func(key string, value *vpp_l3.VrfTable) (metadata interface{}, err error) - Delete func(key string, value *vpp_l3.VrfTable, metadata interface{}) error - Update func(key string, oldValue, newValue *vpp_l3.VrfTable, oldMetadata interface{}) (newMetadata interface{}, err error) - UpdateWithRecreate func(key string, oldValue, newValue *vpp_l3.VrfTable, metadata interface{}) bool + Create func(key string, value *vpp_l3.VrfTable) (metadata *vrfidx.VRFMetadata, err error) + Delete func(key string, value *vpp_l3.VrfTable, metadata *vrfidx.VRFMetadata) error + Update func(key string, oldValue, newValue *vpp_l3.VrfTable, oldMetadata *vrfidx.VRFMetadata) (newMetadata *vrfidx.VRFMetadata, err error) + UpdateWithRecreate func(key string, oldValue, newValue *vpp_l3.VrfTable, metadata *vrfidx.VRFMetadata) bool Retrieve func(correlate []VrfTableKVWithMetadata) ([]VrfTableKVWithMetadata, error) IsRetriableFailure func(err error) bool DerivedValues func(key string, value *vpp_l3.VrfTable) []KeyValuePair @@ -221,11 +222,11 @@ func castVrfTableValue(key string, value proto.Message) (*vpp_l3.VrfTable, error return typedValue, nil } -func castVrfTableMetadata(key string, metadata Metadata) (interface{}, error) { +func castVrfTableMetadata(key string, metadata Metadata) (*vrfidx.VRFMetadata, error) { if metadata == nil { return nil, nil } - typedMetadata, ok := metadata.(interface{}) + typedMetadata, ok := metadata.(*vrfidx.VRFMetadata) if !ok { return nil, ErrInvalidMetadataType(key) } diff --git a/plugins/vpp/l3plugin/descriptor/dhcp_proxy.go b/plugins/vpp/l3plugin/descriptor/dhcp_proxy.go new file mode 100644 index 0000000000..af27361eef --- /dev/null +++ b/plugins/vpp/l3plugin/descriptor/dhcp_proxy.go @@ -0,0 +1,156 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package descriptor + +import ( + "net" + + "github.com/ligato/cn-infra/logging" + "github.com/ligato/cn-infra/utils/addrs" + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/descriptor/adapter" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/pkg/errors" +) + +const ( + // ProxyArpInterfaceDescriptorName is the name of the descriptor. + DHCPProxyDescriptorName = "dhcp-proxy" + + //dependecy labels + vrfTableDependency = "vrf-table-exists" +) + +// DHCPProxyDescriptor teaches KVScheduler how to configure VPP DHCP proxy. +type DHCPProxyDescriptor struct { + log logging.Logger + dhcpProxyHandler vppcalls.DHCPProxyAPI + scheduler kvs.KVScheduler +} + +// NewDHCPProxyDescriptor creates a new instance of the DHCPProxyDescriptor. +func NewDHCPProxyDescriptor(scheduler kvs.KVScheduler, + dhcpProxyHandler vppcalls.DHCPProxyAPI, log logging.PluginLogger) *kvs.KVDescriptor { + + ctx := &DHCPProxyDescriptor{ + scheduler: scheduler, + dhcpProxyHandler: dhcpProxyHandler, + log: log.NewLogger("dhcp-proxy-descriptor"), + } + + typedDescr := &adapter.DHCPProxyDescriptor{ + Name: DHCPProxyDescriptorName, + KeySelector: l3.ModelDHCPProxy.IsKeyValid, + KeyLabel: l3.ModelDHCPProxy.StripKeyPrefix, + NBKeyPrefix: l3.ModelDHCPProxy.KeyPrefix(), + ValueTypeName: l3.ModelDHCPProxy.ProtoName(), + Create: ctx.Create, + Delete: ctx.Delete, + Retrieve: ctx.Retrieve, + Dependencies: ctx.Dependencies, + Validate: ctx.Validate, + } + return adapter.NewDHCPProxyDescriptor(typedDescr) +} + +func (d *DHCPProxyDescriptor) Validate(key string, value *l3.DHCPProxy) error { + + ipAddr := net.ParseIP(value.SourceIpAddress) + if ipAddr == nil { + return errors.Errorf("invalid source IP address: %q", value.SourceIpAddress) + } + + for _, server := range value.Servers { + serverIPAddr := net.ParseIP(server.IpAddress) + if serverIPAddr == nil { + return errors.Errorf("invalid server IP address: %q", server.IpAddress) + } + + if ipAddr.To4() != nil && serverIPAddr.To4() == nil || serverIPAddr.To4() != nil && ipAddr.To4() == nil { + return errors.Errorf("Server address %s must use same IP protocol as source address %s", + serverIPAddr, ipAddr) + } + } + return nil +} + +// Dependencies lists dependencies for a VPP DHCP proxy. +func (d *DHCPProxyDescriptor) Dependencies(key string, value *l3.DHCPProxy) (deps []kvs.Dependency) { + // non-zero VRFs + var protocol l3.VrfTable_Protocol + _, isIPv6, _ := addrs.ParseIPWithPrefix(value.SourceIpAddress) + if isIPv6 { + protocol = l3.VrfTable_IPV6 + } + + if value.RxVrfId != 0 { + deps = append(deps, kvs.Dependency{ + Label: vrfTableDependency, + Key: l3.VrfTableKey(value.RxVrfId, protocol), + }) + } + + for _, server := range value.Servers { + if server.VrfId != 0 { + deps = append(deps, kvs.Dependency{ + Label: vrfTableDependency, + Key: l3.VrfTableKey(server.VrfId, protocol), + }) + } + } + + return deps +} + +// Create enables VPP DHCP proxy. +func (d *DHCPProxyDescriptor) Create(key string, value *l3.DHCPProxy) (metadata interface{}, err error) { + if err := d.dhcpProxyHandler.CreateDHCPProxy(value); err != nil { + return nil, errors.Errorf("failed to create DHCP proxy %v", err) + } + return nil, nil +} + +// Delete disables VPP DHCP proxy. +func (d *DHCPProxyDescriptor) Delete(key string, value *l3.DHCPProxy, metadata interface{}) error { + if err := d.dhcpProxyHandler.DeleteDHCPProxy(value); err != nil { + return errors.Errorf("failed to delete DHCP proxy %v", err) + } + return nil +} + +// Retrieve returns current VPP DHCP proxy configuration. +func (d *DHCPProxyDescriptor) Retrieve(correlate []adapter.DHCPProxyKVWithMetadata) (retrieved []adapter.DHCPProxyKVWithMetadata, err error) { + // Retrieve VPP configuration + dhcpProxyDetails, err := d.dhcpProxyHandler.DumpDHCPProxy() + + if err != nil { + return nil, err + } + + if dhcpProxyDetails == nil { + return nil, nil + } + + for _, detail := range dhcpProxyDetails { + retrieved = append(retrieved, adapter.DHCPProxyKVWithMetadata{ + Key: l3.DHCPProxyKey(detail.DHCPProxy.SourceIpAddress), + Value: detail.DHCPProxy, + Origin: kvs.FromNB, + }) + } + + return retrieved, nil +} diff --git a/plugins/vpp/l3plugin/descriptor/route.go b/plugins/vpp/l3plugin/descriptor/route.go index 53b6da0491..b138951a08 100644 --- a/plugins/vpp/l3plugin/descriptor/route.go +++ b/plugins/vpp/l3plugin/descriptor/route.go @@ -23,13 +23,14 @@ import ( "github.com/pkg/errors" "github.com/ligato/cn-infra/logging" + "github.com/ligato/cn-infra/utils/addrs" interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces" l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/pkg/models" kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" ifdescriptor "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/descriptor" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/descriptor/adapter" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" - "github.com/ligato/cn-infra/utils/addrs" ) const ( @@ -38,8 +39,8 @@ const ( // dependency labels routeOutInterfaceDep = "interface-exists" - vrfTableDep = "vrf-table-exists" - viaVrfTableDep = "via-vrf-table-exists" + vrfTableDep = "vrf-table-exists" + viaVrfTableDep = "via-vrf-table-exists" // static route weight by default defaultWeight = 1 @@ -71,7 +72,7 @@ func NewRouteDescriptor( Delete: ctx.Delete, Retrieve: ctx.Retrieve, Dependencies: ctx.Dependencies, - RetrieveDependencies: []string{ifdescriptor.InterfaceDescriptorName}, + RetrieveDependencies: []string{ifdescriptor.InterfaceDescriptorName, VrfTableDescriptorName}, } return adapter.NewRouteDescriptor(typedDescr) } @@ -102,19 +103,23 @@ func (d *RouteDescriptor) EquivalentRoutes(key string, oldRoute, newRoute *l3.Ro // Validate validates VPP static route configuration. func (d *RouteDescriptor) Validate(key string, route *l3.Route) (err error) { + // validation destination network _, ipNet, err := net.ParseCIDR(route.DstNetwork) if err != nil { return kvs.NewInvalidValueError(err, "dst_network") } + + // validate IP network implied by the IP and prefix length if strings.ToLower(ipNet.String()) != strings.ToLower(route.DstNetwork) { - return kvs.NewInvalidValueError( - fmt.Errorf("DstNetwork (%s) must represent IP network (%s)", route.DstNetwork, ipNet.String()), - "dst_network") + e := fmt.Errorf("DstNetwork (%s) must represent IP network (%s)", route.DstNetwork, ipNet.String()) + return kvs.NewInvalidValueError(e, "dst_network") } + + // TODO: validate mix of IP versions? + return nil } - // Create adds VPP static route. func (d *RouteDescriptor) Create(key string, route *l3.Route) (metadata interface{}, err error) { err = d.routeHandler.VppAddRoute(route) @@ -140,15 +145,15 @@ func (d *RouteDescriptor) Retrieve(correlate []adapter.RouteKVWithMetadata) ( retrieved []adapter.RouteKVWithMetadata, err error, ) { // Retrieve VPP route configuration - Routes, err := d.routeHandler.DumpRoutes() + routes, err := d.routeHandler.DumpRoutes() if err != nil { return nil, errors.Errorf("failed to dump VPP routes: %v", err) } - for _, Route := range Routes { + for _, route := range routes { retrieved = append(retrieved, adapter.RouteKVWithMetadata{ - Key: l3.RouteKey(Route.Route.VrfId, Route.Route.DstNetwork, Route.Route.NextHopAddr), - Value: Route.Route, + Key: models.Key(route.Route), + Value: route.Route, Origin: kvs.UnknownOrigin, }) } diff --git a/plugins/vpp/l3plugin/descriptor/vrf_table.go b/plugins/vpp/l3plugin/descriptor/vrf_table.go index ff7be47983..1743a99fd6 100644 --- a/plugins/vpp/l3plugin/descriptor/vrf_table.go +++ b/plugins/vpp/l3plugin/descriptor/vrf_table.go @@ -18,6 +18,8 @@ import ( "fmt" "strings" + "github.com/ligato/cn-infra/idxmap" + "github.com/pkg/errors" "github.com/ligato/cn-infra/logging" @@ -25,6 +27,7 @@ import ( kvs "github.com/ligato/vpp-agent/plugins/kvscheduler/api" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/descriptor/adapter" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" ) const ( @@ -62,6 +65,8 @@ func NewVrfTableDescriptor( ValueTypeName: l3.ModelVrfTable.ProtoName(), KeySelector: l3.ModelVrfTable.IsKeyValid, KeyLabel: l3.ModelVrfTable.StripKeyPrefix, + WithMetadata: true, + MetadataMapFactory: ctx.MetadataFactory, ValueComparator: ctx.EquivalentVrfTables, Validate: ctx.Validate, Create: ctx.Create, @@ -79,6 +84,11 @@ func (d *VrfTableDescriptor) EquivalentVrfTables(key string, oldVrfTable, newVrf return true } +// MetadataFactory is a factory for index-map customized for VRFs. +func (d *VrfTableDescriptor) MetadataFactory() idxmap.NamedMappingRW { + return vrfidx.NewVRFIndex(d.log, "vpp-vrf-index") +} + // Validate validates configuration of VPP VRF table. func (d *VrfTableDescriptor) Validate(key string, vrfTable *l3.VrfTable) (err error) { if len(vrfTable.Label) > labelLengthLimit { @@ -88,7 +98,7 @@ func (d *VrfTableDescriptor) Validate(key string, vrfTable *l3.VrfTable) (err er } // Create adds VPP VRF table. -func (d *VrfTableDescriptor) Create(key string, vrfTable *l3.VrfTable) (metadata interface{}, err error) { +func (d *VrfTableDescriptor) Create(key string, vrfTable *l3.VrfTable) (metadata *vrfidx.VRFMetadata, err error) { if vrfTable.Id == 0 { // nothing to do, automatically created by VPP } @@ -97,11 +107,17 @@ func (d *VrfTableDescriptor) Create(key string, vrfTable *l3.VrfTable) (metadata return nil, err } - return nil, nil + // fill the metadata + metadata = &vrfidx.VRFMetadata{ + Index: vrfTable.Id, + Protocol: vrfTable.Protocol, + } + + return metadata, nil } // Delete removes VPP VRF table. -func (d *VrfTableDescriptor) Delete(key string, vrfTable *l3.VrfTable, metadata interface{}) error { +func (d *VrfTableDescriptor) Delete(key string, vrfTable *l3.VrfTable, metadata *vrfidx.VRFMetadata) error { if vrfTable.Id == 0 { // nothing to do, VRF ID=0 always exists } @@ -128,8 +144,12 @@ func (d *VrfTableDescriptor) Retrieve(correlate []adapter.VrfTableKVWithMetadata origin = kvs.FromNB } retrieved = append(retrieved, adapter.VrfTableKVWithMetadata{ - Key: l3.VrfTableKey(table.Id, table.Protocol), - Value: table, + Key: l3.VrfTableKey(table.Id, table.Protocol), + Value: table, + Metadata: &vrfidx.VRFMetadata{ + Index: table.Id, + Protocol: table.Protocol, + }, Origin: origin, }) } diff --git a/plugins/vpp/l3plugin/l3plugin.go b/plugins/vpp/l3plugin/l3plugin.go index 408de286c2..b1eabaaba0 100644 --- a/plugins/vpp/l3plugin/l3plugin.go +++ b/plugins/vpp/l3plugin/l3plugin.go @@ -17,7 +17,8 @@ //go:generate descriptor-adapter --descriptor-name ProxyARP --value-type *vpp_l3.ProxyARP --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" //go:generate descriptor-adapter --descriptor-name ProxyARPInterface --value-type *vpp_l3.ProxyARP_Interface --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" //go:generate descriptor-adapter --descriptor-name IPScanNeighbor --value-type *vpp_l3.IPScanNeighbor --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" -//go:generate descriptor-adapter --descriptor-name VrfTable --value-type *vpp_l3.VrfTable --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" +//go:generate descriptor-adapter --descriptor-name VrfTable --value-type *vpp_l3.VrfTable --meta-type *vrfidx.VRFMetadata --import "vrfidx" --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" +//go:generate descriptor-adapter --descriptor-name DHCPProxy --value-type *vpp_l3.DHCPProxy --import "github.com/ligato/vpp-agent/api/models/vpp/l3" --output-dir "descriptor" package l3plugin @@ -32,9 +33,11 @@ import ( "github.com/ligato/vpp-agent/plugins/vpp/ifplugin" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/descriptor" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" _ "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1901" _ "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1904" + _ "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1908" ) // L3Plugin configures Linux routes and ARP entries using Netlink API. @@ -47,9 +50,13 @@ type L3Plugin struct { // VPP handler l3Handler vppcalls.L3VppAPI + // index maps + vrfIndex vrfidx.VRFMetadataIndex + // descriptors proxyArpIfaceDescriptor *descriptor.ProxyArpInterfaceDescriptor ipScanNeighborDescriptor *descriptor.IPScanNeighborDescriptor + dhcpProxyDescriptor *descriptor.DHCPProxyDescriptor } // Deps lists dependencies of the interface p. @@ -71,7 +78,25 @@ func (p *L3Plugin) Init() error { } // init handlers - p.l3Handler = vppcalls.CompatibleL3VppHandler(p.vppCh, p.IfPlugin.GetInterfaceIndex(), p.Log) + p.l3Handler = vppcalls.CompatibleL3VppHandler(p.vppCh, p.IfPlugin.GetInterfaceIndex(), p.vrfIndex, p.Log) + if p.l3Handler == nil { + return errors.Errorf("could not find compatible L2VppHandler") + } + + // init and register VRF descriptor + vrfTableDescriptor := descriptor.NewVrfTableDescriptor(p.l3Handler, p.Log) + if err = p.Deps.KVScheduler.RegisterKVDescriptor(vrfTableDescriptor); err != nil { + return err + } + metadataMap := p.KVScheduler.GetMetadataMap(vrfTableDescriptor.Name) + var withIndex bool + p.vrfIndex, withIndex = metadataMap.(vrfidx.VRFMetadataIndex) + if !withIndex { + return errors.New("missing index with VRF metadata") + } + + // set l3 handler again since it was nil before + p.l3Handler = vppcalls.CompatibleL3VppHandler(p.vppCh, p.IfPlugin.GetInterfaceIndex(), p.vrfIndex, p.Log) // init & register descriptors routeDescriptor := descriptor.NewRouteDescriptor(p.l3Handler, p.Log) @@ -79,7 +104,7 @@ func (p *L3Plugin) Init() error { proxyArpDescriptor := descriptor.NewProxyArpDescriptor(p.KVScheduler, p.l3Handler, p.Log) proxyArpIfaceDescriptor := descriptor.NewProxyArpInterfaceDescriptor(p.KVScheduler, p.l3Handler, p.Log) ipScanNeighborDescriptor := descriptor.NewIPScanNeighborDescriptor(p.KVScheduler, p.l3Handler, p.Log) - vrfTableDescriptor := descriptor.NewVrfTableDescriptor(p.l3Handler, p.Log) + dhcpProxyDescriptor := descriptor.NewDHCPProxyDescriptor(p.KVScheduler, p.l3Handler, p.Log) err = p.Deps.KVScheduler.RegisterKVDescriptor( routeDescriptor, @@ -87,7 +112,7 @@ func (p *L3Plugin) Init() error { proxyArpDescriptor, proxyArpIfaceDescriptor, ipScanNeighborDescriptor, - vrfTableDescriptor, + dhcpProxyDescriptor, ) if err != nil { return err @@ -103,3 +128,8 @@ func (p *L3Plugin) AfterInit() error { } return nil } + +// GetVRFIndex gives read-only access to map with metadata of all configured VPP VRFs. +func (p *L3Plugin) GetVRFIndex() vrfidx.VRFMetadataIndex { + return p.vrfIndex +} diff --git a/plugins/vpp/l3plugin/l3plugin_api.go b/plugins/vpp/l3plugin/l3plugin_api.go new file mode 100644 index 0000000000..34c0e173c0 --- /dev/null +++ b/plugins/vpp/l3plugin/l3plugin_api.go @@ -0,0 +1,23 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package l3plugin + +import "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" + +// API defines methods exposed by VPP-L3Plugin. +type API interface { + // GetVRFIndex gives read-only access to map with metadata of all configured VPP VRFs. + GetVRFIndex() vrfidx.VRFMetadataIndex +} diff --git a/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go index 1bf0777ad5..39dee54d6e 100644 --- a/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go +++ b/plugins/vpp/l3plugin/vppcalls/l3_vppcalls.go @@ -17,6 +17,7 @@ package vppcalls import ( govppapi "git.fd.io/govpp.git/api" "github.com/ligato/cn-infra/logging" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" @@ -29,6 +30,7 @@ type L3VppAPI interface { RouteVppAPI IPNeighVppAPI VrfTableVppAPI + DHCPProxyAPI } // ArpDetails holds info about ARP entry as a proto model @@ -42,6 +44,27 @@ type ArpMeta struct { SwIfIndex uint32 } +// ArpVppAPI provides methods for managing ARP entries +type DHCPProxyAPI interface { + DHCPProxyRead + + // CreateDHCPProxy creates dhcp proxy according to provided input + CreateDHCPProxy(entry *l3.DHCPProxy) error + // DeleteDHCPProxy deletes created dhcp proxy + DeleteDHCPProxy(entry *l3.DHCPProxy) error +} + +// DHCPProxyRead provides read methods for routes +type DHCPProxyRead interface { + // DumpDHCPProxy returns configured DHCP proxy + DumpDHCPProxy() ([]*DHCPProxyDetails, error) +} + +// DHCPProxyDetails holds info about DHCP proxy entry as a proto model +type DHCPProxyDetails struct { + DHCPProxy *l3.DHCPProxy +} + // ArpVppAPI provides methods for managing ARP entries type ArpVppAPI interface { ArpVppRead @@ -177,12 +200,13 @@ var Versions = map[string]HandlerVersion{} type HandlerVersion struct { Msgs []govppapi.Message - New func(govppapi.Channel, ifaceidx.IfaceMetadataIndex, logging.Logger) L3VppAPI + New func(govppapi.Channel, ifaceidx.IfaceMetadataIndex, vrfidx.VRFMetadataIndex, logging.Logger) L3VppAPI } func CompatibleL3VppHandler( ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, + vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger, ) L3VppAPI { for ver, h := range Versions { @@ -191,7 +215,7 @@ func CompatibleL3VppHandler( continue } log.Debug("found compatible version:", ver) - return h.New(ch, ifIdx, log) + return h.New(ch, ifIdx, vrfIdx, log) } panic("no compatible version available") } diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_dump.go new file mode 100644 index 0000000000..783a3efdc3 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_dump.go @@ -0,0 +1,88 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1901 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +func (h *DHCPProxyHandler) DumpDHCPProxy() ([]*vppcalls.DHCPProxyDetails, error) { + var entry []*vppcalls.DHCPProxyDetails + reqCtx := h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 0}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress[:4]).To4().String(), + } + + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer[:4]).To4().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + + reqCtx = h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 1}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress).To16().String(), + } + + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer).To16().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + return entry, nil + +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_vppcalls.go new file mode 100644 index 0000000000..5093740e30 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1901/dhcpproxy_vppcalls.go @@ -0,0 +1,72 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1901 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/dhcp" + "github.com/pkg/errors" +) + +func (h *DHCPProxyHandler) createDeleteDHCPProxy(entry *vpp_l3.DHCPProxy, delete bool) error { + config := &dhcp.DHCPProxyConfig{ + RxVrfID: entry.RxVrfId, + IsAdd: boolToUint(!delete), + } + + ipAddr := net.ParseIP(entry.SourceIpAddress) + + if ipAddr == nil { + return errors.Errorf("Invalid source IP address: %q", entry.SourceIpAddress) + } + + if ipAddr.To4() == nil { + config.IsIPv6 = 1 + config.DHCPSrcAddress = []byte(ipAddr.To16()) + } else { + config.IsIPv6 = 0 + config.DHCPSrcAddress = []byte(ipAddr.To4()) + } + + for _, server := range entry.Servers { + config.ServerVrfID = server.VrfId + ipAddr := net.ParseIP(server.IpAddress) + if ipAddr == nil { + return errors.Errorf("Invalid server IP address: %q", server.IpAddress) + } + + if ipAddr.To4() == nil { + config.DHCPServer = []byte(ipAddr.To16()) + } else { + config.DHCPServer = []byte(ipAddr.To4()) + } + reply := &dhcp.DHCPProxyConfigReply{} + if err := h.callsChannel.SendRequest(config).ReceiveReply(reply); err != nil { + return err + } + } + + return nil +} + +func (h *DHCPProxyHandler) CreateDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, false) +} + +func (h *DHCPProxyHandler) DeleteDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, true) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1901/vppcalls_handlers.go b/plugins/vpp/l3plugin/vppcalls/vpp1901/vppcalls_handlers.go index 274ea6f6ff..3b0283333e 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1901/vppcalls_handlers.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1901/vppcalls_handlers.go @@ -18,23 +18,25 @@ import ( govppapi "git.fd.io/govpp.git/api" "github.com/ligato/cn-infra/logging" "github.com/ligato/cn-infra/logging/logrus" - vpevppcalls "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1901" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/dhcp" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/ip" "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1901/vpe" "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" ) func init() { var msgs []govppapi.Message - msgs = append(msgs, ip.Messages...) - msgs = append(msgs, vpe.Messages...) + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) vppcalls.Versions["vpp1901"] = vppcalls.HandlerVersion{ Msgs: msgs, - New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger, + New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger, ) vppcalls.L3VppAPI { return NewL3VppHandler(ch, ifIdx, log) }, @@ -47,6 +49,7 @@ type L3VppHandler struct { *RouteHandler *IPNeighHandler *VrfTableHandler + *DHCPProxyHandler } func NewL3VppHandler( @@ -58,6 +61,7 @@ func NewL3VppHandler( RouteHandler: NewRouteVppHandler(ch, ifIdx, log), IPNeighHandler: NewIPNeighVppHandler(ch, log), VrfTableHandler: NewVrfTableVppHandler(ch, log), + DHCPProxyHandler: NewDHCPProxyHandler(ch, log), } } @@ -95,6 +99,23 @@ type VrfTableHandler struct { log logging.Logger } +// DHCPProxyHandler is accessor for DHCP proxy-related vppcalls methods +type DHCPProxyHandler struct { + callsChannel govppapi.Channel + log logging.Logger +} + +// NewVrfTableVppHandler creates new instance of vrf-table vppcalls handler +func NewDHCPProxyHandler(callsChan govppapi.Channel, log logging.Logger) *DHCPProxyHandler { + if log == nil { + log = logrus.NewLogger("dhcp-proxy-handler") + } + return &DHCPProxyHandler{ + callsChannel: callsChan, + log: log, + } +} + // NewArpVppHandler creates new instance of IPsec vppcalls handler func NewArpVppHandler(callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) *ArpVppHandler { if log == nil { diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_dump.go new file mode 100644 index 0000000000..6267ebf62b --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_dump.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1904 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +func (h *DHCPProxyHandler) DumpDHCPProxy() ([]*vppcalls.DHCPProxyDetails, error) { + var entry []*vppcalls.DHCPProxyDetails + reqCtx := h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 0}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress[:4]).To4().String(), + } + + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer[:4]).To4().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + + reqCtx = h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 1}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress).To16().String(), + } + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer).To16().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + return entry, nil + +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_vppcalls.go new file mode 100644 index 0000000000..6b2098b5f9 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1904/dhcpproxy_vppcalls.go @@ -0,0 +1,72 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1904 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/dhcp" + "github.com/pkg/errors" +) + +func (h *DHCPProxyHandler) createDeleteDHCPProxy(entry *vpp_l3.DHCPProxy, delete bool) error { + config := &dhcp.DHCPProxyConfig{ + RxVrfID: entry.RxVrfId, + IsAdd: boolToUint(!delete), + } + + ipAddr := net.ParseIP(entry.SourceIpAddress) + + if ipAddr == nil { + return errors.Errorf("Invalid source IP address: %q", entry.SourceIpAddress) + } + + if ipAddr.To4() == nil { + config.IsIPv6 = 1 + config.DHCPSrcAddress = []byte(ipAddr.To16()) + } else { + config.IsIPv6 = 0 + config.DHCPSrcAddress = []byte(ipAddr.To4()) + } + + for _, server := range entry.Servers { + config.ServerVrfID = server.VrfId + ipAddr := net.ParseIP(server.IpAddress) + if ipAddr == nil { + return errors.Errorf("Invalid server IP address: %q", server.IpAddress) + } + + if ipAddr.To4() == nil { + config.DHCPServer = []byte(ipAddr.To16()) + } else { + config.DHCPServer = []byte(ipAddr.To4()) + } + reply := &dhcp.DHCPProxyConfigReply{} + if err := h.callsChannel.SendRequest(config).ReceiveReply(reply); err != nil { + return err + } + } + + return nil +} + +func (h *DHCPProxyHandler) CreateDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, false) +} + +func (h *DHCPProxyHandler) DeleteDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, true) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1904/vppcalls_handlers.go b/plugins/vpp/l3plugin/vppcalls/vpp1904/vppcalls_handlers.go index d069e4746d..e80698a8a4 100644 --- a/plugins/vpp/l3plugin/vppcalls/vpp1904/vppcalls_handlers.go +++ b/plugins/vpp/l3plugin/vppcalls/vpp1904/vppcalls_handlers.go @@ -18,6 +18,10 @@ import ( "fmt" "net" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1904/dhcp" + govppapi "git.fd.io/govpp.git/api" "github.com/ligato/cn-infra/logging" "github.com/ligato/cn-infra/logging/logrus" @@ -32,12 +36,13 @@ import ( func init() { var msgs []govppapi.Message - msgs = append(msgs, ip.Messages...) - msgs = append(msgs, vpe.Messages...) + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) vppcalls.Versions["vpp1904"] = vppcalls.HandlerVersion{ Msgs: msgs, - New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, log logging.Logger, + New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger, ) vppcalls.L3VppAPI { return NewL3VppHandler(ch, ifIdx, log) }, @@ -50,6 +55,7 @@ type L3VppHandler struct { *RouteHandler *IPNeighHandler *VrfTableHandler + *DHCPProxyHandler } func NewL3VppHandler( @@ -61,6 +67,7 @@ func NewL3VppHandler( RouteHandler: NewRouteVppHandler(ch, ifIdx, log), IPNeighHandler: NewIPNeighVppHandler(ch, log), VrfTableHandler: NewVrfTableVppHandler(ch, log), + DHCPProxyHandler: NewDHCPProxyHandler(ch, log), } } @@ -71,6 +78,12 @@ type ArpVppHandler struct { log logging.Logger } +// DHCPProxyHandler is accessor for DHCP proxy-related vppcalls methods +type DHCPProxyHandler struct { + callsChannel govppapi.Channel + log logging.Logger +} + // ProxyArpVppHandler is accessor for proxy ARP-related vppcalls methods type ProxyArpVppHandler struct { callsChannel govppapi.Channel @@ -157,6 +170,17 @@ func NewVrfTableVppHandler(callsChan govppapi.Channel, log logging.Logger) *VrfT } } +// NewVrfTableVppHandler creates new instance of vrf-table vppcalls handler +func NewDHCPProxyHandler(callsChan govppapi.Channel, log logging.Logger) *DHCPProxyHandler { + if log == nil { + log = logrus.NewLogger("dhcp-proxy-handler") + } + return &DHCPProxyHandler{ + callsChannel: callsChan, + log: log, + } +} + func ipToAddress(ipstr string) (addr ip.Address, err error) { netIP := net.ParseIP(ipstr) if netIP == nil { diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_dump.go new file mode 100644 index 0000000000..5c28c6a531 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_dump.go @@ -0,0 +1,90 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + l3binapi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +// DumpArpEntries implements arp handler. +func (h *ArpVppHandler) DumpArpEntries() ([]*vppcalls.ArpDetails, error) { + arpV4Entries, err := h.dumpArpEntries(false) + if err != nil { + return nil, err + } + arpV6Entries, err := h.dumpArpEntries(true) + if err != nil { + return nil, err + } + return append(arpV4Entries, arpV6Entries...), nil +} + +func (h *ArpVppHandler) dumpArpEntries(isIPv6 bool) ([]*vppcalls.ArpDetails, error) { + var entries []*vppcalls.ArpDetails + reqCtx := h.callsChannel.SendMultiRequest(&l3binapi.IPNeighborDump{ + SwIfIndex: 0xffffffff, // Send multirequest to get all ARP entries for given IP version + IsIPv6: boolToUint(isIPv6), + }) + + for { + arpDetails := &l3binapi.IPNeighborDetails{} + stop, err := reqCtx.ReceiveReply(arpDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + + // ARP interface + ifName, _, exists := h.ifIndexes.LookupBySwIfIndex(arpDetails.Neighbor.SwIfIndex) + if !exists { + h.log.Warnf("ARP dump: interface name not found for index %d", arpDetails.Neighbor.SwIfIndex) + } + // IP & MAC address + var ip string + if arpDetails.Neighbor.IPAddress.Af == l3binapi.ADDRESS_IP6 { + addr := arpDetails.Neighbor.IPAddress.Un.GetIP6() + ip = net.IP(addr[:]).To16().String() + } else { + addr := arpDetails.Neighbor.IPAddress.Un.GetIP4() + ip = net.IP(addr[:]).To4().String() + } + + // ARP entry + arp := &l3.ARPEntry{ + Interface: ifName, + IpAddress: ip, + PhysAddress: net.HardwareAddr(arpDetails.Neighbor.MacAddress[:]).String(), + Static: arpDetails.Neighbor.Flags&l3binapi.IP_API_NEIGHBOR_FLAG_STATIC != 0, + } + // ARP meta + meta := &vppcalls.ArpMeta{ + SwIfIndex: arpDetails.Neighbor.SwIfIndex, + } + + entries = append(entries, &vppcalls.ArpDetails{ + Arp: arp, + Meta: meta, + }) + } + + return entries, nil +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls.go new file mode 100644 index 0000000000..6e1f838ba1 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls.go @@ -0,0 +1,74 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/pkg/errors" +) + +// vppAddDelArp adds or removes ARP entry according to provided input +func (h *ArpVppHandler) vppAddDelArp(entry *l3.ARPEntry, delete bool) error { + meta, found := h.ifIndexes.LookupByName(entry.Interface) + if !found { + return errors.Errorf("interface %s not found", entry.Interface) + } + + var flags ip.IPNeighborFlags + flags |= ip.IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY + if entry.Static { + flags |= ip.IP_API_NEIGHBOR_FLAG_STATIC + } + + req := &ip.IPNeighborAddDel{ + IsAdd: boolToUint(!delete), + Neighbor: ip.IPNeighbor{ + SwIfIndex: meta.SwIfIndex, + Flags: flags, + }, + } + + var err error + req.Neighbor.IPAddress, err = ipToAddress(entry.IpAddress) + if err != nil { + return errors.WithStack(err) + } + + macAddr, err := net.ParseMAC(entry.PhysAddress) + if err != nil { + return err + } + copy(req.Neighbor.MacAddress[:], macAddr) + + reply := &ip.IPNeighborAddDelReply{} + if err = h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// VppAddArp implements arp handler. +func (h *ArpVppHandler) VppAddArp(entry *l3.ARPEntry) error { + return h.vppAddDelArp(entry, false) +} + +// VppDelArp implements arp handler. +func (h *ArpVppHandler) VppDelArp(entry *l3.ARPEntry) error { + return h.vppAddDelArp(entry, true) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls_test.go new file mode 100644 index 0000000000..6e0ba5fad2 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/arp_vppcalls_test.go @@ -0,0 +1,92 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + . "github.com/onsi/gomega" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" +) + +var arpEntries = []*l3.ARPEntry{ + { + Interface: "if1", + IpAddress: "192.168.10.21", + PhysAddress: "59:6C:45:59:8E:BD", + Static: true, + }, + { + Interface: "if1", + IpAddress: "192.168.10.22", + PhysAddress: "6C:45:59:59:8E:BD", + Static: false, + }, + { + Interface: "if1", + IpAddress: "dead::1", + PhysAddress: "8E:BD:6C:45:59:59", + Static: false, + }, +} + +// Test adding of ARP +func TestAddArp(t *testing.T) { + ctx, ifIndexes, arpHandler := arpTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{}) + err := arpHandler.VppAddArp(arpEntries[0]) + Expect(err).To(Succeed()) + ctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{}) + err = arpHandler.VppAddArp(arpEntries[1]) + Expect(err).To(Succeed()) + ctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{}) + err = arpHandler.VppAddArp(arpEntries[2]) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{Retval: 1}) + err = arpHandler.VppAddArp(arpEntries[0]) + Expect(err).NotTo(BeNil()) +} + +// Test deleting of ARP +func TestDelArp(t *testing.T) { + ctx, ifIndexes, arpHandler := arpTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&ip.IPNeighborAddDelReply{}) + err := arpHandler.VppDelArp(arpEntries[0]) + Expect(err).To(Succeed()) +} + +func arpTestSetup(t *testing.T) (*vppcallmock.TestCtx, ifaceidx.IfaceMetadataIndexRW, vppcalls.ArpVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifIndexes := ifaceidx.NewIfaceIndex(logrus.NewLogger("test"), "test") + arpHandler := vpp1908.NewArpVppHandler(ctx.MockChannel, ifIndexes, log) + return ctx, ifIndexes, arpHandler +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_dump.go new file mode 100644 index 0000000000..8bdb720b0e --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_dump.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +func (h *DHCPProxyHandler) DumpDHCPProxy() ([]*vppcalls.DHCPProxyDetails, error) { + var entry []*vppcalls.DHCPProxyDetails + reqCtx := h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 0}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress[:4]).To4().String(), + } + + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer[:4]).To4().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + + reqCtx = h.callsChannel.SendMultiRequest(&dhcp.DHCPProxyDump{IsIP6: 1}) + for { + dhcpProxyDetails := &dhcp.DHCPProxyDetails{} + stop, err := reqCtx.ReceiveReply(dhcpProxyDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + proxy := &vpp_l3.DHCPProxy{ + RxVrfId: dhcpProxyDetails.RxVrfID, + SourceIpAddress: net.IP(dhcpProxyDetails.DHCPSrcAddress).To16().String(), + } + for _, server := range dhcpProxyDetails.Servers { + proxyServer := &vpp_l3.DHCPProxy_DHCPServer{ + IpAddress: net.IP(server.DHCPServer).To16().String(), + VrfId: server.ServerVrfID, + } + proxy.Servers = append(proxy.Servers, proxyServer) + } + + entry = append(entry, &vppcalls.DHCPProxyDetails{ + DHCPProxy: proxy, + }) + } + return entry, nil + +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_vppcalls.go new file mode 100644 index 0000000000..881ece478a --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/dhcpproxy_vppcalls.go @@ -0,0 +1,72 @@ +// Copyright (c) 2019 PANTHEON.tech +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + "github.com/pkg/errors" +) + +func (h *DHCPProxyHandler) createDeleteDHCPProxy(entry *vpp_l3.DHCPProxy, delete bool) error { + config := &dhcp.DHCPProxyConfig{ + RxVrfID: entry.RxVrfId, + IsAdd: boolToUint(!delete), + } + + ipAddr := net.ParseIP(entry.SourceIpAddress) + + if ipAddr == nil { + return errors.Errorf("Invalid source IP address: %q", entry.SourceIpAddress) + } + + if ipAddr.To4() == nil { + config.IsIPv6 = 1 + config.DHCPSrcAddress = []byte(ipAddr.To16()) + } else { + config.IsIPv6 = 0 + config.DHCPSrcAddress = []byte(ipAddr.To4()) + } + + for _, server := range entry.Servers { + config.ServerVrfID = server.VrfId + ipAddr := net.ParseIP(server.IpAddress) + if ipAddr == nil { + return errors.Errorf("Invalid server IP address: %q", server.IpAddress) + } + + if ipAddr.To4() == nil { + config.DHCPServer = []byte(ipAddr.To16()) + } else { + config.DHCPServer = []byte(ipAddr.To4()) + } + reply := &dhcp.DHCPProxyConfigReply{} + if err := h.callsChannel.SendRequest(config).ReceiveReply(reply); err != nil { + return err + } + } + + return nil +} + +func (h *DHCPProxyHandler) CreateDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, false) +} + +func (h *DHCPProxyHandler) DeleteDHCPProxy(entry *vpp_l3.DHCPProxy) error { + return h.createDeleteDHCPProxy(entry, true) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/doc.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/doc.go new file mode 100644 index 0000000000..dc4741332a --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/doc.go @@ -0,0 +1,2 @@ +// Package vppcalls contains wrappers over VPP binary APIs for ARPs, proxy ARPs, L3 FIBs and helpers for dumping them. +package vpp1908 diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls.go new file mode 100644 index 0000000000..4fa4c906df --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls.go @@ -0,0 +1,107 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "regexp" + "strconv" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/pkg/errors" +) + +// SetIPScanNeighbor implements ip neigh handler. +func (h *IPNeighHandler) SetIPScanNeighbor(data *l3.IPScanNeighbor) error { + req := &ip.IPScanNeighborEnableDisable{ + Mode: uint8(data.Mode), + ScanInterval: uint8(data.ScanInterval), + MaxProcTime: uint8(data.MaxProcTime), + MaxUpdate: uint8(data.MaxUpdate), + ScanIntDelay: uint8(data.ScanIntDelay), + StaleThreshold: uint8(data.StaleThreshold), + } + reply := &ip.IPScanNeighborEnableDisableReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +var ( + /* + --- + IP neighbor scan disabled - current time is 5.5101 sec + --- + IP neighbor scan enabled for IPv4 neighbors - current time is 95133.3063 sec + Full_scan_interval: 1 min Stale_purge_threshod: 4 min + Max_process_time: 20 usec Max_updates 10 Delay_to_resume_after_max_limit: 231 msec + --- + IP neighbor scan enabled for IPv4 and IPv6 neighbors - current time is 95.6033 sec + Full_scan_interval: 1 min Stale_purge_threshod: 4 min + Max_process_time: 20 usec Max_updates 10 Delay_to_resume_after_max_limit: 1 msec + */ + cliIPScanNeighRe = regexp.MustCompile(`IP neighbor scan (disabled|enabled)(?: for (IPv4|IPv6|IPv4 and IPv6) neighbors)? - current time is [0-9\.]+ sec(?: +\s+Full_scan_interval: ([0-9]+) min\s+Stale_purge_threshod: ([0-9]+) min +\s+Max_process_time: ([0-9]+) usec\s+Max_updates ([0-9]+)\s+Delay_to_resume_after_max_limit: ([0-9]+) msec)?`) +) + +// GetIPScanNeighbor dumps current IP Scan Neighbor configuration. +func (h *IPNeighHandler) GetIPScanNeighbor() (*l3.IPScanNeighbor, error) { + data, err := h.RunCli("show ip scan-neighbor") + if err != nil { + return nil, err + } + + ipScanNeigh := &l3.IPScanNeighbor{} + + matches := cliIPScanNeighRe.FindStringSubmatch(string(data)) + + if len(matches) != 8 { + h.log.Warnf("invalid 'show ip scan-neighbor' output: %q", string(data)) + return nil, errors.Errorf("invalid 'show ip scan-neighbor' output") + } + + if matches[1] == "enabled" { + switch matches[2] { + case "IPv4": + ipScanNeigh.Mode = l3.IPScanNeighbor_IPv4 + case "IPv6": + ipScanNeigh.Mode = l3.IPScanNeighbor_IPv6 + case "IPv4 and IPv6": + ipScanNeigh.Mode = l3.IPScanNeighbor_BOTH + } + } + ipScanNeigh.ScanInterval = h.strToUint32(matches[3]) + ipScanNeigh.StaleThreshold = h.strToUint32(matches[4]) + ipScanNeigh.MaxProcTime = h.strToUint32(matches[5]) + ipScanNeigh.MaxUpdate = h.strToUint32(matches[6]) + ipScanNeigh.ScanIntDelay = h.strToUint32(matches[7]) + + return ipScanNeigh, nil +} + +func (h *IPNeighHandler) strToUint32(s string) uint32 { + if s == "" { + return 0 + } + n, err := strconv.ParseUint(s, 10, 32) + if err != nil { + h.log.Error(err) + } + return uint32(n) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls_test.go new file mode 100644 index 0000000000..ab91a95bc7 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/ipneigh_vppcalls_test.go @@ -0,0 +1,89 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "testing" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +func TestGetIPScanNeighbor(t *testing.T) { + tests := []struct { + name string + cliReply string + expected l3.IPScanNeighbor + }{ + { + name: "mode-disabled", + cliReply: `IP neighbor scan disabled - current time is 3575.2641 sec`, + expected: l3.IPScanNeighbor{ + Mode: l3.IPScanNeighbor_DISABLED, + }, + }, + { + name: "mode-ipv4", + cliReply: `IP neighbor scan enabled for IPv4 neighbors - current time is 2583.4566 sec + Full_scan_interval: 1 min Stale_purge_threshod: 4 min + Max_process_time: 20 usec Max_updates 10 Delay_to_resume_after_max_limit: 1 msec`, + expected: l3.IPScanNeighbor{ + Mode: l3.IPScanNeighbor_IPv4, + ScanInterval: 1, + MaxProcTime: 20, + MaxUpdate: 10, + ScanIntDelay: 1, + StaleThreshold: 4, + }, + }, + { + name: "mode-both", + cliReply: `IP neighbor scan enabled for IPv4 and IPv6 neighbors - current time is 95.6033 sec + Full_scan_interval: 3 min Stale_purge_threshod: 5 min + Max_process_time: 200 usec Max_updates 10 Delay_to_resume_after_max_limit: 100 msec`, + expected: l3.IPScanNeighbor{ + Mode: l3.IPScanNeighbor_BOTH, + ScanInterval: 3, + MaxProcTime: 200, + MaxUpdate: 10, + ScanIntDelay: 100, + StaleThreshold: 5, + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ctx := vppcallmock.SetupTestCtx(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&vpe.CliInbandReply{ + Reply: test.cliReply, + }) + + handler := NewIPNeighVppHandler(ctx.MockChannel, nil) + + ipNeigh, err := handler.GetIPScanNeighbor() + Expect(err).ShouldNot(HaveOccurred()) + Expect(ipNeigh.Mode).To(Equal(test.expected.Mode)) + Expect(ipNeigh.ScanInterval).To(Equal(test.expected.ScanInterval)) + Expect(ipNeigh.ScanIntDelay).To(Equal(test.expected.ScanIntDelay)) + Expect(ipNeigh.StaleThreshold).To(Equal(test.expected.StaleThreshold)) + Expect(ipNeigh.MaxUpdate).To(Equal(test.expected.MaxUpdate)) + Expect(ipNeigh.MaxProcTime).To(Equal(test.expected.MaxProcTime)) + }) + } +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_dump.go new file mode 100644 index 0000000000..787ee5bd4e --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_dump.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + l3binapi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +// DumpProxyArpRanges implements proxy arp handler. +func (h *ProxyArpVppHandler) DumpProxyArpRanges() (pArpRngs []*vppcalls.ProxyArpRangesDetails, err error) { + reqCtx := h.callsChannel.SendMultiRequest(&l3binapi.ProxyArpDump{}) + + for { + proxyArpDetails := &l3binapi.ProxyArpDetails{} + stop, err := reqCtx.ReceiveReply(proxyArpDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + + pArpRngs = append(pArpRngs, &vppcalls.ProxyArpRangesDetails{ + Range: &l3.ProxyARP_Range{ + FirstIpAddr: net.IP(proxyArpDetails.Proxy.Low[:]).To4().String(), + LastIpAddr: net.IP(proxyArpDetails.Proxy.Hi[:]).To4().String(), + }, + }) + } + + return pArpRngs, nil +} + +// DumpProxyArpInterfaces implements proxy arp handler. +func (h *ProxyArpVppHandler) DumpProxyArpInterfaces() (pArpIfs []*vppcalls.ProxyArpInterfaceDetails, err error) { + reqCtx := h.callsChannel.SendMultiRequest(&l3binapi.ProxyArpIntfcDump{}) + + for { + proxyArpDetails := &l3binapi.ProxyArpIntfcDetails{} + stop, err := reqCtx.ReceiveReply(proxyArpDetails) + if stop { + break + } + if err != nil { + h.log.Error(err) + return nil, err + } + + // Interface + ifName, _, exists := h.ifIndexes.LookupBySwIfIndex(proxyArpDetails.SwIfIndex) + if !exists { + h.log.Warnf("Proxy ARP interface dump: missing name for interface index %d", proxyArpDetails.SwIfIndex) + } + + // Create entry + pArpIfs = append(pArpIfs, &vppcalls.ProxyArpInterfaceDetails{ + Interface: &l3.ProxyARP_Interface{ + Name: ifName, + }, + Meta: &vppcalls.ProxyArpInterfaceMeta{ + SwIfIndex: proxyArpDetails.SwIfIndex, + }, + }) + + } + + return pArpIfs, nil +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls.go new file mode 100644 index 0000000000..21f5833dec --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/pkg/errors" +) + +// EnableProxyArpInterface implements proxy arp handler. +func (h *ProxyArpVppHandler) EnableProxyArpInterface(ifName string) error { + return h.vppAddDelProxyArpInterface(ifName, true) +} + +// DisableProxyArpInterface implements proxy arp handler. +func (h *ProxyArpVppHandler) DisableProxyArpInterface(ifName string) error { + return h.vppAddDelProxyArpInterface(ifName, false) +} + +// AddProxyArpRange implements proxy arp handler. +func (h *ProxyArpVppHandler) AddProxyArpRange(firstIP, lastIP []byte) error { + return h.vppAddDelProxyArpRange(firstIP, lastIP, true) +} + +// DeleteProxyArpRange implements proxy arp handler. +func (h *ProxyArpVppHandler) DeleteProxyArpRange(firstIP, lastIP []byte) error { + return h.vppAddDelProxyArpRange(firstIP, lastIP, false) +} + +// vppAddDelProxyArpInterface adds or removes proxy ARP interface entry according to provided input +func (h *ProxyArpVppHandler) vppAddDelProxyArpInterface(ifName string, enable bool) error { + meta, found := h.ifIndexes.LookupByName(ifName) + if !found { + return errors.Errorf("interface %s not found", ifName) + } + + req := &ip.ProxyArpIntfcEnableDisable{ + EnableDisable: boolToUint(enable), + SwIfIndex: meta.SwIfIndex, + } + + reply := &ip.ProxyArpIntfcEnableDisableReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + h.log.Debugf("interface %v enabled for proxy arp: %v", req.SwIfIndex, enable) + + return nil +} + +// vppAddDelProxyArpRange adds or removes proxy ARP range according to provided input +func (h *ProxyArpVppHandler) vppAddDelProxyArpRange(firstIP, lastIP []byte, isAdd bool) error { + proxy := ip.ProxyArp{ + TableID: 0, // TODO: add support for VRF + } + copy(proxy.Low[:], firstIP) + copy(proxy.Hi[:], lastIP) + + req := &ip.ProxyArpAddDel{ + IsAdd: boolToUint(isAdd), + Proxy: proxy, + } + + reply := &ip.ProxyArpAddDelReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + h.log.Debugf("proxy arp range: %v - %v added: %v", req.Proxy.Low, req.Proxy.Hi, isAdd) + + return nil +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls_test.go new file mode 100644 index 0000000000..a32dde456c --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/proxyarp_vppcalls_test.go @@ -0,0 +1,74 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +// Test enable/disable proxy arp +func TestProxyArp(t *testing.T) { + ctx, ifIndexes, _, pArpHandler := pArpTestSetup(t) + defer ctx.TeardownTestCtx() + + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + + ctx.MockVpp.MockReply(&ip.ProxyArpIntfcEnableDisableReply{}) + err := pArpHandler.EnableProxyArpInterface("if1") + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.ProxyArpIntfcEnableDisableReply{}) + err = pArpHandler.DisableProxyArpInterface("if1") + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.ProxyArpIntfcEnableDisableReply{Retval: 1}) + err = pArpHandler.DisableProxyArpInterface("if1") + Expect(err).NotTo(BeNil()) +} + +// Test add/delete ip range for proxy arp +func TestProxyArpRange(t *testing.T) { + ctx, _, _, pArpHandler := pArpTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.ProxyArpAddDelReply{}) + err := pArpHandler.AddProxyArpRange([]byte{192, 168, 10, 20}, []byte{192, 168, 10, 30}) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.ProxyArpAddDelReply{}) + err = pArpHandler.DeleteProxyArpRange([]byte{192, 168, 10, 23}, []byte{192, 168, 10, 27}) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.ProxyArpAddDelReply{Retval: 1}) + err = pArpHandler.AddProxyArpRange([]byte{192, 168, 10, 23}, []byte{192, 168, 10, 27}) + Expect(err).To(Not(BeNil())) +} + +func pArpTestSetup(t *testing.T) (*vppcallmock.TestCtx, ifaceidx.IfaceMetadataIndexRW, vppcalls.ArpVppAPI, vppcalls.ProxyArpVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifIndexes := ifaceidx.NewIfaceIndex(logrus.NewLogger("test"), "test") + arpHandler := vpp1908.NewArpVppHandler(ctx.MockChannel, ifIndexes, log) + pArpHandler := vpp1908.NewProxyArpVppHandler(ctx.MockChannel, ifIndexes, log) + return ctx, ifIndexes, arpHandler, pArpHandler +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump.go new file mode 100644 index 0000000000..54c40c381b --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump.go @@ -0,0 +1,210 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + l3binapi "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +// DumpRoutes implements route handler. +func (h *RouteHandler) DumpRoutes() (routes []*vppcalls.RouteDetails, err error) { + // dump routes for every VRF and for both IP versions + for _, vrfMeta := range h.vrfIndexes.ListAllVrfMetadata() { + ipRoutes, err := h.dumpRoutesForVrfAndIP(vrfMeta.GetIndex(), vrfMeta.GetProtocol()) + if err != nil { + return nil, err + } + routes = append(routes, ipRoutes...) + } + return routes, nil +} + +// dumpRoutesForVrf returns routes for given VRF and IP versiob +func (h *RouteHandler) dumpRoutesForVrfAndIP(vrfID uint32, proto l3.VrfTable_Protocol) (routes []*vppcalls.RouteDetails, err error) { + reqCtx := h.callsChannel.SendMultiRequest(&l3binapi.IPRouteDump{ + Table: l3binapi.IPTable{ + TableID: vrfID, + IsIP6: protoToUint(proto), + }, + }) + for { + fibDetails := &l3binapi.IPRouteDetails{} + stop, err := reqCtx.ReceiveReply(fibDetails) + if stop { + break + } + if err != nil { + return nil, err + } + ipRoute, err := h.dumpRouteIPDetails(fibDetails.Route) + if err != nil { + return nil, err + } + routes = append(routes, ipRoute...) + } + + return routes, nil +} + +// dumpRouteIPDetails processes static route details and returns a route objects. Number of routes returned +// depends on size of path list. +func (h *RouteHandler) dumpRouteIPDetails(ipRoute l3binapi.IPRoute) ([]*vppcalls.RouteDetails, error) { + // Common fields for every route path (destination IP, VRF) + var dstIP string + if ipRoute.Prefix.Address.Af == l3binapi.ADDRESS_IP6 { + ip6Addr := ipRoute.Prefix.Address.Un.GetIP6() + dstIP = fmt.Sprintf("%s/%d", net.IP(ip6Addr[:]).To16().String(), uint32(ipRoute.Prefix.Len)) + } else { + ip4Addr := ipRoute.Prefix.Address.Un.GetIP4() + dstIP = fmt.Sprintf("%s/%d", net.IP(ip4Addr[:4]).To4().String(), uint32(ipRoute.Prefix.Len)) + } + + var routeDetails []*vppcalls.RouteDetails + + // Paths + if ipRoute.NPaths > 0 { + for _, path := range ipRoute.Paths { + // Next hop IP address + var nextHopIP string + netIP := make([]byte, 16) + copy(netIP[:], path.Nh.Address.XXX_UnionData[:]) + if path.Proto == l3binapi.FIB_API_PATH_NH_PROTO_IP6 { + nextHopIP = fmt.Sprintf("%s", net.IP(netIP).To16().String()) + } else { + nextHopIP = fmt.Sprintf("%s", net.IP(netIP[:4]).To4().String()) + } + + // Route type (if via VRF is used) + var routeType l3.Route_RouteType + var viaVrfID uint32 + if path.Type == l3binapi.FIB_API_PATH_TYPE_DROP { + routeType = l3.Route_DROP + } else if path.SwIfIndex == NextHopOutgoingIfUnset && path.TableID != ipRoute.TableID { + // outgoing interface not specified and path table is not equal to route table id = inter-VRF route + routeType = l3.Route_INTER_VRF + viaVrfID = path.TableID + } else { + routeType = l3.Route_INTRA_VRF // default + } + + // Outgoing interface + var ifName string + var ifIdx uint32 + if path.SwIfIndex == NextHopOutgoingIfUnset { + ifIdx = NextHopOutgoingIfUnset + } else { + var exists bool + ifIdx = path.SwIfIndex + if ifName, _, exists = h.ifIndexes.LookupBySwIfIndex(path.SwIfIndex); !exists { + h.log.Warnf("Static route dump: interface name for index %d not found", path.SwIfIndex) + } + } + + // Route configuration + route := &l3.Route{ + Type: routeType, + VrfId: ipRoute.TableID, + DstNetwork: dstIP, + NextHopAddr: nextHopIP, + OutgoingInterface: ifName, + Weight: uint32(path.Weight), + Preference: uint32(path.Preference), + ViaVrfId: viaVrfID, + } + + labelStack := make([]vppcalls.FibMplsLabel, len(path.LabelStack)) + for i, l := range path.LabelStack { + labelStack[i] = vppcalls.FibMplsLabel{ + IsUniform: uintToBool(l.IsUniform), + Label: l.Label, + TTL: l.TTL, + Exp: l.Exp, + } + } + + // Route metadata + meta := &vppcalls.RouteMeta{ + OutgoingIfIdx: ifIdx, + IsIPv6: path.Proto == l3binapi.FIB_API_PATH_NH_PROTO_IP6, + NextHopID: path.Nh.ObjID, + RpfID: path.RpfID, + LabelStack: labelStack, + } + resolvePathType(meta, path.Type) + resolvePathFlags(meta, path.Flags) + // Note: VPP does not return table name as in older versions, the field + // is filled using index map + vrfName, _, exists := h.vrfIndexes.LookupByVRFIndex(ipRoute.TableID) + if exists { + meta.TableName = vrfName + } + + routeDetails = append(routeDetails, &vppcalls.RouteDetails{ + Route: route, + Meta: meta, + }) + } + } else { + // Return route without path fields, but this is not a valid configuration + h.log.Warnf("Route with destination IP %s (VRF %d) has no path specified", dstIP, ipRoute.TableID) + routeDetails = append(routeDetails, &vppcalls.RouteDetails{ + Route: &l3.Route{ + Type: l3.Route_INTRA_VRF, // default + VrfId: ipRoute.TableID, + DstNetwork: dstIP, + }, + }) + } + + return routeDetails, nil +} + +func resolvePathType(meta *vppcalls.RouteMeta, pathType l3binapi.FibPathType) { + switch pathType { + case l3binapi.FIB_API_PATH_TYPE_LOCAL: + meta.IsLocal = true + case l3binapi.FIB_API_PATH_TYPE_UDP_ENCAP: + meta.IsUDPEncap = true + case l3binapi.FIB_API_PATH_TYPE_ICMP_UNREACH: + meta.IsUnreach = true + case l3binapi.FIB_API_PATH_TYPE_ICMP_PROHIBIT: + meta.IsProhibit = true + case l3binapi.FIB_API_PATH_TYPE_DVR: + meta.IsDvr = true + case l3binapi.FIB_API_PATH_TYPE_SOURCE_LOOKUP: + meta.IsSourceLookup = true + } +} + +func resolvePathFlags(meta *vppcalls.RouteMeta, pathFlags l3binapi.FibPathFlags) { + switch pathFlags { + case l3binapi.FIB_API_PATH_FLAG_RESOLVE_VIA_HOST: + meta.IsResolveHost = true + case l3binapi.FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED: + meta.IsResolveAttached = true + } +} + +func protoToUint(proto l3.VrfTable_Protocol) uint8 { + if proto == l3.VrfTable_IPV6 { + return 1 + } + return 0 +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump_test.go new file mode 100644 index 0000000000..0b9923d1b0 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_dump_test.go @@ -0,0 +1,82 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" + + "github.com/ligato/cn-infra/logging/logrus" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +// Test dumping routes +func TestDumpStaticRoutes(t *testing.T) { + ctx := vppcallmock.SetupTestCtx(t) + defer ctx.TeardownTestCtx() + ifIndexes := ifaceidx.NewIfaceIndex(logrus.NewLogger("test-if"), "test-if") + vrfIndexes := vrfidx.NewVRFIndex(logrus.NewLogger("test-vrf"), "test-vrf") + l3handler := NewRouteVppHandler(ctx.MockChannel, ifIndexes, vrfIndexes, logrus.DefaultLogger()) + + vrfIndexes.Put("vrf1-ipv4", &vrfidx.VRFMetadata{Index: 0, Protocol: vpp_l3.VrfTable_IPV4}) + vrfIndexes.Put("vrf1-ipv6", &vrfidx.VRFMetadata{Index: 0, Protocol: vpp_l3.VrfTable_IPV6}) + ifIndexes.Put("if1", &ifaceidx.IfaceMetadata{SwIfIndex: 1}) + ifIndexes.Put("if2", &ifaceidx.IfaceMetadata{SwIfIndex: 2}) + + ctx.MockVpp.MockReply(&ip.IPRouteDetails{ + Route: ip.IPRoute{ + Prefix: ip.Prefix{ + Address: ip.Address{ + Af: ip.ADDRESS_IP4, + Un: ip.AddressUnionIP4([4]uint8{10, 0, 0, 1}), + }, + }, + Paths: []ip.FibPath{ + { + SwIfIndex: 2, + }, + }, + }, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + ctx.MockVpp.MockReply(&ip.IPRouteDetails{ + Route: ip.IPRoute{ + Prefix: ip.Prefix{ + Address: ip.Address{ + Af: ip.ADDRESS_IP6, + Un: ip.AddressUnionIP6([16]uint8{255, 255, 10, 1}), + }, + }, + Paths: []ip.FibPath{ + { + SwIfIndex: 1, + }, + }, + }, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + rtDetails, err := l3handler.DumpRoutes() + Expect(err).To(Succeed()) + Expect(rtDetails).To(HaveLen(2)) + Expect(rtDetails[0].Route.OutgoingInterface).To(Equal("if2")) + Expect(rtDetails[1].Route.OutgoingInterface).To(Equal("if1")) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls.go new file mode 100644 index 0000000000..860e9ae7e4 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls.go @@ -0,0 +1,142 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "net" + + vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/pkg/errors" +) + +const ( + // NextHopViaLabelUnset constant has to be assigned into the field next hop + // via label in ip_add_del_route binary message if next hop via label is not defined. + // Equals to MPLS_LABEL_INVALID defined in VPP + NextHopViaLabelUnset uint32 = 0xfffff + 1 + + // ClassifyTableIndexUnset is a default value for field classify_table_index in ip_add_del_route binary message. + ClassifyTableIndexUnset = ^uint32(0) + + // NextHopOutgoingIfUnset constant has to be assigned into the field next_hop_outgoing_interface + // in ip_add_del_route binary message if outgoing interface for next hop is not defined. + NextHopOutgoingIfUnset = ^uint32(0) +) + +// vppAddDelRoute adds or removes route, according to provided input. Every route has to contain VRF ID (default is 0). +func (h *RouteHandler) vppAddDelRoute(route *vpp_l3.Route, rtIfIdx uint32, delete bool) error { + req := &ip.IPRouteAddDel{ + // Multi path is always true + IsMultipath: 1, + } + if delete { + req.IsAdd = 0 + } else { + req.IsAdd = 1 + } + + // Common route parameters + fibPath := ip.FibPath{ + Weight: uint8(route.Weight), + Preference: uint8(route.Preference), + } + fibPath.Nh, fibPath.Proto = setFibPathNhAndProto(route.NextHopAddr) + + // VRF/Other route parameters based on type + if route.Type == vpp_l3.Route_INTER_VRF { + fibPath.SwIfIndex = rtIfIdx + fibPath.TableID = route.ViaVrfId + } else if route.Type == vpp_l3.Route_DROP { + fibPath.Type = ip.FIB_API_PATH_TYPE_DROP + } else { + fibPath.SwIfIndex = rtIfIdx + fibPath.TableID = route.VrfId + } + // Destination address + prefix, err := networkToPrefix(route.DstNetwork) + if err != nil { + return err + } + + req.Route = ip.IPRoute{ + TableID: route.VrfId, + Prefix: prefix, + NPaths: 1, + Paths: []ip.FibPath{fibPath}, + } + + // Send message + reply := &ip.IPRouteAddDelReply{} + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} + +// VppAddRoute implements route handler. +func (h *RouteHandler) VppAddRoute(route *vpp_l3.Route) error { + swIfIdx, err := h.getRouteSwIfIndex(route.OutgoingInterface) + if err != nil { + return err + } + + return h.vppAddDelRoute(route, swIfIdx, false) +} + +// VppDelRoute implements route handler. +func (h *RouteHandler) VppDelRoute(route *vpp_l3.Route) error { + swIfIdx, err := h.getRouteSwIfIndex(route.OutgoingInterface) + if err != nil { + return err + } + + return h.vppAddDelRoute(route, swIfIdx, true) +} + +func setFibPathNhAndProto(ipStr string) (nh ip.FibPathNh, proto ip.FibPathNhProto) { + netIP := net.ParseIP(ipStr) + if netIP == nil { + return + } + var ipData [16]byte + if netIP.To4() == nil { + proto = ip.FIB_API_PATH_NH_PROTO_IP6 + copy(ipData[:], netIP[:]) + } else { + proto = ip.FIB_API_PATH_NH_PROTO_IP4 + copy(ipData[:], netIP[12:]) + } + return ip.FibPathNh{ + Address: ip.AddressUnion{ + XXX_UnionData: ipData, + }, + ViaLabel: NextHopViaLabelUnset, + ClassifyTableIndex: ClassifyTableIndexUnset, + }, proto +} + +func (h *RouteHandler) getRouteSwIfIndex(ifName string) (swIfIdx uint32, err error) { + swIfIdx = NextHopOutgoingIfUnset + if ifName != "" { + meta, found := h.ifIndexes.LookupByName(ifName) + if !found { + return 0, errors.Errorf("interface %s not found", ifName) + } + swIfIdx = meta.SwIfIndex + } + return +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls_test.go new file mode 100644 index 0000000000..a53dd180de --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls_test.go @@ -0,0 +1,97 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" + + "github.com/ligato/cn-infra/logging/logrus" + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + ifvppcalls "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls" + ifvpp1908 "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +var routes = []*l3.Route{ + { + VrfId: 1, + DstNetwork: "192.168.10.21/24", + NextHopAddr: "192.168.30.1", + OutgoingInterface: "iface1", + }, + { + VrfId: 2, + DstNetwork: "10.0.0.1/24", + NextHopAddr: "192.168.30.1", + }, + { + VrfId: 2, + DstNetwork: "10.11.0.1/16", + NextHopAddr: "192.168.30.1", + OutgoingInterface: "iface3", + }, +} + +// Test adding routes +func TestAddRoute(t *testing.T) { + ctx, _, rtHandler := routeTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPRouteAddDelReply{}) + err := rtHandler.VppAddRoute(routes[0]) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.IPRouteAddDelReply{}) + err = rtHandler.VppAddRoute(routes[2]) + Expect(err).To(Not(BeNil())) // unknown interface +} + +// Test deleting routes +func TestDeleteRoute(t *testing.T) { + ctx, _, rtHandler := routeTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPRouteAddDelReply{}) + err := rtHandler.VppDelRoute(routes[0]) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.IPRouteAddDelReply{}) + err = rtHandler.VppDelRoute(routes[1]) + Expect(err).To(Succeed()) + + ctx.MockVpp.MockReply(&ip.IPRouteAddDelReply{Retval: 1}) + err = rtHandler.VppDelRoute(routes[0]) + Expect(err).To(Not(BeNil())) +} + +func routeTestSetup(t *testing.T) (*vppcallmock.TestCtx, ifvppcalls.InterfaceVppAPI, vppcalls.RouteVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + ifHandler := ifvpp1908.NewInterfaceVppHandler(ctx.MockChannel, log) + ifIndexes := ifaceidx.NewIfaceIndex(logrus.NewLogger("test-if"), "test-if") + vrfIndexes := vrfidx.NewVRFIndex(logrus.NewLogger("test-vrf"), "test-vrf") + ifIndexes.Put("iface1", &ifaceidx.IfaceMetadata{ + SwIfIndex: 1, + }) + rtHandler := vpp1908.NewRouteVppHandler(ctx.MockChannel, ifIndexes, vrfIndexes, log) + return ctx, ifHandler, rtHandler +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vppcalls_handlers.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vppcalls_handlers.go new file mode 100644 index 0000000000..33fa9964d9 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vppcalls_handlers.go @@ -0,0 +1,243 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "fmt" + "net" + + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vrfidx" + + "github.com/ligato/cn-infra/utils/addrs" + + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/dhcp" + + govppapi "git.fd.io/govpp.git/api" + "github.com/ligato/cn-infra/logging" + "github.com/ligato/cn-infra/logging/logrus" + + vpevppcalls "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls" + "github.com/ligato/vpp-agent/plugins/govppmux/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/ifplugin/ifaceidx" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" +) + +func init() { + var msgs []govppapi.Message + msgs = append(msgs, ip.AllMessages()...) + msgs = append(msgs, vpe.AllMessages()...) + msgs = append(msgs, dhcp.AllMessages()...) + + vppcalls.Versions["vpp1908"] = vppcalls.HandlerVersion{ + Msgs: msgs, + New: func(ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger, + ) vppcalls.L3VppAPI { + return NewL3VppHandler(ch, ifIdx, vrfIdx, log) + }, + } +} + +type L3VppHandler struct { + *ArpVppHandler + *ProxyArpVppHandler + *RouteHandler + *IPNeighHandler + *VrfTableHandler + *DHCPProxyHandler +} + +func NewL3VppHandler( + ch govppapi.Channel, ifIdx ifaceidx.IfaceMetadataIndex, vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger, +) *L3VppHandler { + return &L3VppHandler{ + ArpVppHandler: NewArpVppHandler(ch, ifIdx, log), + ProxyArpVppHandler: NewProxyArpVppHandler(ch, ifIdx, log), + RouteHandler: NewRouteVppHandler(ch, ifIdx, vrfIdx, log), + IPNeighHandler: NewIPNeighVppHandler(ch, log), + VrfTableHandler: NewVrfTableVppHandler(ch, log), + DHCPProxyHandler: NewDHCPProxyHandler(ch, log), + } +} + +// ArpVppHandler is accessor for ARP-related vppcalls methods +type ArpVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +// DHCPProxyHandler is accessor for DHCP proxy-related vppcalls methods +type DHCPProxyHandler struct { + callsChannel govppapi.Channel + log logging.Logger +} + +// ProxyArpVppHandler is accessor for proxy ARP-related vppcalls methods +type ProxyArpVppHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + log logging.Logger +} + +// RouteHandler is accessor for route-related vppcalls methods +type RouteHandler struct { + callsChannel govppapi.Channel + ifIndexes ifaceidx.IfaceMetadataIndex + vrfIndexes vrfidx.VRFMetadataIndex + log logging.Logger +} + +// IPNeighHandler is accessor for ip-neighbor-related vppcalls methods +type IPNeighHandler struct { + callsChannel govppapi.Channel + log logging.Logger + vpevppcalls.VpeVppAPI +} + +// VrfTableHandler is accessor for vrf-related vppcalls methods +type VrfTableHandler struct { + callsChannel govppapi.Channel + log logging.Logger +} + +// NewArpVppHandler creates new instance of IPsec vppcalls handler +func NewArpVppHandler(callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) *ArpVppHandler { + if log == nil { + log = logrus.NewLogger("arp-handler") + } + return &ArpVppHandler{ + callsChannel: callsChan, + ifIndexes: ifIndexes, + log: log, + } +} + +// NewProxyArpVppHandler creates new instance of proxy ARP vppcalls handler +func NewProxyArpVppHandler(callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, log logging.Logger) *ProxyArpVppHandler { + if log == nil { + log = logrus.NewLogger("proxy-arp-handler") + } + return &ProxyArpVppHandler{ + callsChannel: callsChan, + ifIndexes: ifIndexes, + log: log, + } +} + +// NewRouteVppHandler creates new instance of route vppcalls handler +func NewRouteVppHandler(callsChan govppapi.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, vrfIdx vrfidx.VRFMetadataIndex, log logging.Logger) *RouteHandler { + if log == nil { + log = logrus.NewLogger("route-handler") + } + return &RouteHandler{ + callsChannel: callsChan, + ifIndexes: ifIndexes, + vrfIndexes: vrfIdx, + log: log, + } +} + +// NewIPNeighVppHandler creates new instance of ip neighbor vppcalls handler +func NewIPNeighVppHandler(callsChan govppapi.Channel, log logging.Logger) *IPNeighHandler { + if log == nil { + log = logrus.NewLogger("ip-neigh") + } + return &IPNeighHandler{ + callsChannel: callsChan, + log: log, + VpeVppAPI: vpp1908.NewVpeHandler(callsChan), + } +} + +// NewVrfTableVppHandler creates new instance of vrf-table vppcalls handler +func NewVrfTableVppHandler(callsChan govppapi.Channel, log logging.Logger) *VrfTableHandler { + if log == nil { + log = logrus.NewLogger("vrf-table-handler") + } + return &VrfTableHandler{ + callsChannel: callsChan, + log: log, + } +} + +// NewVrfTableVppHandler creates new instance of vrf-table vppcalls handler +func NewDHCPProxyHandler(callsChan govppapi.Channel, log logging.Logger) *DHCPProxyHandler { + if log == nil { + log = logrus.NewLogger("dhcp-proxy-handler") + } + return &DHCPProxyHandler{ + callsChannel: callsChan, + log: log, + } +} + +func ipToAddress(ipstr string) (addr ip.Address, err error) { + netIP := net.ParseIP(ipstr) + if netIP == nil { + return ip.Address{}, fmt.Errorf("invalid IP: %q", ipstr) + } + if ip4 := netIP.To4(); ip4 == nil { + addr.Af = ip.ADDRESS_IP6 + var ip6addr ip.IP6Address + copy(ip6addr[:], netIP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = ip.ADDRESS_IP4 + var ip4addr ip.IP4Address + copy(ip4addr[:], ip4) + addr.Un.SetIP4(ip4addr) + } + return +} + +func networkToPrefix(dstNetwork string) (ip.Prefix, error) { + netIP, isIPv6, err := addrs.ParseIPWithPrefix(dstNetwork) + if err != nil { + return ip.Prefix{}, err + } + var addr ip.Address + if isIPv6 { + addr.Af = ip.ADDRESS_IP6 + var ip6addr ip.IP6Address + copy(ip6addr[:], netIP.IP.To16()) + addr.Un.SetIP6(ip6addr) + } else { + addr.Af = ip.ADDRESS_IP4 + var ip4addr ip.IP4Address + copy(ip4addr[:], netIP.IP.To4()) + addr.Un.SetIP4(ip4addr) + } + mask, _ := netIP.Mask.Size() + return ip.Prefix{ + Address: addr, + Len: uint8(mask), + }, nil +} + +func uintToBool(value uint8) bool { + if value == 0 { + return false + } + return true +} + +func boolToUint(input bool) uint8 { + if input { + return 1 + } + return 0 +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump.go new file mode 100644 index 0000000000..7264f8a2d4 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump.go @@ -0,0 +1,56 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "bytes" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" +) + +// DumpVrfTables dumps all configured VRF tables. +func (h *VrfTableHandler) DumpVrfTables() (tables []*l3.VrfTable, err error) { + // dump IPv4 VRF tables + reqCtx := h.callsChannel.SendMultiRequest(&ip.IPTableDump{}) + for { + fibDetails := &ip.IPTableDetails{} + stop, err := reqCtx.ReceiveReply(fibDetails) + if stop { + break + } + if err != nil { + return nil, err + } + tables = append(tables, &l3.VrfTable{ + Id: fibDetails.Table.TableID, + Protocol: getTableProto(uintToBool(fibDetails.Table.IsIP6)), + Label: bytesToString(fibDetails.Table.Name), + }) + } + + return tables, nil +} + +func getTableProto(isIPv6 bool) l3.VrfTable_Protocol { + if isIPv6 { + return l3.VrfTable_IPV6 + } + return l3.VrfTable_IPV4 +} + +func bytesToString(b []byte) string { + return string(bytes.SplitN(b, []byte{0x00}, 2)[0]) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump_test.go new file mode 100644 index 0000000000..2d2e583e5e --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_dump_test.go @@ -0,0 +1,77 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/vpe" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +func TestDumpVrfTables(t *testing.T) { + ctx := vppcallmock.SetupTestCtx(t) + defer ctx.TeardownTestCtx() + vthandler := NewVrfTableVppHandler(ctx.MockChannel, logrus.DefaultLogger()) + + ctx.MockVpp.MockReply( + &ip.IPTableDetails{ + Table: ip.IPTable{ + TableID: 1, + Name: []byte("table3"), + IsIP6: 0, + }, + }, + &ip.IPTableDetails{ + Table: ip.IPTable{ + TableID: 2, + Name: []byte("table3"), + IsIP6: 0, + }, + }, + &ip.IPTableDetails{ + Table: ip.IPTable{ + TableID: 3, + Name: []byte("table2"), + IsIP6: 1, + }, + }, + ) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + ctx.MockVpp.MockReply( + &ip.IPRouteDetails{ + Route: ip.IPRoute{ + TableID: 2, + Paths: []ip.FibPath{{SwIfIndex: 5}}, + }, + }) + ctx.MockVpp.MockReply(&vpe.ControlPingReply{}) + + vrfTables, err := vthandler.DumpVrfTables() + Expect(err).To(Succeed()) + Expect(vrfTables).To(HaveLen(3)) + if vrfTables[0].Label == "table2" { + Expect(vrfTables[1]).To(Equal(&l3.VrfTable{Id: 3, Protocol: l3.VrfTable_IPV4, Label: "table3"})) + Expect(vrfTables[0]).To(Equal(&l3.VrfTable{Id: 2, Protocol: l3.VrfTable_IPV4, Label: "table2"})) + } else { + Expect(vrfTables[0]).To(Equal(&l3.VrfTable{Id: 1, Protocol: l3.VrfTable_IPV4, Label: "table3"})) + Expect(vrfTables[1]).To(Equal(&l3.VrfTable{Id: 2, Protocol: l3.VrfTable_IPV4, Label: "table3"})) + } + Expect(vrfTables[2]).To(Equal(&l3.VrfTable{Id: 3, Protocol: l3.VrfTable_IPV6, Label: "table2"})) +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go new file mode 100644 index 0000000000..235966e804 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls.go @@ -0,0 +1,48 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908 + +import ( + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" +) + +// AddVrfTable adds new VRF table. +func (h *VrfTableHandler) AddVrfTable(table *l3.VrfTable) error { + return h.addDelVrfTable(table, true) +} + +// DelVrfTable deletes existing VRF table. +func (h *VrfTableHandler) DelVrfTable(table *l3.VrfTable) error { + return h.addDelVrfTable(table, false) +} + +func (h *VrfTableHandler) addDelVrfTable(table *l3.VrfTable, isAdd bool) error { + req := &ip.IPTableAddDel{ + Table: ip.IPTable{ + TableID: table.Id, + IsIP6: boolToUint(table.GetProtocol() == l3.VrfTable_IPV6), + Name: []byte(table.Label), + }, + IsAdd: boolToUint(isAdd), + } + reply := &ip.IPTableAddDelReply{} + + if err := h.callsChannel.SendRequest(req).ReceiveReply(reply); err != nil { + return err + } + + return nil +} diff --git a/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go new file mode 100644 index 0000000000..c1edaddf59 --- /dev/null +++ b/plugins/vpp/l3plugin/vppcalls/vpp1908/vrf_vppcalls_test.go @@ -0,0 +1,138 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vpp1908_test + +import ( + "testing" + + "github.com/ligato/cn-infra/logging/logrus" + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + "github.com/ligato/vpp-agent/plugins/vpp/binapi/vpp1908/ip" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls" + "github.com/ligato/vpp-agent/plugins/vpp/l3plugin/vppcalls/vpp1908" + "github.com/ligato/vpp-agent/plugins/vpp/vppcallmock" + . "github.com/onsi/gomega" +) + +var vrfTables = []*l3.VrfTable{ + { + Id: 1, + Protocol: l3.VrfTable_IPV4, + Label: "table1", + }, + { + Id: 1, + Protocol: l3.VrfTable_IPV6, + Label: "table1", + }, + { + Id: 2, + Protocol: l3.VrfTable_IPV6, + Label: "table2", + }, +} + +// Test adding routes +func TestAddVrfTable(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err := vtHandler.AddVrfTable(vrfTables[0]) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table1"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err = vtHandler.AddVrfTable(vrfTables[1]) + Expect(err).To(Succeed()) + + vppMsg, ok = ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table1"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err = vtHandler.AddVrfTable(vrfTables[2]) + Expect(err).To(Succeed()) + + vppMsg, ok = ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(2)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table2"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{Retval: 1}) + err = vtHandler.AddVrfTable(vrfTables[0]) + Expect(err).To(Not(BeNil())) +} + +// Test deleting routes +func TestDeleteVrfTable(t *testing.T) { + ctx, vtHandler := vrfTableTestSetup(t) + defer ctx.TeardownTestCtx() + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err := vtHandler.DelVrfTable(vrfTables[0]) + Expect(err).To(Succeed()) + + vppMsg, ok := ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(0)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table1"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err = vtHandler.DelVrfTable(vrfTables[1]) + Expect(err).To(Succeed()) + + vppMsg, ok = ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(1)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table1"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{}) + err = vtHandler.DelVrfTable(vrfTables[2]) + Expect(err).To(Succeed()) + + vppMsg, ok = ctx.MockChannel.Msg.(*ip.IPTableAddDel) + Expect(ok).To(BeTrue()) + Expect(vppMsg.Table.TableID).To(BeEquivalentTo(2)) + Expect(vppMsg.Table.IsIP6).To(BeEquivalentTo(1)) + Expect(vppMsg.IsAdd).To(BeEquivalentTo(0)) + Expect(vppMsg.Table.Name).To(BeEquivalentTo([]byte("table2"))) + + ctx.MockVpp.MockReply(&ip.IPTableAddDelReply{Retval: 1}) + err = vtHandler.DelVrfTable(vrfTables[0]) + Expect(err).To(Not(BeNil())) +} + +func vrfTableTestSetup(t *testing.T) (*vppcallmock.TestCtx, vppcalls.VrfTableVppAPI) { + ctx := vppcallmock.SetupTestCtx(t) + log := logrus.NewLogger("test-log") + vtHandler := vpp1908.NewVrfTableVppHandler(ctx.MockChannel, log) + return ctx, vtHandler +} diff --git a/plugins/vpp/l3plugin/vrfidx/doc.go b/plugins/vpp/l3plugin/vrfidx/doc.go new file mode 100644 index 0000000000..2927565a32 --- /dev/null +++ b/plugins/vpp/l3plugin/vrfidx/doc.go @@ -0,0 +1,3 @@ +// Package vrfidx implements name-to-index mapping registry and cache +// for VPP VRFs. +package vrfidx diff --git a/plugins/vpp/l3plugin/vrfidx/vrfidx.go b/plugins/vpp/l3plugin/vrfidx/vrfidx.go new file mode 100644 index 0000000000..916c08bcbd --- /dev/null +++ b/plugins/vpp/l3plugin/vrfidx/vrfidx.go @@ -0,0 +1,186 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vrfidx + +import ( + "time" + + l3 "github.com/ligato/vpp-agent/api/models/vpp/l3" + + "github.com/ligato/cn-infra/idxmap" + "github.com/ligato/cn-infra/logging" + + "github.com/ligato/vpp-agent/pkg/idxvpp" +) + +// VRFMetadataIndex provides read-only access to mapping with VPP VRF +// metadata. It extends from NameToIndex. +type VRFMetadataIndex interface { + // LookupByName retrieves a previously stored metadata of VRF + // identified by