diff options
author | 2020-07-17 10:36:28 +0200 | |
---|---|---|
committer | 2020-07-17 11:43:41 +0200 | |
commit | d1f24d37bd447b64e402298bb8eb2479681facf9 (patch) | |
tree | a3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /binapi/geneve/geneve.ba.go | |
parent | 1548c7e12531e3d055567d761c580a1c7ff0ac40 (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/geneve/geneve.ba.go')
-rw-r--r-- | binapi/geneve/geneve.ba.go | 344 |
1 files changed, 344 insertions, 0 deletions
diff --git a/binapi/geneve/geneve.ba.go b/binapi/geneve/geneve.ba.go new file mode 100644 index 0000000..154ce6a --- /dev/null +++ b/binapi/geneve/geneve.ba.go @@ -0,0 +1,344 @@ +// 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/geneve.api.json + +// Package geneve contains generated bindings for API file geneve.api. +// +// Contents: +// 6 messages +// +package geneve + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + 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 = "geneve" + APIVersion = "2.0.0" + VersionCrc = 0x7730c1d3 +) + +// GeneveAddDelTunnel defines message 'geneve_add_del_tunnel'. +type GeneveAddDelTunnel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + LocalAddress ip_types.Address `binapi:"address,name=local_address" json:"local_address,omitempty"` + RemoteAddress ip_types.Address `binapi:"address,name=remote_address" json:"remote_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"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GeneveAddDelTunnel) Reset() { *m = GeneveAddDelTunnel{} } +func (*GeneveAddDelTunnel) GetMessageName() string { return "geneve_add_del_tunnel" } +func (*GeneveAddDelTunnel) GetCrcString() string { return "976693b5" } +func (*GeneveAddDelTunnel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GeneveAddDelTunnel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.LocalAddress.Af + size += 1 * 16 // m.LocalAddress.Un + size += 1 // m.RemoteAddress.Af + size += 1 * 16 // m.RemoteAddress.Un + size += 4 // m.McastSwIfIndex + size += 4 // m.EncapVrfID + size += 4 // m.DecapNextIndex + size += 4 // m.Vni + return size +} +func (m *GeneveAddDelTunnel) 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.LocalAddress.Af)) + buf.EncodeBytes(m.LocalAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.RemoteAddress.Af)) + buf.EncodeBytes(m.RemoteAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.McastSwIfIndex)) + buf.EncodeUint32(uint32(m.EncapVrfID)) + buf.EncodeUint32(uint32(m.DecapNextIndex)) + buf.EncodeUint32(uint32(m.Vni)) + return buf.Bytes(), nil +} +func (m *GeneveAddDelTunnel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.LocalAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RemoteAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.RemoteAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EncapVrfID = buf.DecodeUint32() + m.DecapNextIndex = buf.DecodeUint32() + m.Vni = buf.DecodeUint32() + return nil +} + +// GeneveAddDelTunnelReply defines message 'geneve_add_del_tunnel_reply'. +type GeneveAddDelTunnelReply 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 *GeneveAddDelTunnelReply) Reset() { *m = GeneveAddDelTunnelReply{} } +func (*GeneveAddDelTunnelReply) GetMessageName() string { return "geneve_add_del_tunnel_reply" } +func (*GeneveAddDelTunnelReply) GetCrcString() string { return "5383d31f" } +func (*GeneveAddDelTunnelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GeneveAddDelTunnelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *GeneveAddDelTunnelReply) 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 *GeneveAddDelTunnelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// GeneveTunnelDetails defines message 'geneve_tunnel_details'. +type GeneveTunnelDetails 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"` + Vni uint32 `binapi:"u32,name=vni" json:"vni,omitempty"` +} + +func (m *GeneveTunnelDetails) Reset() { *m = GeneveTunnelDetails{} } +func (*GeneveTunnelDetails) GetMessageName() string { return "geneve_tunnel_details" } +func (*GeneveTunnelDetails) GetCrcString() string { return "e27e2748" } +func (*GeneveTunnelDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *GeneveTunnelDetails) 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.Vni + return size +} +func (m *GeneveTunnelDetails) 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.Vni)) + return buf.Bytes(), nil +} +func (m *GeneveTunnelDetails) 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.Vni = buf.DecodeUint32() + return nil +} + +// GeneveTunnelDump defines message 'geneve_tunnel_dump'. +type GeneveTunnelDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *GeneveTunnelDump) Reset() { *m = GeneveTunnelDump{} } +func (*GeneveTunnelDump) GetMessageName() string { return "geneve_tunnel_dump" } +func (*GeneveTunnelDump) GetCrcString() string { return "f9e6675e" } +func (*GeneveTunnelDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *GeneveTunnelDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *GeneveTunnelDump) 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 *GeneveTunnelDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetGeneveBypass defines message 'sw_interface_set_geneve_bypass'. +type SwInterfaceSetGeneveBypass 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 *SwInterfaceSetGeneveBypass) Reset() { *m = SwInterfaceSetGeneveBypass{} } +func (*SwInterfaceSetGeneveBypass) GetMessageName() string { return "sw_interface_set_geneve_bypass" } +func (*SwInterfaceSetGeneveBypass) GetCrcString() string { return "65247409" } +func (*SwInterfaceSetGeneveBypass) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetGeneveBypass) 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 *SwInterfaceSetGeneveBypass) 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 *SwInterfaceSetGeneveBypass) 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 +} + +// SwInterfaceSetGeneveBypassReply defines message 'sw_interface_set_geneve_bypass_reply'. +type SwInterfaceSetGeneveBypassReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetGeneveBypassReply) Reset() { *m = SwInterfaceSetGeneveBypassReply{} } +func (*SwInterfaceSetGeneveBypassReply) GetMessageName() string { + return "sw_interface_set_geneve_bypass_reply" +} +func (*SwInterfaceSetGeneveBypassReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetGeneveBypassReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetGeneveBypassReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetGeneveBypassReply) 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 *SwInterfaceSetGeneveBypassReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_geneve_binapi_init() } +func file_geneve_binapi_init() { + api.RegisterMessage((*GeneveAddDelTunnel)(nil), "geneve_add_del_tunnel_976693b5") + api.RegisterMessage((*GeneveAddDelTunnelReply)(nil), "geneve_add_del_tunnel_reply_5383d31f") + api.RegisterMessage((*GeneveTunnelDetails)(nil), "geneve_tunnel_details_e27e2748") + api.RegisterMessage((*GeneveTunnelDump)(nil), "geneve_tunnel_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetGeneveBypass)(nil), "sw_interface_set_geneve_bypass_65247409") + api.RegisterMessage((*SwInterfaceSetGeneveBypassReply)(nil), "sw_interface_set_geneve_bypass_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*GeneveAddDelTunnel)(nil), + (*GeneveAddDelTunnelReply)(nil), + (*GeneveTunnelDetails)(nil), + (*GeneveTunnelDump)(nil), + (*SwInterfaceSetGeneveBypass)(nil), + (*SwInterfaceSetGeneveBypassReply)(nil), + } +} |