Code Review
/
govpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Improve binapi generator
[govpp.git]
/
examples
/
rpc-service
/
rpc_service.go
diff --git
a/examples/rpc-service/rpc_service.go
b/examples/rpc-service/rpc_service.go
index
8ff6c08
..
e20e5c0
100644
(file)
--- a/
examples/rpc-service/rpc_service.go
+++ b/
examples/rpc-service/rpc_service.go
@@
-27,8
+27,8
@@
import (
"git.fd.io/govpp.git"
"git.fd.io/govpp.git/adapter/socketclient"
"git.fd.io/govpp.git/api"
"git.fd.io/govpp.git"
"git.fd.io/govpp.git/adapter/socketclient"
"git.fd.io/govpp.git/api"
-
"git.fd.io/govpp.git/examples/binapi/interfaces
"
- "git.fd.io/govpp.git/
examples/
binapi/vpe"
+
interfaces "git.fd.io/govpp.git/binapi/interface
"
+ "git.fd.io/govpp.git/binapi/vpe"
)
var (
)
var (
@@
-47,20
+47,13
@@
func main() {
}
defer conn.Disconnect()
}
defer conn.Disconnect()
- // create a channel
- ch, err := conn.NewAPIChannel()
- if err != nil {
- log.Fatalln("ERROR: creating channel failed:", err)
- }
- defer ch.Close()
-
- showVersion(ch)
- interfaceDump(ch)
+ showVersion(conn)
+ interfaceDump(conn)
}
// showVersion shows an example of simple request with services.
}
// showVersion shows an example of simple request with services.
-func showVersion(c
h api.Channel
) {
- c := vpe.NewServiceClient(c
h
)
+func showVersion(c
onn api.Connection
) {
+ c := vpe.NewServiceClient(c
onn
)
version, err := c.ShowVersion(context.Background(), &vpe.ShowVersion{})
if err != nil {
version, err := c.ShowVersion(context.Background(), &vpe.ShowVersion{})
if err != nil {
@@
-71,10
+64,10
@@
func showVersion(ch api.Channel) {
}
// interfaceDump shows an example of multi request with services.
}
// interfaceDump shows an example of multi request with services.
-func interfaceDump(c
h api.Channel
) {
- c := interfaces.NewServiceClient(c
h
)
+func interfaceDump(c
onn api.Connection
) {
+ c := interfaces.NewServiceClient(c
onn
)
- stream, err := c.
DumpSwInterface
(context.Background(), &interfaces.SwInterfaceDump{})
+ stream, err := c.
SwInterfaceDump
(context.Background(), &interfaces.SwInterfaceDump{})
if err != nil {
log.Fatalln("ERROR: DumpSwInterface failed:", err)
}
if err != nil {
log.Fatalln("ERROR: DumpSwInterface failed:", err)
}