summaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/objects.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-06-26 16:28:20 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-06-27 07:33:14 +0200
commitef471318d66dd2832df4dc929d312f7cd5f7009a (patch)
tree49dda363eaa7ac3102425aba9f13a503b2a04f48 /cmd/binapi-generator/objects.go
parentda15c397b3dbbba07d159b3af767aa13d443cfd6 (diff)
Improvements for binapi-generator and support VPP 19.04 in statsclient
- RPC service client implementation for dumps requests now streams responses - RPC service generation is now enabled by default - examples now allow setting binapi socket address - input dir flag for binapi-generator will recursively look into dirs to support core/plugins in /usr/share/vpp/api - minor improvements in debug logs - add support for VPP 19.04 for statsclient Change-Id: I0939ee3aa6e9f850d073fc5c87aff4ccc56b0d70 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'cmd/binapi-generator/objects.go')
-rw-r--r--cmd/binapi-generator/objects.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/cmd/binapi-generator/objects.go b/cmd/binapi-generator/objects.go
index e3270de..2d5321d 100644
--- a/cmd/binapi-generator/objects.go
+++ b/cmd/binapi-generator/objects.go
@@ -4,6 +4,7 @@ import "fmt"
// Package represents collection of objects parsed from VPP binary API JSON data
type Package struct {
+ Name string
Version string
CRC string
Services []Service
@@ -91,32 +92,33 @@ const (
// printPackage prints all loaded objects for package
func printPackage(pkg *Package) {
+ logf("package: %s %s (%s)", pkg.Name, pkg.Version, pkg.CRC)
if len(pkg.Enums) > 0 {
- logf("loaded %d enums:", len(pkg.Enums))
- for k, enum := range pkg.Enums {
- logf(" - enum #%d\t%+v", k, enum)
+ logf(" %d enums:", len(pkg.Enums))
+ for _, enum := range pkg.Enums {
+ logf(" - %s: %+v", enum.Name, enum)
}
}
if len(pkg.Unions) > 0 {
- logf("loaded %d unions:", len(pkg.Unions))
- for k, union := range pkg.Unions {
- logf(" - union #%d\t%+v", k, union)
+ logf(" %d unions:", len(pkg.Unions))
+ for _, union := range pkg.Unions {
+ logf(" - %s: %+v", union.Name, union)
}
}
if len(pkg.Types) > 0 {
- logf("loaded %d types:", len(pkg.Types))
+ logf(" %d types:", len(pkg.Types))
for _, typ := range pkg.Types {
- logf(" - type: %q (%d fields)", typ.Name, len(typ.Fields))
+ logf(" - %s (%d fields): %+v", typ.Name, len(typ.Fields), typ)
}
}
if len(pkg.Messages) > 0 {
- logf("loaded %d messages:", len(pkg.Messages))
+ logf(" %d messages:", len(pkg.Messages))
for _, msg := range pkg.Messages {
- logf(" - message: %q (%d fields)", msg.Name, len(msg.Fields))
+ logf(" - %s (%d fields) %s", msg.Name, len(msg.Fields), msg.CRC)
}
}
if len(pkg.Services) > 0 {
- logf("loaded %d services:", len(pkg.Services))
+ logf(" %d services:", len(pkg.Services))
for _, svc := range pkg.Services {
var info string
if svc.Stream {
@@ -124,7 +126,7 @@ func printPackage(pkg *Package) {
} else if len(svc.Events) > 0 {
info = fmt.Sprintf("(EVENTS: %v)", svc.Events)
}
- logf(" - service: %s - %q -> %q %s", svc.Name, svc.RequestType, svc.ReplyType, info)
+ logf(" - %s: %q -> %q %s", svc.Name, svc.RequestType, svc.ReplyType, info)
}
}
}