├── binapigen
├── vppapi
│ ├── testdata
│ │ ├── input.txt
│ │ ├── input-read-json-error.json
│ │ └── input-generate-error.json
│ ├── log.go
│ ├── integration_test.go
│ └── input_test.go
├── binapigen_test.go
├── log.go
├── generate.go
└── strings_test.go
├── docs
├── govpp-logo.png
├── RELEASE.md
└── GENERATOR.md
├── api
├── doc.go
├── errors_test.go
└── trace.go
├── codec
├── doc.go
├── bench_test.go
└── marshaler.go
├── .github
├── ci
│ └── yamllint.yml
├── dependabot.yml
├── workflows
│ ├── test.yaml
│ └── release.yaml
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── Dockerfile.govpp
├── extras
├── libmemif
│ └── doc.go
├── .gitignore
├── test
│ ├── build
│ │ ├── vpp.conf
│ │ └── Dockerfile.extras
│ └── run_integration.sh
├── go.mod
├── Makefile
└── gomemif
│ ├── README.rst
│ └── memif
│ ├── interface_unsafe.go
│ ├── control_channel_unsafe.go
│ └── memif_unsafe.go
├── test
├── build
│ ├── vpp.conf
│ └── Dockerfile.integration
├── performance
│ └── binapi_bench_test.go
├── integration
│ ├── main_test.go
│ ├── examples_test.go
│ ├── trace_test.go
│ └── README.md
└── run_integration.sh
├── .golangci.yml
├── .gitignore
├── adapter
├── doc.go
├── socketclient
│ └── doc.go
├── vpp_api.go
└── mock
│ ├── mock_stats_adapter.go
│ └── binapi
│ └── binapi_reflect.go
├── core
├── genericpool
│ └── generic_pool.go
├── control_ping.go
├── request_handler_test.go
├── log.go
└── stream_test.go
├── proxy
├── log.go
└── proxy.go
├── examples
├── README.md
├── api-trace
│ └── README.md
└── multi-vpp
│ └── README.md
├── binapi
├── auto_sdl
│ └── auto_sdl_rpc.ba.go
├── cdp
│ └── cdp_rpc.ba.go
├── ct6
│ └── ct6_rpc.ba.go
├── mdata
│ └── mdata_rpc.ba.go
├── npt66
│ └── npt66_rpc.ba.go
├── oddbuf
│ └── oddbuf_rpc.ba.go
├── ping
│ └── ping_rpc.ba.go
├── gso
│ └── gso_rpc.ba.go
├── rd_cp
│ └── rd_cp_rpc.ba.go
├── tls_openssl
│ └── tls_openssl_rpc.ba.go
├── tcp
│ └── tcp_rpc.ba.go
├── tracenode
│ └── tracenode_rpc.ba.go
├── ioam_cache
│ └── ioam_cache_rpc.ba.go
├── ioam_export
│ └── ioam_export_rpc.ba.go
├── dhcp6_ia_na_client_cp
│ └── dhcp6_ia_na_client_cp_rpc.ba.go
├── crypto_sw_scheduler
│ └── crypto_sw_scheduler_rpc.ba.go
├── gen.go
├── vxlan_gpe_ioam_export
│ └── vxlan_gpe_ioam_export_rpc.ba.go
├── arping
│ └── arping_rpc.ba.go
├── avf
│ └── avf_rpc.ba.go
├── idpf
│ └── idpf_rpc.ba.go
├── pci_types
│ └── pci_types.ba.go
├── af_xdp
│ └── af_xdp_rpc.ba.go
├── udp_ping
│ └── udp_ping_rpc.ba.go
├── p2p_ethernet
│ └── p2p_ethernet_rpc.ba.go
├── feature
│ └── feature_rpc.ba.go
├── http_static
│ └── http_static_rpc.ba.go
├── sr_mobile
│ └── sr_mobile_rpc.ba.go
├── bpf_trace_filter
│ └── bpf_trace_filter_rpc.ba.go
├── vpe
│ ├── vpe_http.ba.go
│ └── vpe_rpc.ba.go
├── adl
│ └── adl_rpc.ba.go
├── dhcp6_pd_client_cp
│ └── dhcp6_pd_client_cp_rpc.ba.go
├── trace
│ └── trace_rpc.ba.go
├── crypto
│ └── crypto_rpc.ba.go
├── graph
│ └── graph_rpc.ba.go
├── sr_mobile_types
│ └── sr_mobile_types.ba.go
├── ethernet_types
│ └── ethernet_types.ba.go
├── lacp
│ └── lacp_rpc.ba.go
├── dev
│ └── dev_rpc.ba.go
├── gre
│ └── gre_rpc.ba.go
├── dns
│ └── dns_rpc.ba.go
├── syslog
│ └── syslog_rpc.ba.go
├── teib
│ └── teib_rpc.ba.go
├── stn
│ └── stn_rpc.ba.go
├── fib
│ └── fib_rpc.ba.go
├── nsim
│ └── nsim_rpc.ba.go
├── flow
│ └── flow_rpc.ba.go
├── mss_clamp
│ └── mss_clamp_rpc.ba.go
├── rdma
│ └── rdma_rpc.ba.go
├── span
│ └── span_rpc.ba.go
├── pipe
│ └── pipe_rpc.ba.go
├── lldp
│ └── lldp_rpc.ba.go
├── sr_pt
│ └── sr_pt_rpc.ba.go
├── urpf
│ └── urpf_rpc.ba.go
├── sr_mpls
│ └── sr_mpls_rpc.ba.go
├── mactime
│ └── mactime_rpc.ba.go
├── pppoe
│ └── pppoe_rpc.ba.go
├── pvti
│ └── pvti_rpc.ba.go
├── l3xc
│ └── l3xc_rpc.ba.go
├── udp
│ └── udp_rpc.ba.go
├── tapv2
│ └── tapv2_rpc.ba.go
├── pot
│ └── pot_rpc.ba.go
├── virtio
│ └── virtio_rpc.ba.go
├── geneve
│ └── geneve_rpc.ba.go
└── ioam_vxlan_gpe
│ └── ioam_vxlan_gpe_rpc.ba.go
├── gen.go
├── cmd
├── govpp
│ ├── main.go
│ ├── util.go
│ ├── log.go
│ └── options.go
└── binapi-generator
│ └── doc.go
├── Dockerfile
├── doc.go
├── INFO.yaml
├── go.mod
├── govpp.go
└── .goreleaser.yml
/binapigen/vppapi/testdata/input.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/binapigen/vppapi/testdata/input-read-json-error.json:
--------------------------------------------------------------------------------
1 | %
--------------------------------------------------------------------------------
/binapigen/vppapi/testdata/input-generate-error.json:
--------------------------------------------------------------------------------
1 | {
2 | "key": "value"
3 | }
--------------------------------------------------------------------------------
/docs/govpp-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FDio/govpp/HEAD/docs/govpp-logo.png
--------------------------------------------------------------------------------
/api/doc.go:
--------------------------------------------------------------------------------
1 | // Package api defines interfaces required by every file generated with binapi-generator
2 | package api
3 |
--------------------------------------------------------------------------------
/codec/doc.go:
--------------------------------------------------------------------------------
1 | // Package codec provides methods allowing to encode and decode message structs to/from binary format accepted by VPP.
2 | package codec
3 |
--------------------------------------------------------------------------------
/.github/ci/yamllint.yml:
--------------------------------------------------------------------------------
1 | ---
2 | extends: relaxed
3 |
4 | yaml-files:
5 | - '*.yaml'
6 | - '*.yml'
7 |
8 | rules:
9 | truthy: disable
10 | # 80 chars should be enough, but don't fail if a line is longer
11 | line-length: disable
12 |
--------------------------------------------------------------------------------
/Dockerfile.govpp:
--------------------------------------------------------------------------------
1 | FROM alpine:3.22
2 |
3 | RUN set -eux; \
4 | apk add --no-cache \
5 | bash \
6 | git \
7 | make \
8 | python3 \
9 | py3-ply
10 |
11 | COPY govpp /
12 |
13 | ENTRYPOINT ["/govpp"]
14 |
--------------------------------------------------------------------------------
/extras/libmemif/doc.go:
--------------------------------------------------------------------------------
1 | // Package libmemif is a Golang adapter for the libmemif library
2 | // (extras/libmemif in the VPP repository). To differentiate between the adapter
3 | // and the underlying C-written library, labels "Go-libmemif" and "C-libmemif"
4 | // are used in the documentation.
5 | package libmemif
6 |
--------------------------------------------------------------------------------
/extras/.gitignore:
--------------------------------------------------------------------------------
1 | # libmemif
2 | libmemif/examples/gopacket/gopacket
3 | libmemif/examples/icmp-responder/icmp-responder
4 | libmemif/examples/jumbo-frames/jumbo-frames
5 | libmemif/examples/raw-data/raw-data
6 | gomemif/examples/bridge/bridge
7 | gomemif/examples/icmp_responder_cb/icmp_responder_cb
8 | gomemif/examples/icmp_responder_poll/icmp_responder_poll
9 |
--------------------------------------------------------------------------------
/test/build/vpp.conf:
--------------------------------------------------------------------------------
1 | unix {
2 | nodaemon
3 | log /var/log/vpp.log
4 | cli-listen /run/vpp/cli.sock
5 | cli-no-pager
6 | full-coredump
7 | pidfile /run/vpp/vpp.pid
8 | }
9 | api-trace {
10 | on
11 | }
12 | socksvr {
13 | socket-name /run/vpp/api.sock
14 | }
15 | statseg {
16 | socket-name /run/vpp/stats.sock
17 | per-node-counters on
18 | }
19 | plugins {
20 | plugin dpdk_plugin.so { disable }
21 | }
22 |
--------------------------------------------------------------------------------
/extras/test/build/vpp.conf:
--------------------------------------------------------------------------------
1 | unix {
2 | nodaemon
3 | log /var/log/vpp.log
4 | cli-listen /run/vpp/cli.sock
5 | cli-no-pager
6 | full-coredump
7 | pidfile /run/vpp/vpp.pid
8 | }
9 | api-trace {
10 | on
11 | }
12 | socksvr {
13 | socket-name /run/vpp/api.sock
14 | }
15 | statseg {
16 | socket-name /run/vpp/stats.sock
17 | per-node-counters on
18 | }
19 | plugins {
20 | plugin dpdk_plugin.so { disable }
21 | }
22 |
--------------------------------------------------------------------------------
/.golangci.yml:
--------------------------------------------------------------------------------
1 | version: "2"
2 | linters:
3 | exclusions:
4 | generated: lax
5 | presets:
6 | - comments
7 | - common-false-positives
8 | - legacy
9 | - std-error-handling
10 | paths:
11 | - .*\.ba.\.go$
12 | - adapter/mock
13 | - third_party$
14 | - builtin$
15 | - examples$
16 | formatters:
17 | exclusions:
18 | generated: lax
19 | paths:
20 | - third_party$
21 | - builtin$
22 | - examples$
23 |
--------------------------------------------------------------------------------
/api/errors_test.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "testing"
5 |
6 | . "github.com/onsi/gomega"
7 | )
8 |
9 | func TestUnspecified(t *testing.T) {
10 | RegisterTestingT(t)
11 |
12 | var err error = VPPApiError(-1)
13 | errstr := err.Error()
14 | Expect(errstr).Should(BeEquivalentTo("VPPApiError: Unspecified Error (-1)"))
15 | }
16 |
17 | func TestUnknown(t *testing.T) {
18 | RegisterTestingT(t)
19 |
20 | var err error = VPPApiError(-999)
21 | errstr := err.Error()
22 | Expect(errstr).Should(BeEquivalentTo("VPPApiError: -999"))
23 | }
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *.log
3 | *.out
4 | *.test
5 |
6 | .idea/
7 |
8 | .cache/
9 |
10 | /bin/
11 | /dist/
12 | /govpp
13 |
14 | # cmd
15 | cmd/binapi-generator/binapi-generator
16 | cmd/vpp-proxy/vpp-proxy
17 | cmd/govpp/govpp
18 |
19 | # examples
20 | examples/api-trace/api-trace
21 | examples/multi-vpp/multi-vpp
22 | examples/perf-bench/perf-bench
23 | examples/rpc-service/rpc-service
24 | examples/simple-client/simple-client
25 | examples/stats-client/stats-client
26 | examples/stream-client/stream-client
27 | examples/union-example/union-example
28 |
29 | /govpp
--------------------------------------------------------------------------------
/adapter/doc.go:
--------------------------------------------------------------------------------
1 | // Package adapter provides an interface between govpp core and the VPP. It is responsible for sending
2 | // and receiving binary-encoded data to/from VPP via shared memory.
3 | //
4 | // The default adapter being used for connection with real VPP is called vppapiclient. It is based on the
5 | // communication with the vppapiclient VPP library written in C via CGO.
6 | //
7 | // Apart from the vppapiclient adapter, mock adapter is provided for unit/integration testing where the actual
8 | // communication with VPP is not demanded.
9 | package adapter
10 |
--------------------------------------------------------------------------------
/core/genericpool/generic_pool.go:
--------------------------------------------------------------------------------
1 | package genericpool
2 |
3 | import (
4 | "sync"
5 | )
6 |
7 | type Resettable interface {
8 | Reset()
9 | }
10 |
11 | type Pool[T any] struct {
12 | p sync.Pool
13 | }
14 |
15 | func (p *Pool[T]) Get() T {
16 | return p.p.Get().(T)
17 | }
18 |
19 | func (p *Pool[T]) Put(x T) {
20 | if res, ok := any(x).(Resettable); ok {
21 | res.Reset()
22 | }
23 | p.p.Put(x)
24 | }
25 |
26 | func New[T any](f func() T) *Pool[T] {
27 | return &Pool[T]{
28 | p: sync.Pool{
29 | New: func() any { return f() },
30 | },
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/extras/go.mod:
--------------------------------------------------------------------------------
1 | module go.fd.io/govpp/extras
2 |
3 | go 1.22
4 |
5 | require (
6 | github.com/google/gopacket v1.1.17
7 | github.com/pkg/profile v1.7.0
8 | github.com/sirupsen/logrus v1.9.3
9 | go.fd.io/govpp v0.10.0
10 | )
11 |
12 | require (
13 | github.com/felixge/fgprof v0.9.3 // indirect
14 | github.com/fsnotify/fsnotify v1.7.0 // indirect
15 | github.com/ftrvxmtrx/fd v0.0.0-20150925145434-c6d800382fff // indirect
16 | github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
17 | github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe // indirect
18 | github.com/mitchellh/go-ps v1.0.0 // indirect
19 | golang.org/x/sys v0.16.0 // indirect
20 | )
21 |
--------------------------------------------------------------------------------
/core/control_ping.go:
--------------------------------------------------------------------------------
1 | package core
2 |
3 | import (
4 | "go.fd.io/govpp/api"
5 | "go.fd.io/govpp/binapi/memclnt"
6 | )
7 |
8 | var (
9 | msgControlPing api.Message = new(ControlPing)
10 | msgControlPingReply api.Message = new(ControlPingReply)
11 | )
12 |
13 | // SetControlPing sets the control ping message used by core.
14 | func SetControlPing(m api.Message) {
15 | msgControlPing = m
16 | }
17 |
18 | // SetControlPingReply sets the control ping reply message used by core.
19 | func SetControlPingReply(m api.Message) {
20 | msgControlPingReply = m
21 | }
22 |
23 | type (
24 | ControlPing = memclnt.ControlPing
25 | ControlPingReply = memclnt.ControlPingReply
26 | )
27 |
--------------------------------------------------------------------------------
/proxy/log.go:
--------------------------------------------------------------------------------
1 | package proxy
2 |
3 | import (
4 | "io"
5 | "os"
6 |
7 | "github.com/sirupsen/logrus"
8 | )
9 |
10 | var (
11 | debug = os.Getenv("DEBUG_GOVPP_PROXY") != ""
12 |
13 | log = logrus.New()
14 | )
15 |
16 | func init() {
17 | if debug {
18 | log.Level = logrus.DebugLevel
19 | log.Debugf("govpp/proxy: debug mode enabled")
20 | }
21 | }
22 |
23 | // SetLogger sets logger.
24 | func SetLogger(l *logrus.Logger) {
25 | log = l
26 | }
27 |
28 | // SetLogLevel sets log level for logger.
29 | func SetLogLevel(lvl logrus.Level) {
30 | log.Level = lvl
31 | }
32 |
33 | // SetOutput sets log output for logger.
34 | func SetLogOutput(out io.Writer) {
35 | log.Out = out
36 | }
37 |
--------------------------------------------------------------------------------
/binapigen/binapigen_test.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package binapigen
16 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | # Examples
2 |
3 | Here is a list of code examples demonstrating various GoVPP features:
4 |
5 | - [api-trace](api-trace) - trace sent/received messages
6 | - [binapi-types](binapi-types) - using common types from generated code
7 | - [multi-vpp](multi-vpp) - connect to multiple VPP instances
8 | - [perf-bench](perf-bench) - very basic performance test for measuring throughput
9 | - [rpc-service](rpc-service) - effortless way to call VPP API via RPC client
10 | - [simple-client](simple-client) - send and receive VPP API messages using GoVPP API directly
11 | - [stats-client](stats-client) - client for retrieving VPP stats data
12 | - [stream-client](stream-client) - using new stream API to call VPP API
13 |
--------------------------------------------------------------------------------
/extras/Makefile:
--------------------------------------------------------------------------------
1 | GO ?= GO111MODULE=on go
2 |
3 | build: extras
4 |
5 | extras:
6 | @echo "=> building extras"
7 | cd libmemif/examples/gopacket && $(GO) build -v
8 | cd libmemif/examples/icmp-responder && $(GO) build -v
9 | cd libmemif/examples/jumbo-frames && $(GO) build -v
10 | cd libmemif/examples/raw-data && $(GO) build -v
11 | cd gomemif/examples/bridge && $(GO) build -v
12 | cd gomemif/examples/icmp_responder_cb && $(GO) build -v
13 | cd gomemif/examples/icmp_responder_poll && $(GO) build -v
14 |
15 | clean:
16 | @echo "=> cleaning extras"
17 | go clean -v ./...
18 |
19 | test-extras: extras
20 | ## Run extras integration tests
21 | @echo "# running extras integration tests"
22 | VPP_REPO=$(VPP_REPO) ./test/run_integration.sh
23 |
24 | .PHONY: build extras clean
25 |
--------------------------------------------------------------------------------
/binapi/auto_sdl/auto_sdl_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package auto_sdl
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service auto_sdl.
12 | type RPCService interface {
13 | AutoSdlConfig(ctx context.Context, in *AutoSdlConfig) (*AutoSdlConfigReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) AutoSdlConfig(ctx context.Context, in *AutoSdlConfig) (*AutoSdlConfigReply, error) {
25 | out := new(AutoSdlConfigReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/cdp/cdp_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package cdp
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service cdp.
12 | type RPCService interface {
13 | CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) {
25 | out := new(CdpEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/ct6/ct6_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package ct6
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service ct6.
12 | type RPCService interface {
13 | Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) {
25 | out := new(Ct6EnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/mdata/mdata_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package mdata
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service mdata.
12 | type RPCService interface {
13 | MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error) {
25 | out := new(MdataEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/npt66/npt66_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package npt66
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service npt66.
12 | type RPCService interface {
13 | Npt66BindingAddDel(ctx context.Context, in *Npt66BindingAddDel) (*Npt66BindingAddDelReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) Npt66BindingAddDel(ctx context.Context, in *Npt66BindingAddDel) (*Npt66BindingAddDelReply, error) {
25 | out := new(Npt66BindingAddDelReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/oddbuf/oddbuf_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package oddbuf
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service oddbuf.
12 | type RPCService interface {
13 | OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error) {
25 | out := new(OddbufEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/ping/ping_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package ping
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service ping.
12 | type RPCService interface {
13 | WantPingFinishedEvents(ctx context.Context, in *WantPingFinishedEvents) (*WantPingFinishedEventsReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) WantPingFinishedEvents(ctx context.Context, in *WantPingFinishedEvents) (*WantPingFinishedEventsReply, error) {
25 | out := new(WantPingFinishedEventsReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/gso/gso_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package gso
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service gso.
12 | type RPCService interface {
13 | FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error) {
25 | out := new(FeatureGsoEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/rd_cp/rd_cp_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package rd_cp
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service rd_cp.
12 | type RPCService interface {
13 | IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error) {
25 | out := new(IP6NdAddressAutoconfigReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/tls_openssl/tls_openssl_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package tls_openssl
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service tls_openssl.
12 | type RPCService interface {
13 | TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error) {
25 | out := new(TLSOpensslSetEngineReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/tcp/tcp_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package tcp
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service tcp.
12 | type RPCService interface {
13 | TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error) {
25 | out := new(TCPConfigureSrcAddressesReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Dependabot configuration
2 | #
3 | # See docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
4 | ---
5 | version: 2
6 | updates:
7 |
8 | # Maintain dependencies for GitHub Actions
9 | - package-ecosystem: "github-actions"
10 | directory: "/"
11 | schedule:
12 | interval: "weekly"
13 | labels:
14 | - "dependencies"
15 | reviewers:
16 | - "FDio/govpp-committers"
17 | groups:
18 | github-deps:
19 | patterns:
20 | - "*"
21 |
22 | # Maintain dependencies for Go modules
23 | - package-ecosystem: "gomod"
24 | directory: "/"
25 | schedule:
26 | interval: "weekly"
27 | labels:
28 | - "dependencies"
29 | reviewers:
30 | - "FDio/govpp-committers"
31 | groups:
32 | go-deps:
33 | patterns:
34 | - "*"
35 |
--------------------------------------------------------------------------------
/binapi/tracenode/tracenode_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package tracenode
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service tracenode.
12 | type RPCService interface {
13 | TracenodeEnableDisable(ctx context.Context, in *TracenodeEnableDisable) (*TracenodeEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) TracenodeEnableDisable(ctx context.Context, in *TracenodeEnableDisable) (*TracenodeEnableDisableReply, error) {
25 | out := new(TracenodeEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/gen.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at:
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 |
17 | package govpp
18 |
19 | //go:generate bash -c "docker run -e PKGPREFIX=$(go list)/binapi -v $(go list -f '{{ .Dir }}'):/gen $(docker build . -q --build-arg GOVPP_VERSION=$(go list -m -f '{{ .Version }}' go.fd.io/govpp))"
20 |
--------------------------------------------------------------------------------
/binapi/ioam_cache/ioam_cache_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package ioam_cache
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service ioam_cache.
12 | type RPCService interface {
13 | IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error) {
25 | out := new(IoamCacheIP6EnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/ioam_export/ioam_export_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package ioam_export
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service ioam_export.
12 | type RPCService interface {
13 | IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error) {
25 | out := new(IoamExportIP6EnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapigen/vppapi/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vppapi
16 |
17 | import (
18 | "log"
19 | "os"
20 | "strings"
21 | )
22 |
23 | var debug = strings.Contains(os.Getenv("DEBUG_GOVPP"), "parser")
24 |
25 | func logf(f string, v ...interface{}) {
26 | if debug {
27 | log.Printf(f, v...)
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/performance/binapi_bench_test.go:
--------------------------------------------------------------------------------
1 | package performance
2 |
3 | import (
4 | "testing"
5 |
6 | "go.fd.io/govpp/binapi/memclnt"
7 |
8 | "go.fd.io/govpp/test/vpptesting"
9 | )
10 |
11 | func BenchmarkBinapiControlPing(b *testing.B) {
12 |
13 | b.Run("1", func(b *testing.B) {
14 | benchBinapiControlPing(b, 1)
15 | })
16 | b.Run("10", func(b *testing.B) {
17 | benchBinapiControlPing(b, 10)
18 | })
19 | b.Run("100", func(b *testing.B) {
20 | benchBinapiControlPing(b, 100)
21 | })
22 | }
23 |
24 | func benchBinapiControlPing(b *testing.B, repeatN int) {
25 | test := vpptesting.SetupVPP(b)
26 | ctx := test.Context
27 |
28 | c := memclnt.NewServiceClient(test.Conn)
29 |
30 | b.ResetTimer()
31 | for i := 0; i < b.N; i++ {
32 | for r := 0; r < repeatN; r++ {
33 | _, err := c.ControlPing(ctx, &memclnt.ControlPing{})
34 | if err != nil {
35 | b.Fatalf("getting version failed: %v", err)
36 | }
37 | }
38 | }
39 | b.StopTimer()
40 | }
41 |
--------------------------------------------------------------------------------
/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package dhcp6_ia_na_client_cp
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service dhcp6_ia_na_client_cp.
12 | type RPCService interface {
13 | DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) {
25 | out := new(DHCP6ClientEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/crypto_sw_scheduler/crypto_sw_scheduler_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package crypto_sw_scheduler
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service crypto_sw_scheduler.
12 | type RPCService interface {
13 | CryptoSwSchedulerSetWorker(ctx context.Context, in *CryptoSwSchedulerSetWorker) (*CryptoSwSchedulerSetWorkerReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) CryptoSwSchedulerSetWorker(ctx context.Context, in *CryptoSwSchedulerSetWorker) (*CryptoSwSchedulerSetWorkerReply, error) {
25 | out := new(CryptoSwSchedulerSetWorkerReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/binapi/gen.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package binapi
16 |
17 | // To generate bindings for VPP API files in the default system directory, run:
18 | //
19 | // go generate ./binapi
20 | //
21 | //go:generate binapi-generator --input=/usr/share/vpp/api --output-dir=. --gen=rpc
22 | //go:generate binapi-generator --input=/usr/share/vpp/api --output-dir=. --gen=http vpe
23 |
--------------------------------------------------------------------------------
/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package vxlan_gpe_ioam_export
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service vxlan_gpe_ioam_export.
12 | type RPCService interface {
13 | VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error)
14 | }
15 |
16 | type serviceClient struct {
17 | conn api.Connection
18 | }
19 |
20 | func NewServiceClient(conn api.Connection) RPCService {
21 | return &serviceClient{conn}
22 | }
23 |
24 | func (c *serviceClient) VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error) {
25 | out := new(VxlanGpeIoamExportEnableDisableReply)
26 | err := c.conn.Invoke(ctx, in, out)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return out, api.RetvalToVPPApiError(out.Retval)
31 | }
32 |
--------------------------------------------------------------------------------
/.github/workflows/test.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Test
3 | on:
4 | # Runs on branch push to master & PRs
5 | push:
6 | branches:
7 | - master
8 | - release/*
9 | pull_request:
10 | paths-ignore:
11 | - 'docs/**'
12 | - '**.md'
13 | # Runs daily at 05:05
14 | schedule:
15 | - cron: '5 5 * * *'
16 | # Allows running manually
17 | workflow_dispatch:
18 |
19 | jobs:
20 | integration:
21 | name: "VPP Integration ${{ matrix.version }}"
22 | runs-on: ubuntu-latest
23 | env:
24 | VPP_REPO: ${{ matrix.version }}
25 | strategy:
26 | fail-fast: false
27 | matrix:
28 | version:
29 | - 'master'
30 | - '2510'
31 | - '2502'
32 | - '2406'
33 |
34 | steps:
35 | - name: "Checkout"
36 | uses: actions/checkout@v6
37 |
38 | - name: "Setup Go"
39 | uses: actions/setup-go@v6
40 | with:
41 | go-version: '1.25'
42 |
43 | - name: "Run Tests"
44 | run: |
45 | make test-integration
46 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Description**
11 | _A clear and concise description of what the bug is.._
12 |
13 | **How to reproduce**
14 | Steps to reproduce the behavior:
15 | 1. _first.._
16 | 2. _then.._
17 | 3. _error.._
18 |
19 | **Expected Behavior**
20 | _A clear and concise description of what you expected to happen._
21 |
22 | **Screenshots/Logs**
23 | _If applicable, add screenshots to help explain your problem._
24 |
25 | **Environment** (please complete the following information)
26 | | Info | Example | Value |
27 | |-----------------------|-----------------------------|-----------|
28 | | OS/arch | _e.g. linux/amd64_ | |
29 | | VPP version | _v24.02-release_ | |
30 | | GoVPP version | _v0.8.0_ | |
31 |
32 | **Additional context**
33 | _Add any other context about the problem here._
34 |
--------------------------------------------------------------------------------
/cmd/govpp/main.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | import (
18 | "github.com/sirupsen/logrus"
19 | )
20 |
21 | func main() {
22 | Execute()
23 | }
24 |
25 | func Execute() {
26 | cli, err := NewCli()
27 | if err != nil {
28 | logrus.Fatalf("CLI init error: %v", err)
29 | }
30 | root := newRootCmd(cli)
31 |
32 | if err := root.Execute(); err != nil {
33 | logrus.Fatalf("ERROR: %v", err)
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/binapigen/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package binapigen
16 |
17 | import (
18 | "os"
19 | "strings"
20 |
21 | "github.com/sirupsen/logrus"
22 | )
23 |
24 | var Logger = logrus.New()
25 |
26 | func init() {
27 | if debug := os.Getenv("DEBUG_GOVPP"); strings.Contains(debug, "binapigen") {
28 | Logger.SetLevel(logrus.DebugLevel)
29 | logrus.SetLevel(logrus.DebugLevel)
30 | }
31 | }
32 |
33 | func logf(f string, v ...interface{}) {
34 | Logger.Debugf(f, v...)
35 | }
36 |
--------------------------------------------------------------------------------
/extras/gomemif/README.rst:
--------------------------------------------------------------------------------
1 | .. _gomemif_doc:
2 |
3 | Gomemif library
4 | =======================
5 |
6 | Memif library implemented in Go. The package contains 3 examples: Bridge and ICMP responder in interrupt and polling mode.
7 |
8 | setup and run
9 | -------------
10 | To Build all examples
11 |
12 | ::
13 |
14 | cd .. && make extras
15 |
16 | To Run ICMP responder in interrupt mode:
17 |
18 | ::
19 |
20 | DBGvpp# create interface memif id 0 master
21 | DBGvpp# set int ip addr memif0/0 192.168.1.2/24
22 | DBGvpp# set int state memif0/0 up
23 |
24 | examples/icmp_responder_cb/icmp_responder_cb
25 | gomemif# start
26 |
27 | DBGvpp# ping 192.168.1.1
28 |
29 | To Run ICMP responder in polling mode:
30 |
31 | ::
32 |
33 | DBGvpp# create interface memif id 0 master
34 | DBGvpp# set int ip addr memif0/0 192.168.1.2/24
35 | DBGvpp# set int state memif0/0 up
36 |
37 | examples/icmp_responder_poll/icmp_responder_poll
38 | gomemif# start
39 |
40 | DBGvpp# ping 192.168.1.1
41 |
42 | To Run Bridge:
43 |
44 | ::
45 |
46 | examples/bridge/bridge
47 | gomemif# start
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/binapi/arping/arping_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package arping
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service arping.
12 | type RPCService interface {
13 | Arping(ctx context.Context, in *Arping) (*ArpingReply, error)
14 | ArpingAcd(ctx context.Context, in *ArpingAcd) (*ArpingAcdReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) Arping(ctx context.Context, in *Arping) (*ArpingReply, error) {
26 | out := new(ArpingReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) ArpingAcd(ctx context.Context, in *ArpingAcd) (*ArpingAcdReply, error) {
35 | out := new(ArpingAcdReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/avf/avf_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package avf
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service avf.
12 | type RPCService interface {
13 | AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error)
14 | AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) {
26 | out := new(AvfCreateReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) {
35 | out := new(AvfDeleteReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/idpf/idpf_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package idpf
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service idpf.
12 | type RPCService interface {
13 | IdpfCreate(ctx context.Context, in *IdpfCreate) (*IdpfCreateReply, error)
14 | IdpfDelete(ctx context.Context, in *IdpfDelete) (*IdpfDeleteReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) IdpfCreate(ctx context.Context, in *IdpfCreate) (*IdpfCreateReply, error) {
26 | out := new(IdpfCreateReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) IdpfDelete(ctx context.Context, in *IdpfDelete) (*IdpfDeleteReply, error) {
35 | out := new(IdpfDeleteReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/pci_types/pci_types.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 | // versions:
3 | // binapi-generator: v0.12.0
4 | // VPP: 25.10-release
5 | // source: core/pci_types.api.json
6 |
7 | // Package pci_types contains generated bindings for API file pci_types.api.
8 | //
9 | // Contents:
10 | // - 1 struct
11 | package pci_types
12 |
13 | import (
14 | api "go.fd.io/govpp/api"
15 | )
16 |
17 | // This is a compile-time assertion to ensure that this generated file
18 | // is compatible with the GoVPP api package it is being compiled against.
19 | // A compilation error at this line likely means your copy of the
20 | // GoVPP api package needs to be updated.
21 | const _ = api.GoVppAPIPackageIsVersion2
22 |
23 | const (
24 | APIFile = "pci_types"
25 | APIVersion = "1.0.0"
26 | VersionCrc = 0x5d418665
27 | )
28 |
29 | // PciAddress defines type 'pci_address'.
30 | type PciAddress struct {
31 | Domain uint16 `binapi:"u16,name=domain" json:"domain,omitempty"`
32 | Bus uint8 `binapi:"u8,name=bus" json:"bus,omitempty"`
33 | Slot uint8 `binapi:"u8,name=slot" json:"slot,omitempty"`
34 | Function uint8 `binapi:"u8,name=function" json:"function,omitempty"`
35 | }
36 |
--------------------------------------------------------------------------------
/binapi/af_xdp/af_xdp_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package af_xdp
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service af_xdp.
12 | type RPCService interface {
13 | AfXdpCreateV3(ctx context.Context, in *AfXdpCreateV3) (*AfXdpCreateV3Reply, error)
14 | AfXdpDelete(ctx context.Context, in *AfXdpDelete) (*AfXdpDeleteReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) AfXdpCreateV3(ctx context.Context, in *AfXdpCreateV3) (*AfXdpCreateV3Reply, error) {
26 | out := new(AfXdpCreateV3Reply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) AfXdpDelete(ctx context.Context, in *AfXdpDelete) (*AfXdpDeleteReply, error) {
35 | out := new(AfXdpDeleteReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapigen/vppapi/integration_test.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | //go:build integration
16 |
17 | package vppapi_test
18 |
19 | import (
20 | "encoding/json"
21 | "testing"
22 |
23 | "go.fd.io/govpp/binapigen/vppapi"
24 | )
25 |
26 | func TestParse(t *testing.T) {
27 | files, err := vppapi.Parse()
28 | if err != nil {
29 | t.Fatal(err)
30 | }
31 |
32 | for _, file := range files {
33 | b, err := json.MarshalIndent(file, "\t", " ")
34 | if err != nil {
35 | t.Fatal(err)
36 | }
37 | t.Logf(" - %s:\n%s", file.Name, b)
38 | }
39 |
40 | t.Logf("parsed %d files", len(files))
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/udp_ping/udp_ping_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package udp_ping
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service udp_ping.
12 | type RPCService interface {
13 | UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error)
14 | UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error) {
26 | out := new(UDPPingAddDelReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) {
35 | out := new(UDPPingExportReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package p2p_ethernet
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service p2p_ethernet.
12 | type RPCService interface {
13 | P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error)
14 | P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error) {
26 | out := new(P2pEthernetAddReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) {
35 | out := new(P2pEthernetDelReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/feature/feature_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package feature
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service feature.
12 | type RPCService interface {
13 | FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error)
14 | FeatureIsEnabled(ctx context.Context, in *FeatureIsEnabled) (*FeatureIsEnabledReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) {
26 | out := new(FeatureEnableDisableReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) FeatureIsEnabled(ctx context.Context, in *FeatureIsEnabled) (*FeatureIsEnabledReply, error) {
35 | out := new(FeatureIsEnabledReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/http_static/http_static_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package http_static
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service http_static.
12 | type RPCService interface {
13 | HTTPStaticEnableV4(ctx context.Context, in *HTTPStaticEnableV4) (*HTTPStaticEnableV4Reply, error)
14 | HTTPStaticEnableV5(ctx context.Context, in *HTTPStaticEnableV5) (*HTTPStaticEnableV5Reply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) HTTPStaticEnableV4(ctx context.Context, in *HTTPStaticEnableV4) (*HTTPStaticEnableV4Reply, error) {
26 | out := new(HTTPStaticEnableV4Reply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) HTTPStaticEnableV5(ctx context.Context, in *HTTPStaticEnableV5) (*HTTPStaticEnableV5Reply, error) {
35 | out := new(HTTPStaticEnableV5Reply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/sr_mobile/sr_mobile_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package sr_mobile
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service sr_mobile.
12 | type RPCService interface {
13 | SrMobileLocalsidAddDel(ctx context.Context, in *SrMobileLocalsidAddDel) (*SrMobileLocalsidAddDelReply, error)
14 | SrMobilePolicyAdd(ctx context.Context, in *SrMobilePolicyAdd) (*SrMobilePolicyAddReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) SrMobileLocalsidAddDel(ctx context.Context, in *SrMobileLocalsidAddDel) (*SrMobileLocalsidAddDelReply, error) {
26 | out := new(SrMobileLocalsidAddDelReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) SrMobilePolicyAdd(ctx context.Context, in *SrMobilePolicyAdd) (*SrMobilePolicyAddReply, error) {
35 | out := new(SrMobilePolicyAddReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/bpf_trace_filter/bpf_trace_filter_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package bpf_trace_filter
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service bpf_trace_filter.
12 | type RPCService interface {
13 | BpfTraceFilterSet(ctx context.Context, in *BpfTraceFilterSet) (*BpfTraceFilterSetReply, error)
14 | BpfTraceFilterSetV2(ctx context.Context, in *BpfTraceFilterSetV2) (*BpfTraceFilterSetV2Reply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) BpfTraceFilterSet(ctx context.Context, in *BpfTraceFilterSet) (*BpfTraceFilterSetReply, error) {
26 | out := new(BpfTraceFilterSetReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) BpfTraceFilterSetV2(ctx context.Context, in *BpfTraceFilterSetV2) (*BpfTraceFilterSetV2Reply, error) {
35 | out := new(BpfTraceFilterSetV2Reply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/vpe/vpe_http.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package vpe
4 |
5 | import (
6 | "encoding/json"
7 | "net/http"
8 | )
9 |
10 | func HTTPHandler(rpc RPCService) http.Handler {
11 | mux := http.NewServeMux()
12 | mux.HandleFunc("/show_version", func(w http.ResponseWriter, req *http.Request) {
13 | var request = new(ShowVersion)
14 | reply, err := rpc.ShowVersion(req.Context(), request)
15 | if err != nil {
16 | http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
17 | return
18 | }
19 | rep, err := json.MarshalIndent(reply, "", " ")
20 | if err != nil {
21 | http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
22 | return
23 | }
24 | w.Write(rep)
25 | })
26 | mux.HandleFunc("/show_vpe_system_time", func(w http.ResponseWriter, req *http.Request) {
27 | var request = new(ShowVpeSystemTime)
28 | reply, err := rpc.ShowVpeSystemTime(req.Context(), request)
29 | if err != nil {
30 | http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
31 | return
32 | }
33 | rep, err := json.MarshalIndent(reply, "", " ")
34 | if err != nil {
35 | http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
36 | return
37 | }
38 | w.Write(rep)
39 | })
40 | return http.HandlerFunc(mux.ServeHTTP)
41 | }
42 |
--------------------------------------------------------------------------------
/binapi/adl/adl_rpc.ba.go:
--------------------------------------------------------------------------------
1 | // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 |
3 | package adl
4 |
5 | import (
6 | "context"
7 |
8 | api "go.fd.io/govpp/api"
9 | )
10 |
11 | // RPCService defines RPC service adl.
12 | type RPCService interface {
13 | AdlAllowlistEnableDisable(ctx context.Context, in *AdlAllowlistEnableDisable) (*AdlAllowlistEnableDisableReply, error)
14 | AdlInterfaceEnableDisable(ctx context.Context, in *AdlInterfaceEnableDisable) (*AdlInterfaceEnableDisableReply, error)
15 | }
16 |
17 | type serviceClient struct {
18 | conn api.Connection
19 | }
20 |
21 | func NewServiceClient(conn api.Connection) RPCService {
22 | return &serviceClient{conn}
23 | }
24 |
25 | func (c *serviceClient) AdlAllowlistEnableDisable(ctx context.Context, in *AdlAllowlistEnableDisable) (*AdlAllowlistEnableDisableReply, error) {
26 | out := new(AdlAllowlistEnableDisableReply)
27 | err := c.conn.Invoke(ctx, in, out)
28 | if err != nil {
29 | return nil, err
30 | }
31 | return out, api.RetvalToVPPApiError(out.Retval)
32 | }
33 |
34 | func (c *serviceClient) AdlInterfaceEnableDisable(ctx context.Context, in *AdlInterfaceEnableDisable) (*AdlInterfaceEnableDisableReply, error) {
35 | out := new(AdlInterfaceEnableDisableReply)
36 | err := c.conn.Invoke(ctx, in, out)
37 | if err != nil {
38 | return nil, err
39 | }
40 | return out, api.RetvalToVPPApiError(out.Retval)
41 | }
42 |
--------------------------------------------------------------------------------
/examples/api-trace/README.md:
--------------------------------------------------------------------------------
1 | # API trace example
2 |
3 | The example demonstrates how to use the GoVPP API trace functionality. The trace is bound to a connection.
4 | The `core.Connection` includes the API trace object capable of recording API messages processed during the VPP API
5 | message exchange. Traced messages are called `records`.
6 |
7 | Each record contains information about the API message, its direction, time, and the channel ID.
8 |
9 | The trace is disabled by default. In order to enable it, call `NewTrace`:
10 |
11 | ```go
12 | c, err := govpp.Connect(*sockAddr)
13 | if err != nil {
14 | // handler error
15 | }
16 | size := 10
17 | trace := core.NewTrace(c, size)
18 | defer trace.Close()
19 | ```
20 |
21 | The code above initializes the new tracer which records a certain number of messages defined by the `size`.
22 |
23 | The following methods are available to call on the trace:
24 |
25 | * `GetRecords() []*Record` returns all records beginning with the initialization of the trace till the point of the
26 | method call. The size also restricts the maximum number of records. All records received after the tracer is full are
27 | discarded.
28 | * `GetRecordsForChannel(chId uint16) []*Record` works the same as the method above, but filters messages per channel.
29 | * `Clear()` resets the tracer and allows to reuse it with (the size remains the same).
30 | * `Close()` closes the tracer.
--------------------------------------------------------------------------------
/cmd/binapi-generator/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Cisco and/or its affiliates.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at:
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // The binapi-generator parses VPP API definitions in JSON format and generates Go code.
16 | //
17 | // The VPP API input can be specified using --input= option, where INPUT
18 | // is one of the following:
19 | //
20 | // - path to directory containing `*.api.json` files (these may be nested under core/plugins)
21 | // - path to local VPP repository (uses files under`build-root/install-vpp-native/vpp/share/vpp/api`)
22 | //
23 | // The generated Go code will be placed into directory specified using
24 | // `--output-dir=