summaryrefslogtreecommitdiffstats
path: root/binapi/gtpu
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-07-17 10:36:28 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-07-17 11:43:41 +0200
commitd1f24d37bd447b64e402298bb8eb2479681facf9 (patch)
treea3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /binapi/gtpu
parent1548c7e12531e3d055567d761c580a1c7ff0ac40 (diff)
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 <ofabry@cisco.com>
Diffstat (limited to 'binapi/gtpu')
-rw-r--r--binapi/gtpu/gtpu.ba.go427
-rw-r--r--binapi/gtpu/gtpu_rest.ba.go83
-rw-r--r--binapi/gtpu/gtpu_rpc.ba.go93
3 files changed, 603 insertions, 0 deletions
diff --git a/binapi/gtpu/gtpu.ba.go b/binapi/gtpu/gtpu.ba.go
new file mode 100644
index 0000000..02903a9
--- /dev/null
+++ b/binapi/gtpu/gtpu.ba.go
@@ -0,0 +1,427 @@
+// 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/plugins/gtpu.api.json
+
+// Package gtpu contains generated bindings for API file gtpu.api.
+//
+// Contents:
+// 8 messages
+//
+package gtpu
+
+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"
+)
+
+// 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 = "gtpu"
+ APIVersion = "2.0.0"
+ VersionCrc = 0x30326e2d
+)
+
+// GtpuAddDelTunnel defines message 'gtpu_add_del_tunnel'.
+type GtpuAddDelTunnel struct {
+ IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
+ SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"`
+ DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"`
+ McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"`
+ EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
+ DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"`
+ Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"`
+}
+
+func (m *GtpuAddDelTunnel) Reset() { *m = GtpuAddDelTunnel{} }
+func (*GtpuAddDelTunnel) GetMessageName() string { return "gtpu_add_del_tunnel" }
+func (*GtpuAddDelTunnel) GetCrcString() string { return "9a26a51c" }
+func (*GtpuAddDelTunnel) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *GtpuAddDelTunnel) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 1 // m.IsAdd
+ size += 1 // m.SrcAddress.Af
+ size += 1 * 16 // m.SrcAddress.Un
+ size += 1 // m.DstAddress.Af
+ size += 1 * 16 // m.DstAddress.Un
+ size += 4 // m.McastSwIfIndex
+ size += 4 // m.EncapVrfID
+ size += 4 // m.DecapNextIndex
+ size += 4 // m.Teid
+ return size
+}
+func (m *GtpuAddDelTunnel) 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.EncodeUint8(uint8(m.SrcAddress.Af))
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeUint8(uint8(m.DstAddress.Af))
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeUint32(uint32(m.McastSwIfIndex))
+ buf.EncodeUint32(uint32(m.EncapVrfID))
+ buf.EncodeUint32(uint32(m.DecapNextIndex))
+ buf.EncodeUint32(uint32(m.Teid))
+ return buf.Bytes(), nil
+}
+func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.IsAdd = buf.DecodeBool()
+ m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ m.EncapVrfID = buf.DecodeUint32()
+ m.DecapNextIndex = buf.DecodeUint32()
+ m.Teid = buf.DecodeUint32()
+ return nil
+}
+
+// GtpuAddDelTunnelReply defines message 'gtpu_add_del_tunnel_reply'.
+type GtpuAddDelTunnelReply 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 *GtpuAddDelTunnelReply) Reset() { *m = GtpuAddDelTunnelReply{} }
+func (*GtpuAddDelTunnelReply) GetMessageName() string { return "gtpu_add_del_tunnel_reply" }
+func (*GtpuAddDelTunnelReply) GetCrcString() string { return "5383d31f" }
+func (*GtpuAddDelTunnelReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *GtpuAddDelTunnelReply) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.Retval
+ size += 4 // m.SwIfIndex
+ return size
+}
+func (m *GtpuAddDelTunnelReply) 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 *GtpuAddDelTunnelReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = int32(buf.DecodeUint32())
+ m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ return nil
+}
+
+// GtpuOffloadRx defines message 'gtpu_offload_rx'.
+type GtpuOffloadRx struct {
+ HwIfIndex uint32 `binapi:"u32,name=hw_if_index" json:"hw_if_index,omitempty"`
+ SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
+ Enable uint8 `binapi:"u8,name=enable" json:"enable,omitempty"`
+}
+
+func (m *GtpuOffloadRx) Reset() { *m = GtpuOffloadRx{} }
+func (*GtpuOffloadRx) GetMessageName() string { return "gtpu_offload_rx" }
+func (*GtpuOffloadRx) GetCrcString() string { return "f0b08786" }
+func (*GtpuOffloadRx) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *GtpuOffloadRx) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.HwIfIndex
+ size += 4 // m.SwIfIndex
+ size += 1 // m.Enable
+ return size
+}
+func (m *GtpuOffloadRx) 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.HwIfIndex))
+ buf.EncodeUint32(uint32(m.SwIfIndex))
+ buf.EncodeUint8(uint8(m.Enable))
+ return buf.Bytes(), nil
+}
+func (m *GtpuOffloadRx) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.HwIfIndex = buf.DecodeUint32()
+ m.SwIfIndex = buf.DecodeUint32()
+ m.Enable = buf.DecodeUint8()
+ return nil
+}
+
+// GtpuOffloadRxReply defines message 'gtpu_offload_rx_reply'.
+type GtpuOffloadRxReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *GtpuOffloadRxReply) Reset() { *m = GtpuOffloadRxReply{} }
+func (*GtpuOffloadRxReply) GetMessageName() string { return "gtpu_offload_rx_reply" }
+func (*GtpuOffloadRxReply) GetCrcString() string { return "e8d4e804" }
+func (*GtpuOffloadRxReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *GtpuOffloadRxReply) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.Retval
+ return size
+}
+func (m *GtpuOffloadRxReply) 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 *GtpuOffloadRxReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = int32(buf.DecodeUint32())
+ return nil
+}
+
+// GtpuTunnelDetails defines message 'gtpu_tunnel_details'.
+type GtpuTunnelDetails struct {
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
+ SrcAddress ip_types.Address `binapi:"address,name=src_address" json:"src_address,omitempty"`
+ DstAddress ip_types.Address `binapi:"address,name=dst_address" json:"dst_address,omitempty"`
+ McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"`
+ EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
+ DecapNextIndex uint32 `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"`
+ Teid uint32 `binapi:"u32,name=teid" json:"teid,omitempty"`
+}
+
+func (m *GtpuTunnelDetails) Reset() { *m = GtpuTunnelDetails{} }
+func (*GtpuTunnelDetails) GetMessageName() string { return "gtpu_tunnel_details" }
+func (*GtpuTunnelDetails) GetCrcString() string { return "a4d81a09" }
+func (*GtpuTunnelDetails) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *GtpuTunnelDetails) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.SwIfIndex
+ size += 1 // m.SrcAddress.Af
+ size += 1 * 16 // m.SrcAddress.Un
+ size += 1 // m.DstAddress.Af
+ size += 1 * 16 // m.DstAddress.Un
+ size += 4 // m.McastSwIfIndex
+ size += 4 // m.EncapVrfID
+ size += 4 // m.DecapNextIndex
+ size += 4 // m.Teid
+ return size
+}
+func (m *GtpuTunnelDetails) 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.EncodeUint8(uint8(m.SrcAddress.Af))
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeUint8(uint8(m.DstAddress.Af))
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeUint32(uint32(m.McastSwIfIndex))
+ buf.EncodeUint32(uint32(m.EncapVrfID))
+ buf.EncodeUint32(uint32(m.DecapNextIndex))
+ buf.EncodeUint32(uint32(m.Teid))
+ return buf.Bytes(), nil
+}
+func (m *GtpuTunnelDetails) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ m.EncapVrfID = buf.DecodeUint32()
+ m.DecapNextIndex = buf.DecodeUint32()
+ m.Teid = buf.DecodeUint32()
+ return nil
+}
+
+// GtpuTunnelDump defines message 'gtpu_tunnel_dump'.
+type GtpuTunnelDump struct {
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
+}
+
+func (m *GtpuTunnelDump) Reset() { *m = GtpuTunnelDump{} }
+func (*GtpuTunnelDump) GetMessageName() string { return "gtpu_tunnel_dump" }
+func (*GtpuTunnelDump) GetCrcString() string { return "f9e6675e" }
+func (*GtpuTunnelDump) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *GtpuTunnelDump) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.SwIfIndex
+ return size
+}
+func (m *GtpuTunnelDump) 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 *GtpuTunnelDump) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ return nil
+}
+
+// SwInterfaceSetGtpuBypass defines message 'sw_interface_set_gtpu_bypass'.
+type SwInterfaceSetGtpuBypass 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" json:"enable,omitempty"`
+}
+
+func (m *SwInterfaceSetGtpuBypass) Reset() { *m = SwInterfaceSetGtpuBypass{} }
+func (*SwInterfaceSetGtpuBypass) GetMessageName() string { return "sw_interface_set_gtpu_bypass" }
+func (*SwInterfaceSetGtpuBypass) GetCrcString() string { return "65247409" }
+func (*SwInterfaceSetGtpuBypass) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *SwInterfaceSetGtpuBypass) 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 *SwInterfaceSetGtpuBypass) 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 *SwInterfaceSetGtpuBypass) 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
+}
+
+// SwInterfaceSetGtpuBypassReply defines message 'sw_interface_set_gtpu_bypass_reply'.
+type SwInterfaceSetGtpuBypassReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *SwInterfaceSetGtpuBypassReply) Reset() { *m = SwInterfaceSetGtpuBypassReply{} }
+func (*SwInterfaceSetGtpuBypassReply) GetMessageName() string {
+ return "sw_interface_set_gtpu_bypass_reply"
+}
+func (*SwInterfaceSetGtpuBypassReply) GetCrcString() string { return "e8d4e804" }
+func (*SwInterfaceSetGtpuBypassReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *SwInterfaceSetGtpuBypassReply) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.Retval
+ return size
+}
+func (m *SwInterfaceSetGtpuBypassReply) 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 *SwInterfaceSetGtpuBypassReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = int32(buf.DecodeUint32())
+ return nil
+}
+
+func init() { file_gtpu_binapi_init() }
+func file_gtpu_binapi_init() {
+ api.RegisterMessage((*GtpuAddDelTunnel)(nil), "gtpu_add_del_tunnel_9a26a51c")
+ api.RegisterMessage((*GtpuAddDelTunnelReply)(nil), "gtpu_add_del_tunnel_reply_5383d31f")
+ api.RegisterMessage((*GtpuOffloadRx)(nil), "gtpu_offload_rx_f0b08786")
+ api.RegisterMessage((*GtpuOffloadRxReply)(nil), "gtpu_offload_rx_reply_e8d4e804")
+ api.RegisterMessage((*GtpuTunnelDetails)(nil), "gtpu_tunnel_details_a4d81a09")
+ api.RegisterMessage((*GtpuTunnelDump)(nil), "gtpu_tunnel_dump_f9e6675e")
+ api.RegisterMessage((*SwInterfaceSetGtpuBypass)(nil), "sw_interface_set_gtpu_bypass_65247409")
+ api.RegisterMessage((*SwInterfaceSetGtpuBypassReply)(nil), "sw_interface_set_gtpu_bypass_reply_e8d4e804")
+}
+
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+ return []api.Message{
+ (*GtpuAddDelTunnel)(nil),
+ (*GtpuAddDelTunnelReply)(nil),
+ (*GtpuOffloadRx)(nil),
+ (*GtpuOffloadRxReply)(nil),
+ (*GtpuTunnelDetails)(nil),
+ (*GtpuTunnelDump)(nil),
+ (*SwInterfaceSetGtpuBypass)(nil),
+ (*SwInterfaceSetGtpuBypassReply)(nil),
+ }
+}
diff --git a/binapi/gtpu/gtpu_rest.ba.go b/binapi/gtpu/gtpu_rest.ba.go
new file mode 100644
index 0000000..6631cd8
--- /dev/null
+++ b/binapi/gtpu/gtpu_rest.ba.go
@@ -0,0 +1,83 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+
+package gtpu
+
+import (
+ "encoding/json"
+ "io/ioutil"
+ "net/http"
+)
+
+func RESTHandler(rpc RPCService) http.Handler {
+ mux := http.NewServeMux()
+ mux.HandleFunc("/gtpu_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(GtpuAddDelTunnel)
+ 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.GtpuAddDelTunnel(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("/gtpu_offload_rx", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(GtpuOffloadRx)
+ 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.GtpuOffloadRx(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("/sw_interface_set_gtpu_bypass", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(SwInterfaceSetGtpuBypass)
+ 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.SwInterfaceSetGtpuBypass(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/gtpu/gtpu_rpc.ba.go b/binapi/gtpu/gtpu_rpc.ba.go
new file mode 100644
index 0000000..fb0bb47
--- /dev/null
+++ b/binapi/gtpu/gtpu_rpc.ba.go
@@ -0,0 +1,93 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+
+package gtpu
+
+import (
+ "context"
+ "fmt"
+ api "git.fd.io/govpp.git/api"
+ vpe "git.fd.io/govpp.git/binapi/vpe"
+ "io"
+)
+
+// RPCService defines RPC service gtpu.
+type RPCService interface {
+ GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error)
+ GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error)
+ GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error)
+ SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error)
+}
+
+type serviceClient struct {
+ conn api.Connection
+}
+
+func NewServiceClient(conn api.Connection) RPCService {
+ return &serviceClient{conn}
+}
+
+func (c *serviceClient) GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error) {
+ out := new(GtpuAddDelTunnelReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) {
+ out := new(GtpuOffloadRxReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *serviceClient) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) {
+ stream, err := c.conn.NewStream(ctx)
+ if err != nil {
+ return nil, err
+ }
+ x := &serviceClient_GtpuTunnelDumpClient{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_GtpuTunnelDumpClient interface {
+ Recv() (*GtpuTunnelDetails, error)
+ api.Stream
+}
+
+type serviceClient_GtpuTunnelDumpClient struct {
+ api.Stream
+}
+
+func (c *serviceClient_GtpuTunnelDumpClient) Recv() (*GtpuTunnelDetails, error) {
+ msg, err := c.Stream.RecvMsg()
+ if err != nil {
+ return nil, err
+ }
+ switch m := msg.(type) {
+ case *GtpuTunnelDetails:
+ return m, nil
+ case *vpe.ControlPingReply:
+ return nil, io.EOF
+ default:
+ return nil, fmt.Errorf("unexpected message: %T %v", m, m)
+ }
+}
+
+func (c *serviceClient) SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInterfaceSetGtpuBypass) (*SwInterfaceSetGtpuBypassReply, error) {
+ out := new(SwInterfaceSetGtpuBypassReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}