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 --- internal/testbinapi/binapi2001/sr/sr.ba.go | 1716 ++++++++++++++++++++++++++++ 1 file changed, 1716 insertions(+) create mode 100644 internal/testbinapi/binapi2001/sr/sr.ba.go (limited to 'internal/testbinapi/binapi2001/sr/sr.ba.go') diff --git a/internal/testbinapi/binapi2001/sr/sr.ba.go b/internal/testbinapi/binapi2001/sr/sr.ba.go new file mode 100644 index 0000000..b0e423b --- /dev/null +++ b/internal/testbinapi/binapi2001/sr/sr.ba.go @@ -0,0 +1,1716 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/sr.api.json + +/* +Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). + +It consists of: + 20 messages + 3 types +*/ +package sr + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// 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 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbf277f96 +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +type SrIP6Address struct { + Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` +} + +func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } + +// Srv6Sid represents VPP binary API type 'srv6_sid'. +type Srv6Sid struct { + Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` +} + +func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } + +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` +} + +func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } + +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` + NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` +} + +func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } +func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } +func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.NhAddr6 + size += 16 + // field[1] m.NhAddr4 + size += 4 + return size +} +func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Localsid.Addr) { + x = uint8(m.Localsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + buf[pos] = uint8(m.Behavior) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.NhAddr6) { + x = uint8(m.NhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.NhAddr4) { + x = uint8(m.NhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + m.Localsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Localsid.Addr); i++ { + m.Localsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NhAddr6 + m.NhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.NhAddr6); i++ { + m.NhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NhAddr4 + m.NhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.NhAddr4); i++ { + m.NhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } +func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } +func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` + XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` +} + +func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } +func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } +func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidsDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Addr + // field[2] m.Addr.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 2 + // field[1] m.FibTable + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.XconnectNhAddr6 + size += 16 + // field[1] m.XconnectNhAddr4 + size += 4 + // field[1] m.XconnectIfaceOrVrfTable + size += 4 + return size +} +func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Addr + // field[2] m.Addr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Addr.Addr) { + x = uint8(m.Addr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) + pos += 2 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.XconnectNhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.XconnectNhAddr6) { + x = uint8(m.XconnectNhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.XconnectNhAddr4) { + x = uint8(m.XconnectNhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Addr + // field[2] m.Addr.Addr + m.Addr.Addr = make([]uint8, 16) + for i := 0; i < len(m.Addr.Addr); i++ { + m.Addr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.XconnectNhAddr6 + m.XconnectNhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.XconnectNhAddr6); i++ { + m.XconnectNhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + m.XconnectNhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.XconnectNhAddr4); i++ { + m.XconnectNhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } +func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } +func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } +func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` + SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } +func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } +func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } +func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPoliciesDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + // field[1] m.Type + size += 1 + // field[1] m.IsEncap + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.NumSidLists + size += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidList + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + // field[2] s1.NumSids + size += 1 + // field[2] s1.Weight + size += 4 + // field[2] s1.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(s1.Sids) { + s2 = s1.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + } + return size +} +func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NumSidLists + buf[pos] = uint8(len(m.SidLists)) + pos += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var v1 Srv6SidList + if j1 < len(m.SidLists) { + v1 = m.SidLists[j1] + } + // field[2] v1.NumSids + buf[pos] = uint8(v1.NumSids) + pos += 1 + // field[2] v1.Weight + o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) + pos += 4 + // field[2] v1.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(v1.Sids) { + v2 = v1.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + } + return buf, nil +} +func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NumSidLists + m.NumSidLists = uint8(tmp[pos]) + pos += 1 + // field[1] m.SidLists + m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) + for j1 := 0; j1 < int(m.NumSidLists); j1++ { + // field[2] m.SidLists[j1].NumSids + m.SidLists[j1].NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.SidLists[j1].Weight + m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.SidLists[j1].Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.SidLists[j1].Sids[j2].Addr + m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { + m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + } + return nil +} + +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } +func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } +func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPoliciesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } +func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } +func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } +func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.Weight + size += 4 + // field[1] m.IsEncap + size += 1 + // field[1] m.Type + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } +func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } +func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` +} + +func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } +func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } +func (*SrPolicyDel) GetCrcString() string { return "e4133171" } +func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + return size +} +func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr.Addr) { + x = uint8(m.BsidAddr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + m.BsidAddr.Addr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr.Addr); i++ { + m.BsidAddr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } +func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } +func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } +func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } +func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } +func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.Operation + size += 1 + // field[1] m.SlIndex + size += 4 + // field[1] m.Weight + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Operation + buf[pos] = uint8(m.Operation) + pos += 1 + // field[1] m.SlIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) + pos += 4 + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyMod) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Operation + m.Operation = uint8(tmp[pos]) + pos += 1 + // field[1] m.SlIndex + m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } +func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } +func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. +type SrSetEncapHopLimit struct { + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} + +func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } +func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } +func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } +func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapHopLimit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HopLimit + size += 1 + return size +} +func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HopLimit + buf[pos] = uint8(m.HopLimit) + pos += 1 + return buf, nil +} +func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HopLimit + m.HopLimit = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. +type SrSetEncapHopLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } +func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } +func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapHopLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` +} + +func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } +func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } +func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } +func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapSource) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EncapsSource + size += 16 + return size +} +func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EncapsSource + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.EncapsSource) { + x = uint8(m.EncapsSource[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EncapsSource + m.EncapsSource = make([]uint8, 16) + for i := 0; i < len(m.EncapsSource); i++ { + m.EncapsSource[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } +func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } +func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` +} + +func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } +func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } +func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } +func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TrafficType + size += 1 + return size +} +func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + return buf, nil +} +func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } +func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } +func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } +func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } +func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringPolDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TrafficType + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + return size +} +func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } +func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } +func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } +func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringPolDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_sr_binapi_init() } +func file_sr_binapi_init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") + api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") + api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapHopLimit)(nil), + (*SrSetEncapHopLimitReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits -- cgit 1.2.3-korg