aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/vpp-proxy
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-07-17 10:36:28 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-07-17 11:43:41 +0200
commitd1f24d37bd447b64e402298bb8eb2479681facf9 (patch)
treea3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /cmd/vpp-proxy
parent1548c7e12531e3d055567d761c580a1c7ff0ac40 (diff)
Improve binapi generator
- simplified Size/Marshal/Unmarshal methods - replace struc in unions with custom marshal/unmarshal - fix imports in generated files - fix mock adapter - generate rpc service using low-level stream API (dumps generate control ping or stream msg..) - move examples/binapi to binapi and generate all API for latest release - add binapigen.Plugin for developing custom generator plugins - optionally generate HTTP handlers (REST API) for RPC services - add govpp program for browsing VPP API Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'cmd/vpp-proxy')
-rw-r--r--cmd/vpp-proxy/main.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/cmd/vpp-proxy/main.go b/cmd/vpp-proxy/main.go
index 5221218..d1af5df 100644
--- a/cmd/vpp-proxy/main.go
+++ b/cmd/vpp-proxy/main.go
@@ -15,18 +15,16 @@
package main
import (
- "context"
"encoding/gob"
"flag"
- "io"
"log"
"git.fd.io/govpp.git/adapter/socketclient"
"git.fd.io/govpp.git/adapter/statsclient"
"git.fd.io/govpp.git/api"
+ interfaces "git.fd.io/govpp.git/binapi/interface"
+ "git.fd.io/govpp.git/binapi/vpe"
_ "git.fd.io/govpp.git/core"
- "git.fd.io/govpp.git/examples/binapi/interfaces"
- "git.fd.io/govpp.git/examples/binapi/vpe"
"git.fd.io/govpp.git/proxy"
)
@@ -93,30 +91,12 @@ func runClient() {
panic(err)
}
- // - using binapi message directly
req := &vpe.CliInband{Cmd: "show version"}
reply := new(vpe.CliInbandReply)
if err := binapiChannel.SendRequest(req).ReceiveReply(reply); err != nil {
log.Fatalln("binapi request failed:", err)
}
log.Printf("VPP version: %+v", reply.Reply)
-
- // - or using generated rpc service
- svc := interfaces.NewServiceClient(binapiChannel)
- stream, err := svc.DumpSwInterface(context.Background(), &interfaces.SwInterfaceDump{})
- if err != nil {
- log.Fatalln("binapi request failed:", err)
- }
- for {
- iface, err := stream.Recv()
- if err == io.EOF {
- break
- }
- if err != nil {
- log.Fatalln(err)
- }
- log.Printf("- interface: %+v", iface)
- }
}
func runServer() {