From fa21c9d726ebb807895a8571af9a16dab5cd8d6e Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 8 Feb 2019 01:16:32 +0100 Subject: Generator improvements and cleanup - generator now supports include-comments flag (as opt-in) - minor code cleanup in binapi-generator - remove obsolete unit tests - flatten examples from examples/cmd folder - introduce constant for checking compatibility in future versions Change-Id: I3545f2ba4b869a3b51d6d0de7e742f3f1e1be392 Signed-off-by: Ondrej Fabry --- .gitignore | 7 +- Makefile | 22 +- README.md | 12 +- api/api.go | 5 +- cmd/binapi-generator/definitions.go | 42 +- cmd/binapi-generator/generate.go | 61 +- cmd/binapi-generator/main.go | 38 +- cmd/binapi-generator/objects.go | 52 +- cmd/binapi-generator/parse.go | 218 +- cmd/binapi-generator/types.go | 129 ++ core/connection_test.go | 21 - examples/bin_api/VPP_VERSION | 2 +- examples/bin_api/acl/acl.ba.go | 1053 +-------- examples/bin_api/af_packet/af_packet.ba.go | 203 +- examples/bin_api/interfaces/interfaces.ba.go | 1467 +----------- examples/bin_api/ip/ip.ba.go | 3113 +------------------------- examples/bin_api/maps/maps.ba.go | 1021 +-------- examples/bin_api/memif/memif.ba.go | 317 +-- examples/bin_api/tap/tap.ba.go | 263 +-- examples/bin_api/vpe/vpe.ba.go | 457 +--- examples/cmd/perf-bench/perf-bench.go | 126 -- examples/cmd/simple-client/simple_client.go | 271 --- examples/cmd/stats-api/README.md | 68 - examples/cmd/stats-api/stats_api.go | 140 -- examples/cmd/union-example/union_example.go | 103 - examples/perf-bench/perf-bench.go | 126 ++ examples/simple-client/simple_client.go | 271 +++ examples/stats-api/README.md | 68 + examples/stats-api/stats_api.go | 140 ++ examples/union-example/union_example.go | 103 + 30 files changed, 1052 insertions(+), 8867 deletions(-) create mode 100644 cmd/binapi-generator/types.go delete mode 100644 examples/cmd/perf-bench/perf-bench.go delete mode 100644 examples/cmd/simple-client/simple_client.go delete mode 100644 examples/cmd/stats-api/README.md delete mode 100644 examples/cmd/stats-api/stats_api.go delete mode 100644 examples/cmd/union-example/union_example.go create mode 100644 examples/perf-bench/perf-bench.go create mode 100644 examples/simple-client/simple_client.go create mode 100644 examples/stats-api/README.md create mode 100644 examples/stats-api/stats_api.go create mode 100644 examples/union-example/union_example.go diff --git a/.gitignore b/.gitignore index 5bf6a1e..3163b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,10 @@ cmd/binapi-generator/binapi-generator # examples -examples/cmd/perf-bench/perf-bench -examples/cmd/simple-client/simple-client -examples/cmd/stats-api/stats-api +examples/perf-bench/perf-bench +examples/simple-client/simple-client +examples/stats-api/stats-api +examples/union-example/union-example # extras extras/libmemif/examples/gopacket/gopacket diff --git a/Makefile b/Makefile index fce72ac..e5ae92e 100644 --- a/Makefile +++ b/Makefile @@ -6,21 +6,22 @@ VPP_VERSION := $(shell apt-cache show vpp | grep Version: | cut -d' ' -f2-) all: test build examples install: - @echo "=> installing ${VERSION}" + @echo "=> installing binapi generator ${VERSION}" go install ./cmd/binapi-generator build: - @echo "=> building ${VERSION}" + @echo "=> building binapi generator ${VERSION}" cd cmd/binapi-generator && go build -v examples: @echo "=> building examples" - cd examples/cmd/simple-client && go build -v - cd examples/cmd/stats-client && go build -v - cd examples/cmd/perf-bench && go build -v + cd examples/simple-client && go build -v + cd examples/stats-api && go build -v + cd examples/perf-bench && go build -v + cd examples/union-example && go build -v test: - @echo "=> testing" + @echo "=> running tests" go test -cover ./cmd/... go test -cover ./core ./api ./codec @@ -34,9 +35,10 @@ extras: clean: @echo "=> cleaning" rm -f cmd/binapi-generator/binapi-generator - rm -f examples/cmd/perf-bench/perf-bench - rm -f examples/cmd/simple-client/simple-client - rm -f examples/cmd/stats-client/stats-client + rm -f examples/perf-bench/perf-bench + rm -f examples/simple-client/simple-client + rm -f examples/stats-api/stats-api + rm -f examples/union-example/union-example rm -f extras/libmemif/examples/gopacket/gopacket rm -f extras/libmemif/examples/icmp-responder/icmp-responder rm -f extras/libmemif/examples/jumbo-frames/jumbo-frames @@ -51,7 +53,7 @@ generate: install cd examples && go generate ./... update-vppapi: - @echo "=> updating API JSON files using installed VPP (${VPP_VERSION})" + @echo "=> updating API JSON files using installed VPP ${VPP_VERSION}" @cd ${BINAPI_DIR} && find . -type f -name '*.api.json' -exec cp /usr/share/vpp/api/'{}' '{}' \; @echo ${VPP_VERSION} > ${BINAPI_DIR}/VPP_VERSION diff --git a/README.md b/README.md index f1c83c6..b07820e 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ This set of packages provide the API for communication with VPP from Go. It consists of the following packages: -- [adapter](adapter/): adapter between GoVPP core and the VPP +- [adapter](adapter/): adapter between GoVPP core and the VPP binary API - [api](api/api.go): API for communication with GoVPP core -- [binapi-generator](cmd/binapi-generator/): Generator for the VPP binary API definitions in JSON format to Go code +- [binapi-generator](cmd/binapi-generator/): generator for the VPP binary API definitions in JSON format to Go code - [codec](codec/): handles encoding/decoding of generated messages into binary form - [core](core/): main functionality of the GoVPP - [examples](examples/): examples that use the GoVPP API in real use-cases of VPP management application @@ -92,12 +92,14 @@ func main() { } ``` -The example above uses simple wrapper API over underlying go channels, see [example client](examples/cmd/simple-client/simple_client.go) +The example above uses simple wrapper API over underlying go channels, +see [example client](examples/simple-client/simple_client.go) for more examples, including the example on how to use the Go channels directly. ## Build & Installation Procedure -Govpp uses `vppapiclient` library from VPP codebase to communicate with VPP. To build GoVPP, vpp-dev package must be installed, +GoVPP uses `vppapiclient` library from VPP codebase to communicate with VPP. +To build GoVPP, vpp-dev package must be installed, either [from packages](https://wiki.fd.io/view/VPP/Installing_VPP_binaries_from_packages) or [from sources](https://wiki.fd.io/view/VPP/Build,_install,_and_test_images#Build_A_VPP_Package). @@ -138,7 +140,7 @@ binapi-generator --input-dir=examples/bin_api --output-dir=examples/bin_api In Go, [go generate](https://blog.golang.org/generate) tool can be leveraged to ease the code generation process. It allows to specify generator instructions in any one of the regular (non-generated) `.go` files that are dependent on generated code using special comments, e.g. the one from -[example client](examples/cmd/simple-client/simple_client.go): +[example client](examples/simple-client/simple_client.go): ```go //go:generate binapi-generator --input-dir=bin_api --output-dir=bin_api diff --git a/api/api.go b/api/api.go index 57a744e..3e4eb0b 100644 --- a/api/api.go +++ b/api/api.go @@ -115,7 +115,6 @@ type SubscriptionCtx interface { Unsubscribe() error } -// map of registered messages var registeredMessages = make(map[string]Message) // RegisterMessage is called from generated code to register message. @@ -130,3 +129,7 @@ func RegisterMessage(x Message, name string) { func GetRegisteredMessages() map[string]Message { return registeredMessages } + +// GoVppAPIPackageIsVersion1 is referenced from generated binapi files +// to assert that that code is compatible with this version of the GoVPP api package. +const GoVppAPIPackageIsVersion1 = true diff --git a/cmd/binapi-generator/definitions.go b/cmd/binapi-generator/definitions.go index 3ad782f..9bf9e53 100644 --- a/cmd/binapi-generator/definitions.go +++ b/cmd/binapi-generator/definitions.go @@ -15,43 +15,10 @@ package main import ( - "strconv" "strings" "unicode" ) -func getBinapiTypeSize(binapiType string) int { - if _, ok := binapiTypes[binapiType]; ok { - b, err := strconv.Atoi(strings.TrimLeft(binapiType, "uif")) - if err == nil { - return b / 8 - } - } - return -1 -} - -// binapiTypes is a set of types used VPP binary API for translation to Go types -var binapiTypes = map[string]string{ - "u8": "uint8", - "i8": "int8", - "u16": "uint16", - "i16": "int16", - "u32": "uint32", - "i32": "int32", - "u64": "uint64", - "i64": "int64", - "f64": "float64", -} - -func usesInitialism(s string) string { - if u := strings.ToUpper(s); commonInitialisms[u] { - return u - } else if su, ok := specialInitialisms[u]; ok { - return su - } - return "" -} - // commonInitialisms is a set of common initialisms that need to stay in upper case. var commonInitialisms = map[string]bool{ "ACL": true, @@ -105,6 +72,15 @@ var specialInitialisms = map[string]string{ //"IPV6": "IPv6", } +func usesInitialism(s string) string { + if u := strings.ToUpper(s); commonInitialisms[u] { + return u + } else if su, ok := specialInitialisms[u]; ok { + return su + } + return "" +} + // camelCaseName returns correct name identifier (camelCase). func camelCaseName(name string) (should string) { name = strings.Title(name) diff --git a/cmd/binapi-generator/generate.go b/cmd/binapi-generator/generate.go index 48c3a41..f2da08a 100644 --- a/cmd/binapi-generator/generate.go +++ b/cmd/binapi-generator/generate.go @@ -25,9 +25,11 @@ import ( ) const ( + inputFileExt = ".api.json" // file extension of the VPP API files + outputFileExt = ".ba.go" // file extension of the Go generated files + govppApiImportPath = "git.fd.io/govpp.git/api" // import path of the govpp API package - inputFileExt = ".api.json" // file extension of the VPP binary API files - outputFileExt = ".ba.go" // file extension of the Go generated files + constAPIVersionCrc = "APIVersionCrc" // name for the API version CRC constant ) // context is a structure storing data for code generation @@ -37,6 +39,9 @@ type context struct { inputData []byte // contents of the input file + includeAPIVersionCrc bool // include constant with API version CRC string + includeComments bool // include parts of original source in comments + moduleName string // name of the source VPP module packageName string // name of the Go package being generated @@ -83,10 +88,9 @@ func generatePackage(ctx *context, w *bufio.Writer) error { generateHeader(ctx, w) generateImports(ctx, w) - if *includeAPIVer { - const APIVerConstName = "VlAPIVersion" - fmt.Fprintf(w, "// %s represents version of the binary API module.\n", APIVerConstName) - fmt.Fprintf(w, "const %s = %v\n", APIVerConstName, ctx.packageData.APIVersion) + if ctx.includeAPIVersionCrc { + fmt.Fprintf(w, "// %s defines API version CRC of the VPP binary API module.\n", constAPIVersionCrc) + fmt.Fprintf(w, "const %s = %v\n", constAPIVersionCrc, ctx.packageData.APIVersion) fmt.Fprintln(w) } @@ -194,9 +198,9 @@ func generateHeader(ctx *context, w io.Writer) { // generateImports writes generated package imports into w func generateImports(ctx *context, w io.Writer) { - fmt.Fprintf(w, "import \"%s\"\n", govppApiImportPath) - fmt.Fprintf(w, "import \"%s\"\n", "github.com/lunixbochs/struc") - fmt.Fprintf(w, "import \"%s\"\n", "bytes") + fmt.Fprintf(w, "import api \"%s\"\n", govppApiImportPath) + fmt.Fprintf(w, "import struc \"%s\"\n", "github.com/lunixbochs/struc") + fmt.Fprintf(w, "import bytes \"%s\"\n", "bytes") fmt.Fprintln(w) fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n") @@ -204,6 +208,13 @@ func generateImports(ctx *context, w io.Writer) { fmt.Fprintf(w, "var _ = struc.Pack\n") fmt.Fprintf(w, "var _ = bytes.NewBuffer\n") fmt.Fprintln(w) + + /*fmt.Fprintln(w, "// This is a compile-time assertion to ensure that this generated file") + fmt.Fprintln(w, "// is compatible with the GoVPP api package it is being compiled against.") + fmt.Fprintln(w, "// A compilation error at this line likely means your copy of the") + fmt.Fprintln(w, "// GoVPP api package needs to be updated.") + fmt.Fprintln(w, "const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package") + fmt.Fprintln(w)*/ } // generateComment writes generated comment for the object into w @@ -214,6 +225,10 @@ func generateComment(ctx *context, w io.Writer, goName string, vppName string, o fmt.Fprintf(w, "// %s represents VPP binary API %s '%s':\n", goName, objKind, vppName) } + if !ctx.includeComments { + return + } + var isNotSpace = func(r rune) bool { return !unicode.IsSpace(r) } @@ -271,7 +286,7 @@ func generateServices(ctx *context, w *bufio.Writer, services []Service) { // generate interface fmt.Fprintf(w, "type %s interface {\n", "Services") - for _, svc := range ctx.packageData.Services { + for _, svc := range services { generateService(ctx, w, &svc) } fmt.Fprintln(w, "}") @@ -284,7 +299,14 @@ func generateService(ctx *context, w io.Writer, svc *Service) { reqTyp := camelCaseName(svc.RequestType) // method name is same as parameter type name by default - method := svc.MethodName() + method := reqTyp + if svc.Stream { + // use Dump as prefix instead of suffix for stream services + if m := strings.TrimSuffix(method, "Dump"); method != m { + method = "Dump" + m + } + } + params := fmt.Sprintf("*%s", reqTyp) returns := "error" if replyType := camelCaseName(svc.ReplyType); replyType != "" { @@ -450,7 +472,7 @@ func generateType(ctx *context, w io.Writer, typ *Type) { for i, field := range typ.Fields { // skip internal fields switch strings.ToLower(field.Name) { - case "crc", "_vl_msg_id": + case crcField, msgIdField: continue } @@ -488,17 +510,17 @@ func generateMessage(ctx *context, w io.Writer, msg *Message) { n := 0 for i, field := range msg.Fields { if i == 1 { - if field.Name == "client_index" { + if field.Name == clientIndexField { // "client_index" as the second member, // this might be an event message or a request msgType = eventMessage wasClientIndex = true - } else if field.Name == "context" { + } else if field.Name == contextField { // reply needs "context" as the second member msgType = replyMessage } } else if i == 2 { - if wasClientIndex && field.Name == "context" { + if wasClientIndex && field.Name == contextField { // request needs "client_index" as the second member // and "context" as the third member msgType = requestMessage @@ -507,9 +529,9 @@ func generateMessage(ctx *context, w io.Writer, msg *Message) { // skip internal fields switch strings.ToLower(field.Name) { - case "crc", "_vl_msg_id": + case crcField, msgIdField: continue - case "client_index", "context": + case clientIndexField, contextField: if n == 0 { continue } @@ -550,9 +572,10 @@ func generateField(ctx *context, w io.Writer, fields []Field, i int) { } dataType := convertToGoType(ctx, field.Type) - fieldType := dataType - if field.IsArray() { + + // check if it is array + if field.Length > 0 || field.SizeFrom != "" { if dataType == "uint8" { dataType = "byte" } diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index b73a699..b3a131c 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -30,27 +30,15 @@ import ( ) var ( - inputFile = flag.String("input-file", "", "Input JSON file.") - inputDir = flag.String("input-dir", ".", "Input directory with JSON files.") + inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") + inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") - includeAPIVer = flag.Bool("include-apiver", false, "Whether to include VlAPIVersion in generated file.") - debug = flag.Bool("debug", false, "Turn on debug mode.") - continueOnError = flag.Bool("continue-onerror", false, "Wheter to continue with next file on error.") + includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") + includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") + continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") + debug = flag.Bool("debug", false, "Enable debug mode.") ) -func init() { - flag.Parse() - if *debug { - logrus.SetLevel(logrus.DebugLevel) - } -} - -func logf(f string, v ...interface{}) { - if *debug { - logrus.Debugf(f, v...) - } -} - var log = logrus.Logger{ Level: logrus.InfoLevel, Formatter: &logrus.TextFormatter{}, @@ -58,6 +46,11 @@ var log = logrus.Logger{ } func main() { + flag.Parse() + if *debug { + logrus.SetLevel(logrus.DebugLevel) + } + if *inputFile == "" && *inputDir == "" { fmt.Fprintln(os.Stderr, "ERROR: input-file or input-dir must be specified") os.Exit(1) @@ -112,6 +105,9 @@ func generateFromFile(inputFile, outputDir string) error { return err } + ctx.includeAPIVersionCrc = *includeAPIVer + ctx.includeComments = *includeComments + // read input file contents ctx.inputData, err = readFile(inputFile) if err != nil { @@ -182,3 +178,9 @@ func parseJSON(inputData []byte) (*jsongo.JSONNode, error) { return &root, nil } + +func logf(f string, v ...interface{}) { + if *debug { + logrus.Debugf(f, v...) + } +} diff --git a/cmd/binapi-generator/objects.go b/cmd/binapi-generator/objects.go index 4b424f5..75c7581 100644 --- a/cmd/binapi-generator/objects.go +++ b/cmd/binapi-generator/objects.go @@ -1,9 +1,5 @@ package main -import ( - "strings" -) - // Package represents collection of objects parsed from VPP binary API JSON data type Package struct { APIVersion string @@ -52,6 +48,14 @@ type Type struct { Fields []Field } +// Field represents VPP binary API object field +type Field struct { + Name string + Type string + Length int + SizeFrom string +} + // Union represents VPP binary API union type Union struct { Name string @@ -75,43 +79,3 @@ const ( eventMessage // VPP event message otherMessage // other VPP message ) - -// Field represents VPP binary API object field -type Field struct { - Name string - Type string - Length int - SizeFrom string -} - -func (f *Field) IsArray() bool { - return f.Length > 0 || f.SizeFrom != "" -} - -func (s Service) MethodName() string { - reqTyp := camelCaseName(s.RequestType) - - // method name is same as parameter type name by default - method := reqTyp - if s.Stream { - // use Dump as prefix instead of suffix for stream services - if m := strings.TrimSuffix(method, "Dump"); method != m { - method = "Dump" + m - } - } - - return method -} - -func (s Service) IsDumpService() bool { - return s.Stream -} - -func (s Service) IsEventService() bool { - return len(s.Events) > 0 -} - -func (s Service) IsRequestService() bool { - // some binapi messages might have `null` reply (for example: memclnt) - return s.ReplyType != "" && s.ReplyType != "null" // not null -} diff --git a/cmd/binapi-generator/parse.go b/cmd/binapi-generator/parse.go index 07abebd..4138ac6 100644 --- a/cmd/binapi-generator/parse.go +++ b/cmd/binapi-generator/parse.go @@ -23,26 +23,62 @@ import ( "github.com/bennyscetbun/jsongo" ) +// top level objects +const ( + objTypes = "types" + objMessages = "messages" + objUnions = "unions" + objEnums = "enums" + objServices = "services" + objAliases = "aliases" + vlAPIVersion = "vl_api_version" +) + +// various object fields +const ( + crcField = "crc" + msgIdField = "_vl_msg_id" + + clientIndexField = "client_index" + contextField = "context" + + aliasLengthField = "length" + aliasTypeField = "type" + + replyField = "reply" + streamField = "stream" + eventsField = "events" +) + +// service name parts +const ( + serviceEventPrefix = "want_" + serviceDumpSuffix = "_dump" + serviceDetailsSuffix = "_details" + serviceReplySuffix = "_reply" + serviceNoReply = "null" +) + // parsePackage parses provided JSON data into objects prepared for code generation func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { - logf(" %s contains: %d services, %d messages, %d types, %d enums, %d unions, %d aliases (version: %s)", + logf(" %s (version: %s) contains: %d services, %d messages, %d types, %d enums, %d unions, %d aliases", ctx.packageName, - jsonRoot.Map("services").Len(), - jsonRoot.Map("messages").Len(), - jsonRoot.Map("types").Len(), - jsonRoot.Map("enums").Len(), - jsonRoot.Map("unions").Len(), - jsonRoot.Map("aliases").Len(), - jsonRoot.Map("vl_api_version").Get(), + jsonRoot.Map(vlAPIVersion).Get(), + jsonRoot.Map(objServices).Len(), + jsonRoot.Map(objMessages).Len(), + jsonRoot.Map(objTypes).Len(), + jsonRoot.Map(objEnums).Len(), + jsonRoot.Map(objUnions).Len(), + jsonRoot.Map(objAliases).Len(), ) pkg := Package{ - APIVersion: jsonRoot.Map("vl_api_version").Get().(string), + APIVersion: jsonRoot.Map(vlAPIVersion).Get().(string), RefMap: make(map[string]string), } // parse enums - enums := jsonRoot.Map("enums") + enums := jsonRoot.Map(objEnums) pkg.Enums = make([]Enum, enums.Len()) for i := 0; i < enums.Len(); i++ { enumNode := enums.At(i) @@ -60,7 +96,7 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { }) // parse aliases - aliases := jsonRoot.Map("aliases") + aliases := jsonRoot.Map(objAliases) if aliases.GetType() == jsongo.TypeMap { pkg.Aliases = make([]Alias, aliases.Len()) for i, key := range aliases.GetKeys() { @@ -80,7 +116,7 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { }) // parse types - types := jsonRoot.Map("types") + types := jsonRoot.Map(objTypes) pkg.Types = make([]Type, types.Len()) for i := 0; i < types.Len(); i++ { typNode := types.At(i) @@ -98,7 +134,7 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { }) // parse unions - unions := jsonRoot.Map("unions") + unions := jsonRoot.Map(objUnions) pkg.Unions = make([]Union, unions.Len()) for i := 0; i < unions.Len(); i++ { unionNode := unions.At(i) @@ -116,7 +152,7 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { }) // parse messages - messages := jsonRoot.Map("messages") + messages := jsonRoot.Map(objMessages) pkg.Messages = make([]Message, messages.Len()) for i := 0; i < messages.Len(); i++ { msgNode := messages.At(i) @@ -133,7 +169,7 @@ func parsePackage(ctx *context, jsonRoot *jsongo.JSONNode) (*Package, error) { }) // parse services - services := jsonRoot.Map("services") + services := jsonRoot.Map(objServices) if services.GetType() == jsongo.TypeMap { pkg.Services = make([]Service, services.Len()) for i, key := range services.GetKeys() { @@ -255,7 +291,7 @@ func parseUnion(ctx *context, unionNode *jsongo.JSONNode) (*Union, error) { if !ok { return nil, fmt.Errorf("union name is %T, not a string", unionNode.At(0).Get()) } - unionCRC, ok := unionNode.At(unionNode.Len() - 1).At("crc").Get().(string) + unionCRC, ok := unionNode.At(unionNode.Len() - 1).At(crcField).Get().(string) if !ok { return nil, fmt.Errorf("union crc invalid or missing") } @@ -292,7 +328,7 @@ func parseType(ctx *context, typeNode *jsongo.JSONNode) (*Type, error) { if !ok { return nil, fmt.Errorf("type name is %T, not a string", typeNode.At(0).Get()) } - typeCRC, ok := typeNode.At(typeNode.Len() - 1).At("crc").Get().(string) + typeCRC, ok := typeNode.At(typeNode.Len() - 1).At(crcField).Get().(string) if !ok { return nil, fmt.Errorf("type crc invalid or missing") } @@ -319,14 +355,9 @@ func parseType(ctx *context, typeNode *jsongo.JSONNode) (*Type, error) { return &typ, nil } -const ( - aliasesLength = "length" - aliasesType = "type" -) - // parseAlias parses VPP binary API alias object from JSON node func parseAlias(ctx *context, aliasName string, aliasNode *jsongo.JSONNode) (*Alias, error) { - if aliasNode.Len() == 0 || aliasNode.At(aliasesType).GetType() != jsongo.TypeValue { + if aliasNode.Len() == 0 || aliasNode.At(aliasTypeField).GetType() != jsongo.TypeValue { return nil, errors.New("invalid JSON for alias specified") } @@ -334,7 +365,7 @@ func parseAlias(ctx *context, aliasName string, aliasNode *jsongo.JSONNode) (*Al Name: aliasName, } - if typeNode := aliasNode.At(aliasesType); typeNode.GetType() == jsongo.TypeValue { + if typeNode := aliasNode.At(aliasTypeField); typeNode.GetType() == jsongo.TypeValue { typ, ok := typeNode.Get().(string) if !ok { return nil, fmt.Errorf("alias type is %T, not a string", typeNode.Get()) @@ -344,7 +375,7 @@ func parseAlias(ctx *context, aliasName string, aliasNode *jsongo.JSONNode) (*Al } } - if lengthNode := aliasNode.At(aliasesLength); lengthNode.GetType() == jsongo.TypeValue { + if lengthNode := aliasNode.At(aliasLengthField); lengthNode.GetType() == jsongo.TypeValue { length, ok := lengthNode.Get().(float64) if !ok { return nil, fmt.Errorf("alias length is %T, not a float64", lengthNode.Get()) @@ -365,7 +396,7 @@ func parseMessage(ctx *context, msgNode *jsongo.JSONNode) (*Message, error) { if !ok { return nil, fmt.Errorf("message name is %T, not a string", msgNode.At(0).Get()) } - msgCRC, ok := msgNode.At(msgNode.Len() - 1).At("crc").Get().(string) + msgCRC, ok := msgNode.At(msgNode.Len() - 1).At(crcField).Get().(string) if !ok { return nil, fmt.Errorf("message crc invalid or missing") @@ -432,7 +463,7 @@ func parseField(ctx *context, field *jsongo.JSONNode) (*Field, error) { // parseService parses VPP binary API service object from JSON node func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Service, error) { - if svcNode.Len() == 0 || svcNode.At("reply").GetType() != jsongo.TypeValue { + if svcNode.Len() == 0 || svcNode.At(replyField).GetType() != jsongo.TypeValue { return nil, errors.New("invalid JSON for service specified") } @@ -441,18 +472,18 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv RequestType: svcName, } - if replyNode := svcNode.At("reply"); replyNode.GetType() == jsongo.TypeValue { + if replyNode := svcNode.At(replyField); replyNode.GetType() == jsongo.TypeValue { reply, ok := replyNode.Get().(string) if !ok { return nil, fmt.Errorf("service reply is %T, not a string", replyNode.Get()) } - if reply != "null" { + if reply != serviceNoReply { svc.ReplyType = reply } } // stream service (dumps) - if streamNode := svcNode.At("stream"); streamNode.GetType() == jsongo.TypeValue { + if streamNode := svcNode.At(streamField); streamNode.GetType() == jsongo.TypeValue { var ok bool svc.Stream, ok = streamNode.Get().(bool) if !ok { @@ -461,7 +492,7 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv } // events service (event subscription) - if eventsNode := svcNode.At("events"); eventsNode.GetType() == jsongo.TypeArray { + if eventsNode := svcNode.At(eventsField); eventsNode.GetType() == jsongo.TypeArray { for j := 0; j < eventsNode.Len(); j++ { event := eventsNode.At(j).Get().(string) svc.Events = append(svc.Events, event) @@ -469,111 +500,30 @@ func parseService(ctx *context, svcName string, svcNode *jsongo.JSONNode) (*Serv } // validate service - if svc.IsEventService() { - if !strings.HasPrefix(svc.RequestType, "want_") { - log.Debugf("Unusual EVENTS SERVICE: %+v\n"+ - "- events service %q does not have 'want_' prefix in request.", - svc, svc.Name) - } - } else if svc.IsDumpService() { - if !strings.HasSuffix(svc.RequestType, "_dump") || - !strings.HasSuffix(svc.ReplyType, "_details") { - log.Debugf("Unusual STREAM SERVICE: %+v\n"+ - "- stream service %q does not have '_dump' suffix in request or reply does not have '_details' suffix.", - svc, svc.Name) - } - } else if svc.IsRequestService() { - if !strings.HasSuffix(svc.ReplyType, "_reply") { - log.Debugf("Unusual REQUEST SERVICE: %+v\n"+ - "- service %q does not have '_reply' suffix in reply.", - svc, svc.Name) + if len(svc.Events) > 0 { + // EVENT service + if !strings.HasPrefix(svc.RequestType, serviceEventPrefix) { + log.Debugf("unusual EVENTS service: %+v\n"+ + "- events service %q does not have %q prefix in request.", + svc, svc.Name, serviceEventPrefix) + } + } else if svc.Stream { + // STREAM service + if !strings.HasSuffix(svc.RequestType, serviceDumpSuffix) || + !strings.HasSuffix(svc.ReplyType, serviceDetailsSuffix) { + log.Debugf("unusual STREAM service: %+v\n"+ + "- stream service %q does not have %q suffix in request or reply does not have %q suffix.", + svc, svc.Name, serviceDumpSuffix, serviceDetailsSuffix) + } + } else if svc.ReplyType != "" && svc.ReplyType != serviceNoReply { + // REQUEST service + // some messages might have `null` reply (for example: memclnt) + if !strings.HasSuffix(svc.ReplyType, serviceReplySuffix) { + log.Debugf("unusual REQUEST service: %+v\n"+ + "- service %q does not have %q suffix in reply.", + svc, svc.Name, serviceReplySuffix) } } return &svc, nil } - -// toApiType returns name that is used as type reference in VPP binary API -func toApiType(name string) string { - return fmt.Sprintf("vl_api_%s_t", name) -} - -// convertToGoType translates the VPP binary API type into Go type -func convertToGoType(ctx *context, binapiType string) (typ string) { - if t, ok := binapiTypes[binapiType]; ok { - // basic types - typ = t - } else if r, ok := ctx.packageData.RefMap[binapiType]; ok { - // specific types (enums/types/unions) - typ = camelCaseName(r) - } else { - switch binapiType { - case "bool", "string": - typ = binapiType - default: - // fallback type - log.Warnf("found unknown VPP binary API type %q, using byte", binapiType) - typ = "byte" - } - } - return typ -} - -func getSizeOfType(typ *Type) (size int) { - for _, field := range typ.Fields { - size += getSizeOfBinapiTypeLength(field.Type, field.Length) - } - return size -} - -func getSizeOfBinapiTypeLength(typ string, length int) (size int) { - if n := getBinapiTypeSize(typ); n > 0 { - if length > 0 { - return n * length - } else { - return n - } - } - return -} - -func getTypeByRef(ctx *context, ref string) *Type { - for _, typ := range ctx.packageData.Types { - if ref == toApiType(typ.Name) { - return &typ - } - } - return nil -} - -func getAliasByRef(ctx *context, ref string) *Alias { - for _, alias := range ctx.packageData.Aliases { - if ref == toApiType(alias.Name) { - return &alias - } - } - return nil -} - -func getUnionSize(ctx *context, union *Union) (maxSize int) { - for _, field := range union.Fields { - typ := getTypeByRef(ctx, field.Type) - if typ != nil { - if size := getSizeOfType(typ); size > maxSize { - maxSize = size - } - continue - } - alias := getAliasByRef(ctx, field.Type) - if alias != nil { - if size := getSizeOfBinapiTypeLength(alias.Type, alias.Length); size > maxSize { - maxSize = size - } - continue - } else { - logf("no type or alias found for union %s field type %q", union.Name, field.Type) - continue - } - } - return -} diff --git a/cmd/binapi-generator/types.go b/cmd/binapi-generator/types.go new file mode 100644 index 0000000..3aa9819 --- /dev/null +++ b/cmd/binapi-generator/types.go @@ -0,0 +1,129 @@ +// 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" + "strconv" + "strings" +) + +// toApiType returns name that is used as type reference in VPP binary API +func toApiType(name string) string { + return fmt.Sprintf("vl_api_%s_t", name) +} + +// binapiTypes is a set of types used VPP binary API for translation to Go types +var binapiTypes = map[string]string{ + "u8": "uint8", + "i8": "int8", + "u16": "uint16", + "i16": "int16", + "u32": "uint32", + "i32": "int32", + "u64": "uint64", + "i64": "int64", + "f64": "float64", +} + +func getBinapiTypeSize(binapiType string) int { + if _, ok := binapiTypes[binapiType]; ok { + b, err := strconv.Atoi(strings.TrimLeft(binapiType, "uif")) + if err == nil { + return b / 8 + } + } + return -1 +} + +// convertToGoType translates the VPP binary API type into Go type +func convertToGoType(ctx *context, binapiType string) (typ string) { + if t, ok := binapiTypes[binapiType]; ok { + // basic types + typ = t + } else if r, ok := ctx.packageData.RefMap[binapiType]; ok { + // specific types (enums/types/unions) + typ = camelCaseName(r) + } else { + switch binapiType { + case "bool", "string": + typ = binapiType + default: + // fallback type + log.Warnf("found unknown VPP binary API type %q, using byte", binapiType) + typ = "byte" + } + } + return typ +} + +func getSizeOfType(typ *Type) (size int) { + for _, field := range typ.Fields { + size += getSizeOfBinapiTypeLength(field.Type, field.Length) + } + return size +} + +func getSizeOfBinapiTypeLength(typ string, length int) (size int) { + if n := getBinapiTypeSize(typ); n > 0 { + if length > 0 { + return n * length + } else { + return n + } + } + return +} + +func getTypeByRef(ctx *context, ref string) *Type { + for _, typ := range ctx.packageData.Types { + if ref == toApiType(typ.Name) { + return &typ + } + } + return nil +} + +func getAliasByRef(ctx *context, ref string) *Alias { + for _, alias := range ctx.packageData.Aliases { + if ref == toApiType(alias.Name) { + return &alias + } + } + return nil +} + +func getUnionSize(ctx *context, union *Union) (maxSize int) { + for _, field := range union.Fields { + typ := getTypeByRef(ctx, field.Type) + if typ != nil { + if size := getSizeOfType(typ); size > maxSize { + maxSize = size + } + continue + } + alias := getAliasByRef(ctx, field.Type) + if alias != nil { + if size := getSizeOfBinapiTypeLength(alias.Type, alias.Length); size > maxSize { + maxSize = size + } + continue + } else { + logf("no type or alias found for union %s field type %q", union.Name, field.Type) + continue + } + } + return +} diff --git a/core/connection_test.go b/core/connection_test.go index 2ecdd34..929f468 100644 --- a/core/connection_test.go +++ b/core/connection_test.go @@ -22,7 +22,6 @@ import ( "git.fd.io/govpp.git/codec" "git.fd.io/govpp.git/core" "git.fd.io/govpp.git/examples/bin_api/interfaces" - "git.fd.io/govpp.git/examples/bin_api/stats" "git.fd.io/govpp.git/examples/bin_api/vpe" . "github.com/onsi/gomega" ) @@ -74,16 +73,6 @@ func TestNilConnection(t *testing.T) { Expect(err.Error()).To(ContainSubstring("nil")) } -func TestDoubleConnection(t *testing.T) { - ctx := setupTest(t, false) - defer ctx.teardownTest() - - conn, err := core.Connect(ctx.mockVpp) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("only one connection per process")) - Expect(conn).Should(BeNil()) -} - func TestAsyncConnection(t *testing.T) { ctx := setupTest(t, false) defer ctx.teardownTest() @@ -123,16 +112,6 @@ func TestCodec(t *testing.T) { err = msgCodec.DecodeMsg(data, msg2) Expect(err).ShouldNot(HaveOccurred()) Expect(msg2.Retval).To(BeEquivalentTo(55)) - - // other - data, err = msgCodec.EncodeMsg(&stats.VnetIP4FibCounters{VrfID: 77}, 33) - Expect(err).ShouldNot(HaveOccurred()) - Expect(data).ShouldNot(BeEmpty()) - - msg3 := &stats.VnetIP4FibCounters{} - err = msgCodec.DecodeMsg(data, msg3) - Expect(err).ShouldNot(HaveOccurred()) - Expect(msg3.VrfID).To(BeEquivalentTo(77)) } func TestCodecNegative(t *testing.T) { diff --git a/examples/bin_api/VPP_VERSION b/examples/bin_api/VPP_VERSION index 4f9e13e..fd1330c 100644 --- a/examples/bin_api/VPP_VERSION +++ b/examples/bin_api/VPP_VERSION @@ -1 +1 @@ -19.01-rc0~622-g7b01e9e8~b1858 +v19.01-2-gcd56f69af diff --git a/examples/bin_api/acl/acl.ba.go b/examples/bin_api/acl/acl.ba.go index 9b43110..b37fd76 100644 --- a/examples/bin_api/acl/acl.ba.go +++ b/examples/bin_api/acl/acl.ba.go @@ -11,9 +11,9 @@ */ package acl -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -21,69 +21,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "acl_plugin_get_version": { -// "reply": "acl_plugin_get_version_reply" -// }, -// "acl_dump": { -// "reply": "acl_details", -// "stream": true -// }, -// "acl_interface_add_del": { -// "reply": "acl_interface_add_del_reply" -// }, -// "acl_del": { -// "reply": "acl_del_reply" -// }, -// "macip_acl_del": { -// "reply": "macip_acl_del_reply" -// }, -// "acl_plugin_control_ping": { -// "reply": "acl_plugin_control_ping_reply" -// }, -// "macip_acl_interface_get": { -// "reply": "macip_acl_interface_get_reply" -// }, -// "acl_interface_etype_whitelist_dump": { -// "reply": "acl_interface_etype_whitelist_details", -// "stream": true -// }, -// "macip_acl_interface_add_del": { -// "reply": "macip_acl_interface_add_del_reply" -// }, -// "acl_add_replace": { -// "reply": "acl_add_replace_reply" -// }, -// "acl_plugin_get_conn_table_max_entries": { -// "reply": "acl_plugin_get_conn_table_max_entries_reply" -// }, -// "acl_interface_list_dump": { -// "reply": "acl_interface_list_details", -// "stream": true -// }, -// "acl_interface_set_acl_list": { -// "reply": "acl_interface_set_acl_list_reply" -// }, -// "macip_acl_add": { -// "reply": "macip_acl_add_reply" -// }, -// "acl_interface_set_etype_whitelist": { -// "reply": "acl_interface_set_etype_whitelist_reply" -// }, -// "macip_acl_add_replace": { -// "reply": "macip_acl_add_replace_reply" -// }, -// "macip_acl_dump": { -// "reply": "macip_acl_details", -// "stream": true -// }, -// "macip_acl_interface_list_dump": { -// "reply": "macip_acl_interface_list_details", -// "stream": true -// } -// }, -// type Services interface { DumpACL(*ACLDump) ([]*ACLDetails, error) DumpACLInterfaceEtypeWhitelist(*ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) @@ -108,66 +45,6 @@ type Services interface { /* Types */ // ACLRule represents VPP binary API type 'acl_rule': -// -// "acl_rule", -// [ -// "u8", -// "is_permit" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "src_ip_addr", -// 16 -// ], -// [ -// "u8", -// "src_ip_prefix_len" -// ], -// [ -// "u8", -// "dst_ip_addr", -// 16 -// ], -// [ -// "u8", -// "dst_ip_prefix_len" -// ], -// [ -// "u8", -// "proto" -// ], -// [ -// "u16", -// "srcport_or_icmptype_first" -// ], -// [ -// "u16", -// "srcport_or_icmptype_last" -// ], -// [ -// "u16", -// "dstport_or_icmpcode_first" -// ], -// [ -// "u16", -// "dstport_or_icmpcode_last" -// ], -// [ -// "u8", -// "tcp_flags_mask" -// ], -// [ -// "u8", -// "tcp_flags_value" -// ], -// { -// "crc": "0x6f99bf4d" -// } -// type ACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -192,39 +69,6 @@ func (*ACLRule) GetCrcString() string { } // MacipACLRule represents VPP binary API type 'macip_acl_rule': -// -// "macip_acl_rule", -// [ -// "u8", -// "is_permit" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "src_mac", -// 6 -// ], -// [ -// "u8", -// "src_mac_mask", -// 6 -// ], -// [ -// "u8", -// "src_ip_addr", -// 16 -// ], -// [ -// "u8", -// "src_ip_prefix_len" -// ], -// { -// "crc": "0x70589f1e" -// } -// type MacipACLRule struct { IsPermit uint8 IsIPv6 uint8 @@ -244,43 +88,6 @@ func (*MacipACLRule) GetCrcString() string { /* Messages */ // ACLAddReplace represents VPP binary API message 'acl_add_replace': -// -// "acl_add_replace", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_acl_rule_t", -// "r", -// 0, -// "count" -// ], -// { -// "crc": "0xe839997e" -// } -// type ACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -299,28 +106,6 @@ func (*ACLAddReplace) GetMessageType() api.MessageType { } // ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply': -// -// "acl_add_replace_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xac407b0c" -// } -// type ACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -337,28 +122,6 @@ func (*ACLAddReplaceReply) GetMessageType() api.MessageType { } // ACLDel represents VPP binary API message 'acl_del': -// -// "acl_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0xef34fea4" -// } -// type ACLDel struct { ACLIndex uint32 } @@ -374,24 +137,6 @@ func (*ACLDel) GetMessageType() api.MessageType { } // ACLDelReply represents VPP binary API message 'acl_del_reply': -// -// "acl_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ACLDelReply struct { Retval int32 } @@ -407,39 +152,6 @@ func (*ACLDelReply) GetMessageType() api.MessageType { } // ACLDetails represents VPP binary API message 'acl_details': -// -// "acl_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_acl_rule_t", -// "r", -// 0, -// "count" -// ], -// { -// "crc": "0x5bd895be" -// } -// type ACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -458,28 +170,6 @@ func (*ACLDetails) GetMessageType() api.MessageType { } // ACLDump represents VPP binary API message 'acl_dump': -// -// "acl_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0xef34fea4" -// } -// type ACLDump struct { ACLIndex uint32 } @@ -495,40 +185,6 @@ func (*ACLDump) GetMessageType() api.MessageType { } // ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del': -// -// "acl_interface_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_input" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0x0b2aedd1" -// } -// type ACLInterfaceAddDel struct { IsAdd uint8 IsInput uint8 @@ -547,24 +203,6 @@ func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { } // ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply': -// -// "acl_interface_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ACLInterfaceAddDelReply struct { Retval int32 } @@ -580,38 +218,6 @@ func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { } // ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details': -// -// "acl_interface_etype_whitelist_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "count" -// ], -// [ -// "u8", -// "n_input" -// ], -// [ -// "u16", -// "whitelist", -// 0, -// "count" -// ], -// { -// "crc": "0x6a5d4e81" -// } -// type ACLInterfaceEtypeWhitelistDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -630,28 +236,6 @@ func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { } // ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump': -// -// "acl_interface_etype_whitelist_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type ACLInterfaceEtypeWhitelistDump struct { SwIfIndex uint32 } @@ -667,38 +251,6 @@ func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { } // ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details': -// -// "acl_interface_list_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "count" -// ], -// [ -// "u8", -// "n_input" -// ], -// [ -// "u32", -// "acls", -// 0, -// "count" -// ], -// { -// "crc": "0xd5e80809" -// } -// type ACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -717,28 +269,6 @@ func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { } // ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump': -// -// "acl_interface_list_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type ACLInterfaceListDump struct { SwIfIndex uint32 } @@ -754,42 +284,6 @@ func (*ACLInterfaceListDump) GetMessageType() api.MessageType { } // ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list': -// -// "acl_interface_set_acl_list", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "count" -// ], -// [ -// "u8", -// "n_input" -// ], -// [ -// "u32", -// "acls", -// 0, -// "count" -// ], -// { -// "crc": "0x8baece38" -// } -// type ACLInterfaceSetACLList struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -808,24 +302,6 @@ func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { } // ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply': -// -// "acl_interface_set_acl_list_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ACLInterfaceSetACLListReply struct { Retval int32 } @@ -841,42 +317,6 @@ func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { } // ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist': -// -// "acl_interface_set_etype_whitelist", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "count" -// ], -// [ -// "u8", -// "n_input" -// ], -// [ -// "u16", -// "whitelist", -// 0, -// "count" -// ], -// { -// "crc": "0xf515efc5" -// } -// type ACLInterfaceSetEtypeWhitelist struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Whitelist"` @@ -895,24 +335,6 @@ func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { } // ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply': -// -// "acl_interface_set_etype_whitelist_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ACLInterfaceSetEtypeWhitelistReply struct { Retval int32 } @@ -928,24 +350,6 @@ func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { } // ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping': -// -// "acl_plugin_control_ping", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ACLPluginControlPing struct{} func (*ACLPluginControlPing) GetMessageName() string { @@ -959,32 +363,6 @@ func (*ACLPluginControlPing) GetMessageType() api.MessageType { } // ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply': -// -// "acl_plugin_control_ping_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "vpe_pid" -// ], -// { -// "crc": "0xf6b0b8ca" -// } -// type ACLPluginControlPingReply struct { Retval int32 ClientIndex uint32 @@ -1002,24 +380,6 @@ func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { } // ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries': -// -// "acl_plugin_get_conn_table_max_entries", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ACLPluginGetConnTableMaxEntries struct{} func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { @@ -1033,24 +393,6 @@ func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { } // ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply': -// -// "acl_plugin_get_conn_table_max_entries_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u64", -// "conn_table_max_entries" -// ], -// { -// "crc": "0x7a096d3d" -// } -// type ACLPluginGetConnTableMaxEntriesReply struct { ConnTableMaxEntries uint64 } @@ -1066,24 +408,6 @@ func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { } // ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version': -// -// "acl_plugin_get_version", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ACLPluginGetVersion struct{} func (*ACLPluginGetVersion) GetMessageName() string { @@ -1097,28 +421,6 @@ func (*ACLPluginGetVersion) GetMessageType() api.MessageType { } // ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply': -// -// "acl_plugin_get_version_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "major" -// ], -// [ -// "u32", -// "minor" -// ], -// { -// "crc": "0x9b32cf86" -// } -// type ACLPluginGetVersionReply struct { Major uint32 Minor uint32 @@ -1135,39 +437,6 @@ func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { } // MacipACLAdd represents VPP binary API message 'macip_acl_add': -// -// "macip_acl_add", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_macip_acl_rule_t", -// "r", -// 0, -// "count" -// ], -// { -// "crc": "0xb3d3d65a" -// } -// type MacipACLAdd struct { Tag []byte `struc:"[64]byte"` Count uint32 `struc:"sizeof=R"` @@ -1185,43 +454,6 @@ func (*MacipACLAdd) GetMessageType() api.MessageType { } // MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace': -// -// "macip_acl_add_replace", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_macip_acl_rule_t", -// "r", -// 0, -// "count" -// ], -// { -// "crc": "0xa0e8c01b" -// } -// type MacipACLAddReplace struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -1240,28 +472,6 @@ func (*MacipACLAddReplace) GetMessageType() api.MessageType { } // MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply': -// -// "macip_acl_add_replace_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xac407b0c" -// } -// type MacipACLAddReplaceReply struct { ACLIndex uint32 Retval int32 @@ -1278,28 +488,6 @@ func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { } // MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply': -// -// "macip_acl_add_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xac407b0c" -// } -// type MacipACLAddReply struct { ACLIndex uint32 Retval int32 @@ -1316,28 +504,6 @@ func (*MacipACLAddReply) GetMessageType() api.MessageType { } // MacipACLDel represents VPP binary API message 'macip_acl_del': -// -// "macip_acl_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0xef34fea4" -// } -// type MacipACLDel struct { ACLIndex uint32 } @@ -1353,24 +519,6 @@ func (*MacipACLDel) GetMessageType() api.MessageType { } // MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply': -// -// "macip_acl_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MacipACLDelReply struct { Retval int32 } @@ -1386,39 +534,6 @@ func (*MacipACLDelReply) GetMessageType() api.MessageType { } // MacipACLDetails represents VPP binary API message 'macip_acl_details': -// -// "macip_acl_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_macip_acl_rule_t", -// "r", -// 0, -// "count" -// ], -// { -// "crc": "0xdd2b55ba" -// } -// type MacipACLDetails struct { ACLIndex uint32 Tag []byte `struc:"[64]byte"` @@ -1437,28 +552,6 @@ func (*MacipACLDetails) GetMessageType() api.MessageType { } // MacipACLDump represents VPP binary API message 'macip_acl_dump': -// -// "macip_acl_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0xef34fea4" -// } -// type MacipACLDump struct { ACLIndex uint32 } @@ -1474,36 +567,6 @@ func (*MacipACLDump) GetMessageType() api.MessageType { } // MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del': -// -// "macip_acl_interface_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "acl_index" -// ], -// { -// "crc": "0x6a6be97c" -// } -// type MacipACLInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -1521,24 +584,6 @@ func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { } // MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply': -// -// "macip_acl_interface_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MacipACLInterfaceAddDelReply struct { Retval int32 } @@ -1554,24 +599,6 @@ func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { } // MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get': -// -// "macip_acl_interface_get", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MacipACLInterfaceGet struct{} func (*MacipACLInterfaceGet) GetMessageName() string { @@ -1585,30 +612,6 @@ func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { } // MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply': -// -// "macip_acl_interface_get_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "u32", -// "acls", -// 0, -// "count" -// ], -// { -// "crc": "0xaccf9b05" -// } -// type MacipACLInterfaceGetReply struct { Count uint32 `struc:"sizeof=Acls"` Acls []uint32 @@ -1625,34 +628,6 @@ func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { } // MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details': -// -// "macip_acl_interface_list_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "count" -// ], -// [ -// "u32", -// "acls", -// 0, -// "count" -// ], -// { -// "crc": "0x29783fa0" -// } -// type MacipACLInterfaceListDetails struct { SwIfIndex uint32 Count uint8 `struc:"sizeof=Acls"` @@ -1670,28 +645,6 @@ func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { } // MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump': -// -// "macip_acl_interface_list_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type MacipACLInterfaceListDump struct { SwIfIndex uint32 } diff --git a/examples/bin_api/af_packet/af_packet.ba.go b/examples/bin_api/af_packet/af_packet.ba.go index 668c95a..5177b7d 100644 --- a/examples/bin_api/af_packet/af_packet.ba.go +++ b/examples/bin_api/af_packet/af_packet.ba.go @@ -10,9 +10,9 @@ */ package af_packet -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -20,23 +20,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "af_packet_dump": { -// "reply": "af_packet_details", -// "stream": true -// }, -// "af_packet_set_l4_cksum_offload": { -// "reply": "af_packet_set_l4_cksum_offload_reply" -// }, -// "af_packet_delete": { -// "reply": "af_packet_delete_reply" -// }, -// "af_packet_create": { -// "reply": "af_packet_create_reply" -// } -// }, -// type Services interface { DumpAfPacket(*AfPacketDump) ([]*AfPacketDetails, error) AfPacketCreate(*AfPacketCreate) (*AfPacketCreateReply, error) @@ -47,38 +30,6 @@ type Services interface { /* Messages */ // AfPacketCreate represents VPP binary API message 'af_packet_create': -// -// "af_packet_create", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "host_if_name", -// 64 -// ], -// [ -// "u8", -// "hw_addr", -// 6 -// ], -// [ -// "u8", -// "use_random_hw_addr" -// ], -// { -// "crc": "0x6d5d30d6" -// } -// type AfPacketCreate struct { HostIfName []byte `struc:"[64]byte"` HwAddr []byte `struc:"[6]byte"` @@ -96,28 +47,6 @@ func (*AfPacketCreate) GetMessageType() api.MessageType { } // AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply': -// -// "af_packet_create_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type AfPacketCreateReply struct { Retval int32 SwIfIndex uint32 @@ -134,29 +63,6 @@ func (*AfPacketCreateReply) GetMessageType() api.MessageType { } // AfPacketDelete represents VPP binary API message 'af_packet_delete': -// -// "af_packet_delete", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "host_if_name", -// 64 -// ], -// { -// "crc": "0x3efceda3" -// } -// type AfPacketDelete struct { HostIfName []byte `struc:"[64]byte"` } @@ -172,24 +78,6 @@ func (*AfPacketDelete) GetMessageType() api.MessageType { } // AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply': -// -// "af_packet_delete_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type AfPacketDeleteReply struct { Retval int32 } @@ -205,29 +93,6 @@ func (*AfPacketDeleteReply) GetMessageType() api.MessageType { } // AfPacketDetails represents VPP binary API message 'af_packet_details': -// -// "af_packet_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "host_if_name", -// 64 -// ], -// { -// "crc": "0x057205fa" -// } -// type AfPacketDetails struct { SwIfIndex uint32 HostIfName []byte `struc:"[64]byte"` @@ -244,24 +109,6 @@ func (*AfPacketDetails) GetMessageType() api.MessageType { } // AfPacketDump represents VPP binary API message 'af_packet_dump': -// -// "af_packet_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type AfPacketDump struct{} func (*AfPacketDump) GetMessageName() string { @@ -275,32 +122,6 @@ func (*AfPacketDump) GetMessageType() api.MessageType { } // AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload': -// -// "af_packet_set_l4_cksum_offload", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "sw_if_index" -// ], -// [ -// "u8", -// "set" -// ], -// { -// "crc": "0x86538585" -// } -// type AfPacketSetL4CksumOffload struct { SwIfIndex uint8 Set uint8 @@ -317,24 +138,6 @@ func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { } // AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply': -// -// "af_packet_set_l4_cksum_offload_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type AfPacketSetL4CksumOffloadReply struct { Retval int32 } diff --git a/examples/bin_api/interfaces/interfaces.ba.go b/examples/bin_api/interfaces/interfaces.ba.go index 2f9b943..5f949df 100644 --- a/examples/bin_api/interfaces/interfaces.ba.go +++ b/examples/bin_api/interfaces/interfaces.ba.go @@ -11,9 +11,9 @@ */ package interfaces -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -21,90 +21,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "create_subif": { -// "reply": "create_subif_reply" -// }, -// "sw_interface_set_ip_directed_broadcast": { -// "reply": "sw_interface_set_ip_directed_broadcast_reply" -// }, -// "delete_subif": { -// "reply": "delete_subif_reply" -// }, -// "sw_interface_get_mac_address": { -// "reply": "sw_interface_get_mac_address_reply" -// }, -// "sw_interface_tag_add_del": { -// "reply": "sw_interface_tag_add_del_reply" -// }, -// "collect_detailed_interface_stats": { -// "reply": "collect_detailed_interface_stats_reply" -// }, -// "sw_interface_dump": { -// "reply": "sw_interface_details", -// "stream": true -// }, -// "sw_interface_set_rx_placement": { -// "reply": "sw_interface_set_rx_placement_reply" -// }, -// "sw_interface_add_del_address": { -// "reply": "sw_interface_add_del_address_reply" -// }, -// "sw_interface_get_table": { -// "reply": "sw_interface_get_table_reply" -// }, -// "interface_name_renumber": { -// "reply": "interface_name_renumber_reply" -// }, -// "create_loopback_instance": { -// "reply": "create_loopback_instance_reply" -// }, -// "sw_interface_set_mtu": { -// "reply": "sw_interface_set_mtu_reply" -// }, -// "want_interface_events": { -// "reply": "want_interface_events_reply", -// "events": [ -// "sw_interface_event" -// ] -// }, -// "create_loopback": { -// "reply": "create_loopback_reply" -// }, -// "sw_interface_clear_stats": { -// "reply": "sw_interface_clear_stats_reply" -// }, -// "hw_interface_set_mtu": { -// "reply": "hw_interface_set_mtu_reply" -// }, -// "sw_interface_set_mac_address": { -// "reply": "sw_interface_set_mac_address_reply" -// }, -// "sw_interface_set_unnumbered": { -// "reply": "sw_interface_set_unnumbered_reply" -// }, -// "sw_interface_rx_placement_dump": { -// "reply": "sw_interface_rx_placement_details", -// "stream": true -// }, -// "sw_interface_set_flags": { -// "reply": "sw_interface_set_flags_reply" -// }, -// "delete_loopback": { -// "reply": "delete_loopback_reply" -// }, -// "sw_interface_set_rx_mode": { -// "reply": "sw_interface_set_rx_mode_reply" -// }, -// "create_vlan_subif": { -// "reply": "create_vlan_subif_reply" -// }, -// "sw_interface_set_table": { -// "reply": "sw_interface_set_table_reply" -// } -// }, -// type Services interface { DumpSwInterface(*SwInterfaceDump) ([]*SwInterfaceDetails, error) DumpSwInterfaceRxPlacement(*SwInterfaceRxPlacementDump) ([]*SwInterfaceRxPlacementDetails, error) @@ -136,42 +52,11 @@ type Services interface { /* Aliases */ // InterfaceIndex represents VPP binary API alias 'interface_index': -// -// "interface_index": { -// "type": "u32" -// } -// type InterfaceIndex uint32 /* Messages */ // CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats': -// -// "collect_detailed_interface_stats", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "enable_disable" -// ], -// { -// "crc": "0x69d24598" -// } -// type CollectDetailedInterfaceStats struct { SwIfIndex uint32 EnableDisable uint8 @@ -188,24 +73,6 @@ func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { } // CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply': -// -// "collect_detailed_interface_stats_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type CollectDetailedInterfaceStatsReply struct { Retval int32 } @@ -221,29 +88,6 @@ func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { } // CreateLoopback represents VPP binary API message 'create_loopback': -// -// "create_loopback", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// { -// "crc": "0x3b54129c" -// } -// type CreateLoopback struct { MacAddress []byte `struc:"[6]byte"` } @@ -259,37 +103,6 @@ func (*CreateLoopback) GetMessageType() api.MessageType { } // CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance': -// -// "create_loopback_instance", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// [ -// "u8", -// "is_specified" -// ], -// [ -// "u32", -// "user_instance" -// ], -// { -// "crc": "0x7bbd53b6" -// } -// type CreateLoopbackInstance struct { MacAddress []byte `struc:"[6]byte"` IsSpecified uint8 @@ -307,28 +120,6 @@ func (*CreateLoopbackInstance) GetMessageType() api.MessageType { } // CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply': -// -// "create_loopback_instance_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type CreateLoopbackInstanceReply struct { Retval int32 SwIfIndex uint32 @@ -345,28 +136,6 @@ func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { } // CreateLoopbackReply represents VPP binary API message 'create_loopback_reply': -// -// "create_loopback_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type CreateLoopbackReply struct { Retval int32 SwIfIndex uint32 @@ -383,72 +152,6 @@ func (*CreateLoopbackReply) GetMessageType() api.MessageType { } // CreateSubif represents VPP binary API message 'create_subif': -// -// "create_subif", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "sub_id" -// ], -// [ -// "u8", -// "no_tags" -// ], -// [ -// "u8", -// "one_tag" -// ], -// [ -// "u8", -// "two_tags" -// ], -// [ -// "u8", -// "dot1ad" -// ], -// [ -// "u8", -// "exact_match" -// ], -// [ -// "u8", -// "default_sub" -// ], -// [ -// "u8", -// "outer_vlan_id_any" -// ], -// [ -// "u8", -// "inner_vlan_id_any" -// ], -// [ -// "u16", -// "outer_vlan_id" -// ], -// [ -// "u16", -// "inner_vlan_id" -// ], -// { -// "crc": "0x86cfe408" -// } -// type CreateSubif struct { SwIfIndex uint32 SubID uint32 @@ -475,28 +178,6 @@ func (*CreateSubif) GetMessageType() api.MessageType { } // CreateSubifReply represents VPP binary API message 'create_subif_reply': -// -// "create_subif_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type CreateSubifReply struct { Retval int32 SwIfIndex uint32 @@ -513,32 +194,6 @@ func (*CreateSubifReply) GetMessageType() api.MessageType { } // CreateVlanSubif represents VPP binary API message 'create_vlan_subif': -// -// "create_vlan_subif", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "vlan_id" -// ], -// { -// "crc": "0x70cadeda" -// } -// type CreateVlanSubif struct { SwIfIndex uint32 VlanID uint32 @@ -555,28 +210,6 @@ func (*CreateVlanSubif) GetMessageType() api.MessageType { } // CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply': -// -// "create_vlan_subif_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type CreateVlanSubifReply struct { Retval int32 SwIfIndex uint32 @@ -593,28 +226,6 @@ func (*CreateVlanSubifReply) GetMessageType() api.MessageType { } // DeleteLoopback represents VPP binary API message 'delete_loopback': -// -// "delete_loopback", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type DeleteLoopback struct { SwIfIndex uint32 } @@ -630,24 +241,6 @@ func (*DeleteLoopback) GetMessageType() api.MessageType { } // DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply': -// -// "delete_loopback_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type DeleteLoopbackReply struct { Retval int32 } @@ -663,28 +256,6 @@ func (*DeleteLoopbackReply) GetMessageType() api.MessageType { } // DeleteSubif represents VPP binary API message 'delete_subif': -// -// "delete_subif", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type DeleteSubif struct { SwIfIndex uint32 } @@ -700,24 +271,6 @@ func (*DeleteSubif) GetMessageType() api.MessageType { } // DeleteSubifReply represents VPP binary API message 'delete_subif_reply': -// -// "delete_subif_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type DeleteSubifReply struct { Retval int32 } @@ -733,32 +286,6 @@ func (*DeleteSubifReply) GetMessageType() api.MessageType { } // HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu': -// -// "hw_interface_set_mtu", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u16", -// "mtu" -// ], -// { -// "crc": "0x132da1e7" -// } -// type HwInterfaceSetMtu struct { SwIfIndex uint32 Mtu uint16 @@ -775,24 +302,6 @@ func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { } // HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply': -// -// "hw_interface_set_mtu_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type HwInterfaceSetMtuReply struct { Retval int32 } @@ -808,32 +317,6 @@ func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { } // InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber': -// -// "interface_name_renumber", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "new_show_dev_instance" -// ], -// { -// "crc": "0x39194269" -// } -// type InterfaceNameRenumber struct { SwIfIndex uint32 NewShowDevInstance uint32 @@ -850,24 +333,6 @@ func (*InterfaceNameRenumber) GetMessageType() api.MessageType { } // InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply': -// -// "interface_name_renumber_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type InterfaceNameRenumberReply struct { Retval int32 } @@ -883,49 +348,6 @@ func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { } // SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address': -// -// "sw_interface_add_del_address", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "del_all" -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// { -// "crc": "0x7b583179" -// } -// type SwInterfaceAddDelAddress struct { SwIfIndex uint32 IsAdd uint8 @@ -946,24 +368,6 @@ func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { } // SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply': -// -// "sw_interface_add_del_address_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceAddDelAddressReply struct { Retval int32 } @@ -979,28 +383,6 @@ func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { } // SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats': -// -// "sw_interface_clear_stats", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type SwInterfaceClearStats struct { SwIfIndex uint32 } @@ -1016,24 +398,6 @@ func (*SwInterfaceClearStats) GetMessageType() api.MessageType { } // SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply': -// -// "sw_interface_clear_stats_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceClearStatsReply struct { Retval int32 } @@ -1049,150 +413,6 @@ func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { } // SwInterfaceDetails represents VPP binary API message 'sw_interface_details': -// -// "sw_interface_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "sup_sw_if_index" -// ], -// [ -// "u32", -// "l2_address_length" -// ], -// [ -// "u8", -// "l2_address", -// 8 -// ], -// [ -// "u8", -// "interface_name", -// 64 -// ], -// [ -// "u8", -// "admin_up_down" -// ], -// [ -// "u8", -// "link_up_down" -// ], -// [ -// "u8", -// "link_duplex" -// ], -// [ -// "u32", -// "link_speed" -// ], -// [ -// "u16", -// "link_mtu" -// ], -// [ -// "u32", -// "mtu", -// 4 -// ], -// [ -// "u32", -// "sub_id" -// ], -// [ -// "u8", -// "sub_dot1ad" -// ], -// [ -// "u8", -// "sub_dot1ah" -// ], -// [ -// "u8", -// "sub_number_of_tags" -// ], -// [ -// "u16", -// "sub_outer_vlan_id" -// ], -// [ -// "u16", -// "sub_inner_vlan_id" -// ], -// [ -// "u8", -// "sub_exact_match" -// ], -// [ -// "u8", -// "sub_default" -// ], -// [ -// "u8", -// "sub_outer_vlan_id_any" -// ], -// [ -// "u8", -// "sub_inner_vlan_id_any" -// ], -// [ -// "u32", -// "vtr_op" -// ], -// [ -// "u32", -// "vtr_push_dot1q" -// ], -// [ -// "u32", -// "vtr_tag1" -// ], -// [ -// "u32", -// "vtr_tag2" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// [ -// "u16", -// "outer_tag" -// ], -// [ -// "u8", -// "b_dmac", -// 6 -// ], -// [ -// "u8", -// "b_smac", -// 6 -// ], -// [ -// "u16", -// "b_vlanid" -// ], -// [ -// "u32", -// "i_sid" -// ], -// { -// "crc": "0xe4ee7eb6" -// } -// type SwInterfaceDetails struct { SwIfIndex uint32 SupSwIfIndex uint32 @@ -1238,33 +458,6 @@ func (*SwInterfaceDetails) GetMessageType() api.MessageType { } // SwInterfaceDump represents VPP binary API message 'sw_interface_dump': -// -// "sw_interface_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "name_filter_valid" -// ], -// [ -// "u8", -// "name_filter", -// 49 -// ], -// { -// "crc": "0x63f5e3b7" -// } -// type SwInterfaceDump struct { NameFilterValid uint8 NameFilter []byte `struc:"[49]byte"` @@ -1281,40 +474,6 @@ func (*SwInterfaceDump) GetMessageType() api.MessageType { } // SwInterfaceEvent represents VPP binary API message 'sw_interface_event': -// -// "sw_interface_event", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "admin_up_down" -// ], -// [ -// "u8", -// "link_up_down" -// ], -// [ -// "u8", -// "deleted" -// ], -// { -// "crc": "0xbf9938e4" -// } -// type SwInterfaceEvent struct { PID uint32 SwIfIndex uint32 @@ -1334,28 +493,6 @@ func (*SwInterfaceEvent) GetMessageType() api.MessageType { } // SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address': -// -// "sw_interface_get_mac_address", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type SwInterfaceGetMacAddress struct { SwIfIndex uint32 } @@ -1371,29 +508,6 @@ func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { } // SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply': -// -// "sw_interface_get_mac_address_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// { -// "crc": "0x8ea538d3" -// } -// type SwInterfaceGetMacAddressReply struct { Retval int32 MacAddress []byte `struc:"[6]byte"` @@ -1410,32 +524,6 @@ func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { } // SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table': -// -// "sw_interface_get_table", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x6b7bcd0a" -// } -// type SwInterfaceGetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -1452,28 +540,6 @@ func (*SwInterfaceGetTable) GetMessageType() api.MessageType { } // SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply': -// -// "sw_interface_get_table_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "vrf_id" -// ], -// { -// "crc": "0xa6eb0109" -// } -// type SwInterfaceGetTableReply struct { Retval int32 VrfID uint32 @@ -1490,40 +556,6 @@ func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { } // SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details': -// -// "sw_interface_rx_placement_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "queue_id" -// ], -// [ -// "u32", -// "worker_id" -// ], -// [ -// "u8", -// "mode" -// ], -// { -// "crc": "0x0e9e33f4" -// } -// type SwInterfaceRxPlacementDetails struct { SwIfIndex uint32 QueueID uint32 @@ -1542,28 +574,6 @@ func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { } // SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump': -// -// "sw_interface_rx_placement_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type SwInterfaceRxPlacementDump struct { SwIfIndex uint32 } @@ -1579,32 +589,6 @@ func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { } // SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags': -// -// "sw_interface_set_flags", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "admin_up_down" -// ], -// { -// "crc": "0x555485f5" -// } -// type SwInterfaceSetFlags struct { SwIfIndex uint32 AdminUpDown uint8 @@ -1621,24 +605,6 @@ func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { } // SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply': -// -// "sw_interface_set_flags_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetFlagsReply struct { Retval int32 } @@ -1654,32 +620,6 @@ func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { } // SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast': -// -// "sw_interface_set_ip_directed_broadcast", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "enable" -// ], -// { -// "crc": "0xa36fadc0" -// } -// type SwInterfaceSetIPDirectedBroadcast struct { SwIfIndex uint32 Enable uint8 @@ -1696,24 +636,6 @@ func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { } // SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply': -// -// "sw_interface_set_ip_directed_broadcast_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetIPDirectedBroadcastReply struct { Retval int32 } @@ -1729,33 +651,6 @@ func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType } // SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address': -// -// "sw_interface_set_mac_address", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// { -// "crc": "0xeed5dfca" -// } -// type SwInterfaceSetMacAddress struct { SwIfIndex uint32 MacAddress []byte `struc:"[6]byte"` @@ -1772,24 +667,6 @@ func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { } // SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply': -// -// "sw_interface_set_mac_address_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetMacAddressReply struct { Retval int32 } @@ -1805,33 +682,6 @@ func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { } // SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu': -// -// "sw_interface_set_mtu", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "mtu", -// 4 -// ], -// { -// "crc": "0xd0008db8" -// } -// type SwInterfaceSetMtu struct { SwIfIndex uint32 Mtu []uint32 `struc:"[4]uint32"` @@ -1848,24 +698,6 @@ func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { } // SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply': -// -// "sw_interface_set_mtu_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetMtuReply struct { Retval int32 } @@ -1881,40 +713,6 @@ func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { } // SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode': -// -// "sw_interface_set_rx_mode", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "queue_id_valid" -// ], -// [ -// "u32", -// "queue_id" -// ], -// [ -// "u8", -// "mode" -// ], -// { -// "crc": "0x2a1cc58c" -// } -// type SwInterfaceSetRxMode struct { SwIfIndex uint32 QueueIDValid uint8 @@ -1933,24 +731,6 @@ func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { } // SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply': -// -// "sw_interface_set_rx_mode_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetRxModeReply struct { Retval int32 } @@ -1966,40 +746,6 @@ func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { } // SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement': -// -// "sw_interface_set_rx_placement", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "queue_id" -// ], -// [ -// "u32", -// "worker_id" -// ], -// [ -// "u8", -// "is_main" -// ], -// { -// "crc": "0x4ef4377d" -// } -// type SwInterfaceSetRxPlacement struct { SwIfIndex uint32 QueueID uint32 @@ -2018,24 +764,6 @@ func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { } // SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply': -// -// "sw_interface_set_rx_placement_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetRxPlacementReply struct { Retval int32 } @@ -2051,36 +779,6 @@ func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { } // SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table': -// -// "sw_interface_set_table", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u32", -// "vrf_id" -// ], -// { -// "crc": "0xacb25d89" -// } -// type SwInterfaceSetTable struct { SwIfIndex uint32 IsIPv6 uint8 @@ -2098,24 +796,6 @@ func (*SwInterfaceSetTable) GetMessageType() api.MessageType { } // SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply': -// -// "sw_interface_set_table_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetTableReply struct { Retval int32 } @@ -2131,36 +811,6 @@ func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { } // SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered': -// -// "sw_interface_set_unnumbered", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "unnumbered_sw_if_index" -// ], -// [ -// "u8", -// "is_add" -// ], -// { -// "crc": "0xa2c1bbda" -// } -// type SwInterfaceSetUnnumbered struct { SwIfIndex uint32 UnnumberedSwIfIndex uint32 @@ -2178,24 +828,6 @@ func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { } // SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply': -// -// "sw_interface_set_unnumbered_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceSetUnnumberedReply struct { Retval int32 } @@ -2211,37 +843,6 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { } // SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del': -// -// "sw_interface_tag_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// { -// "crc": "0x14cc636c" -// } -// type SwInterfaceTagAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -2259,24 +860,6 @@ func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { } // SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply': -// -// "sw_interface_tag_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceTagAddDelReply struct { Retval int32 } @@ -2292,32 +875,6 @@ func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { } // WantInterfaceEvents represents VPP binary API message 'want_interface_events': -// -// "want_interface_events", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "enable_disable" -// ], -// [ -// "u32", -// "pid" -// ], -// { -// "crc": "0x476f5a08" -// } -// type WantInterfaceEvents struct { EnableDisable uint32 PID uint32 @@ -2334,24 +891,6 @@ func (*WantInterfaceEvents) GetMessageType() api.MessageType { } // WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply': -// -// "want_interface_events_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type WantInterfaceEventsReply struct { Retval int32 } diff --git a/examples/bin_api/ip/ip.ba.go b/examples/bin_api/ip/ip.ba.go index 290abec..bedb5c9 100644 --- a/examples/bin_api/ip/ip.ba.go +++ b/examples/bin_api/ip/ip.ba.go @@ -14,9 +14,9 @@ */ package ip -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -24,165 +24,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "ip_container_proxy_dump": { -// "reply": "ip_container_proxy_details", -// "stream": true -// }, -// "ip_address_dump": { -// "reply": "ip_address_details", -// "stream": true -// }, -// "ip_source_and_port_range_check_add_del": { -// "reply": "ip_source_and_port_range_check_add_del_reply" -// }, -// "reset_fib": { -// "reply": "reset_fib_reply" -// }, -// "ip_probe_neighbor": { -// "reply": "ip_probe_neighbor_reply" -// }, -// "want_ip6_nd_events": { -// "reply": "want_ip6_nd_events_reply", -// "events": [ -// "ip6_nd_event" -// ] -// }, -// "ip_punt_police": { -// "reply": "ip_punt_police_reply" -// }, -// "ip6nd_proxy_add_del": { -// "reply": "ip6nd_proxy_add_del_reply" -// }, -// "set_arp_neighbor_limit": { -// "reply": "set_arp_neighbor_limit_reply" -// }, -// "ip_reassembly_enable_disable": { -// "reply": "ip_reassembly_enable_disable_reply" -// }, -// "ip6_fib_dump": { -// "reply": "ip6_fib_details", -// "stream": true -// }, -// "ip6nd_send_router_solicitation": { -// "reply": "ip6nd_send_router_solicitation_reply" -// }, -// "ip_source_check_interface_add_del": { -// "reply": "ip_source_check_interface_add_del_reply" -// }, -// "ip_table_add_del": { -// "reply": "ip_table_add_del_reply" -// }, -// "ip_neighbor_dump": { -// "reply": "ip_neighbor_details", -// "stream": true -// }, -// "ip_punt_redirect": { -// "reply": "ip_punt_redirect_reply" -// }, -// "sw_interface_ip6nd_ra_prefix": { -// "reply": "sw_interface_ip6nd_ra_prefix_reply" -// }, -// "ip_reassembly_set": { -// "reply": "ip_reassembly_set_reply" -// }, -// "ip6_mfib_dump": { -// "reply": "ip6_mfib_details", -// "stream": true -// }, -// "sw_interface_ip6nd_ra_config": { -// "reply": "sw_interface_ip6nd_ra_config_reply" -// }, -// "proxy_arp_dump": { -// "reply": "proxy_arp_details", -// "stream": true -// }, -// "sw_interface_ip6_enable_disable": { -// "reply": "sw_interface_ip6_enable_disable_reply" -// }, -// "ip_source_and_port_range_check_interface_add_del": { -// "reply": "ip_source_and_port_range_check_interface_add_del_reply" -// }, -// "mfib_signal_dump": { -// "reply": "mfib_signal_details", -// "stream": true -// }, -// "ip_punt_redirect_dump": { -// "reply": "ip_punt_redirect_details", -// "stream": true -// }, -// "ip_container_proxy_add_del": { -// "reply": "ip_container_proxy_add_del_reply" -// }, -// "ip_mfib_dump": { -// "reply": "ip_mfib_details", -// "stream": true -// }, -// "ip_unnumbered_dump": { -// "reply": "ip_unnumbered_details", -// "stream": true -// }, -// "ip_dump": { -// "reply": "ip_details", -// "stream": true -// }, -// "ip_neighbor_add_del": { -// "reply": "ip_neighbor_add_del_reply" -// }, -// "proxy_arp_intfc_enable_disable": { -// "reply": "proxy_arp_intfc_enable_disable_reply" -// }, -// "proxy_arp_add_del": { -// "reply": "proxy_arp_add_del_reply" -// }, -// "ip_add_del_route": { -// "reply": "ip_add_del_route_reply" -// }, -// "ip6nd_proxy_dump": { -// "reply": "ip6nd_proxy_details", -// "stream": true -// }, -// "want_ip6_ra_events": { -// "reply": "want_ip6_ra_events_reply", -// "events": [ -// "ip6_ra_event" -// ] -// }, -// "ip_fib_dump": { -// "reply": "ip_fib_details", -// "stream": true -// }, -// "ip_scan_neighbor_enable_disable": { -// "reply": "ip_scan_neighbor_enable_disable_reply" -// }, -// "ioam_enable": { -// "reply": "ioam_enable_reply" -// }, -// "ip_mroute_add_del": { -// "reply": "ip_mroute_add_del_reply" -// }, -// "proxy_arp_intfc_dump": { -// "reply": "proxy_arp_intfc_details", -// "stream": true -// }, -// "want_ip4_arp_events": { -// "reply": "want_ip4_arp_events_reply", -// "events": [ -// "ip4_arp_event" -// ] -// }, -// "ip_reassembly_get": { -// "reply": "ip_reassembly_get_reply" -// }, -// "set_ip_flow_hash": { -// "reply": "set_ip_flow_hash_reply" -// }, -// "ioam_disable": { -// "reply": "ioam_disable_reply" -// } -// }, -// type Services interface { DumpIP6Fib(*IP6FibDump) ([]*IP6FibDetails, error) DumpIP6Mfib(*IP6MfibDump) ([]*IP6MfibDetails, error) @@ -233,20 +74,6 @@ type Services interface { /* Enums */ // AddressFamily represents VPP binary API enum 'address_family': -// -// "address_family", -// [ -// "ADDRESS_IP4", -// 0 -// ], -// [ -// "ADDRESS_IP6", -// 1 -// ], -// { -// "enumtype": "u32" -// } -// type AddressFamily uint32 const ( @@ -257,39 +84,17 @@ const ( /* Aliases */ // IP4Address represents VPP binary API alias 'ip4_address': -// -// "ip4_address": { -// "length": 4, -// "type": "u8" -// }, -// type IP4Address [4]uint8 // IP6Address represents VPP binary API alias 'ip6_address': -// -// "ip6_address": { -// "length": 16, -// "type": "u8" -// }, -// type IP6Address [16]uint8 // MacAddress represents VPP binary API alias 'mac_address': -// -// "mac_address": { -// "length": 6, -// "type": "u8" -// } -// type MacAddress [6]uint8 /* Types */ // Address represents VPP binary API type 'address': -// -// "address", -// 4 -// type Address struct { Af AddressFamily Un AddressUnion @@ -303,28 +108,6 @@ func (*Address) GetCrcString() string { } // FibMplsLabel represents VPP binary API type 'fib_mpls_label': -// -// "fib_mpls_label", -// [ -// "u8", -// "is_uniform" -// ], -// [ -// "u32", -// "label" -// ], -// [ -// "u8", -// "ttl" -// ], -// [ -// "u8", -// "exp" -// ], -// { -// "crc": "0xc93bf35c" -// } -// type FibMplsLabel struct { IsUniform uint8 Label uint32 @@ -340,98 +123,6 @@ func (*FibMplsLabel) GetCrcString() string { } // FibPath represents VPP binary API type 'fib_path': -// -// "fib_path", -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u8", -// "weight" -// ], -// [ -// "u8", -// "preference" -// ], -// [ -// "u8", -// "is_local" -// ], -// [ -// "u8", -// "is_drop" -// ], -// [ -// "u8", -// "is_udp_encap" -// ], -// [ -// "u8", -// "is_unreach" -// ], -// [ -// "u8", -// "is_prohibit" -// ], -// [ -// "u8", -// "is_resolve_host" -// ], -// [ -// "u8", -// "is_resolve_attached" -// ], -// [ -// "u8", -// "is_dvr" -// ], -// [ -// "u8", -// "is_source_lookup" -// ], -// [ -// "u8", -// "is_interface_rx" -// ], -// [ -// "u8", -// "afi" -// ], -// [ -// "u8", -// "next_hop", -// 16 -// ], -// [ -// "u32", -// "next_hop_id" -// ], -// [ -// "u32", -// "rpf_id" -// ], -// [ -// "u32", -// "via_label" -// ], -// [ -// "u8", -// "n_labels" -// ], -// [ -// "vl_api_fib_mpls_label_t", -// "label_stack", -// 16 -// ], -// { -// "crc": "0xba7a81f0" -// } -// type FibPath struct { SwIfIndex uint32 TableID uint32 @@ -464,20 +155,6 @@ func (*FibPath) GetCrcString() string { } // IP4Prefix represents VPP binary API type 'ip4_prefix': -// -// "ip4_prefix", -// [ -// "vl_api_ip4_address_t", -// "prefix" -// ], -// [ -// "u8", -// "len" -// ], -// { -// "crc": "0xea8dc11d" -// } -// type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -491,20 +168,6 @@ func (*IP4Prefix) GetCrcString() string { } // IP6Prefix represents VPP binary API type 'ip6_prefix': -// -// "ip6_prefix", -// [ -// "vl_api_ip6_address_t", -// "prefix" -// ], -// [ -// "u8", -// "len" -// ], -// { -// "crc": "0x779fd64f" -// } -// type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -518,33 +181,6 @@ func (*IP6Prefix) GetCrcString() string { } // IP6RaPrefixInfo represents VPP binary API type 'ip6_ra_prefix_info': -// -// "ip6_ra_prefix_info", -// [ -// "u8", -// "dst_address", -// 16 -// ], -// [ -// "u8", -// "dst_address_length" -// ], -// [ -// "u8", -// "flags" -// ], -// [ -// "u32", -// "valid_time" -// ], -// [ -// "u32", -// "preferred_time" -// ], -// { -// "crc": "0x83d7c6e5" -// } -// type IP6RaPrefixInfo struct { DstAddress []byte `struc:"[16]byte"` DstAddressLength uint8 @@ -561,20 +197,6 @@ func (*IP6RaPrefixInfo) GetCrcString() string { } // MfibPath represents VPP binary API type 'mfib_path': -// -// "mfib_path", -// [ -// "vl_api_fib_path_t", -// "path" -// ], -// [ -// "u32", -// "itf_flags" -// ], -// { -// "crc": "0x4ba77d32" -// } -// type MfibPath struct { Path FibPath ItfFlags uint32 @@ -588,28 +210,6 @@ func (*MfibPath) GetCrcString() string { } // Mprefix represents VPP binary API type 'mprefix': -// -// "mprefix", -// [ -// "vl_api_address_family_t", -// "af" -// ], -// [ -// "u16", -// "grp_address_length" -// ], -// [ -// "vl_api_address_union_t", -// "grp_address" -// ], -// [ -// "vl_api_address_union_t", -// "src_address" -// ], -// { -// "crc": "0x1c4cba05" -// } -// type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -625,20 +225,6 @@ func (*Mprefix) GetCrcString() string { } // Prefix represents VPP binary API type 'prefix': -// -// "prefix", -// [ -// "vl_api_address_t", -// "address" -// ], -// [ -// "u8", -// "address_length" -// ], -// { -// "crc": "0x0403aebc" -// } -// type Prefix struct { Address Address AddressLength uint8 @@ -652,26 +238,6 @@ func (*Prefix) GetCrcString() string { } // ProxyArp represents VPP binary API type 'proxy_arp': -// -// "proxy_arp", -// [ -// "u32", -// "vrf_id" -// ], -// [ -// "u8", -// "low_address", -// 4 -// ], -// [ -// "u8", -// "hi_address", -// 4 -// ], -// { -// "crc": "0x6d88106e" -// } -// type ProxyArp struct { VrfID uint32 LowAddress []byte `struc:"[4]byte"` @@ -686,24 +252,6 @@ func (*ProxyArp) GetCrcString() string { } // PuntRedirect represents VPP binary API type 'punt_redirect': -// -// "punt_redirect", -// [ -// "u32", -// "rx_sw_if_index" -// ], -// [ -// "u32", -// "tx_sw_if_index" -// ], -// [ -// "vl_api_address_t", -// "nh" -// ], -// { -// "crc": "0x3e7a801f" -// } -// type PuntRedirect struct { RxSwIfIndex uint32 TxSwIfIndex uint32 @@ -720,20 +268,6 @@ func (*PuntRedirect) GetCrcString() string { /* Unions */ // AddressUnion represents VPP binary API union 'address_union': -// -// "address_union", -// [ -// "vl_api_ip4_address_t", -// "ip4" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6" -// ], -// { -// "crc": "0xd68a2fb4" -// } -// type AddressUnion struct { Union_data [16]byte } @@ -782,28 +316,6 @@ func (u *AddressUnion) GetIP6() (a IP6Address) { /* Messages */ // IoamDisable represents VPP binary API message 'ioam_disable': -// -// "ioam_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u16", -// "id" -// ], -// { -// "crc": "0x6b16a45e" -// } -// type IoamDisable struct { ID uint16 } @@ -819,24 +331,6 @@ func (*IoamDisable) GetMessageType() api.MessageType { } // IoamDisableReply represents VPP binary API message 'ioam_disable_reply': -// -// "ioam_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IoamDisableReply struct { Retval int32 } @@ -852,48 +346,6 @@ func (*IoamDisableReply) GetMessageType() api.MessageType { } // IoamEnable represents VPP binary API message 'ioam_enable': -// -// "ioam_enable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u16", -// "id" -// ], -// [ -// "u8", -// "seqno" -// ], -// [ -// "u8", -// "analyse" -// ], -// [ -// "u8", -// "pot_enable" -// ], -// [ -// "u8", -// "trace_enable" -// ], -// [ -// "u32", -// "node_id" -// ], -// { -// "crc": "0x9392e032" -// } -// type IoamEnable struct { ID uint16 Seqno uint8 @@ -914,24 +366,6 @@ func (*IoamEnable) GetMessageType() api.MessageType { } // IoamEnableReply represents VPP binary API message 'ioam_enable_reply': -// -// "ioam_enable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IoamEnableReply struct { Retval int32 } @@ -947,41 +381,6 @@ func (*IoamEnableReply) GetMessageType() api.MessageType { } // IP4ArpEvent represents VPP binary API message 'ip4_arp_event': -// -// "ip4_arp_event", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "address" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "new_mac", -// 6 -// ], -// [ -// "u8", -// "mac_ip" -// ], -// { -// "crc": "0xef7235f7" -// } -// type IP4ArpEvent struct { Address uint32 PID uint32 @@ -1001,52 +400,6 @@ func (*IP4ArpEvent) GetMessageType() api.MessageType { } // IP6FibDetails represents VPP binary API message 'ip6_fib_details': -// -// "ip6_fib_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u8", -// "table_name", -// 64 -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "u32", -// "stats_index" -// ], -// [ -// "vl_api_fib_path_t", -// "path", -// 0, -// "count" -// ], -// { -// "crc": "0xef11e94d" -// } -// type IP6FibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -1068,24 +421,6 @@ func (*IP6FibDetails) GetMessageType() api.MessageType { } // IP6FibDump represents VPP binary API message 'ip6_fib_dump': -// -// "ip6_fib_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IP6FibDump struct{} func (*IP6FibDump) GetMessageName() string { @@ -1099,48 +434,6 @@ func (*IP6FibDump) GetMessageType() api.MessageType { } // IP6MfibDetails represents VPP binary API message 'ip6_mfib_details': -// -// "ip6_mfib_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "grp_address", -// 16 -// ], -// [ -// "u8", -// "src_address", -// 16 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_mfib_path_t", -// "path", -// 0, -// "count" -// ], -// { -// "crc": "0x738c546e" -// } -// type IP6MfibDetails struct { TableID uint32 AddressLength uint8 @@ -1161,24 +454,6 @@ func (*IP6MfibDetails) GetMessageType() api.MessageType { } // IP6MfibDump represents VPP binary API message 'ip6_mfib_dump': -// -// "ip6_mfib_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IP6MfibDump struct{} func (*IP6MfibDump) GetMessageName() string { @@ -1192,42 +467,6 @@ func (*IP6MfibDump) GetMessageType() api.MessageType { } // IP6NdEvent represents VPP binary API message 'ip6_nd_event': -// -// "ip6_nd_event", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// [ -// "u8", -// "new_mac", -// 6 -// ], -// [ -// "u8", -// "mac_ip" -// ], -// { -// "crc": "0x96ab2fdd" -// } -// type IP6NdEvent struct { PID uint32 SwIfIndex uint32 @@ -1247,63 +486,6 @@ func (*IP6NdEvent) GetMessageType() api.MessageType { } // IP6RaEvent represents VPP binary API message 'ip6_ra_event': -// -// "ip6_ra_event", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "router_address", -// 16 -// ], -// [ -// "u8", -// "current_hop_limit" -// ], -// [ -// "u8", -// "flags" -// ], -// [ -// "u16", -// "router_lifetime_in_sec" -// ], -// [ -// "u32", -// "neighbor_reachable_time_in_msec" -// ], -// [ -// "u32", -// "time_in_msec_between_retransmitted_neighbor_solicitations" -// ], -// [ -// "u32", -// "n_prefixes" -// ], -// [ -// "vl_api_ip6_ra_prefix_info_t", -// "prefixes", -// 0, -// "n_prefixes" -// ], -// { -// "crc": "0xc5e54257" -// } -// type IP6RaEvent struct { PID uint32 SwIfIndex uint32 @@ -1328,37 +510,6 @@ func (*IP6RaEvent) GetMessageType() api.MessageType { } // IP6ndProxyAddDel represents VPP binary API message 'ip6nd_proxy_add_del': -// -// "ip6nd_proxy_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_del" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// { -// "crc": "0xd95f0fa0" -// } -// type IP6ndProxyAddDel struct { SwIfIndex uint32 IsDel uint8 @@ -1376,24 +527,6 @@ func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { } // IP6ndProxyAddDelReply represents VPP binary API message 'ip6nd_proxy_add_del_reply': -// -// "ip6nd_proxy_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IP6ndProxyAddDelReply struct { Retval int32 } @@ -1409,29 +542,6 @@ func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType { } // IP6ndProxyDetails represents VPP binary API message 'ip6nd_proxy_details': -// -// "ip6nd_proxy_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// { -// "crc": "0x6a47c974" -// } -// type IP6ndProxyDetails struct { SwIfIndex uint32 Address []byte `struc:"[16]byte"` @@ -1448,24 +558,6 @@ func (*IP6ndProxyDetails) GetMessageType() api.MessageType { } // IP6ndProxyDump represents VPP binary API message 'ip6nd_proxy_dump': -// -// "ip6nd_proxy_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IP6ndProxyDump struct{} func (*IP6ndProxyDump) GetMessageName() string { @@ -1479,48 +571,6 @@ func (*IP6ndProxyDump) GetMessageType() api.MessageType { } // IP6ndSendRouterSolicitation represents VPP binary API message 'ip6nd_send_router_solicitation': -// -// "ip6nd_send_router_solicitation", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "irt" -// ], -// [ -// "u32", -// "mrt" -// ], -// [ -// "u32", -// "mrc" -// ], -// [ -// "u32", -// "mrd" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "stop" -// ], -// { -// "crc": "0xbd968917" -// } -// type IP6ndSendRouterSolicitation struct { Irt uint32 Mrt uint32 @@ -1541,24 +591,6 @@ func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType { } // IP6ndSendRouterSolicitationReply represents VPP binary API message 'ip6nd_send_router_solicitation_reply': -// -// "ip6nd_send_router_solicitation_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IP6ndSendRouterSolicitationReply struct { Retval int32 } @@ -1574,136 +606,6 @@ func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { } // IPAddDelRoute represents VPP binary API message 'ip_add_del_route': -// -// "ip_add_del_route", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "next_hop_sw_if_index" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u32", -// "classify_table_index" -// ], -// [ -// "u32", -// "next_hop_table_id" -// ], -// [ -// "u32", -// "next_hop_id" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_drop" -// ], -// [ -// "u8", -// "is_unreach" -// ], -// [ -// "u8", -// "is_prohibit" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "is_local" -// ], -// [ -// "u8", -// "is_classify" -// ], -// [ -// "u8", -// "is_multipath" -// ], -// [ -// "u8", -// "is_resolve_host" -// ], -// [ -// "u8", -// "is_resolve_attached" -// ], -// [ -// "u8", -// "is_dvr" -// ], -// [ -// "u8", -// "is_source_lookup" -// ], -// [ -// "u8", -// "is_udp_encap" -// ], -// [ -// "u8", -// "next_hop_weight" -// ], -// [ -// "u8", -// "next_hop_preference" -// ], -// [ -// "u8", -// "next_hop_proto" -// ], -// [ -// "u8", -// "dst_address_length" -// ], -// [ -// "u8", -// "dst_address", -// 16 -// ], -// [ -// "u8", -// "next_hop_address", -// 16 -// ], -// [ -// "u8", -// "next_hop_n_out_labels" -// ], -// [ -// "u32", -// "next_hop_via_label" -// ], -// [ -// "vl_api_fib_mpls_label_t", -// "next_hop_out_label_stack", -// 0, -// "next_hop_n_out_labels" -// ], -// { -// "crc": "0x4219d62d" -// } -// type IPAddDelRoute struct { NextHopSwIfIndex uint32 TableID uint32 @@ -1745,28 +647,6 @@ func (*IPAddDelRoute) GetMessageType() api.MessageType { } // IPAddDelRouteReply represents VPP binary API message 'ip_add_del_route_reply': -// -// "ip_add_del_route_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "stats_index" -// ], -// { -// "crc": "0x1992deab" -// } -// type IPAddDelRouteReply struct { Retval int32 StatsIndex uint32 @@ -1783,37 +663,6 @@ func (*IPAddDelRouteReply) GetMessageType() api.MessageType { } // IPAddressDetails represents VPP binary API message 'ip_address_details': -// -// "ip_address_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "ip", -// 16 -// ], -// [ -// "u8", -// "prefix_length" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x9bc25966" -// } -// type IPAddressDetails struct { IP []byte `struc:"[16]byte"` PrefixLength uint8 @@ -1832,32 +681,6 @@ func (*IPAddressDetails) GetMessageType() api.MessageType { } // IPAddressDump represents VPP binary API message 'ip_address_dump': -// -// "ip_address_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x6b7bcd0a" -// } -// type IPAddressDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -1874,45 +697,6 @@ func (*IPAddressDump) GetMessageType() api.MessageType { } // IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del': -// -// "ip_container_proxy_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "ip", -// 16 -// ], -// [ -// "u8", -// "is_ip4" -// ], -// [ -// "u8", -// "plen" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_add" -// ], -// { -// "crc": "0x0a355d39" -// } -// type IPContainerProxyAddDel struct { IP []byte `struc:"[16]byte"` IsIP4 uint8 @@ -1932,24 +716,6 @@ func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { } // IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply': -// -// "ip_container_proxy_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPContainerProxyAddDelReply struct { Retval int32 } @@ -1965,28 +731,6 @@ func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { } // IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details': -// -// "ip_container_proxy_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "vl_api_prefix_t", -// "prefix" -// ], -// { -// "crc": "0xd528df63" -// } -// type IPContainerProxyDetails struct { SwIfIndex uint32 Prefix Prefix @@ -2003,24 +747,6 @@ func (*IPContainerProxyDetails) GetMessageType() api.MessageType { } // IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump': -// -// "ip_container_proxy_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IPContainerProxyDump struct{} func (*IPContainerProxyDump) GetMessageName() string { @@ -2034,28 +760,6 @@ func (*IPContainerProxyDump) GetMessageType() api.MessageType { } // IPDetails represents VPP binary API message 'ip_details': -// -// "ip_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x8bb37ec4" -// } -// type IPDetails struct { SwIfIndex uint32 IsIPv6 uint8 @@ -2072,28 +776,6 @@ func (*IPDetails) GetMessageType() api.MessageType { } // IPDump represents VPP binary API message 'ip_dump': -// -// "ip_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0xde883da4" -// } -// type IPDump struct { IsIPv6 uint8 } @@ -2109,52 +791,6 @@ func (*IPDump) GetMessageType() api.MessageType { } // IPFibDetails represents VPP binary API message 'ip_fib_details': -// -// "ip_fib_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u8", -// "table_name", -// 64 -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "address", -// 4 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "u32", -// "stats_index" -// ], -// [ -// "vl_api_fib_path_t", -// "path", -// 0, -// "count" -// ], -// { -// "crc": "0xf6a2fab3" -// } -// type IPFibDetails struct { TableID uint32 TableName []byte `struc:"[64]byte"` @@ -2176,24 +812,6 @@ func (*IPFibDetails) GetMessageType() api.MessageType { } // IPFibDump represents VPP binary API message 'ip_fib_dump': -// -// "ip_fib_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IPFibDump struct{} func (*IPFibDump) GetMessageName() string { @@ -2207,60 +825,6 @@ func (*IPFibDump) GetMessageType() api.MessageType { } // IPMfibDetails represents VPP binary API message 'ip_mfib_details': -// -// "ip_mfib_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u32", -// "entry_flags" -// ], -// [ -// "u32", -// "rpf_id" -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "grp_address", -// 4 -// ], -// [ -// "u8", -// "src_address", -// 4 -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "u32", -// "stats_index" -// ], -// [ -// "vl_api_mfib_path_t", -// "path", -// 0, -// "count" -// ], -// { -// "crc": "0x61faa26f" -// } -// type IPMfibDetails struct { TableID uint32 EntryFlags uint32 @@ -2284,24 +848,6 @@ func (*IPMfibDetails) GetMessageType() api.MessageType { } // IPMfibDump represents VPP binary API message 'ip_mfib_dump': -// -// "ip_mfib_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type IPMfibDump struct{} func (*IPMfibDump) GetMessageName() string { @@ -2315,83 +861,6 @@ func (*IPMfibDump) GetMessageType() api.MessageType { } // IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del': -// -// "ip_mroute_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "next_hop_sw_if_index" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u32", -// "entry_flags" -// ], -// [ -// "u32", -// "itf_flags" -// ], -// [ -// "u32", -// "rpf_id" -// ], -// [ -// "u32", -// "bier_imp" -// ], -// [ -// "u16", -// "grp_address_length" -// ], -// [ -// "u8", -// "next_hop_afi" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "is_local" -// ], -// [ -// "u8", -// "grp_address", -// 16 -// ], -// [ -// "u8", -// "src_address", -// 16 -// ], -// [ -// "u8", -// "nh_address", -// 16 -// ], -// { -// "crc": "0xf44c17b1" -// } -// type IPMrouteAddDel struct { NextHopSwIfIndex uint32 TableID uint32 @@ -2420,28 +889,6 @@ func (*IPMrouteAddDel) GetMessageType() api.MessageType { } // IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply': -// -// "ip_mroute_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "stats_index" -// ], -// { -// "crc": "0x1992deab" -// } -// type IPMrouteAddDelReply struct { Retval int32 StatsIndex uint32 @@ -2458,54 +905,6 @@ func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { } // IPNeighborAddDel represents VPP binary API message 'ip_neighbor_add_del': -// -// "ip_neighbor_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "is_static" -// ], -// [ -// "u8", -// "is_no_adj_fib" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// [ -// "u8", -// "dst_address", -// 16 -// ], -// { -// "crc": "0x4711eb25" -// } -// type IPNeighborAddDel struct { SwIfIndex uint32 IsAdd uint8 @@ -2527,28 +926,6 @@ func (*IPNeighborAddDel) GetMessageType() api.MessageType { } // IPNeighborAddDelReply represents VPP binary API message 'ip_neighbor_add_del_reply': -// -// "ip_neighbor_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "stats_index" -// ], -// { -// "crc": "0x1992deab" -// } -// type IPNeighborAddDelReply struct { Retval int32 StatsIndex uint32 @@ -2565,46 +942,6 @@ func (*IPNeighborAddDelReply) GetMessageType() api.MessageType { } // IPNeighborDetails represents VPP binary API message 'ip_neighbor_details': -// -// "ip_neighbor_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "stats_index" -// ], -// [ -// "u8", -// "is_static" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// [ -// "u8", -// "ip_address", -// 16 -// ], -// { -// "crc": "0xc7001770" -// } -// type IPNeighborDetails struct { SwIfIndex uint32 StatsIndex uint32 @@ -2625,32 +962,6 @@ func (*IPNeighborDetails) GetMessageType() api.MessageType { } // IPNeighborDump represents VPP binary API message 'ip_neighbor_dump': -// -// "ip_neighbor_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x6b7bcd0a" -// } -// type IPNeighborDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -2667,37 +978,6 @@ func (*IPNeighborDump) GetMessageType() api.MessageType { } // IPProbeNeighbor represents VPP binary API message 'ip_probe_neighbor': -// -// "ip_probe_neighbor", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "dst_address", -// 16 -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x1e44bfd7" -// } -// type IPProbeNeighbor struct { SwIfIndex uint32 DstAddress []byte `struc:"[16]byte"` @@ -2715,24 +995,6 @@ func (*IPProbeNeighbor) GetMessageType() api.MessageType { } // IPProbeNeighborReply represents VPP binary API message 'ip_probe_neighbor_reply': -// -// "ip_probe_neighbor_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPProbeNeighborReply struct { Retval int32 } @@ -2748,36 +1010,6 @@ func (*IPProbeNeighborReply) GetMessageType() api.MessageType { } // IPPuntPolice represents VPP binary API message 'ip_punt_police': -// -// "ip_punt_police", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "policer_index" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "is_ip6" -// ], -// { -// "crc": "0x38691592" -// } -// type IPPuntPolice struct { PolicerIndex uint32 IsAdd uint8 @@ -2795,24 +1027,6 @@ func (*IPPuntPolice) GetMessageType() api.MessageType { } // IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply': -// -// "ip_punt_police_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPPuntPoliceReply struct { Retval int32 } @@ -2828,32 +1042,6 @@ func (*IPPuntPoliceReply) GetMessageType() api.MessageType { } // IPPuntRedirect represents VPP binary API message 'ip_punt_redirect': -// -// "ip_punt_redirect", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_punt_redirect_t", -// "punt" -// ], -// [ -// "u8", -// "is_add" -// ], -// { -// "crc": "0xa953495b" -// } -// type IPPuntRedirect struct { Punt PuntRedirect IsAdd uint8 @@ -2870,24 +1058,6 @@ func (*IPPuntRedirect) GetMessageType() api.MessageType { } // IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details': -// -// "ip_punt_redirect_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_punt_redirect_t", -// "punt" -// ], -// { -// "crc": "0xa47f70da" -// } -// type IPPuntRedirectDetails struct { Punt PuntRedirect } @@ -2903,32 +1073,6 @@ func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { } // IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump': -// -// "ip_punt_redirect_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x6b7bcd0a" -// } -// type IPPuntRedirectDump struct { SwIfIndex uint32 IsIPv6 uint8 @@ -2945,24 +1089,6 @@ func (*IPPuntRedirectDump) GetMessageType() api.MessageType { } // IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply': -// -// "ip_punt_redirect_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPPuntRedirectReply struct { Retval int32 } @@ -2978,36 +1104,6 @@ func (*IPPuntRedirectReply) GetMessageType() api.MessageType { } // IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable': -// -// "ip_reassembly_enable_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "enable_ip4" -// ], -// [ -// "u8", -// "enable_ip6" -// ], -// { -// "crc": "0xbb8dc5d0" -// } -// type IPReassemblyEnableDisable struct { SwIfIndex uint32 EnableIP4 uint8 @@ -3025,24 +1121,6 @@ func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { } // IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply': -// -// "ip_reassembly_enable_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPReassemblyEnableDisableReply struct { Retval int32 } @@ -3058,28 +1136,6 @@ func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { } // IPReassemblyGet represents VPP binary API message 'ip_reassembly_get': -// -// "ip_reassembly_get", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_ip6" -// ], -// { -// "crc": "0x6fe91190" -// } -// type IPReassemblyGet struct { IsIP6 uint8 } @@ -3095,40 +1151,6 @@ func (*IPReassemblyGet) GetMessageType() api.MessageType { } // IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply': -// -// "ip_reassembly_get_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "timeout_ms" -// ], -// [ -// "u32", -// "max_reassemblies" -// ], -// [ -// "u32", -// "expire_walk_interval_ms" -// ], -// [ -// "u8", -// "is_ip6" -// ], -// { -// "crc": "0x1f90afd1" -// } -// type IPReassemblyGetReply struct { Retval int32 TimeoutMs uint32 @@ -3148,40 +1170,6 @@ func (*IPReassemblyGetReply) GetMessageType() api.MessageType { } // IPReassemblySet represents VPP binary API message 'ip_reassembly_set': -// -// "ip_reassembly_set", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "timeout_ms" -// ], -// [ -// "u32", -// "max_reassemblies" -// ], -// [ -// "u32", -// "expire_walk_interval_ms" -// ], -// [ -// "u8", -// "is_ip6" -// ], -// { -// "crc": "0x1db184de" -// } -// type IPReassemblySet struct { TimeoutMs uint32 MaxReassemblies uint32 @@ -3200,24 +1188,6 @@ func (*IPReassemblySet) GetMessageType() api.MessageType { } // IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply': -// -// "ip_reassembly_set_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPReassemblySetReply struct { Retval int32 } @@ -3233,48 +1203,6 @@ func (*IPReassemblySetReply) GetMessageType() api.MessageType { } // IPScanNeighborEnableDisable represents VPP binary API message 'ip_scan_neighbor_enable_disable': -// -// "ip_scan_neighbor_enable_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "mode" -// ], -// [ -// "u8", -// "scan_interval" -// ], -// [ -// "u8", -// "max_proc_time" -// ], -// [ -// "u8", -// "max_update" -// ], -// [ -// "u8", -// "scan_int_delay" -// ], -// [ -// "u8", -// "stale_threshold" -// ], -// { -// "crc": "0x0a6bf57a" -// } -// type IPScanNeighborEnableDisable struct { Mode uint8 ScanInterval uint8 @@ -3295,24 +1223,6 @@ func (*IPScanNeighborEnableDisable) GetMessageType() api.MessageType { } // IPScanNeighborEnableDisableReply represents VPP binary API message 'ip_scan_neighbor_enable_disable_reply': -// -// "ip_scan_neighbor_enable_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPScanNeighborEnableDisableReply struct { Retval int32 } @@ -3328,59 +1238,6 @@ func (*IPScanNeighborEnableDisableReply) GetMessageType() api.MessageType { } // IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del': -// -// "ip_source_and_port_range_check_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "mask_length" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// [ -// "u8", -// "number_of_ranges" -// ], -// [ -// "u16", -// "low_ports", -// 32 -// ], -// [ -// "u16", -// "high_ports", -// 32 -// ], -// [ -// "u32", -// "vrf_id" -// ], -// { -// "crc": "0x03d6b03a" -// } -// type IPSourceAndPortRangeCheckAddDel struct { IsIPv6 uint8 IsAdd uint8 @@ -3403,24 +1260,6 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { } // IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply': -// -// "ip_source_and_port_range_check_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPSourceAndPortRangeCheckAddDelReply struct { Retval int32 } @@ -3436,48 +1275,6 @@ func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { } // IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del': -// -// "ip_source_and_port_range_check_interface_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "tcp_in_vrf_id" -// ], -// [ -// "u32", -// "tcp_out_vrf_id" -// ], -// [ -// "u32", -// "udp_in_vrf_id" -// ], -// [ -// "u32", -// "udp_out_vrf_id" -// ], -// { -// "crc": "0x6966bc44" -// } -// type IPSourceAndPortRangeCheckInterfaceAddDel struct { IsAdd uint8 SwIfIndex uint32 @@ -3498,24 +1295,6 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageTyp } // IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply': -// -// "ip_source_and_port_range_check_interface_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { Retval int32 } @@ -3531,36 +1310,6 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.Messa } // IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del': -// -// "ip_source_check_interface_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "loose" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x0a60152a" -// } -// type IPSourceCheckInterfaceAddDel struct { IsAdd uint8 Loose uint8 @@ -3578,24 +1327,6 @@ func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { } // IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply': -// -// "ip_source_check_interface_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPSourceCheckInterfaceAddDelReply struct { Retval int32 } @@ -3611,41 +1342,6 @@ func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { } // IPTableAddDel represents VPP binary API message 'ip_table_add_del': -// -// "ip_table_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u8", -// "name", -// 64 -// ], -// { -// "crc": "0x0240c89d" -// } -// type IPTableAddDel struct { TableID uint32 IsIPv6 uint8 @@ -3664,24 +1360,6 @@ func (*IPTableAddDel) GetMessageType() api.MessageType { } // IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply': -// -// "ip_table_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type IPTableAddDelReply struct { Retval int32 } @@ -3697,28 +1375,6 @@ func (*IPTableAddDelReply) GetMessageType() api.MessageType { } // IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details': -// -// "ip_unnumbered_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "ip_sw_if_index" -// ], -// { -// "crc": "0xae694cf4" -// } -// type IPUnnumberedDetails struct { SwIfIndex uint32 IPSwIfIndex uint32 @@ -3735,28 +1391,6 @@ func (*IPUnnumberedDetails) GetMessageType() api.MessageType { } // IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump': -// -// "ip_unnumbered_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type IPUnnumberedDump struct { SwIfIndex uint32 } @@ -3772,51 +1406,6 @@ func (*IPUnnumberedDump) GetMessageType() api.MessageType { } // MfibSignalDetails represents VPP binary API message 'mfib_signal_details': -// -// "mfib_signal_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u32", -// "table_id" -// ], -// [ -// "u16", -// "grp_address_len" -// ], -// [ -// "u8", -// "grp_address", -// 16 -// ], -// [ -// "u8", -// "src_address", -// 16 -// ], -// [ -// "u16", -// "ip_packet_len" -// ], -// [ -// "u8", -// "ip_packet_data", -// 256 -// ], -// { -// "crc": "0x3f5f03f5" -// } -// type MfibSignalDetails struct { SwIfIndex uint32 TableID uint32 @@ -3838,24 +1427,6 @@ func (*MfibSignalDetails) GetMessageType() api.MessageType { } // MfibSignalDump represents VPP binary API message 'mfib_signal_dump': -// -// "mfib_signal_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MfibSignalDump struct{} func (*MfibSignalDump) GetMessageName() string { @@ -3869,32 +1440,6 @@ func (*MfibSignalDump) GetMessageType() api.MessageType { } // ProxyArpAddDel represents VPP binary API message 'proxy_arp_add_del': -// -// "proxy_arp_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "vl_api_proxy_arp_t", -// "proxy" -// ], -// { -// "crc": "0x227988d9" -// } -// type ProxyArpAddDel struct { IsAdd uint8 Proxy ProxyArp @@ -3911,24 +1456,6 @@ func (*ProxyArpAddDel) GetMessageType() api.MessageType { } // ProxyArpAddDelReply represents VPP binary API message 'proxy_arp_add_del_reply': -// -// "proxy_arp_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ProxyArpAddDelReply struct { Retval int32 } @@ -3944,24 +1471,6 @@ func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { } // ProxyArpDetails represents VPP binary API message 'proxy_arp_details': -// -// "proxy_arp_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_proxy_arp_t", -// "proxy" -// ], -// { -// "crc": "0x9b707c77" -// } -// type ProxyArpDetails struct { Proxy ProxyArp } @@ -3977,24 +1486,6 @@ func (*ProxyArpDetails) GetMessageType() api.MessageType { } // ProxyArpDump represents VPP binary API message 'proxy_arp_dump': -// -// "proxy_arp_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ProxyArpDump struct{} func (*ProxyArpDump) GetMessageName() string { @@ -4008,24 +1499,6 @@ func (*ProxyArpDump) GetMessageType() api.MessageType { } // ProxyArpIntfcDetails represents VPP binary API message 'proxy_arp_intfc_details': -// -// "proxy_arp_intfc_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xf6458e5f" -// } -// type ProxyArpIntfcDetails struct { SwIfIndex uint32 } @@ -4041,24 +1514,6 @@ func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { } // ProxyArpIntfcDump represents VPP binary API message 'proxy_arp_intfc_dump': -// -// "proxy_arp_intfc_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ProxyArpIntfcDump struct{} func (*ProxyArpIntfcDump) GetMessageName() string { @@ -4072,32 +1527,6 @@ func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { } // ProxyArpIntfcEnableDisable represents VPP binary API message 'proxy_arp_intfc_enable_disable': -// -// "proxy_arp_intfc_enable_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "enable_disable" -// ], -// { -// "crc": "0x69d24598" -// } -// type ProxyArpIntfcEnableDisable struct { SwIfIndex uint32 EnableDisable uint8 @@ -4114,24 +1543,6 @@ func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { } // ProxyArpIntfcEnableDisableReply represents VPP binary API message 'proxy_arp_intfc_enable_disable_reply': -// -// "proxy_arp_intfc_enable_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ProxyArpIntfcEnableDisableReply struct { Retval int32 } @@ -4147,32 +1558,6 @@ func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { } // ResetFib represents VPP binary API message 'reset_fib': -// -// "reset_fib", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "vrf_id" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// { -// "crc": "0x8553ebd9" -// } -// type ResetFib struct { VrfID uint32 IsIPv6 uint8 @@ -4189,24 +1574,6 @@ func (*ResetFib) GetMessageType() api.MessageType { } // ResetFibReply represents VPP binary API message 'reset_fib_reply': -// -// "reset_fib_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type ResetFibReply struct { Retval int32 } @@ -4222,32 +1589,6 @@ func (*ResetFibReply) GetMessageType() api.MessageType { } // SetArpNeighborLimit represents VPP binary API message 'set_arp_neighbor_limit': -// -// "set_arp_neighbor_limit", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u32", -// "arp_neighbor_limit" -// ], -// { -// "crc": "0x97d01fd6" -// } -// type SetArpNeighborLimit struct { IsIPv6 uint8 ArpNeighborLimit uint32 @@ -4264,24 +1605,6 @@ func (*SetArpNeighborLimit) GetMessageType() api.MessageType { } // SetArpNeighborLimitReply represents VPP binary API message 'set_arp_neighbor_limit_reply': -// -// "set_arp_neighbor_limit_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SetArpNeighborLimitReply struct { Retval int32 } @@ -4297,60 +1620,6 @@ func (*SetArpNeighborLimitReply) GetMessageType() api.MessageType { } // SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash': -// -// "set_ip_flow_hash", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "vrf_id" -// ], -// [ -// "u8", -// "is_ipv6" -// ], -// [ -// "u8", -// "src" -// ], -// [ -// "u8", -// "dst" -// ], -// [ -// "u8", -// "sport" -// ], -// [ -// "u8", -// "dport" -// ], -// [ -// "u8", -// "proto" -// ], -// [ -// "u8", -// "reverse" -// ], -// [ -// "u8", -// "symmetric" -// ], -// { -// "crc": "0xa9084bfb" -// } -// type SetIPFlowHash struct { VrfID uint32 IsIPv6 uint8 @@ -4374,24 +1643,6 @@ func (*SetIPFlowHash) GetMessageType() api.MessageType { } // SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply': -// -// "set_ip_flow_hash_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SetIPFlowHashReply struct { Retval int32 } @@ -4407,32 +1658,6 @@ func (*SetIPFlowHashReply) GetMessageType() api.MessageType { } // SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable': -// -// "sw_interface_ip6_enable_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "enable" -// ], -// { -// "crc": "0xa36fadc0" -// } -// type SwInterfaceIP6EnableDisable struct { SwIfIndex uint32 Enable uint8 @@ -4449,24 +1674,6 @@ func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { } // SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply': -// -// "sw_interface_ip6_enable_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceIP6EnableDisableReply struct { Retval int32 } @@ -4482,80 +1689,6 @@ func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { } // SwInterfaceIP6ndRaConfig represents VPP binary API message 'sw_interface_ip6nd_ra_config': -// -// "sw_interface_ip6nd_ra_config", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "suppress" -// ], -// [ -// "u8", -// "managed" -// ], -// [ -// "u8", -// "other" -// ], -// [ -// "u8", -// "ll_option" -// ], -// [ -// "u8", -// "send_unicast" -// ], -// [ -// "u8", -// "cease" -// ], -// [ -// "u8", -// "is_no" -// ], -// [ -// "u8", -// "default_router" -// ], -// [ -// "u32", -// "max_interval" -// ], -// [ -// "u32", -// "min_interval" -// ], -// [ -// "u32", -// "lifetime" -// ], -// [ -// "u32", -// "initial_count" -// ], -// [ -// "u32", -// "initial_interval" -// ], -// { -// "crc": "0xc3f02daa" -// } -// type SwInterfaceIP6ndRaConfig struct { SwIfIndex uint32 Suppress uint8 @@ -4584,24 +1717,6 @@ func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType { } // SwInterfaceIP6ndRaConfigReply represents VPP binary API message 'sw_interface_ip6nd_ra_config_reply': -// -// "sw_interface_ip6nd_ra_config_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceIP6ndRaConfigReply struct { Retval int32 } @@ -4617,69 +1732,6 @@ func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType { } // SwInterfaceIP6ndRaPrefix represents VPP binary API message 'sw_interface_ip6nd_ra_prefix': -// -// "sw_interface_ip6nd_ra_prefix", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// [ -// "u8", -// "address_length" -// ], -// [ -// "u8", -// "use_default" -// ], -// [ -// "u8", -// "no_advertise" -// ], -// [ -// "u8", -// "off_link" -// ], -// [ -// "u8", -// "no_autoconfig" -// ], -// [ -// "u8", -// "no_onlink" -// ], -// [ -// "u8", -// "is_no" -// ], -// [ -// "u32", -// "val_lifetime" -// ], -// [ -// "u32", -// "pref_lifetime" -// ], -// { -// "crc": "0xca763c9a" -// } -// type SwInterfaceIP6ndRaPrefix struct { SwIfIndex uint32 Address []byte `struc:"[16]byte"` @@ -4705,24 +1757,6 @@ func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { } // SwInterfaceIP6ndRaPrefixReply represents VPP binary API message 'sw_interface_ip6nd_ra_prefix_reply': -// -// "sw_interface_ip6nd_ra_prefix_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type SwInterfaceIP6ndRaPrefixReply struct { Retval int32 } @@ -4738,36 +1772,6 @@ func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType { } // WantIP4ArpEvents represents VPP binary API message 'want_ip4_arp_events': -// -// "want_ip4_arp_events", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "enable_disable" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u32", -// "address" -// ], -// { -// "crc": "0x77e06379" -// } -// type WantIP4ArpEvents struct { EnableDisable uint8 PID uint32 @@ -4785,24 +1789,6 @@ func (*WantIP4ArpEvents) GetMessageType() api.MessageType { } // WantIP4ArpEventsReply represents VPP binary API message 'want_ip4_arp_events_reply': -// -// "want_ip4_arp_events_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type WantIP4ArpEventsReply struct { Retval int32 } @@ -4818,37 +1804,6 @@ func (*WantIP4ArpEventsReply) GetMessageType() api.MessageType { } // WantIP6NdEvents represents VPP binary API message 'want_ip6_nd_events': -// -// "want_ip6_nd_events", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "enable_disable" -// ], -// [ -// "u32", -// "pid" -// ], -// [ -// "u8", -// "address", -// 16 -// ], -// { -// "crc": "0x1cf65fbb" -// } -// type WantIP6NdEvents struct { EnableDisable uint8 PID uint32 @@ -4866,24 +1821,6 @@ func (*WantIP6NdEvents) GetMessageType() api.MessageType { } // WantIP6NdEventsReply represents VPP binary API message 'want_ip6_nd_events_reply': -// -// "want_ip6_nd_events_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type WantIP6NdEventsReply struct { Retval int32 } @@ -4899,32 +1836,6 @@ func (*WantIP6NdEventsReply) GetMessageType() api.MessageType { } // WantIP6RaEvents represents VPP binary API message 'want_ip6_ra_events': -// -// "want_ip6_ra_events", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "enable_disable" -// ], -// [ -// "u32", -// "pid" -// ], -// { -// "crc": "0x05b454b5" -// } -// type WantIP6RaEvents struct { EnableDisable uint8 PID uint32 @@ -4941,24 +1852,6 @@ func (*WantIP6RaEvents) GetMessageType() api.MessageType { } // WantIP6RaEventsReply represents VPP binary API message 'want_ip6_ra_events_reply': -// -// "want_ip6_ra_events_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type WantIP6RaEventsReply struct { Retval int32 } diff --git a/examples/bin_api/maps/maps.ba.go b/examples/bin_api/maps/maps.ba.go index a5fc9d6..e4fea90 100644 --- a/examples/bin_api/maps/maps.ba.go +++ b/examples/bin_api/maps/maps.ba.go @@ -14,9 +14,9 @@ */ package maps -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -24,60 +24,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "map_param_set_fragmentation": { -// "reply": "map_param_set_fragmentation_reply" -// }, -// "map_param_add_del_pre_resolve": { -// "reply": "map_param_add_del_pre_resolve_reply" -// }, -// "map_param_set_tcp": { -// "reply": "map_param_set_tcp_reply" -// }, -// "map_rule_dump": { -// "reply": "map_rule_details", -// "stream": true -// }, -// "map_if_enable_disable": { -// "reply": "map_if_enable_disable_reply" -// }, -// "map_param_set_icmp6": { -// "reply": "map_param_set_icmp6_reply" -// }, -// "map_add_del_rule": { -// "reply": "map_add_del_rule_reply" -// }, -// "map_domain_dump": { -// "reply": "map_domain_details", -// "stream": true -// }, -// "map_param_get": { -// "reply": "map_param_get_reply" -// }, -// "map_param_set_icmp": { -// "reply": "map_param_set_icmp_reply" -// }, -// "map_add_domain": { -// "reply": "map_add_domain_reply" -// }, -// "map_summary_stats": { -// "reply": "map_summary_stats_reply" -// }, -// "map_param_set_traffic_class": { -// "reply": "map_param_set_traffic_class_reply" -// }, -// "map_del_domain": { -// "reply": "map_del_domain_reply" -// }, -// "map_param_set_reassembly": { -// "reply": "map_param_set_reassembly_reply" -// }, -// "map_param_set_security_check": { -// "reply": "map_param_set_security_check_reply" -// } -// }, -// type Services interface { DumpMapDomain(*MapDomainDump) ([]*MapDomainDetails, error) DumpMapRule(*MapRuleDump) ([]*MapRuleDetails, error) @@ -100,20 +46,6 @@ type Services interface { /* Enums */ // AddressFamily represents VPP binary API enum 'address_family': -// -// "address_family", -// [ -// "ADDRESS_IP4", -// 0 -// ], -// [ -// "ADDRESS_IP6", -// 1 -// ], -// { -// "enumtype": "u32" -// } -// type AddressFamily uint32 const ( @@ -124,40 +56,14 @@ const ( /* Aliases */ // IP4Address represents VPP binary API alias 'ip4_address': -// -// "ip4_address": { -// "length": 4, -// "type": "u8" -// } -// type IP4Address [4]uint8 // IP6Address represents VPP binary API alias 'ip6_address': -// -// "ip6_address": { -// "length": 16, -// "type": "u8" -// }, -// type IP6Address [16]uint8 /* Types */ // Address represents VPP binary API type 'address': -// -// "address", -// [ -// "vl_api_address_family_t", -// "af" -// ], -// [ -// "vl_api_address_union_t", -// "un" -// ], -// { -// "crc": "0x09f11671" -// } -// type Address struct { Af AddressFamily Un AddressUnion @@ -171,20 +77,6 @@ func (*Address) GetCrcString() string { } // IP4Prefix represents VPP binary API type 'ip4_prefix': -// -// "ip4_prefix", -// [ -// "vl_api_ip4_address_t", -// "prefix" -// ], -// [ -// "u8", -// "len" -// ], -// { -// "crc": "0xea8dc11d" -// } -// type IP4Prefix struct { Prefix IP4Address Len uint8 @@ -198,20 +90,6 @@ func (*IP4Prefix) GetCrcString() string { } // IP6Prefix represents VPP binary API type 'ip6_prefix': -// -// "ip6_prefix", -// [ -// "vl_api_ip6_address_t", -// "prefix" -// ], -// [ -// "u8", -// "len" -// ], -// { -// "crc": "0x779fd64f" -// } -// type IP6Prefix struct { Prefix IP6Address Len uint8 @@ -225,28 +103,6 @@ func (*IP6Prefix) GetCrcString() string { } // Mprefix represents VPP binary API type 'mprefix': -// -// "mprefix", -// [ -// "vl_api_address_family_t", -// "af" -// ], -// [ -// "u16", -// "grp_address_length" -// ], -// [ -// "vl_api_address_union_t", -// "grp_address" -// ], -// [ -// "vl_api_address_union_t", -// "src_address" -// ], -// { -// "crc": "0x1c4cba05" -// } -// type Mprefix struct { Af AddressFamily GrpAddressLength uint16 @@ -262,20 +118,6 @@ func (*Mprefix) GetCrcString() string { } // Prefix represents VPP binary API type 'prefix': -// -// "prefix", -// [ -// "vl_api_address_t", -// "address" -// ], -// [ -// "u8", -// "address_length" -// ], -// { -// "crc": "0x0403aebc" -// } -// type Prefix struct { Address Address AddressLength uint8 @@ -291,20 +133,6 @@ func (*Prefix) GetCrcString() string { /* Unions */ // AddressUnion represents VPP binary API union 'address_union': -// -// "address_union", -// [ -// "vl_api_ip4_address_t", -// "ip4" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6" -// ], -// { -// "crc": "0xd68a2fb4" -// } -// type AddressUnion struct { Union_data [16]byte } @@ -353,40 +181,6 @@ func (u *AddressUnion) GetIP6() (a IP6Address) { /* Messages */ // MapAddDelRule represents VPP binary API message 'map_add_del_rule': -// -// "map_add_del_rule", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "index" -// ], -// [ -// "bool", -// "is_add" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6_dst" -// ], -// [ -// "u16", -// "psid" -// ], -// { -// "crc": "0xe6132040" -// } -// type MapAddDelRule struct { Index uint32 IsAdd bool @@ -405,24 +199,6 @@ func (*MapAddDelRule) GetMessageType() api.MessageType { } // MapAddDelRuleReply represents VPP binary API message 'map_add_del_rule_reply': -// -// "map_add_del_rule_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapAddDelRuleReply struct { Retval int32 } @@ -438,52 +214,6 @@ func (*MapAddDelRuleReply) GetMessageType() api.MessageType { } // MapAddDomain represents VPP binary API message 'map_add_domain': -// -// "map_add_domain", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_ip6_prefix_t", -// "ip6_prefix" -// ], -// [ -// "vl_api_ip4_prefix_t", -// "ip4_prefix" -// ], -// [ -// "vl_api_ip6_prefix_t", -// "ip6_src" -// ], -// [ -// "u8", -// "ea_bits_len" -// ], -// [ -// "u8", -// "psid_offset" -// ], -// [ -// "u8", -// "psid_length" -// ], -// [ -// "u16", -// "mtu" -// ], -// { -// "crc": "0xa9358068" -// } -// type MapAddDomain struct { IP6Prefix IP6Prefix IP4Prefix IP4Prefix @@ -505,28 +235,6 @@ func (*MapAddDomain) GetMessageType() api.MessageType { } // MapAddDomainReply represents VPP binary API message 'map_add_domain_reply': -// -// "map_add_domain_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "index" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0x3e6d4e2c" -// } -// type MapAddDomainReply struct { Index uint32 Retval int32 @@ -543,28 +251,6 @@ func (*MapAddDomainReply) GetMessageType() api.MessageType { } // MapDelDomain represents VPP binary API message 'map_del_domain': -// -// "map_del_domain", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "index" -// ], -// { -// "crc": "0x8ac76db6" -// } -// type MapDelDomain struct { Index uint32 } @@ -580,24 +266,6 @@ func (*MapDelDomain) GetMessageType() api.MessageType { } // MapDelDomainReply represents VPP binary API message 'map_del_domain_reply': -// -// "map_del_domain_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapDelDomainReply struct { Retval int32 } @@ -613,56 +281,6 @@ func (*MapDelDomainReply) GetMessageType() api.MessageType { } // MapDomainDetails represents VPP binary API message 'map_domain_details': -// -// "map_domain_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "domain_index" -// ], -// [ -// "vl_api_ip6_prefix_t", -// "ip6_prefix" -// ], -// [ -// "vl_api_ip4_prefix_t", -// "ip4_prefix" -// ], -// [ -// "vl_api_ip6_prefix_t", -// "ip6_src" -// ], -// [ -// "u8", -// "ea_bits_len" -// ], -// [ -// "u8", -// "psid_offset" -// ], -// [ -// "u8", -// "psid_length" -// ], -// [ -// "u8", -// "flags" -// ], -// [ -// "u16", -// "mtu" -// ], -// { -// "crc": "0x2a17dcb8" -// } -// type MapDomainDetails struct { DomainIndex uint32 IP6Prefix IP6Prefix @@ -686,24 +304,6 @@ func (*MapDomainDetails) GetMessageType() api.MessageType { } // MapDomainDump represents VPP binary API message 'map_domain_dump': -// -// "map_domain_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MapDomainDump struct{} func (*MapDomainDump) GetMessageName() string { @@ -717,36 +317,6 @@ func (*MapDomainDump) GetMessageType() api.MessageType { } // MapIfEnableDisable represents VPP binary API message 'map_if_enable_disable': -// -// "map_if_enable_disable", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "bool", -// "is_enable" -// ], -// [ -// "bool", -// "is_translation" -// ], -// { -// "crc": "0x61a30cd9" -// } -// type MapIfEnableDisable struct { SwIfIndex uint32 IsEnable bool @@ -764,24 +334,6 @@ func (*MapIfEnableDisable) GetMessageType() api.MessageType { } // MapIfEnableDisableReply represents VPP binary API message 'map_if_enable_disable_reply': -// -// "map_if_enable_disable_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapIfEnableDisableReply struct { Retval int32 } @@ -797,36 +349,6 @@ func (*MapIfEnableDisableReply) GetMessageType() api.MessageType { } // MapParamAddDelPreResolve represents VPP binary API message 'map_param_add_del_pre_resolve': -// -// "map_param_add_del_pre_resolve", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "is_add" -// ], -// [ -// "vl_api_ip4_address_t", -// "ip4_nh_address" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6_nh_address" -// ], -// { -// "crc": "0xea9a9a4a" -// } -// type MapParamAddDelPreResolve struct { IsAdd bool IP4NhAddress IP4Address @@ -844,24 +366,6 @@ func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType { } // MapParamAddDelPreResolveReply represents VPP binary API message 'map_param_add_del_pre_resolve_reply': -// -// "map_param_add_del_pre_resolve_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamAddDelPreResolveReply struct { Retval int32 } @@ -877,24 +381,6 @@ func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType { } // MapParamGet represents VPP binary API message 'map_param_get': -// -// "map_param_get", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MapParamGet struct{} func (*MapParamGet) GetMessageName() string { @@ -908,96 +394,6 @@ func (*MapParamGet) GetMessageType() api.MessageType { } // MapParamGetReply represents VPP binary API message 'map_param_get_reply': -// -// "map_param_get_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u8", -// "frag_inner" -// ], -// [ -// "u8", -// "frag_ignore_df" -// ], -// [ -// "vl_api_ip4_address_t", -// "icmp_ip4_err_relay_src" -// ], -// [ -// "bool", -// "icmp6_enable_unreachable" -// ], -// [ -// "vl_api_ip4_address_t", -// "ip4_nh_address" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6_nh_address" -// ], -// [ -// "u16", -// "ip4_lifetime_ms" -// ], -// [ -// "u16", -// "ip4_pool_size" -// ], -// [ -// "u32", -// "ip4_buffers" -// ], -// [ -// "f64", -// "ip4_ht_ratio" -// ], -// [ -// "u16", -// "ip6_lifetime_ms" -// ], -// [ -// "u16", -// "ip6_pool_size" -// ], -// [ -// "u32", -// "ip6_buffers" -// ], -// [ -// "f64", -// "ip6_ht_ratio" -// ], -// [ -// "bool", -// "sec_check_enable" -// ], -// [ -// "bool", -// "sec_check_fragments" -// ], -// [ -// "bool", -// "tc_copy" -// ], -// [ -// "u8", -// "tc_class" -// ], -// { -// "crc": "0xb40e9226" -// } -// type MapParamGetReply struct { Retval int32 FragInner uint8 @@ -1031,32 +427,6 @@ func (*MapParamGetReply) GetMessageType() api.MessageType { } // MapParamSetFragmentation represents VPP binary API message 'map_param_set_fragmentation': -// -// "map_param_set_fragmentation", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "inner" -// ], -// [ -// "bool", -// "ignore_df" -// ], -// { -// "crc": "0x9ff54d90" -// } -// type MapParamSetFragmentation struct { Inner bool IgnoreDf bool @@ -1073,24 +443,6 @@ func (*MapParamSetFragmentation) GetMessageType() api.MessageType { } // MapParamSetFragmentationReply represents VPP binary API message 'map_param_set_fragmentation_reply': -// -// "map_param_set_fragmentation_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetFragmentationReply struct { Retval int32 } @@ -1106,28 +458,6 @@ func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType { } // MapParamSetICMP represents VPP binary API message 'map_param_set_icmp': -// -// "map_param_set_icmp", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_ip4_address_t", -// "ip4_err_relay_src" -// ], -// { -// "crc": "0x4c0a4fd2" -// } -// type MapParamSetICMP struct { IP4ErrRelaySrc IP4Address } @@ -1143,28 +473,6 @@ func (*MapParamSetICMP) GetMessageType() api.MessageType { } // MapParamSetICMP6 represents VPP binary API message 'map_param_set_icmp6': -// -// "map_param_set_icmp6", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "enable_unreachable" -// ], -// { -// "crc": "0x5d01f8c1" -// } -// type MapParamSetICMP6 struct { EnableUnreachable bool } @@ -1180,24 +488,6 @@ func (*MapParamSetICMP6) GetMessageType() api.MessageType { } // MapParamSetICMP6Reply represents VPP binary API message 'map_param_set_icmp6_reply': -// -// "map_param_set_icmp6_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetICMP6Reply struct { Retval int32 } @@ -1213,24 +503,6 @@ func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType { } // MapParamSetICMPReply represents VPP binary API message 'map_param_set_icmp_reply': -// -// "map_param_set_icmp_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetICMPReply struct { Retval int32 } @@ -1246,44 +518,6 @@ func (*MapParamSetICMPReply) GetMessageType() api.MessageType { } // MapParamSetReassembly represents VPP binary API message 'map_param_set_reassembly': -// -// "map_param_set_reassembly", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "is_ip6" -// ], -// [ -// "u16", -// "lifetime_ms" -// ], -// [ -// "u16", -// "pool_size" -// ], -// [ -// "u32", -// "buffers" -// ], -// [ -// "f64", -// "ht_ratio" -// ], -// { -// "crc": "0x54172b10" -// } -// type MapParamSetReassembly struct { IsIP6 bool LifetimeMs uint16 @@ -1303,24 +537,6 @@ func (*MapParamSetReassembly) GetMessageType() api.MessageType { } // MapParamSetReassemblyReply represents VPP binary API message 'map_param_set_reassembly_reply': -// -// "map_param_set_reassembly_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetReassemblyReply struct { Retval int32 } @@ -1336,32 +552,6 @@ func (*MapParamSetReassemblyReply) GetMessageType() api.MessageType { } // MapParamSetSecurityCheck represents VPP binary API message 'map_param_set_security_check': -// -// "map_param_set_security_check", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "enable" -// ], -// [ -// "bool", -// "fragments" -// ], -// { -// "crc": "0x6abe9836" -// } -// type MapParamSetSecurityCheck struct { Enable bool Fragments bool @@ -1378,24 +568,6 @@ func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType { } // MapParamSetSecurityCheckReply represents VPP binary API message 'map_param_set_security_check_reply': -// -// "map_param_set_security_check_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetSecurityCheckReply struct { Retval int32 } @@ -1411,28 +583,6 @@ func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType { } // MapParamSetTCP represents VPP binary API message 'map_param_set_tcp': -// -// "map_param_set_tcp", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u16", -// "tcp_mss" -// ], -// { -// "crc": "0x87a825d9" -// } -// type MapParamSetTCP struct { TCPMss uint16 } @@ -1448,24 +598,6 @@ func (*MapParamSetTCP) GetMessageType() api.MessageType { } // MapParamSetTCPReply represents VPP binary API message 'map_param_set_tcp_reply': -// -// "map_param_set_tcp_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetTCPReply struct { Retval int32 } @@ -1481,32 +613,6 @@ func (*MapParamSetTCPReply) GetMessageType() api.MessageType { } // MapParamSetTrafficClass represents VPP binary API message 'map_param_set_traffic_class': -// -// "map_param_set_traffic_class", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "bool", -// "copy" -// ], -// [ -// "u8", -// "class" -// ], -// { -// "crc": "0x007ee563" -// } -// type MapParamSetTrafficClass struct { Copy bool Class uint8 @@ -1523,24 +629,6 @@ func (*MapParamSetTrafficClass) GetMessageType() api.MessageType { } // MapParamSetTrafficClassReply represents VPP binary API message 'map_param_set_traffic_class_reply': -// -// "map_param_set_traffic_class_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MapParamSetTrafficClassReply struct { Retval int32 } @@ -1556,28 +644,6 @@ func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType { } // MapRuleDetails represents VPP binary API message 'map_rule_details': -// -// "map_rule_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "vl_api_ip6_address_t", -// "ip6_dst" -// ], -// [ -// "u16", -// "psid" -// ], -// { -// "crc": "0x4f932665" -// } -// type MapRuleDetails struct { IP6Dst IP6Address Psid uint16 @@ -1594,28 +660,6 @@ func (*MapRuleDetails) GetMessageType() api.MessageType { } // MapRuleDump represents VPP binary API message 'map_rule_dump': -// -// "map_rule_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "domain_index" -// ], -// { -// "crc": "0xe43e6ff6" -// } -// type MapRuleDump struct { DomainIndex uint32 } @@ -1631,24 +675,6 @@ func (*MapRuleDump) GetMessageType() api.MessageType { } // MapSummaryStats represents VPP binary API message 'map_summary_stats': -// -// "map_summary_stats", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MapSummaryStats struct{} func (*MapSummaryStats) GetMessageName() string { @@ -1662,47 +688,6 @@ func (*MapSummaryStats) GetMessageType() api.MessageType { } // MapSummaryStatsReply represents VPP binary API message 'map_summary_stats_reply': -// -// "map_summary_stats_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u64", -// "total_bindings" -// ], -// [ -// "u64", -// "total_pkts", -// 2 -// ], -// [ -// "u64", -// "total_bytes", -// 2 -// ], -// [ -// "u64", -// "total_ip4_fragments" -// ], -// [ -// "u64", -// "total_security_check", -// 2 -// ], -// { -// "crc": "0x0e4ace0e" -// } -// type MapSummaryStatsReply struct { Retval int32 TotalBindings uint64 diff --git a/examples/bin_api/memif/memif.ba.go b/examples/bin_api/memif/memif.ba.go index b0b3ee3..800b64c 100644 --- a/examples/bin_api/memif/memif.ba.go +++ b/examples/bin_api/memif/memif.ba.go @@ -10,9 +10,9 @@ */ package memif -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -20,27 +20,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "memif_delete": { -// "reply": "memif_delete_reply" -// }, -// "memif_socket_filename_add_del": { -// "reply": "memif_socket_filename_add_del_reply" -// }, -// "memif_create": { -// "reply": "memif_create_reply" -// }, -// "memif_socket_filename_dump": { -// "reply": "memif_socket_filename_details", -// "stream": true -// }, -// "memif_dump": { -// "reply": "memif_details", -// "stream": true -// } -// }, -// type Services interface { DumpMemif(*MemifDump) ([]*MemifDetails, error) DumpMemifSocketFilename(*MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) @@ -52,66 +31,6 @@ type Services interface { /* Messages */ // MemifCreate represents VPP binary API message 'memif_create': -// -// "memif_create", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "role" -// ], -// [ -// "u8", -// "mode" -// ], -// [ -// "u8", -// "rx_queues" -// ], -// [ -// "u8", -// "tx_queues" -// ], -// [ -// "u32", -// "id" -// ], -// [ -// "u32", -// "socket_id" -// ], -// [ -// "u8", -// "secret", -// 24 -// ], -// [ -// "u32", -// "ring_size" -// ], -// [ -// "u16", -// "buffer_size" -// ], -// [ -// "u8", -// "hw_addr", -// 6 -// ], -// { -// "crc": "0x6597cdb2" -// } -// type MemifCreate struct { Role uint8 Mode uint8 @@ -136,28 +55,6 @@ func (*MemifCreate) GetMessageType() api.MessageType { } // MemifCreateReply represents VPP binary API message 'memif_create_reply': -// -// "memif_create_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type MemifCreateReply struct { Retval int32 SwIfIndex uint32 @@ -174,28 +71,6 @@ func (*MemifCreateReply) GetMessageType() api.MessageType { } // MemifDelete represents VPP binary API message 'memif_delete': -// -// "memif_delete", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type MemifDelete struct { SwIfIndex uint32 } @@ -211,24 +86,6 @@ func (*MemifDelete) GetMessageType() api.MessageType { } // MemifDeleteReply represents VPP binary API message 'memif_delete_reply': -// -// "memif_delete_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MemifDeleteReply struct { Retval int32 } @@ -244,66 +101,6 @@ func (*MemifDeleteReply) GetMessageType() api.MessageType { } // MemifDetails represents VPP binary API message 'memif_details': -// -// "memif_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "if_name", -// 64 -// ], -// [ -// "u8", -// "hw_addr", -// 6 -// ], -// [ -// "u32", -// "id" -// ], -// [ -// "u8", -// "role" -// ], -// [ -// "u8", -// "mode" -// ], -// [ -// "u32", -// "socket_id" -// ], -// [ -// "u32", -// "ring_size" -// ], -// [ -// "u16", -// "buffer_size" -// ], -// [ -// "u8", -// "admin_up_down" -// ], -// [ -// "u8", -// "link_up_down" -// ], -// { -// "crc": "0x4f5a3397" -// } -// type MemifDetails struct { SwIfIndex uint32 IfName []byte `struc:"[64]byte"` @@ -329,24 +126,6 @@ func (*MemifDetails) GetMessageType() api.MessageType { } // MemifDump represents VPP binary API message 'memif_dump': -// -// "memif_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MemifDump struct{} func (*MemifDump) GetMessageName() string { @@ -360,37 +139,6 @@ func (*MemifDump) GetMessageType() api.MessageType { } // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del': -// -// "memif_socket_filename_add_del", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "is_add" -// ], -// [ -// "u32", -// "socket_id" -// ], -// [ -// "u8", -// "socket_filename", -// 128 -// ], -// { -// "crc": "0x30e3929d" -// } -// type MemifSocketFilenameAddDel struct { IsAdd uint8 SocketID uint32 @@ -408,24 +156,6 @@ func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { } // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply': -// -// "memif_socket_filename_add_del_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type MemifSocketFilenameAddDelReply struct { Retval int32 } @@ -441,29 +171,6 @@ func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { } // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details': -// -// "memif_socket_filename_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "socket_id" -// ], -// [ -// "u8", -// "socket_filename", -// 128 -// ], -// { -// "crc": "0xe347e32f" -// } -// type MemifSocketFilenameDetails struct { SocketID uint32 SocketFilename []byte `struc:"[128]byte"` @@ -480,24 +187,6 @@ func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { } // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump': -// -// "memif_socket_filename_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type MemifSocketFilenameDump struct{} func (*MemifSocketFilenameDump) GetMessageName() string { diff --git a/examples/bin_api/tap/tap.ba.go b/examples/bin_api/tap/tap.ba.go index d363146..aafd206 100644 --- a/examples/bin_api/tap/tap.ba.go +++ b/examples/bin_api/tap/tap.ba.go @@ -10,9 +10,9 @@ */ package tap -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -20,23 +20,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "tap_delete": { -// "reply": "tap_delete_reply" -// }, -// "sw_interface_tap_dump": { -// "reply": "sw_interface_tap_details", -// "stream": true -// }, -// "tap_modify": { -// "reply": "tap_modify_reply" -// }, -// "tap_connect": { -// "reply": "tap_connect_reply" -// } -// }, -// type Services interface { DumpSwInterfaceTap(*SwInterfaceTapDump) ([]*SwInterfaceTapDetails, error) TapConnect(*TapConnect) (*TapConnectReply, error) @@ -47,29 +30,6 @@ type Services interface { /* Messages */ // SwInterfaceTapDetails represents VPP binary API message 'sw_interface_tap_details': -// -// "sw_interface_tap_details", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "dev_name", -// 64 -// ], -// { -// "crc": "0x76229a57" -// } -// type SwInterfaceTapDetails struct { SwIfIndex uint32 DevName []byte `struc:"[64]byte"` @@ -86,24 +46,6 @@ func (*SwInterfaceTapDetails) GetMessageType() api.MessageType { } // SwInterfaceTapDump represents VPP binary API message 'sw_interface_tap_dump': -// -// "sw_interface_tap_dump", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type SwInterfaceTapDump struct{} func (*SwInterfaceTapDump) GetMessageName() string { @@ -117,77 +59,6 @@ func (*SwInterfaceTapDump) GetMessageType() api.MessageType { } // TapConnect represents VPP binary API message 'tap_connect': -// -// "tap_connect", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "use_random_mac" -// ], -// [ -// "u8", -// "tap_name", -// 64 -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// [ -// "u8", -// "renumber" -// ], -// [ -// "u32", -// "custom_dev_instance" -// ], -// [ -// "u8", -// "ip4_address_set" -// ], -// [ -// "u8", -// "ip4_address", -// 4 -// ], -// [ -// "u8", -// "ip4_mask_width" -// ], -// [ -// "u8", -// "ip6_address_set" -// ], -// [ -// "u8", -// "ip6_address", -// 16 -// ], -// [ -// "u8", -// "ip6_mask_width" -// ], -// [ -// "u8", -// "tag", -// 64 -// ], -// { -// "crc": "0x9b9c396f" -// } -// type TapConnect struct { UseRandomMac uint8 TapName []byte `struc:"[64]byte"` @@ -214,28 +85,6 @@ func (*TapConnect) GetMessageType() api.MessageType { } // TapConnectReply represents VPP binary API message 'tap_connect_reply': -// -// "tap_connect_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type TapConnectReply struct { Retval int32 SwIfIndex uint32 @@ -252,28 +101,6 @@ func (*TapConnectReply) GetMessageType() api.MessageType { } // TapDelete represents VPP binary API message 'tap_delete': -// -// "tap_delete", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0x529cb13f" -// } -// type TapDelete struct { SwIfIndex uint32 } @@ -289,24 +116,6 @@ func (*TapDelete) GetMessageType() api.MessageType { } // TapDeleteReply represents VPP binary API message 'tap_delete_reply': -// -// "tap_delete_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// { -// "crc": "0xe8d4e804" -// } -// type TapDeleteReply struct { Retval int32 } @@ -322,50 +131,6 @@ func (*TapDeleteReply) GetMessageType() api.MessageType { } // TapModify represents VPP binary API message 'tap_modify': -// -// "tap_modify", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// [ -// "u8", -// "use_random_mac" -// ], -// [ -// "u8", -// "tap_name", -// 64 -// ], -// [ -// "u8", -// "mac_address", -// 6 -// ], -// [ -// "u8", -// "renumber" -// ], -// [ -// "u32", -// "custom_dev_instance" -// ], -// { -// "crc": "0x8047ae5c" -// } -// type TapModify struct { SwIfIndex uint32 UseRandomMac uint8 @@ -386,28 +151,6 @@ func (*TapModify) GetMessageType() api.MessageType { } // TapModifyReply represents VPP binary API message 'tap_modify_reply': -// -// "tap_modify_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "sw_if_index" -// ], -// { -// "crc": "0xfda5941f" -// } -// type TapModifyReply struct { Retval int32 SwIfIndex uint32 diff --git a/examples/bin_api/vpe/vpe.ba.go b/examples/bin_api/vpe/vpe.ba.go index 9eb4c98..7dc718d 100644 --- a/examples/bin_api/vpe/vpe.ba.go +++ b/examples/bin_api/vpe/vpe.ba.go @@ -11,9 +11,9 @@ */ package vpe -import "git.fd.io/govpp.git/api" -import "github.com/lunixbochs/struc" -import "bytes" +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 @@ -21,37 +21,6 @@ var _ = struc.Pack var _ = bytes.NewBuffer // Services represents VPP binary API services: -// -// "services": { -// "cli_inband": { -// "reply": "cli_inband_reply" -// }, -// "get_node_index": { -// "reply": "get_node_index_reply" -// }, -// "cli": { -// "reply": "cli_reply" -// }, -// "show_version": { -// "reply": "show_version_reply" -// }, -// "get_node_graph": { -// "reply": "get_node_graph_reply" -// }, -// "get_next_index": { -// "reply": "get_next_index_reply" -// }, -// "show_threads": { -// "reply": "show_threads_reply" -// }, -// "add_node_next": { -// "reply": "add_node_next_reply" -// }, -// "control_ping": { -// "reply": "control_ping_reply" -// } -// }, -// type Services interface { AddNodeNext(*AddNodeNext) (*AddNodeNextReply, error) Cli(*Cli) (*CliReply, error) @@ -67,11 +36,6 @@ type Services interface { /* Types */ // ThreadData represents VPP binary API type 'thread_data': -// -// "thread_data", -// 0, -// "count" -// type ThreadData struct { ID uint32 Name []byte `struc:"[64]byte"` @@ -92,34 +56,6 @@ func (*ThreadData) GetCrcString() string { /* Messages */ // AddNodeNext represents VPP binary API message 'add_node_next': -// -// "add_node_next", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "node_name", -// 64 -// ], -// [ -// "u8", -// "next_name", -// 64 -// ], -// { -// "crc": "0x9ab92f7a" -// } -// type AddNodeNext struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -136,28 +72,6 @@ func (*AddNodeNext) GetMessageType() api.MessageType { } // AddNodeNextReply represents VPP binary API message 'add_node_next_reply': -// -// "add_node_next_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "next_index" -// ], -// { -// "crc": "0x2ed75f32" -// } -// type AddNodeNextReply struct { Retval int32 NextIndex uint32 @@ -174,28 +88,6 @@ func (*AddNodeNextReply) GetMessageType() api.MessageType { } // Cli represents VPP binary API message 'cli': -// -// "cli", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u64", -// "cmd_in_shmem" -// ], -// { -// "crc": "0x23bfbfff" -// } -// type Cli struct { CmdInShmem uint64 } @@ -211,28 +103,6 @@ func (*Cli) GetMessageType() api.MessageType { } // CliInband represents VPP binary API message 'cli_inband': -// -// "cli_inband", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "string", -// "cmd" -// ], -// { -// "crc": "0xb1ad59b3" -// } -// type CliInband struct { XXX_CmdLen uint32 `struc:"sizeof=Cmd"` Cmd string @@ -249,28 +119,6 @@ func (*CliInband) GetMessageType() api.MessageType { } // CliInbandReply represents VPP binary API message 'cli_inband_reply': -// -// "cli_inband_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "string", -// "reply" -// ], -// { -// "crc": "0x6d3c80a4" -// } -// type CliInbandReply struct { Retval int32 XXX_ReplyLen uint32 `struc:"sizeof=Reply"` @@ -288,28 +136,6 @@ func (*CliInbandReply) GetMessageType() api.MessageType { } // CliReply represents VPP binary API message 'cli_reply': -// -// "cli_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u64", -// "reply_in_shmem" -// ], -// { -// "crc": "0x06d68297" -// } -// type CliReply struct { Retval int32 ReplyInShmem uint64 @@ -326,24 +152,6 @@ func (*CliReply) GetMessageType() api.MessageType { } // ControlPing represents VPP binary API message 'control_ping': -// -// "control_ping", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ControlPing struct{} func (*ControlPing) GetMessageName() string { @@ -357,32 +165,6 @@ func (*ControlPing) GetMessageType() api.MessageType { } // ControlPingReply represents VPP binary API message 'control_ping_reply': -// -// "control_ping_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "vpe_pid" -// ], -// { -// "crc": "0xf6b0b8ca" -// } -// type ControlPingReply struct { Retval int32 ClientIndex uint32 @@ -400,34 +182,6 @@ func (*ControlPingReply) GetMessageType() api.MessageType { } // GetNextIndex represents VPP binary API message 'get_next_index': -// -// "get_next_index", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "node_name", -// 64 -// ], -// [ -// "u8", -// "next_name", -// 64 -// ], -// { -// "crc": "0x9ab92f7a" -// } -// type GetNextIndex struct { NodeName []byte `struc:"[64]byte"` NextName []byte `struc:"[64]byte"` @@ -444,28 +198,6 @@ func (*GetNextIndex) GetMessageType() api.MessageType { } // GetNextIndexReply represents VPP binary API message 'get_next_index_reply': -// -// "get_next_index_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "next_index" -// ], -// { -// "crc": "0x2ed75f32" -// } -// type GetNextIndexReply struct { Retval int32 NextIndex uint32 @@ -482,24 +214,6 @@ func (*GetNextIndexReply) GetMessageType() api.MessageType { } // GetNodeGraph represents VPP binary API message 'get_node_graph': -// -// "get_node_graph", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type GetNodeGraph struct{} func (*GetNodeGraph) GetMessageName() string { @@ -513,28 +227,6 @@ func (*GetNodeGraph) GetMessageType() api.MessageType { } // GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply': -// -// "get_node_graph_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u64", -// "reply_in_shmem" -// ], -// { -// "crc": "0x06d68297" -// } -// type GetNodeGraphReply struct { Retval int32 ReplyInShmem uint64 @@ -551,29 +243,6 @@ func (*GetNodeGraphReply) GetMessageType() api.MessageType { } // GetNodeIndex represents VPP binary API message 'get_node_index': -// -// "get_node_index", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "u8", -// "node_name", -// 64 -// ], -// { -// "crc": "0x6c9a495d" -// } -// type GetNodeIndex struct { NodeName []byte `struc:"[64]byte"` } @@ -589,28 +258,6 @@ func (*GetNodeIndex) GetMessageType() api.MessageType { } // GetNodeIndexReply represents VPP binary API message 'get_node_index_reply': -// -// "get_node_index_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "node_index" -// ], -// { -// "crc": "0xa8600b89" -// } -// type GetNodeIndexReply struct { Retval int32 NodeIndex uint32 @@ -627,24 +274,6 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType { } // ShowThreads represents VPP binary API message 'show_threads': -// -// "show_threads", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ShowThreads struct{} func (*ShowThreads) GetMessageName() string { @@ -658,34 +287,6 @@ func (*ShowThreads) GetMessageType() api.MessageType { } // ShowThreadsReply represents VPP binary API message 'show_threads_reply': -// -// "show_threads_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "u32", -// "count" -// ], -// [ -// "vl_api_thread_data_t", -// "thread_data", -// 0, -// "count" -// ], -// { -// "crc": "0x6942fb35" -// } -// type ShowThreadsReply struct { Retval int32 Count uint32 `struc:"sizeof=ThreadData"` @@ -703,24 +304,6 @@ func (*ShowThreadsReply) GetMessageType() api.MessageType { } // ShowVersion represents VPP binary API message 'show_version': -// -// "show_version", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "client_index" -// ], -// [ -// "u32", -// "context" -// ], -// { -// "crc": "0x51077d14" -// } -// type ShowVersion struct{} func (*ShowVersion) GetMessageName() string { @@ -734,40 +317,6 @@ func (*ShowVersion) GetMessageType() api.MessageType { } // ShowVersionReply represents VPP binary API message 'show_version_reply': -// -// "show_version_reply", -// [ -// "u16", -// "_vl_msg_id" -// ], -// [ -// "u32", -// "context" -// ], -// [ -// "i32", -// "retval" -// ], -// [ -// "string", -// "program" -// ], -// [ -// "string", -// "version" -// ], -// [ -// "string", -// "build_date" -// ], -// [ -// "string", -// "build_directory" -// ], -// { -// "crc": "0xb9bcf6df" -// } -// type ShowVersionReply struct { Retval int32 XXX_ProgramLen uint32 `struc:"sizeof=Program"` diff --git a/examples/cmd/perf-bench/perf-bench.go b/examples/cmd/perf-bench/perf-bench.go deleted file mode 100644 index 664f046..0000000 --- a/examples/cmd/perf-bench/perf-bench.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2017 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. - -// Binary simple-client is an example VPP management application that exercises the -// govpp API on real-world use-cases. -package main - -import ( - "flag" - "fmt" - "log" - "time" - - "github.com/pkg/profile" - "github.com/sirupsen/logrus" - - "git.fd.io/govpp.git" - "git.fd.io/govpp.git/api" - "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/bin_api/vpe" -) - -const ( - defaultSyncRequestCount = 1000 - defaultAsyncRequestCount = 10000 -) - -func main() { - // parse optional flags - var sync, prof bool - var cnt int - flag.BoolVar(&sync, "sync", false, "run synchronous perf test") - flag.IntVar(&cnt, "count", 0, "count of requests to be sent to VPP") - flag.BoolVar(&prof, "prof", false, "generate profile data") - flag.Parse() - - if cnt == 0 { - // no specific count defined - use defaults - if sync { - cnt = defaultSyncRequestCount - } else { - cnt = defaultAsyncRequestCount - } - } - - if prof { - defer profile.Start().Stop() - } - - // log only errors - core.SetLogger(&logrus.Logger{Level: logrus.ErrorLevel}) - - // connect to VPP - conn, err := govpp.Connect("") - if err != nil { - log.Fatalln("Error:", err) - } - defer conn.Disconnect() - - // create an API channel - ch, err := conn.NewAPIChannelBuffered(cnt, cnt) - if err != nil { - log.Fatalln("Error:", err) - } - defer ch.Close() - - // run the test & measure the time - start := time.Now() - - if sync { - // run synchronous test - syncTest(ch, cnt) - } else { - // run asynchronous test - asyncTest(ch, cnt) - } - - elapsed := time.Since(start) - fmt.Println("Test took:", elapsed) - fmt.Printf("Requests per second: %.0f\n", float64(cnt)/elapsed.Seconds()) -} - -func syncTest(ch api.Channel, cnt int) { - fmt.Printf("Running synchronous perf test with %d requests...\n", cnt) - - for i := 0; i < cnt; i++ { - req := &vpe.ControlPing{} - reply := &vpe.ControlPingReply{} - - if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { - log.Fatalln("Error in reply:", err) - } - } -} - -func asyncTest(ch api.Channel, cnt int) { - fmt.Printf("Running asynchronous perf test with %d requests...\n", cnt) - - ctxChan := make(chan api.RequestCtx, cnt) - - go func() { - for i := 0; i < cnt; i++ { - ctxChan <- ch.SendRequest(&vpe.ControlPing{}) - } - close(ctxChan) - fmt.Printf("Sending asynchronous requests finished\n") - }() - - for ctx := range ctxChan { - reply := &vpe.ControlPingReply{} - if err := ctx.ReceiveReply(reply); err != nil { - log.Fatalln("Error in reply:", err) - } - } -} diff --git a/examples/cmd/simple-client/simple_client.go b/examples/cmd/simple-client/simple_client.go deleted file mode 100644 index 08d4da6..0000000 --- a/examples/cmd/simple-client/simple_client.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (c) 2017 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. - -// simple-client is an example VPP management application that exercises the -// govpp API on real-world use-cases. -package main - -import ( - "fmt" - "log" - "net" - "os" - "strings" - - "git.fd.io/govpp.git" - "git.fd.io/govpp.git/api" - "git.fd.io/govpp.git/examples/bin_api/acl" - "git.fd.io/govpp.git/examples/bin_api/interfaces" - "git.fd.io/govpp.git/examples/bin_api/ip" -) - -func main() { - fmt.Println("Starting simple VPP client...") - - // connect to VPP - conn, err := govpp.Connect("") - if err != nil { - log.Fatalln("ERROR:", err) - } - defer conn.Disconnect() - - // create an API channel that will be used in the examples - ch, err := conn.NewAPIChannel() - if err != nil { - log.Fatalln("ERROR:", err) - } - defer ch.Close() - - // individual examples - aclVersion(ch) - aclConfig(ch) - aclDump(ch) - - interfaceDump(ch) - ipAddressDump(ch) - - setIpUnnumbered(ch) - ipUnnumberedDump(ch) - - interfaceNotifications(ch) -} - -// aclVersion is the simplest API example - one empty request message and one reply message. -func aclVersion(ch api.Channel) { - fmt.Println("ACL getting version") - - req := &acl.ACLPluginGetVersion{} - reply := &acl.ACLPluginGetVersionReply{} - - if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { - fmt.Println("ERROR:", err) - } else { - fmt.Printf("ACL version reply: %+v\n", reply) - } -} - -// aclConfig is another simple API example - in this case, the request contains structured data. -func aclConfig(ch api.Channel) { - fmt.Println("ACL adding replace") - - req := &acl.ACLAddReplace{ - ACLIndex: ^uint32(0), - Tag: []byte("access list 1"), - R: []acl.ACLRule{ - { - IsPermit: 1, - SrcIPAddr: net.ParseIP("10.0.0.0").To4(), - SrcIPPrefixLen: 8, - DstIPAddr: net.ParseIP("192.168.1.0").To4(), - DstIPPrefixLen: 24, - Proto: 6, - }, - { - IsPermit: 1, - SrcIPAddr: net.ParseIP("8.8.8.8").To4(), - SrcIPPrefixLen: 32, - DstIPAddr: net.ParseIP("172.16.0.0").To4(), - DstIPPrefixLen: 16, - Proto: 6, - }, - }, - } - reply := &acl.ACLAddReplaceReply{} - - if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { - fmt.Println("ERROR:", err) - return - } - if reply.Retval != 0 { - fmt.Println("Retval:", reply.Retval) - return - } - - fmt.Printf("ACL add replace reply: %+v\n", reply) - -} - -// aclDump shows an example where SendRequest and ReceiveReply are not chained together. -func aclDump(ch api.Channel) { - fmt.Println("Dumping ACL") - - req := &acl.ACLDump{} - reply := &acl.ACLDetails{} - - reqCtx := ch.SendRequest(req) - - if err := reqCtx.ReceiveReply(reply); err != nil { - fmt.Println("ERROR:", err) - } else { - fmt.Printf("ACL details: %+v\n", reply) - } -} - -// interfaceDump shows an example of multipart request (multiple replies are expected). -func interfaceDump(ch api.Channel) { - fmt.Println("Dumping interfaces") - - reqCtx := ch.SendMultiRequest(&interfaces.SwInterfaceDump{}) - - for { - msg := &interfaces.SwInterfaceDetails{} - stop, err := reqCtx.ReceiveReply(msg) - if stop { - break - } - if err != nil { - fmt.Println("ERROR:", err) - } - ifaceName := strings.TrimFunc(string(msg.InterfaceName), func(r rune) bool { - return r == 0x00 - }) - fmt.Printf("Interface %q: %+v\n", ifaceName, msg) - } -} - -func ipAddressDump(ch api.Channel) { - fmt.Println("Dumping IP addresses") - - req := &ip.IPAddressDump{ - SwIfIndex: 1, //^uint32(0), - } - reqCtx := ch.SendMultiRequest(req) - - for { - msg := &ip.IPAddressDetails{} - stop, err := reqCtx.ReceiveReply(msg) - if stop { - break - } - if err != nil { - fmt.Println("ERROR:", err) - } - fmt.Printf("ip address details: %d %+v\n", msg.SwIfIndex, msg) - } -} - -// aclDump shows an example where SendRequest and ReceiveReply are not chained together. -func setIpUnnumbered(ch api.Channel) { - req := &interfaces.SwInterfaceSetUnnumbered{ - SwIfIndex: 1, - UnnumberedSwIfIndex: 2, - IsAdd: 1, - } - reply := &interfaces.SwInterfaceSetUnnumberedReply{} - - if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { - fmt.Println("ERROR:", err) - } else { - fmt.Printf("%+v\n", reply) - } -} - -func ipUnnumberedDump(ch api.Channel) { - fmt.Println("Dumping IP unnumbered") - - reqCtx := ch.SendMultiRequest(&ip.IPUnnumberedDump{ - SwIfIndex: ^uint32(0), - }) - - for { - msg := &ip.IPUnnumberedDetails{} - stop, err := reqCtx.ReceiveReply(msg) - if stop { - break - } - if err != nil { - fmt.Println("ERROR:", err) - } - fmt.Printf("IP unnumbered details: %+v\n", msg) - } -} - -// interfaceNotifications shows the usage of notification API. Note that for notifications, -// you are supposed to create your own Go channel with your preferred buffer size. If the channel's -// buffer is full, the notifications will not be delivered into it. -func interfaceNotifications(ch api.Channel) { - fmt.Println("Subscribing to notificaiton events") - - notifChan := make(chan api.Message, 100) - - // subscribe for specific notification message - sub, err := ch.SubscribeNotification(notifChan, &interfaces.SwInterfaceEvent{}) - if err != nil { - panic(err) - } - - // enable interface events in VPP - err = ch.SendRequest(&interfaces.WantInterfaceEvents{ - PID: uint32(os.Getpid()), - EnableDisable: 1, - }).ReceiveReply(&interfaces.WantInterfaceEventsReply{}) - if err != nil { - panic(err) - } - - // generate some events in VPP - err = ch.SendRequest(&interfaces.SwInterfaceSetFlags{ - SwIfIndex: 0, - AdminUpDown: 0, - }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) - if err != nil { - panic(err) - } - err = ch.SendRequest(&interfaces.SwInterfaceSetFlags{ - SwIfIndex: 0, - AdminUpDown: 1, - }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) - if err != nil { - panic(err) - } - - // receive one notification - notif := (<-notifChan).(*interfaces.SwInterfaceEvent) - fmt.Printf("incoming event: %+v\n", notif) - - // disable interface events in VPP - err = ch.SendRequest(&interfaces.WantInterfaceEvents{ - PID: uint32(os.Getpid()), - EnableDisable: 0, - }).ReceiveReply(&interfaces.WantInterfaceEventsReply{}) - if err != nil { - panic(err) - } - - // unsubscribe from delivery of the notifications - err = sub.Unsubscribe() - if err != nil { - panic(err) - } -} diff --git a/examples/cmd/stats-api/README.md b/examples/cmd/stats-api/README.md deleted file mode 100644 index 44a1663..0000000 --- a/examples/cmd/stats-api/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# Stats API Example - -This example demonstrates how to retrieve statistics from VPP using [the new Stats API](https://github.com/FDio/vpp/blob/master/src/vpp/stats/stats.md). - -## Requirements - -The following requirements are required to run this example: - -- install **VPP 18.10+** -- enable stats in VPP: - - ```sh - statseg { - default - } - ``` - > The [default socket](https://wiki.fd.io/view/VPP/Command-line_Arguments#.22statseg.22_parameters) is located at `/run/vpp/stats.sock`. -- run the VPP, ideally with some traffic - -## Running example - -First build the example: `go build git.fd.io/govpp.git/examples/cmd/stats-api`. - -Use commands `ls` and `dump` to list and dump statistics. Optionally, patterns can be used to filter the results. - -### List stats matching patterns `/sys/` and `/if/` -``` -$ ./stats-api ls /sys/ /if/ -Listing stats.. /sys/ /if/ - - /sys/vector_rate - - /sys/input_rate - - /sys/last_update - - /sys/last_stats_clear - - /sys/heartbeat - - /sys/node/clocks - - /sys/node/vectors - - /sys/node/calls - - /sys/node/suspends - - /if/drops - - /if/punt - - /if/ip4 - - /if/ip6 - - /if/rx-no-buf - - /if/rx-miss - - /if/rx-error - - /if/tx-error - - /if/rx - - /if/rx-unicast - - /if/rx-multicast - - /if/rx-broadcast - - /if/tx - - /if/tx-unicast-miss - - /if/tx-multicast - - /if/tx-broadcast -Listed 25 stats -``` - -### Dump all stats with their types and values -``` -$ ./stats-api dump -Dumping stats.. - - /sys/last_update ScalarIndex 10408 - - /sys/heartbeat ScalarIndex 1041 - - /err/ip4-icmp-error/unknown type ErrorIndex 5 - - /net/route/to CombinedCounterVector [[{Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:5 Bytes:420}]] - - /if/drops SimpleCounterVector [[0 5 5]] -Dumped 5 (2798) stats -``` diff --git a/examples/cmd/stats-api/stats_api.go b/examples/cmd/stats-api/stats_api.go deleted file mode 100644 index 6fd46d2..0000000 --- a/examples/cmd/stats-api/stats_api.go +++ /dev/null @@ -1,140 +0,0 @@ -// 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 main - -import ( - "flag" - "fmt" - "log" - "os" - "strings" - - "git.fd.io/govpp.git/adapter" - "git.fd.io/govpp.git/adapter/vppapiclient" -) - -// ------------------------------------------------------------------ -// Example - Stats API -// ------------------------------------------------------------------ -// The example stats_api demonstrates how to retrieve stats -// from the VPP using the new stats API. -// ------------------------------------------------------------------ - -var ( - statsSocket = flag.String("socket", vppapiclient.DefaultStatSocket, "VPP stats segment socket") - dumpAll = flag.Bool("all", false, "Dump all stats including ones with zero values") -) - -func init() { - flag.Usage = func() { - fmt.Fprintf(os.Stderr, "%s: usage [ls|dump] ...\n", os.Args[0]) - flag.PrintDefaults() - os.Exit(1) - } -} - -func main() { - flag.Parse() - - cmd := flag.Arg(0) - - switch cmd { - case "", "ls", "dump": - default: - flag.Usage() - } - - var patterns []string - if flag.NArg() > 0 { - patterns = flag.Args()[1:] - } - - client := vppapiclient.NewStatClient(*statsSocket) - - fmt.Printf("Connecting to stats socket: %s\n", *statsSocket) - - if err := client.Connect(); err != nil { - log.Fatalln("Connecting failed:", err) - } - defer client.Disconnect() - - switch cmd { - case "dump": - dumpStats(client, patterns, !*dumpAll) - default: - listStats(client, patterns) - } -} - -func listStats(client adapter.StatsAPI, patterns []string) { - fmt.Printf("Listing stats.. %s\n", strings.Join(patterns, " ")) - - list, err := client.ListStats(patterns...) - if err != nil { - log.Fatalln("listing stats failed:", err) - } - - for _, stat := range list { - fmt.Printf(" - %v\n", stat) - } - - fmt.Printf("Listed %d stats\n", len(list)) -} - -func dumpStats(client adapter.StatsAPI, patterns []string, skipZeros bool) { - fmt.Printf("Dumping stats.. %s\n", strings.Join(patterns, " ")) - - stats, err := client.DumpStats(patterns...) - if err != nil { - log.Fatalln("dumping stats failed:", err) - } - - n := 0 - for _, stat := range stats { - if isZero(stat.Data) && skipZeros { - continue - } - fmt.Printf(" - %-25s %25v %+v\n", stat.Name, stat.Type, stat.Data) - n++ - } - - fmt.Printf("Dumped %d (%d) stats\n", n, len(stats)) -} - -func isZero(stat adapter.Stat) bool { - switch s := stat.(type) { - case adapter.ScalarStat: - return s == 0 - case adapter.ErrorStat: - return s == 0 - case adapter.SimpleCounterStat: - for _, ss := range s { - for _, sss := range ss { - if sss != 0 { - return false - } - } - } - case adapter.CombinedCounterStat: - for _, ss := range s { - for _, sss := range ss { - if sss.Bytes != 0 || sss.Packets != 0 { - return false - } - } - } - } - return true -} diff --git a/examples/cmd/union-example/union_example.go b/examples/cmd/union-example/union_example.go deleted file mode 100644 index d4563c6..0000000 --- a/examples/cmd/union-example/union_example.go +++ /dev/null @@ -1,103 +0,0 @@ -// 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. - -// union-example is an example to show how to use unions in VPP binary API. -package main - -import ( - "bytes" - "fmt" - "log" - "net" - - "git.fd.io/govpp.git/examples/bin_api/ip" - "github.com/lunixbochs/struc" -) - -func main() { - encodingExample() - usageExample() -} - -func encodingExample() { - // create union with IPv4 address - var unionIP4 ip.AddressUnion - unionIP4.SetIP4(ip.IP4Address{192, 168, 1, 10}) - - // use it in the Address type - addr := &ip.Address{ - Af: ip.ADDRESS_IP4, - Un: ip.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10}), - } - log.Printf("encoding union IPv4: %v", addr.Un.GetIP4()) - - // encode the address with union - data := encode(addr) - // decode the address with union - addr2 := decode(data) - - log.Printf("decoded union IPv4: %v", addr2.Un.GetIP4()) -} - -func encode(addr *ip.Address) []byte { - log.Printf("encoding address: %#v", addr) - buf := new(bytes.Buffer) - if err := struc.Pack(buf, addr); err != nil { - panic(err) - } - return buf.Bytes() -} - -func decode(data []byte) *ip.Address { - addr := new(ip.Address) - buf := bytes.NewReader(data) - if err := struc.Unpack(buf, addr); err != nil { - panic(err) - } - log.Printf("decoded address: %#v", addr) - return addr -} - -func usageExample() { - var convAddr = func(ip string) { - addr, err := ipToAddress(ip) - if err != nil { - log.Printf("converting ip %q failed: %v", ip, err) - } - fmt.Printf("% 0X\n", addr) - } - - convAddr("10.10.10.10") - convAddr("::1") - convAddr("") -} - -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/examples/perf-bench/perf-bench.go b/examples/perf-bench/perf-bench.go new file mode 100644 index 0000000..24d3ebb --- /dev/null +++ b/examples/perf-bench/perf-bench.go @@ -0,0 +1,126 @@ +// Copyright (c) 2017 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. + +// Binary simple-client is an example VPP management application that exercises the +// govpp API on real-world use-cases. +package main + +import ( + "flag" + "fmt" + "log" + "time" + + "github.com/pkg/profile" + "github.com/sirupsen/logrus" + + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/core" + "git.fd.io/govpp.git/examples/bin_api/vpe" +) + +const ( + defaultSyncRequestCount = 1000 + defaultAsyncRequestCount = 10000 +) + +func main() { + // parse optional flags + var sync, prof bool + var cnt int + flag.BoolVar(&sync, "sync", false, "run synchronous perf test") + flag.IntVar(&cnt, "count", 0, "count of requests to be sent to VPP") + flag.BoolVar(&prof, "prof", false, "generate profile data") + flag.Parse() + + if cnt == 0 { + // no specific count defined - use defaults + if sync { + cnt = defaultSyncRequestCount + } else { + cnt = defaultAsyncRequestCount + } + } + + if prof { + defer profile.Start().Stop() + } + + // connect to VPP + conn, err := govpp.Connect("") + if err != nil { + log.Fatalln("Error:", err) + } + defer conn.Disconnect() + + // create an API channel + ch, err := conn.NewAPIChannelBuffered(cnt, cnt) + if err != nil { + log.Fatalln("Error:", err) + } + defer ch.Close() + + // log only errors + core.SetLogger(&logrus.Logger{Level: logrus.ErrorLevel}) + + // run the test & measure the time + start := time.Now() + + if sync { + // run synchronous test + syncTest(ch, cnt) + } else { + // run asynchronous test + asyncTest(ch, cnt) + } + + elapsed := time.Since(start) + fmt.Println("Test took:", elapsed) + fmt.Printf("Requests per second: %.0f\n", float64(cnt)/elapsed.Seconds()) +} + +func syncTest(ch api.Channel, cnt int) { + fmt.Printf("Running synchronous perf test with %d requests...\n", cnt) + + for i := 0; i < cnt; i++ { + req := &vpe.ControlPing{} + reply := &vpe.ControlPingReply{} + + if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { + log.Fatalln("Error in reply:", err) + } + } +} + +func asyncTest(ch api.Channel, cnt int) { + fmt.Printf("Running asynchronous perf test with %d requests...\n", cnt) + + ctxChan := make(chan api.RequestCtx, cnt) + + go func() { + for i := 0; i < cnt; i++ { + ctxChan <- ch.SendRequest(&vpe.ControlPing{}) + } + close(ctxChan) + fmt.Printf("Sending asynchronous requests finished\n") + }() + + for ctx := range ctxChan { + reply := &vpe.ControlPingReply{} + if err := ctx.ReceiveReply(reply); err != nil { + log.Fatalln("Error in reply:", err) + } + } +} diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go new file mode 100644 index 0000000..08d4da6 --- /dev/null +++ b/examples/simple-client/simple_client.go @@ -0,0 +1,271 @@ +// Copyright (c) 2017 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. + +// simple-client is an example VPP management application that exercises the +// govpp API on real-world use-cases. +package main + +import ( + "fmt" + "log" + "net" + "os" + "strings" + + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/examples/bin_api/acl" + "git.fd.io/govpp.git/examples/bin_api/interfaces" + "git.fd.io/govpp.git/examples/bin_api/ip" +) + +func main() { + fmt.Println("Starting simple VPP client...") + + // connect to VPP + conn, err := govpp.Connect("") + if err != nil { + log.Fatalln("ERROR:", err) + } + defer conn.Disconnect() + + // create an API channel that will be used in the examples + ch, err := conn.NewAPIChannel() + if err != nil { + log.Fatalln("ERROR:", err) + } + defer ch.Close() + + // individual examples + aclVersion(ch) + aclConfig(ch) + aclDump(ch) + + interfaceDump(ch) + ipAddressDump(ch) + + setIpUnnumbered(ch) + ipUnnumberedDump(ch) + + interfaceNotifications(ch) +} + +// aclVersion is the simplest API example - one empty request message and one reply message. +func aclVersion(ch api.Channel) { + fmt.Println("ACL getting version") + + req := &acl.ACLPluginGetVersion{} + reply := &acl.ACLPluginGetVersionReply{} + + if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { + fmt.Println("ERROR:", err) + } else { + fmt.Printf("ACL version reply: %+v\n", reply) + } +} + +// aclConfig is another simple API example - in this case, the request contains structured data. +func aclConfig(ch api.Channel) { + fmt.Println("ACL adding replace") + + req := &acl.ACLAddReplace{ + ACLIndex: ^uint32(0), + Tag: []byte("access list 1"), + R: []acl.ACLRule{ + { + IsPermit: 1, + SrcIPAddr: net.ParseIP("10.0.0.0").To4(), + SrcIPPrefixLen: 8, + DstIPAddr: net.ParseIP("192.168.1.0").To4(), + DstIPPrefixLen: 24, + Proto: 6, + }, + { + IsPermit: 1, + SrcIPAddr: net.ParseIP("8.8.8.8").To4(), + SrcIPPrefixLen: 32, + DstIPAddr: net.ParseIP("172.16.0.0").To4(), + DstIPPrefixLen: 16, + Proto: 6, + }, + }, + } + reply := &acl.ACLAddReplaceReply{} + + if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { + fmt.Println("ERROR:", err) + return + } + if reply.Retval != 0 { + fmt.Println("Retval:", reply.Retval) + return + } + + fmt.Printf("ACL add replace reply: %+v\n", reply) + +} + +// aclDump shows an example where SendRequest and ReceiveReply are not chained together. +func aclDump(ch api.Channel) { + fmt.Println("Dumping ACL") + + req := &acl.ACLDump{} + reply := &acl.ACLDetails{} + + reqCtx := ch.SendRequest(req) + + if err := reqCtx.ReceiveReply(reply); err != nil { + fmt.Println("ERROR:", err) + } else { + fmt.Printf("ACL details: %+v\n", reply) + } +} + +// interfaceDump shows an example of multipart request (multiple replies are expected). +func interfaceDump(ch api.Channel) { + fmt.Println("Dumping interfaces") + + reqCtx := ch.SendMultiRequest(&interfaces.SwInterfaceDump{}) + + for { + msg := &interfaces.SwInterfaceDetails{} + stop, err := reqCtx.ReceiveReply(msg) + if stop { + break + } + if err != nil { + fmt.Println("ERROR:", err) + } + ifaceName := strings.TrimFunc(string(msg.InterfaceName), func(r rune) bool { + return r == 0x00 + }) + fmt.Printf("Interface %q: %+v\n", ifaceName, msg) + } +} + +func ipAddressDump(ch api.Channel) { + fmt.Println("Dumping IP addresses") + + req := &ip.IPAddressDump{ + SwIfIndex: 1, //^uint32(0), + } + reqCtx := ch.SendMultiRequest(req) + + for { + msg := &ip.IPAddressDetails{} + stop, err := reqCtx.ReceiveReply(msg) + if stop { + break + } + if err != nil { + fmt.Println("ERROR:", err) + } + fmt.Printf("ip address details: %d %+v\n", msg.SwIfIndex, msg) + } +} + +// aclDump shows an example where SendRequest and ReceiveReply are not chained together. +func setIpUnnumbered(ch api.Channel) { + req := &interfaces.SwInterfaceSetUnnumbered{ + SwIfIndex: 1, + UnnumberedSwIfIndex: 2, + IsAdd: 1, + } + reply := &interfaces.SwInterfaceSetUnnumberedReply{} + + if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { + fmt.Println("ERROR:", err) + } else { + fmt.Printf("%+v\n", reply) + } +} + +func ipUnnumberedDump(ch api.Channel) { + fmt.Println("Dumping IP unnumbered") + + reqCtx := ch.SendMultiRequest(&ip.IPUnnumberedDump{ + SwIfIndex: ^uint32(0), + }) + + for { + msg := &ip.IPUnnumberedDetails{} + stop, err := reqCtx.ReceiveReply(msg) + if stop { + break + } + if err != nil { + fmt.Println("ERROR:", err) + } + fmt.Printf("IP unnumbered details: %+v\n", msg) + } +} + +// interfaceNotifications shows the usage of notification API. Note that for notifications, +// you are supposed to create your own Go channel with your preferred buffer size. If the channel's +// buffer is full, the notifications will not be delivered into it. +func interfaceNotifications(ch api.Channel) { + fmt.Println("Subscribing to notificaiton events") + + notifChan := make(chan api.Message, 100) + + // subscribe for specific notification message + sub, err := ch.SubscribeNotification(notifChan, &interfaces.SwInterfaceEvent{}) + if err != nil { + panic(err) + } + + // enable interface events in VPP + err = ch.SendRequest(&interfaces.WantInterfaceEvents{ + PID: uint32(os.Getpid()), + EnableDisable: 1, + }).ReceiveReply(&interfaces.WantInterfaceEventsReply{}) + if err != nil { + panic(err) + } + + // generate some events in VPP + err = ch.SendRequest(&interfaces.SwInterfaceSetFlags{ + SwIfIndex: 0, + AdminUpDown: 0, + }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) + if err != nil { + panic(err) + } + err = ch.SendRequest(&interfaces.SwInterfaceSetFlags{ + SwIfIndex: 0, + AdminUpDown: 1, + }).ReceiveReply(&interfaces.SwInterfaceSetFlagsReply{}) + if err != nil { + panic(err) + } + + // receive one notification + notif := (<-notifChan).(*interfaces.SwInterfaceEvent) + fmt.Printf("incoming event: %+v\n", notif) + + // disable interface events in VPP + err = ch.SendRequest(&interfaces.WantInterfaceEvents{ + PID: uint32(os.Getpid()), + EnableDisable: 0, + }).ReceiveReply(&interfaces.WantInterfaceEventsReply{}) + if err != nil { + panic(err) + } + + // unsubscribe from delivery of the notifications + err = sub.Unsubscribe() + if err != nil { + panic(err) + } +} diff --git a/examples/stats-api/README.md b/examples/stats-api/README.md new file mode 100644 index 0000000..0f26197 --- /dev/null +++ b/examples/stats-api/README.md @@ -0,0 +1,68 @@ +# Stats API Example + +This example demonstrates how to retrieve statistics from VPP using [the new Stats API](https://github.com/FDio/vpp/blob/master/src/vpp/stats/stats.md). + +## Requirements + +The following requirements are required to run this example: + +- install **VPP 18.10+** +- enable stats in VPP: + + ```sh + statseg { + default + } + ``` + > The [default socket](https://wiki.fd.io/view/VPP/Command-line_Arguments#.22statseg.22_parameters) is located at `/run/vpp/stats.sock`. +- run the VPP, ideally with some traffic + +## Running example + +First build the example: `go build git.fd.io/govpp.git/examples/stats-api`. + +Use commands `ls` and `dump` to list and dump statistics. Optionally, patterns can be used to filter the results. + +### List stats matching patterns `/sys/` and `/if/` +``` +$ ./stats-api ls /sys/ /if/ +Listing stats.. /sys/ /if/ + - /sys/vector_rate + - /sys/input_rate + - /sys/last_update + - /sys/last_stats_clear + - /sys/heartbeat + - /sys/node/clocks + - /sys/node/vectors + - /sys/node/calls + - /sys/node/suspends + - /if/drops + - /if/punt + - /if/ip4 + - /if/ip6 + - /if/rx-no-buf + - /if/rx-miss + - /if/rx-error + - /if/tx-error + - /if/rx + - /if/rx-unicast + - /if/rx-multicast + - /if/rx-broadcast + - /if/tx + - /if/tx-unicast-miss + - /if/tx-multicast + - /if/tx-broadcast +Listed 25 stats +``` + +### Dump all stats with their types and values +``` +$ ./stats-api dump +Dumping stats.. + - /sys/last_update ScalarIndex 10408 + - /sys/heartbeat ScalarIndex 1041 + - /err/ip4-icmp-error/unknown type ErrorIndex 5 + - /net/route/to CombinedCounterVector [[{Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:5 Bytes:420}]] + - /if/drops SimpleCounterVector [[0 5 5]] +Dumped 5 (2798) stats +``` diff --git a/examples/stats-api/stats_api.go b/examples/stats-api/stats_api.go new file mode 100644 index 0000000..6fd46d2 --- /dev/null +++ b/examples/stats-api/stats_api.go @@ -0,0 +1,140 @@ +// 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 main + +import ( + "flag" + "fmt" + "log" + "os" + "strings" + + "git.fd.io/govpp.git/adapter" + "git.fd.io/govpp.git/adapter/vppapiclient" +) + +// ------------------------------------------------------------------ +// Example - Stats API +// ------------------------------------------------------------------ +// The example stats_api demonstrates how to retrieve stats +// from the VPP using the new stats API. +// ------------------------------------------------------------------ + +var ( + statsSocket = flag.String("socket", vppapiclient.DefaultStatSocket, "VPP stats segment socket") + dumpAll = flag.Bool("all", false, "Dump all stats including ones with zero values") +) + +func init() { + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "%s: usage [ls|dump] ...\n", os.Args[0]) + flag.PrintDefaults() + os.Exit(1) + } +} + +func main() { + flag.Parse() + + cmd := flag.Arg(0) + + switch cmd { + case "", "ls", "dump": + default: + flag.Usage() + } + + var patterns []string + if flag.NArg() > 0 { + patterns = flag.Args()[1:] + } + + client := vppapiclient.NewStatClient(*statsSocket) + + fmt.Printf("Connecting to stats socket: %s\n", *statsSocket) + + if err := client.Connect(); err != nil { + log.Fatalln("Connecting failed:", err) + } + defer client.Disconnect() + + switch cmd { + case "dump": + dumpStats(client, patterns, !*dumpAll) + default: + listStats(client, patterns) + } +} + +func listStats(client adapter.StatsAPI, patterns []string) { + fmt.Printf("Listing stats.. %s\n", strings.Join(patterns, " ")) + + list, err := client.ListStats(patterns...) + if err != nil { + log.Fatalln("listing stats failed:", err) + } + + for _, stat := range list { + fmt.Printf(" - %v\n", stat) + } + + fmt.Printf("Listed %d stats\n", len(list)) +} + +func dumpStats(client adapter.StatsAPI, patterns []string, skipZeros bool) { + fmt.Printf("Dumping stats.. %s\n", strings.Join(patterns, " ")) + + stats, err := client.DumpStats(patterns...) + if err != nil { + log.Fatalln("dumping stats failed:", err) + } + + n := 0 + for _, stat := range stats { + if isZero(stat.Data) && skipZeros { + continue + } + fmt.Printf(" - %-25s %25v %+v\n", stat.Name, stat.Type, stat.Data) + n++ + } + + fmt.Printf("Dumped %d (%d) stats\n", n, len(stats)) +} + +func isZero(stat adapter.Stat) bool { + switch s := stat.(type) { + case adapter.ScalarStat: + return s == 0 + case adapter.ErrorStat: + return s == 0 + case adapter.SimpleCounterStat: + for _, ss := range s { + for _, sss := range ss { + if sss != 0 { + return false + } + } + } + case adapter.CombinedCounterStat: + for _, ss := range s { + for _, sss := range ss { + if sss.Bytes != 0 || sss.Packets != 0 { + return false + } + } + } + } + return true +} diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go new file mode 100644 index 0000000..d4563c6 --- /dev/null +++ b/examples/union-example/union_example.go @@ -0,0 +1,103 @@ +// 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. + +// union-example is an example to show how to use unions in VPP binary API. +package main + +import ( + "bytes" + "fmt" + "log" + "net" + + "git.fd.io/govpp.git/examples/bin_api/ip" + "github.com/lunixbochs/struc" +) + +func main() { + encodingExample() + usageExample() +} + +func encodingExample() { + // create union with IPv4 address + var unionIP4 ip.AddressUnion + unionIP4.SetIP4(ip.IP4Address{192, 168, 1, 10}) + + // use it in the Address type + addr := &ip.Address{ + Af: ip.ADDRESS_IP4, + Un: ip.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10}), + } + log.Printf("encoding union IPv4: %v", addr.Un.GetIP4()) + + // encode the address with union + data := encode(addr) + // decode the address with union + addr2 := decode(data) + + log.Printf("decoded union IPv4: %v", addr2.Un.GetIP4()) +} + +func encode(addr *ip.Address) []byte { + log.Printf("encoding address: %#v", addr) + buf := new(bytes.Buffer) + if err := struc.Pack(buf, addr); err != nil { + panic(err) + } + return buf.Bytes() +} + +func decode(data []byte) *ip.Address { + addr := new(ip.Address) + buf := bytes.NewReader(data) + if err := struc.Unpack(buf, addr); err != nil { + panic(err) + } + log.Printf("decoded address: %#v", addr) + return addr +} + +func usageExample() { + var convAddr = func(ip string) { + addr, err := ipToAddress(ip) + if err != nil { + log.Printf("converting ip %q failed: %v", ip, err) + } + fmt.Printf("% 0X\n", addr) + } + + convAddr("10.10.10.10") + convAddr("::1") + convAddr("") +} + +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 +} -- cgit 1.2.3-korg