diff options
author | 2022-04-27 18:39:03 +0200 | |
---|---|---|
committer | 2022-05-30 18:49:13 +0200 | |
commit | 4102c72bce694babd94a481b1201d33895a6f9c5 (patch) | |
tree | 1b11238ca4706008c88712f26942dd74ab9c14a6 /internal/testbinapi/binapi2001/gbp | |
parent | a4112fac7b86fe09650d2bb57969fe46404edd7d (diff) |
Update generated binapi to v22.02 & makefile changes
This patch does some small updates to the Makefile.
* `make gen-binapi-from-code` is removed, and moves to
`gen-binapi-local`
* `make build` is patched to build cmd & examples
* `make binapi-generator` to build the api-generator
without other binaries, as they typically require its
output to build.
* `make gen-binapi-local` runs the locally built binapi-generator
to update the local bindings. It expects ${VPP_DIR} to be set and
to point to a local vpp repository checked out with the right version
* `make gen-binapi-internal` runs the locally built binapi-generator
to update the bindings in `internal/testbinapi/binapi2001`
Regarding VPP, notable changes when moving to v22.02 are :
- ControlPing moved from vpe to memclnt
- CliInband went from vpe to vlib
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Change-Id: Ie5cd2d5ded7ecaffd9abc3ca675df40be272b1fa
Diffstat (limited to 'internal/testbinapi/binapi2001/gbp')
-rw-r--r-- | internal/testbinapi/binapi2001/gbp/gbp.ba.go | 47 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/gbp/gbp_rpc.ba.go | 69 |
2 files changed, 94 insertions, 22 deletions
diff --git a/internal/testbinapi/binapi2001/gbp/gbp.ba.go b/internal/testbinapi/binapi2001/gbp/gbp.ba.go index 1f00396..27df8b5 100644 --- a/internal/testbinapi/binapi2001/gbp/gbp.ba.go +++ b/internal/testbinapi/binapi2001/gbp/gbp.ba.go @@ -1,6 +1,6 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev +// binapi-generator: v0.5.0-dev // VPP: 20.01 // source: .vppapi/plugins/gbp.api.json @@ -17,11 +17,12 @@ package gbp import ( "fmt" - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" "net" "strconv" "strings" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -777,12 +778,15 @@ func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) { } return AddressWithPrefix(prefix), nil } + func (x AddressWithPrefix) String() string { return Prefix(x).String() } + func (x *AddressWithPrefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *AddressWithPrefix) UnmarshalText(text []byte) error { prefix, err := ParseAddressWithPrefix(string(text)) if err != nil { @@ -814,12 +818,15 @@ func ParseIP4Address(s string) (IP4Address, error) { func (x IP4Address) ToIP() net.IP { return net.IP(x[:]).To4() } + func (x IP4Address) String() string { return x.ToIP().String() } + func (x *IP4Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP4Address) UnmarshalText(text []byte) error { ipaddr, err := ParseIP4Address(string(text)) if err != nil { @@ -848,12 +855,15 @@ func ParseIP6Address(s string) (IP6Address, error) { func (x IP6Address) ToIP() net.IP { return net.IP(x[:]).To16() } + func (x IP6Address) String() string { return x.ToIP().String() } + func (x *IP6Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP6Address) UnmarshalText(text []byte) error { ipaddr, err := ParseIP6Address(string(text)) if err != nil { @@ -878,15 +888,19 @@ func ParseMacAddress(s string) (MacAddress, error) { copy(macaddr[:], mac[:]) return macaddr, nil } + func (x MacAddress) ToMAC() net.HardwareAddr { return net.HardwareAddr(x[:]) } + func (x MacAddress) String() string { return x.ToMAC().String() } + func (x *MacAddress) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *MacAddress) UnmarshalText(text []byte) error { mac, err := ParseMacAddress(string(text)) if err != nil { @@ -907,6 +921,10 @@ func ParseAddress(s string) (Address, error) { if ip == nil { return Address{}, fmt.Errorf("invalid address: %s", s) } + return AddressFromIP(ip), nil +} + +func AddressFromIP(ip net.IP) Address { var addr Address if ip.To4() == nil { addr.Af = ADDRESS_IP6 @@ -919,8 +937,9 @@ func ParseAddress(s string) (Address, error) { copy(ip4[:], ip.To4()) addr.Un.SetIP4(ip4) } - return addr, nil + return addr } + func (x Address) ToIP() net.IP { if x.Af == ADDRESS_IP6 { ip6 := x.Un.GetIP6() @@ -930,12 +949,15 @@ func (x Address) ToIP() net.IP { return net.IP(ip4[:]).To4() } } + func (x Address) String() string { return x.ToIP().String() } + func (x *Address) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *Address) UnmarshalText(text []byte) error { addr, err := ParseAddress(string(text)) if err != nil { @@ -1095,18 +1117,22 @@ func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { } return prefix, nil } + func (x IP4Prefix) ToIPNet() *net.IPNet { mask := net.CIDRMask(int(x.Len), 32) ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x IP4Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *IP4Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP4Prefix) UnmarshalText(text []byte) error { prefix, err := ParseIP4Prefix(string(text)) if err != nil { @@ -1149,18 +1175,22 @@ func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { } return prefix, nil } + func (x IP6Prefix) ToIPNet() *net.IPNet { mask := net.CIDRMask(int(x.Len), 128) ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x IP6Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *IP6Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *IP6Prefix) UnmarshalText(text []byte) error { prefix, err := ParseIP6Prefix(string(text)) if err != nil { @@ -1211,6 +1241,7 @@ func ParsePrefix(ip string) (prefix Prefix, err error) { } return prefix, nil } + func (x Prefix) ToIPNet() *net.IPNet { var mask net.IPMask if x.Address.Af == ADDRESS_IP4 { @@ -1221,13 +1252,16 @@ func (x Prefix) ToIPNet() *net.IPNet { ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} return ipnet } + func (x Prefix) String() string { ip := x.Address.String() return ip + "/" + strconv.Itoa(int(x.Len)) } + func (x *Prefix) MarshalText() ([]byte, error) { return []byte(x.String()), nil } + func (x *Prefix) UnmarshalText(text []byte) error { prefix, err := ParsePrefix(string(text)) if err != nil { @@ -1245,8 +1279,9 @@ type PrefixMatcher struct { // AddressUnion defines union 'address_union'. type AddressUnion struct { - // IP4 *IP4Address - // IP6 *IP6Address + // AddressUnion can be one of: + // - IP4 *IP4Address + // - IP6 *IP6Address XXX_UnionData [16]byte } diff --git a/internal/testbinapi/binapi2001/gbp/gbp_rpc.ba.go b/internal/testbinapi/binapi2001/gbp/gbp_rpc.ba.go index bad1f79..cd62e3a 100644 --- a/internal/testbinapi/binapi2001/gbp/gbp_rpc.ba.go +++ b/internal/testbinapi/binapi2001/gbp/gbp_rpc.ba.go @@ -5,12 +5,13 @@ package gbp import ( "context" "fmt" + "io" + api "git.fd.io/govpp.git/api" vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" - "io" ) -// RPCService defines RPC service gbp. +// RPCService defines RPC service gbp. type RPCService interface { GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) @@ -51,7 +52,7 @@ func (c *serviceClient) GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDom if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) { @@ -60,7 +61,7 @@ func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDom if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) { @@ -96,6 +97,10 @@ func (c *serviceClient_GbpBridgeDomainDumpClient) Recv() (*GbpBridgeDomainDetail case *GbpBridgeDomainDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -108,7 +113,7 @@ func (c *serviceClient) GbpContractAddDel(ctx context.Context, in *GbpContractAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) { @@ -144,6 +149,10 @@ func (c *serviceClient_GbpContractDumpClient) Recv() (*GbpContractDetails, error case *GbpContractDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -156,7 +165,7 @@ func (c *serviceClient) GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) { @@ -165,7 +174,7 @@ func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) { @@ -201,6 +210,10 @@ func (c *serviceClient_GbpEndpointDumpClient) Recv() (*GbpEndpointDetails, error case *GbpEndpointDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -213,7 +226,7 @@ func (c *serviceClient) GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpoint if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) { @@ -222,7 +235,7 @@ func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpoint if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) { @@ -258,6 +271,10 @@ func (c *serviceClient_GbpEndpointGroupDumpClient) Recv() (*GbpEndpointGroupDeta case *GbpEndpointGroupDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -270,7 +287,7 @@ func (c *serviceClient) GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) { @@ -306,6 +323,10 @@ func (c *serviceClient_GbpExtItfDumpClient) Recv() (*GbpExtItfDetails, error) { case *GbpExtItfDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -318,7 +339,7 @@ func (c *serviceClient) GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) { @@ -354,6 +375,10 @@ func (c *serviceClient_GbpRecircDumpClient) Recv() (*GbpRecircDetails, error) { case *GbpRecircDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -366,7 +391,7 @@ func (c *serviceClient) GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) { @@ -375,7 +400,7 @@ func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) { @@ -411,6 +436,10 @@ func (c *serviceClient_GbpRouteDomainDumpClient) Recv() (*GbpRouteDomainDetails, case *GbpRouteDomainDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -423,7 +452,7 @@ func (c *serviceClient) GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) { @@ -459,6 +488,10 @@ func (c *serviceClient_GbpSubnetDumpClient) Recv() (*GbpSubnetDetails, error) { case *GbpSubnetDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) @@ -471,7 +504,7 @@ func (c *serviceClient) GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) { @@ -480,7 +513,7 @@ func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) { @@ -516,6 +549,10 @@ func (c *serviceClient_GbpVxlanTunnelDumpClient) Recv() (*GbpVxlanTunnelDetails, case *GbpVxlanTunnelDetails: return m, nil case *vpe.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) |