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 --- binapi/vxlan_gbp/vxlan_gbp.ba.go | 385 ++++++++++++++++++++++++++++++++++ binapi/vxlan_gbp/vxlan_gbp_rest.ba.go | 60 ++++++ binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go | 83 ++++++++ 3 files changed, 528 insertions(+) create mode 100644 binapi/vxlan_gbp/vxlan_gbp.ba.go create mode 100644 binapi/vxlan_gbp/vxlan_gbp_rest.ba.go create mode 100644 binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go (limited to 'binapi/vxlan_gbp') diff --git a/binapi/vxlan_gbp/vxlan_gbp.ba.go b/binapi/vxlan_gbp/vxlan_gbp.ba.go new file mode 100644 index 0000000..d5c3f32 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp.ba.go @@ -0,0 +1,385 @@ +// 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/vxlan_gbp.api.json + +// Package vxlan_gbp contains generated bindings for API file vxlan_gbp.api. +// +// Contents: +// 1 enum +// 1 struct +// 6 messages +// +package vxlan_gbp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// 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 + +const ( + APIFile = "vxlan_gbp" + APIVersion = "1.1.1" + VersionCrc = 0xfa8aff54 +) + +// VxlanGbpAPITunnelMode defines enum 'vxlan_gbp_api_tunnel_mode'. +type VxlanGbpAPITunnelMode uint32 + +const ( + VXLAN_GBP_API_TUNNEL_MODE_L2 VxlanGbpAPITunnelMode = 1 + VXLAN_GBP_API_TUNNEL_MODE_L3 VxlanGbpAPITunnelMode = 2 +) + +var ( + VxlanGbpAPITunnelMode_name = map[uint32]string{ + 1: "VXLAN_GBP_API_TUNNEL_MODE_L2", + 2: "VXLAN_GBP_API_TUNNEL_MODE_L3", + } + VxlanGbpAPITunnelMode_value = map[string]uint32{ + "VXLAN_GBP_API_TUNNEL_MODE_L2": 1, + "VXLAN_GBP_API_TUNNEL_MODE_L3": 2, + } +) + +func (x VxlanGbpAPITunnelMode) String() string { + s, ok := VxlanGbpAPITunnelMode_name[uint32(x)] + if ok { + return s + } + return "VxlanGbpAPITunnelMode(" + strconv.Itoa(int(x)) + ")" +} + +// VxlanGbpTunnel defines type 'vxlan_gbp_tunnel'. +type VxlanGbpTunnel struct { + Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"` + Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"` + Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"` + McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"` + EncapTableID uint32 `binapi:"u32,name=encap_table_id" json:"encap_table_id,omitempty"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mode VxlanGbpAPITunnelMode `binapi:"vxlan_gbp_api_tunnel_mode,name=mode" json:"mode,omitempty"` +} + +// SwInterfaceSetVxlanGbpBypass defines message 'sw_interface_set_vxlan_gbp_bypass'. +type SwInterfaceSetVxlanGbpBypass struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetVxlanGbpBypass) Reset() { *m = SwInterfaceSetVxlanGbpBypass{} } +func (*SwInterfaceSetVxlanGbpBypass) GetMessageName() string { + return "sw_interface_set_vxlan_gbp_bypass" +} +func (*SwInterfaceSetVxlanGbpBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetVxlanGbpBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetVxlanGbpBypass) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetVxlanGbpBypass) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGbpBypass) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetVxlanGbpBypassReply defines message 'sw_interface_set_vxlan_gbp_bypass_reply'. +type SwInterfaceSetVxlanGbpBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetVxlanGbpBypassReply) Reset() { *m = SwInterfaceSetVxlanGbpBypassReply{} } +func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageName() string { + return "sw_interface_set_vxlan_gbp_bypass_reply" +} +func (*SwInterfaceSetVxlanGbpBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetVxlanGbpBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetVxlanGbpBypassReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetVxlanGbpBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelAddDel defines message 'vxlan_gbp_tunnel_add_del'. +type VxlanGbpTunnelAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *VxlanGbpTunnelAddDel) Reset() { *m = VxlanGbpTunnelAddDel{} } +func (*VxlanGbpTunnelAddDel) GetMessageName() string { return "vxlan_gbp_tunnel_add_del" } +func (*VxlanGbpTunnelAddDel) GetCrcString() string { return "8c819166" } +func (*VxlanGbpTunnelAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGbpTunnelAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.McastSwIfIndex + size += 4 // m.Tunnel.EncapTableID + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.Mode + return size +} +func (m *VxlanGbpTunnelAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.EncapTableID)) + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.EncapTableID = buf.DecodeUint32() + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelAddDelReply defines message 'vxlan_gbp_tunnel_add_del_reply'. +type VxlanGbpTunnelAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGbpTunnelAddDelReply) Reset() { *m = VxlanGbpTunnelAddDelReply{} } +func (*VxlanGbpTunnelAddDelReply) GetMessageName() string { return "vxlan_gbp_tunnel_add_del_reply" } +func (*VxlanGbpTunnelAddDelReply) GetCrcString() string { return "5383d31f" } +func (*VxlanGbpTunnelAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGbpTunnelAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGbpTunnelAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelDetails defines message 'vxlan_gbp_tunnel_details'. +type VxlanGbpTunnelDetails struct { + Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *VxlanGbpTunnelDetails) Reset() { *m = VxlanGbpTunnelDetails{} } +func (*VxlanGbpTunnelDetails) GetMessageName() string { return "vxlan_gbp_tunnel_details" } +func (*VxlanGbpTunnelDetails) GetCrcString() string { return "1da24016" } +func (*VxlanGbpTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *VxlanGbpTunnelDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Tunnel.Instance + size += 1 // m.Tunnel.Src.Af + size += 1 * 16 // m.Tunnel.Src.Un + size += 1 // m.Tunnel.Dst.Af + size += 1 * 16 // m.Tunnel.Dst.Un + size += 4 // m.Tunnel.McastSwIfIndex + size += 4 // m.Tunnel.EncapTableID + size += 4 // m.Tunnel.Vni + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.Mode + return size +} +func (m *VxlanGbpTunnelDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Tunnel.Instance)) + buf.EncodeUint8(uint8(m.Tunnel.Src.Af)) + buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Tunnel.Dst.Af)) + buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.EncapTableID)) + buf.EncodeUint32(uint32(m.Tunnel.Vni)) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(uint32(m.Tunnel.Mode)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.Instance = buf.DecodeUint32() + m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.EncapTableID = buf.DecodeUint32() + m.Tunnel.Vni = buf.DecodeUint32() + m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32()) + return nil +} + +// VxlanGbpTunnelDump defines message 'vxlan_gbp_tunnel_dump'. +type VxlanGbpTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *VxlanGbpTunnelDump) Reset() { *m = VxlanGbpTunnelDump{} } +func (*VxlanGbpTunnelDump) GetMessageName() string { return "vxlan_gbp_tunnel_dump" } +func (*VxlanGbpTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*VxlanGbpTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *VxlanGbpTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *VxlanGbpTunnelDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *VxlanGbpTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_vxlan_gbp_binapi_init() } +func file_vxlan_gbp_binapi_init() { + api.RegisterMessage((*SwInterfaceSetVxlanGbpBypass)(nil), "sw_interface_set_vxlan_gbp_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetVxlanGbpBypassReply)(nil), "sw_interface_set_vxlan_gbp_bypass_reply_e8d4e804") + api.RegisterMessage((*VxlanGbpTunnelAddDel)(nil), "vxlan_gbp_tunnel_add_del_8c819166") + api.RegisterMessage((*VxlanGbpTunnelAddDelReply)(nil), "vxlan_gbp_tunnel_add_del_reply_5383d31f") + api.RegisterMessage((*VxlanGbpTunnelDetails)(nil), "vxlan_gbp_tunnel_details_1da24016") + api.RegisterMessage((*VxlanGbpTunnelDump)(nil), "vxlan_gbp_tunnel_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SwInterfaceSetVxlanGbpBypass)(nil), + (*SwInterfaceSetVxlanGbpBypassReply)(nil), + (*VxlanGbpTunnelAddDel)(nil), + (*VxlanGbpTunnelAddDelReply)(nil), + (*VxlanGbpTunnelDetails)(nil), + (*VxlanGbpTunnelDump)(nil), + } +} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go new file mode 100644 index 0000000..5d94785 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gbp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/sw_interface_set_vxlan_gbp_bypass", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetVxlanGbpBypass) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetVxlanGbpBypass(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/vxlan_gbp_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGbpTunnelAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.VxlanGbpTunnelAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go new file mode 100644 index 0000000..7d23984 --- /dev/null +++ b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vxlan_gbp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service vxlan_gbp. +type RPCService interface { + SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) + VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) + VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) { + out := new(SwInterfaceSetVxlanGbpBypassReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) { + out := new(VxlanGbpTunnelAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_VxlanGbpTunnelDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_VxlanGbpTunnelDumpClient interface { + Recv() (*VxlanGbpTunnelDetails, error) + api.Stream +} + +type serviceClient_VxlanGbpTunnelDumpClient struct { + api.Stream +} + +func (c *serviceClient_VxlanGbpTunnelDumpClient) Recv() (*VxlanGbpTunnelDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *VxlanGbpTunnelDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} -- cgit 1.2.3-korg