diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/lb')
-rw-r--r-- | internal/testbinapi/binapi2001/lb/lb.ba.go | 43 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/lb/lb_rpc.ba.go | 25 |
2 files changed, 54 insertions, 14 deletions
diff --git a/internal/testbinapi/binapi2001/lb/lb.ba.go b/internal/testbinapi/binapi2001/lb/lb.ba.go index 348a150..12536bb 100644 --- a/internal/testbinapi/binapi2001/lb/lb.ba.go +++ b/internal/testbinapi/binapi2001/lb/lb.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/lb.api.json @@ -17,11 +17,12 @@ package lb 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 @@ -675,12 +676,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 { @@ -709,12 +713,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 { @@ -743,12 +750,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 { @@ -772,6 +782,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 @@ -784,8 +798,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() @@ -795,12 +810,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 { @@ -843,18 +861,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 { @@ -897,18 +919,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 { @@ -966,6 +992,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 { @@ -976,13 +1003,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 { @@ -1000,8 +1030,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/lb/lb_rpc.ba.go b/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go index 3375e9c..43c0c4b 100644 --- a/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go +++ b/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go @@ -5,12 +5,13 @@ package lb 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 lb. +// RPCService defines RPC service lb. type RPCService interface { LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) @@ -36,7 +37,7 @@ func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) { @@ -45,7 +46,7 @@ func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) { @@ -54,7 +55,7 @@ func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) { @@ -63,7 +64,7 @@ func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) { @@ -99,6 +100,10 @@ func (c *serviceClient_LbAsDumpClient) Recv() (*LbAsDetails, error) { case *LbAsDetails: 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) @@ -111,7 +116,7 @@ func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, e if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) { @@ -120,7 +125,7 @@ func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlus if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) { @@ -156,6 +161,10 @@ func (c *serviceClient_LbVipDumpClient) Recv() (*LbVipDetails, error) { case *LbVipDetails: 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) |