diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/dhcp')
-rw-r--r-- | internal/testbinapi/binapi2001/dhcp/dhcp.ba.go | 47 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go | 33 |
2 files changed, 62 insertions, 18 deletions
diff --git a/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go b/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go index f75e7ed..a84d4da 100644 --- a/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go +++ b/internal/testbinapi/binapi2001/dhcp/dhcp.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/dhcp.api.json @@ -17,11 +17,12 @@ package dhcp 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 @@ -621,12 +622,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 { @@ -655,12 +659,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 { @@ -689,12 +696,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 { @@ -719,15 +729,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 { @@ -748,6 +762,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 @@ -760,8 +778,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() @@ -771,12 +790,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 { @@ -869,18 +891,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 { @@ -923,18 +949,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 { @@ -985,6 +1015,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 { @@ -995,13 +1026,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 { @@ -1019,8 +1053,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/dhcp/dhcp_rpc.ba.go b/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go index ae59820..25918a0 100644 --- a/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go +++ b/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go @@ -5,12 +5,13 @@ package dhcp 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 dhcp. +// RPCService defines RPC service dhcp. type RPCService interface { DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) @@ -41,7 +42,7 @@ func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { @@ -50,7 +51,7 @@ func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { @@ -59,7 +60,7 @@ func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6P if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { @@ -68,7 +69,7 @@ func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6Sen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { @@ -77,7 +78,7 @@ func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) { @@ -113,6 +114,10 @@ func (c *serviceClient_DHCPClientDumpClient) Recv() (*DHCPClientDetails, error) case *DHCPClientDetails: 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) @@ -125,7 +130,7 @@ func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPlugi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) { @@ -143,7 +148,7 @@ func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) { @@ -179,6 +184,10 @@ func (c *serviceClient_DHCPProxyDumpClient) Recv() (*DHCPProxyDetails, error) { case *DHCPProxyDetails: 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) @@ -191,7 +200,7 @@ func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { @@ -200,7 +209,7 @@ func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { @@ -209,5 +218,5 @@ func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6R if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } |