From d1f24d37bd447b64e402298bb8eb2479681facf9 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 17 Jul 2020 10:36:28 +0200 Subject: Improve binapi generator - simplified Size/Marshal/Unmarshal methods - replace struc in unions with custom marshal/unmarshal - fix imports in generated files - fix mock adapter - generate rpc service using low-level stream API (dumps generate control ping or stream msg..) - move examples/binapi to binapi and generate all API for latest release - add binapigen.Plugin for developing custom generator plugins - optionally generate HTTP handlers (REST API) for RPC services - add govpp program for browsing VPP API Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b Signed-off-by: Ondrej Fabry --- examples/binapi/fib_types/fib_types.ba.go | 255 ------------------------------ 1 file changed, 255 deletions(-) delete mode 100644 examples/binapi/fib_types/fib_types.ba.go (limited to 'examples/binapi/fib_types/fib_types.ba.go') diff --git a/examples/binapi/fib_types/fib_types.ba.go b/examples/binapi/fib_types/fib_types.ba.go deleted file mode 100644 index 9050e85..0000000 --- a/examples/binapi/fib_types/fib_types.ba.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/fib_types.api.json - -/* -Package fib_types contains generated code for VPP API file fib_types.api (2.0.0). - -It consists of: - 5 aliases - 7 enums - 9 types - 1 union -*/ -package fib_types - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "fib_types" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xd6a5938 -) - -type AddressFamily = ip_types.AddressFamily - -// FibPathFlags represents VPP binary API enum 'fib_path_flags'. -type FibPathFlags uint32 - -const ( - FIB_API_PATH_FLAG_NONE FibPathFlags = 0 - FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 - FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 - FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 -) - -var ( - FibPathFlags_name = map[uint32]string{ - 0: "FIB_API_PATH_FLAG_NONE", - 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", - 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", - 4: "FIB_API_PATH_FLAG_POP_PW_CW", - } - FibPathFlags_value = map[string]uint32{ - "FIB_API_PATH_FLAG_NONE": 0, - "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, - "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, - "FIB_API_PATH_FLAG_POP_PW_CW": 4, - } -) - -func (x FibPathFlags) String() string { - s, ok := FibPathFlags_name[uint32(x)] - if ok { - return s - } - return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. -type FibPathNhProto uint32 - -const ( - FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 - FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 - FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 - FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 - FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 -) - -var ( - FibPathNhProto_name = map[uint32]string{ - 0: "FIB_API_PATH_NH_PROTO_IP4", - 1: "FIB_API_PATH_NH_PROTO_IP6", - 2: "FIB_API_PATH_NH_PROTO_MPLS", - 3: "FIB_API_PATH_NH_PROTO_ETHERNET", - 4: "FIB_API_PATH_NH_PROTO_BIER", - } - FibPathNhProto_value = map[string]uint32{ - "FIB_API_PATH_NH_PROTO_IP4": 0, - "FIB_API_PATH_NH_PROTO_IP6": 1, - "FIB_API_PATH_NH_PROTO_MPLS": 2, - "FIB_API_PATH_NH_PROTO_ETHERNET": 3, - "FIB_API_PATH_NH_PROTO_BIER": 4, - } -) - -func (x FibPathNhProto) String() string { - s, ok := FibPathNhProto_name[uint32(x)] - if ok { - return s - } - return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathType represents VPP binary API enum 'fib_path_type'. -type FibPathType uint32 - -const ( - FIB_API_PATH_TYPE_NORMAL FibPathType = 0 - FIB_API_PATH_TYPE_LOCAL FibPathType = 1 - FIB_API_PATH_TYPE_DROP FibPathType = 2 - FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 - FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 - FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 - FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 - FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 - FIB_API_PATH_TYPE_DVR FibPathType = 8 - FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 - FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 -) - -var ( - FibPathType_name = map[uint32]string{ - 0: "FIB_API_PATH_TYPE_NORMAL", - 1: "FIB_API_PATH_TYPE_LOCAL", - 2: "FIB_API_PATH_TYPE_DROP", - 3: "FIB_API_PATH_TYPE_UDP_ENCAP", - 4: "FIB_API_PATH_TYPE_BIER_IMP", - 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", - 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", - 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", - 8: "FIB_API_PATH_TYPE_DVR", - 9: "FIB_API_PATH_TYPE_INTERFACE_RX", - 10: "FIB_API_PATH_TYPE_CLASSIFY", - } - FibPathType_value = map[string]uint32{ - "FIB_API_PATH_TYPE_NORMAL": 0, - "FIB_API_PATH_TYPE_LOCAL": 1, - "FIB_API_PATH_TYPE_DROP": 2, - "FIB_API_PATH_TYPE_UDP_ENCAP": 3, - "FIB_API_PATH_TYPE_BIER_IMP": 4, - "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, - "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, - "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, - "FIB_API_PATH_TYPE_DVR": 8, - "FIB_API_PATH_TYPE_INTERFACE_RX": 9, - "FIB_API_PATH_TYPE_CLASSIFY": 10, - } -) - -func (x FibPathType) String() string { - s, ok := FibPathType_name[uint32(x)] - if ok { - return s - } - return "FibPathType(" + strconv.Itoa(int(x)) + ")" -} - -type IPDscp = ip_types.IPDscp - -type IPEcn = ip_types.IPEcn - -type IPProto = ip_types.IPProto - -type AddressWithPrefix = ip_types.AddressWithPrefix - -type IP4Address = ip_types.IP4Address - -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix - -type IP6Address = ip_types.IP6Address - -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix - -type Address = ip_types.Address - -// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. -type FibMplsLabel struct { - IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` - Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` - TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` - Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` -} - -func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } - -// FibPath represents VPP binary API type 'fib_path'. -type FibPath struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` - Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` - Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` - Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` - NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` - LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` -} - -func (*FibPath) GetTypeName() string { return "fib_path" } - -// FibPathNh represents VPP binary API type 'fib_path_nh'. -type FibPathNh struct { - Address ip_types.AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` - ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` - ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` - ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` -} - -func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } - -type IP4Prefix = ip_types.IP4Prefix - -type IP6Prefix = ip_types.IP6Prefix - -type Mprefix = ip_types.Mprefix - -type Prefix = ip_types.Prefix - -type PrefixMatcher = ip_types.PrefixMatcher - -type AddressUnion = ip_types.AddressUnion - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf -- cgit 1.2.3-korg