From c7ae74a95d1bd6fefcbb061f5f045c60c11e32fc Mon Sep 17 00:00:00 2001 From: Vladimir Lavor Date: Wed, 1 Jul 2020 12:18:54 +0200 Subject: Binary API generator improvements * Many aliases removed, aliased types reference original types via import instead * Added various helper methods for simpler conversion between go and vpp types Change-Id: I7999ac8d524cece4da03e6447b13421659765095 Signed-off-by: Vladimir Lavor --- examples/binapi/acl/acl.ba.go | 189 +++++------- examples/binapi/af_packet/af_packet.ba.go | 51 ++-- examples/binapi/fib_types/fib_types.ba.go | 14 +- .../binapi/interface_types/interface_types.ba.go | 6 + examples/binapi/interfaces/interfaces.ba.go | 331 ++++++++++----------- examples/binapi/ip/ip.ba.go | 323 +++++++++----------- examples/binapi/ip_types/ip_types.ba.go | 71 +++++ examples/binapi/memclnt/memclnt.ba.go | 6 + examples/binapi/memif/memif.ba.go | 69 +++-- examples/binapi/sr/sr.ba.go | 182 +++++------ examples/binapi/vpe/vpe.ba.go | 6 + 11 files changed, 610 insertions(+), 638 deletions(-) (limited to 'examples/binapi') diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go index 604b352..f191c78 100644 --- a/examples/binapi/acl/acl.ba.go +++ b/examples/binapi/acl/acl.ba.go @@ -20,9 +20,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -77,81 +80,48 @@ func (x ACLAction) String() string { return "ACLAction(" + strconv.Itoa(int(x)) + ")" } -type AddressFamily = ip_types.AddressFamily - -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type IPDscp = ip_types.IPDscp - -type IPEcn = ip_types.IPEcn - -type IPProto = ip_types.IPProto - -type LinkDuplex = interface_types.LinkDuplex - -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - -type SubIfFlags = interface_types.SubIfFlags - -type AddressWithPrefix = ip_types.AddressWithPrefix - -type InterfaceIndex = interface_types.InterfaceIndex - -type IP4Address = ip_types.IP4Address - -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix - -type IP6Address = ip_types.IP6Address - -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix - // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} + +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} + // ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { - IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` - SrcPrefix Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` - DstPrefix Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` - Proto IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` - SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` - SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` - DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` - DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` - TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` - TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix ip_types.Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` } func (*ACLRule) GetTypeName() string { return "acl_rule" } -type Address = ip_types.Address - -type IP4Prefix = ip_types.IP4Prefix - -type IP6Prefix = ip_types.IP6Prefix - // MacipACLRule represents VPP binary API type 'macip_acl_rule'. type MacipACLRule struct { - IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` - SrcMac MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` - SrcMacMask MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` - SrcPrefix Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcMac MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` + SrcMacMask MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` } func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } -type Mprefix = ip_types.Mprefix - -type Prefix = ip_types.Prefix - -type PrefixMatcher = ip_types.PrefixMatcher - -type AddressUnion = ip_types.AddressUnion - // ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` @@ -319,7 +289,7 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { // field[2] m.R[j1].SrcPrefix // field[3] m.R[j1].SrcPrefix.Address // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].SrcPrefix.Address.Un copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -330,7 +300,7 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { // field[2] m.R[j1].DstPrefix // field[3] m.R[j1].DstPrefix.Address // field[4] m.R[j1].DstPrefix.Address.Af - m.R[j1].DstPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].DstPrefix.Address.Un copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -339,7 +309,7 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = IPProto(tmp[pos]) + m.R[j1].Proto = ip_types.IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -677,7 +647,7 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { // field[2] m.R[j1].SrcPrefix // field[3] m.R[j1].SrcPrefix.Address // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].SrcPrefix.Address.Un copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -688,7 +658,7 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { // field[2] m.R[j1].DstPrefix // field[3] m.R[j1].DstPrefix.Address // field[4] m.R[j1].DstPrefix.Address.Af - m.R[j1].DstPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].DstPrefix.Address.Un copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -697,7 +667,7 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = IPProto(tmp[pos]) + m.R[j1].Proto = ip_types.IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -769,10 +739,10 @@ func (m *ACLDump) Unmarshal(tmp []byte) error { // ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } @@ -836,7 +806,7 @@ func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { m.IsInput = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -892,10 +862,10 @@ func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } @@ -957,7 +927,7 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -976,7 +946,7 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } @@ -1017,17 +987,17 @@ func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. type ACLInterfaceListDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } @@ -1087,7 +1057,7 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1106,7 +1076,7 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { // ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` } func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } @@ -1145,17 +1115,17 @@ func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. type ACLInterfaceSetACLList struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } @@ -1215,7 +1185,7 @@ func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1282,10 +1252,10 @@ func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { // ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } @@ -1347,7 +1317,7 @@ func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1923,7 +1893,7 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { // field[2] m.R[j1].SrcPrefix // field[3] m.R[j1].SrcPrefix.Address // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].SrcPrefix.Address.Un copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2080,7 +2050,7 @@ func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { // field[2] m.R[j1].SrcPrefix // field[3] m.R[j1].SrcPrefix.Address // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].SrcPrefix.Address.Un copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2439,7 +2409,7 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { // field[2] m.R[j1].SrcPrefix // field[3] m.R[j1].SrcPrefix.Address // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = AddressFamily(tmp[pos]) + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.R[j1].SrcPrefix.Address.Un copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2499,9 +2469,9 @@ func (m *MacipACLDump) Unmarshal(tmp []byte) error { // MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } @@ -2555,7 +2525,7 @@ func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2713,9 +2683,9 @@ func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } @@ -2772,7 +2742,7 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -2788,7 +2758,7 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } @@ -2827,7 +2797,7 @@ func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -2925,6 +2895,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/af_packet/af_packet.ba.go b/examples/binapi/af_packet/af_packet.ba.go index d2cc52b..5dc2850 100644 --- a/examples/binapi/af_packet/af_packet.ba.go +++ b/examples/binapi/af_packet/af_packet.ba.go @@ -18,9 +18,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -44,23 +47,22 @@ const ( VersionCrc = 0xe0b6c022 ) -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type LinkDuplex = interface_types.LinkDuplex - -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - -type SubIfFlags = interface_types.SubIfFlags - -type InterfaceIndex = interface_types.InterfaceIndex - // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} + +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} + // AfPacketCreate represents VPP binary API message 'af_packet_create'. type AfPacketCreate struct { HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` @@ -140,8 +142,8 @@ func (m *AfPacketCreate) Unmarshal(tmp []byte) error { // AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. type AfPacketCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } @@ -188,7 +190,7 @@ func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -290,8 +292,8 @@ func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { // AfPacketDetails represents VPP binary API message 'af_packet_details'. type AfPacketDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` } func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } @@ -335,7 +337,7 @@ func (m *AfPacketDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.HostIfName { @@ -384,8 +386,8 @@ func (m *AfPacketDump) Unmarshal(tmp []byte) error { // AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. type AfPacketSetL4CksumOffload struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Set bool `binapi:"bool,name=set" json:"set,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` } func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } @@ -431,7 +433,7 @@ func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Set m.Set = tmp[pos] != 0 @@ -520,6 +522,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/fib_types/fib_types.ba.go b/examples/binapi/fib_types/fib_types.ba.go index 1d824e5..9050e85 100644 --- a/examples/binapi/fib_types/fib_types.ba.go +++ b/examples/binapi/fib_types/fib_types.ba.go @@ -19,9 +19,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -217,10 +220,10 @@ func (*FibPath) GetTypeName() string { return "fib_path" } // FibPathNh represents VPP binary API type 'fib_path_nh'. type FibPathNh struct { - Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` - ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` - ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` - ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` + Address ip_types.AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` } func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } @@ -244,6 +247,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/interface_types/interface_types.ba.go b/examples/binapi/interface_types/interface_types.ba.go index 0191e5f..1c0a72c 100644 --- a/examples/binapi/interface_types/interface_types.ba.go +++ b/examples/binapi/interface_types/interface_types.ba.go @@ -17,9 +17,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -261,6 +264,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go index fea1079..8b9176c 100644 --- a/examples/binapi/interfaces/interfaces.ba.go +++ b/examples/binapi/interfaces/interfaces.ba.go @@ -20,9 +20,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -47,59 +50,26 @@ const ( VersionCrc = 0x58d4cf5a ) -type AddressFamily = ip_types.AddressFamily - -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type IPDscp = ip_types.IPDscp - -type IPEcn = ip_types.IPEcn - -type IPProto = ip_types.IPProto - -type LinkDuplex = interface_types.LinkDuplex - -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - -type SubIfFlags = interface_types.SubIfFlags - -type AddressWithPrefix = ip_types.AddressWithPrefix - -type InterfaceIndex = interface_types.InterfaceIndex - -type IP4Address = ip_types.IP4Address - -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix - -type IP6Address = ip_types.IP6Address - -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix - // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -type Address = ip_types.Address - -type IP4Prefix = ip_types.IP4Prefix - -type IP6Prefix = ip_types.IP6Prefix - -type Mprefix = ip_types.Mprefix - -type Prefix = ip_types.Prefix - -type PrefixMatcher = ip_types.PrefixMatcher +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} -type AddressUnion = ip_types.AddressUnion +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} // CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. type CollectDetailedInterfaceStats struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` } func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } @@ -147,7 +117,7 @@ func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.EnableDisable m.EnableDisable = tmp[pos] != 0 @@ -333,8 +303,8 @@ func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { // CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. type CreateLoopbackInstanceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } @@ -381,15 +351,15 @@ func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. type CreateLoopbackReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } @@ -436,18 +406,18 @@ func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // CreateSubif represents VPP binary API message 'create_subif'. type CreateSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` - InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` } func (m *CreateSubif) Reset() { *m = CreateSubif{} } @@ -506,13 +476,13 @@ func (m *CreateSubif) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SubID m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SubIfFlags - m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + m.SubIfFlags = interface_types.SubIfFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.OuterVlanID m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) @@ -525,8 +495,8 @@ func (m *CreateSubif) Unmarshal(tmp []byte) error { // CreateSubifReply represents VPP binary API message 'create_subif_reply'. type CreateSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *CreateSubifReply) Reset() { *m = CreateSubifReply{} } @@ -573,15 +543,15 @@ func (m *CreateSubifReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. type CreateVlanSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` } func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } @@ -625,7 +595,7 @@ func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.VlanID m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) @@ -635,8 +605,8 @@ func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { // CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. type CreateVlanSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } @@ -683,14 +653,14 @@ func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // DeleteLoopback represents VPP binary API message 'delete_loopback'. type DeleteLoopback struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } @@ -729,7 +699,7 @@ func (m *DeleteLoopback) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -782,7 +752,7 @@ func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { // DeleteSubif represents VPP binary API message 'delete_subif'. type DeleteSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } @@ -821,7 +791,7 @@ func (m *DeleteSubif) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -874,8 +844,8 @@ func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { // HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. type HwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` } func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } @@ -919,7 +889,7 @@ func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Mtu m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) @@ -975,8 +945,8 @@ func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { // InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. type InterfaceNameRenumber struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` } func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } @@ -1020,7 +990,7 @@ func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.NewShowDevInstance m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1076,10 +1046,10 @@ func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { // SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. type SwInterfaceAddDelAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` - Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` } func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } @@ -1151,7 +1121,7 @@ func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsAdd m.IsAdd = tmp[pos] != 0 @@ -1162,7 +1132,7 @@ func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -1517,7 +1487,7 @@ func (m *SwInterfaceAddressReplaceEndReply) Unmarshal(tmp []byte) error { // SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. type SwInterfaceClearStats struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } @@ -1556,7 +1526,7 @@ func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -1609,32 +1579,32 @@ func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { // SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. type SwInterfaceDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` - L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` - LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` - LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` - LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` - SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` - SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` - SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` - VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` - VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` - VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` - OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` - BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` - BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` - BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` - ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` - InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` - InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type interface_types.IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex interface_types.LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` } func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } @@ -1822,7 +1792,7 @@ func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SupSwIfIndex m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1833,13 +1803,13 @@ func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { pos += 1 } // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Type - m.Type = IfType(o.Uint32(tmp[pos : pos+4])) + m.Type = interface_types.IfType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.LinkDuplex - m.LinkDuplex = LinkDuplex(o.Uint32(tmp[pos : pos+4])) + m.LinkDuplex = interface_types.LinkDuplex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.LinkSpeed m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1866,7 +1836,7 @@ func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) pos += 2 // field[1] m.SubIfFlags - m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + m.SubIfFlags = interface_types.SubIfFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.VtrOp m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1922,10 +1892,10 @@ func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { // SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. type SwInterfaceDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` - NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` - XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` - NameFilter string `json:"name_filter,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` + NameFilter string `json:"name_filter,omitempty"` } func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } @@ -1978,7 +1948,7 @@ func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.NameFilterValid m.NameFilterValid = tmp[pos] != 0 @@ -1995,10 +1965,10 @@ func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { // SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. type SwInterfaceEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` } func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } @@ -2057,10 +2027,10 @@ func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { m.PID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Deleted m.Deleted = tmp[pos] != 0 @@ -2070,7 +2040,7 @@ func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { // SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. type SwInterfaceGetMacAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } @@ -2109,7 +2079,7 @@ func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -2181,8 +2151,8 @@ func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { // SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. type SwInterfaceGetTable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + 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"` } func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } @@ -2228,7 +2198,7 @@ func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsIPv6 m.IsIPv6 = tmp[pos] != 0 @@ -2293,10 +2263,10 @@ func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { // SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. type SwInterfaceRxPlacementDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` } func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } @@ -2352,7 +2322,7 @@ func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.QueueID m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2361,14 +2331,14 @@ func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Mode - m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + m.Mode = interface_types.RxMode(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. type SwInterfaceRxPlacementDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } @@ -2407,15 +2377,15 @@ func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. type SwInterfaceSetFlags struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` } func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } @@ -2459,10 +2429,10 @@ func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -2515,8 +2485,8 @@ func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { // SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. type SwInterfaceSetIPDirectedBroadcast struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` } func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } @@ -2564,7 +2534,7 @@ func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Enable m.Enable = tmp[pos] != 0 @@ -2626,8 +2596,8 @@ func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { // SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. type SwInterfaceSetMacAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` } func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } @@ -2677,7 +2647,7 @@ func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.MacAddress for i := 0; i < len(m.MacAddress); i++ { @@ -2737,8 +2707,8 @@ func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { // SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. type SwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` } func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } @@ -2788,7 +2758,7 @@ func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Mtu m.Mtu = make([]uint32, 4) @@ -2847,10 +2817,10 @@ func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { // SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. type SwInterfaceSetRxMode struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` } func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } @@ -2906,7 +2876,7 @@ func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.QueueIDValid m.QueueIDValid = tmp[pos] != 0 @@ -2915,7 +2885,7 @@ func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Mode - m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + m.Mode = interface_types.RxMode(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -2968,10 +2938,10 @@ func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { // SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. type SwInterfaceSetRxPlacement struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` } func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } @@ -3027,7 +2997,7 @@ func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.QueueID m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) @@ -3091,9 +3061,9 @@ func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { // SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. type SwInterfaceSetTable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + 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"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } @@ -3144,7 +3114,7 @@ func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsIPv6 m.IsIPv6 = tmp[pos] != 0 @@ -3203,9 +3173,9 @@ func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { // SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. type SwInterfaceSetUnnumbered struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` } func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } @@ -3256,10 +3226,10 @@ func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.UnnumberedSwIfIndex - m.UnnumberedSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.UnnumberedSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsAdd m.IsAdd = tmp[pos] != 0 @@ -3317,9 +3287,9 @@ func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { // SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. type SwInterfaceTagAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` } func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } @@ -3373,7 +3343,7 @@ func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Tag { @@ -3662,6 +3632,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go index 183ed99..ed8640b 100644 --- a/examples/binapi/ip/ip.ba.go +++ b/examples/binapi/ip/ip.ba.go @@ -20,9 +20,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -47,24 +50,6 @@ const ( VersionCrc = 0x765d74b1 ) -type AddressFamily = fib_types.AddressFamily - -type FibPathFlags = fib_types.FibPathFlags - -type FibPathNhProto = fib_types.FibPathNhProto - -type FibPathType = fib_types.FibPathType - -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type IPDscp = fib_types.IPDscp - -type IPEcn = fib_types.IPEcn - -type IPProto = fib_types.IPProto - // IPReassType represents VPP binary API enum 'ip_reass_type'. type IPReassType uint32 @@ -92,8 +77,6 @@ func (x IPReassType) String() string { return "IPReassType(" + strconv.Itoa(int(x)) + ")" } -type LinkDuplex = interface_types.LinkDuplex - // MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. type MfibItfFlags uint32 @@ -133,58 +116,41 @@ func (x MfibItfFlags) String() string { return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" } -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - -type SubIfFlags = interface_types.SubIfFlags - -type AddressWithPrefix = fib_types.AddressWithPrefix - -type InterfaceIndex = interface_types.InterfaceIndex - -type IP4Address = fib_types.IP4Address - -type IP4AddressWithPrefix = fib_types.IP4AddressWithPrefix - -type IP6Address = fib_types.IP6Address - -type IP6AddressWithPrefix = fib_types.IP6AddressWithPrefix - // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 -type Address = fib_types.Address - -type FibMplsLabel = fib_types.FibMplsLabel - -type FibPath = fib_types.FibPath - -type FibPathNh = fib_types.FibPathNh - -type IP4Prefix = fib_types.IP4Prefix +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} -type IP6Prefix = fib_types.IP6Prefix +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} // IPMroute represents VPP binary API type 'ip_mroute'. type IPMroute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix fib_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` } func (*IPMroute) GetTypeName() string { return "ip_mroute" } // IPRoute represents VPP binary API type 'ip_route'. type IPRoute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` } func (*IPRoute) GetTypeName() string { return "ip_route" } @@ -200,29 +166,21 @@ func (*IPTable) GetTypeName() string { return "ip_table" } // MfibPath represents VPP binary API type 'mfib_path'. type MfibPath struct { - ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` - Path FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` + ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` + Path fib_types.FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` } func (*MfibPath) GetTypeName() string { return "mfib_path" } -type Mprefix = fib_types.Mprefix - -type Prefix = fib_types.Prefix - -type PrefixMatcher = fib_types.PrefixMatcher - // PuntRedirect represents VPP binary API type 'punt_redirect'. type PuntRedirect struct { - RxSwIfIndex InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` - TxSwIfIndex InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` - Nh Address `binapi:"address,name=nh" json:"nh,omitempty"` + RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Nh fib_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` } func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } -type AddressUnion = fib_types.AddressUnion - // IoamDisable represents VPP binary API message 'ioam_disable'. type IoamDisable struct { ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` @@ -462,8 +420,8 @@ func (m *IoamEnableReply) Unmarshal(tmp []byte) error { // IPAddressDetails represents VPP binary API message 'ip_address_details'. type IPAddressDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix fib_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` } func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } @@ -521,12 +479,12 @@ func (m *IPAddressDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -539,8 +497,8 @@ func (m *IPAddressDetails) Unmarshal(tmp []byte) error { // IPAddressDump represents VPP binary API message 'ip_address_dump'. type IPAddressDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + 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"` } func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } @@ -586,7 +544,7 @@ func (m *IPAddressDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsIPv6 m.IsIPv6 = tmp[pos] != 0 @@ -596,9 +554,9 @@ func (m *IPAddressDump) Unmarshal(tmp []byte) error { // IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. type IPContainerProxyAddDel struct { - Pfx Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Pfx fib_types.Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` } func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } @@ -665,7 +623,7 @@ func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { // field[1] m.Pfx // field[2] m.Pfx.Address // field[3] m.Pfx.Address.Af - m.Pfx.Address.Af = AddressFamily(tmp[pos]) + m.Pfx.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Pfx.Address.Un copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -674,7 +632,7 @@ func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { m.Pfx.Len = uint8(tmp[pos]) pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsAdd m.IsAdd = tmp[pos] != 0 @@ -732,8 +690,8 @@ func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { // IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. type IPContainerProxyDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` } func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } @@ -791,12 +749,12 @@ func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -845,8 +803,8 @@ func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { // IPDetails represents VPP binary API message 'ip_details'. type IPDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + 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"` } func (m *IPDetails) Reset() { *m = IPDetails{} } @@ -892,7 +850,7 @@ func (m *IPDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsIPv6 m.IsIPv6 = tmp[pos] != 0 @@ -1026,7 +984,7 @@ func (m *IPMrouteAddDel) Size() int { size += 1 // field[4] s2.Path.LabelStack for j4 := 0; j4 < 16; j4++ { - var s4 FibMplsLabel + var s4 fib_types.FibMplsLabel _ = s4 if j4 < len(s2.Path.LabelStack) { s4 = s2.Path.LabelStack[j4] @@ -1142,7 +1100,7 @@ func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { pos += 1 // field[4] v2.Path.LabelStack for j4 := 0; j4 < 16; j4++ { - var v4 FibMplsLabel + var v4 fib_types.FibMplsLabel if j4 < len(v2.Path.LabelStack) { v4 = v2.Path.LabelStack[j4] } @@ -1185,7 +1143,7 @@ func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(tmp[pos]) + m.Route.Prefix.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Route.Prefix.GrpAddressLength m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) @@ -1222,13 +1180,13 @@ func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) pos += 1 // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Nh // field[5] m.Route.Paths[j2].Path.Nh.Address @@ -1392,7 +1350,7 @@ func (m *IPMrouteDetails) Size() int { size += 1 // field[4] s2.Path.LabelStack for j4 := 0; j4 < 16; j4++ { - var s4 FibMplsLabel + var s4 fib_types.FibMplsLabel _ = s4 if j4 < len(s2.Path.LabelStack) { s4 = s2.Path.LabelStack[j4] @@ -1498,7 +1456,7 @@ func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { pos += 1 // field[4] v2.Path.LabelStack for j4 := 0; j4 < 16; j4++ { - var v4 FibMplsLabel + var v4 fib_types.FibMplsLabel if j4 < len(v2.Path.LabelStack) { v4 = v2.Path.LabelStack[j4] } @@ -1535,7 +1493,7 @@ func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { pos += 4 // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(tmp[pos]) + m.Route.Prefix.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Route.Prefix.GrpAddressLength m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) @@ -1572,13 +1530,13 @@ func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) pos += 1 // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Path.Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[4] m.Route.Paths[j2].Path.Nh // field[5] m.Route.Paths[j2].Path.Nh.Address @@ -1974,14 +1932,14 @@ func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { _ = pos // field[1] m.Punt // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(tmp[pos]) + m.Punt.Nh.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Punt.Nh.Un copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2053,14 +2011,14 @@ func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { _ = pos // field[1] m.Punt // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[2] m.Punt.Nh // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(tmp[pos]) + m.Punt.Nh.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Punt.Nh.Un copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2070,8 +2028,8 @@ func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { // IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. type IPPuntRedirectDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + 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"` } func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } @@ -2117,7 +2075,7 @@ func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IsIPv6 m.IsIPv6 = tmp[pos] != 0 @@ -2173,10 +2131,10 @@ func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { // IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. type IPReassemblyEnableDisable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` - EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` + EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` } func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } @@ -2234,7 +2192,7 @@ func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.EnableIP4 m.EnableIP4 = tmp[pos] != 0 @@ -2623,7 +2581,7 @@ func (m *IPRouteAddDel) Size() int { size += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 FibPath + var s2 fib_types.FibPath _ = s2 if j2 < len(m.Route.Paths) { s2 = m.Route.Paths[j2] @@ -2657,7 +2615,7 @@ func (m *IPRouteAddDel) Size() int { size += 1 // field[3] s2.LabelStack for j3 := 0; j3 < 16; j3++ { - var s3 FibMplsLabel + var s3 fib_types.FibMplsLabel _ = s3 if j3 < len(s2.LabelStack) { s3 = s2.LabelStack[j3] @@ -2718,7 +2676,7 @@ func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { pos += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 FibPath + var v2 fib_types.FibPath if j2 < len(m.Route.Paths) { v2 = m.Route.Paths[j2] } @@ -2764,7 +2722,7 @@ func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { pos += 1 // field[3] v2.LabelStack for j3 := 0; j3 < 16; j3++ { - var v3 FibMplsLabel + var v3 fib_types.FibMplsLabel if j3 < len(v2.LabelStack) { v3 = v2.LabelStack[j3] } @@ -2805,7 +2763,7 @@ func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.Route.Prefix.Address.Un copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -2817,7 +2775,7 @@ func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { m.Route.NPaths = uint8(tmp[pos]) pos += 1 // field[2] m.Route.Paths - m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) for j2 := 0; j2 < int(m.Route.NPaths); j2++ { // field[3] m.Route.Paths[j2].SwIfIndex m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2835,13 +2793,13 @@ func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { m.Route.Paths[j2].Preference = uint8(tmp[pos]) pos += 1 // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Nh // field[4] m.Route.Paths[j2].Nh.Address @@ -2965,7 +2923,7 @@ func (m *IPRouteDetails) Size() int { size += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 FibPath + var s2 fib_types.FibPath _ = s2 if j2 < len(m.Route.Paths) { s2 = m.Route.Paths[j2] @@ -2999,7 +2957,7 @@ func (m *IPRouteDetails) Size() int { size += 1 // field[3] s2.LabelStack for j3 := 0; j3 < 16; j3++ { - var s3 FibMplsLabel + var s3 fib_types.FibMplsLabel _ = s3 if j3 < len(s2.LabelStack) { s3 = s2.LabelStack[j3] @@ -3050,7 +3008,7 @@ func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { pos += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 FibPath + var v2 fib_types.FibPath if j2 < len(m.Route.Paths) { v2 = m.Route.Paths[j2] } @@ -3096,7 +3054,7 @@ func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { pos += 1 // field[3] v2.LabelStack for j3 := 0; j3 < 16; j3++ { - var v3 FibMplsLabel + var v3 fib_types.FibMplsLabel if j3 < len(v2.LabelStack) { v3 = v2.LabelStack[j3] } @@ -3131,7 +3089,7 @@ func (m *IPRouteDetails) Unmarshal(tmp []byte) error { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.Route.Prefix.Address.Un copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -3143,7 +3101,7 @@ func (m *IPRouteDetails) Unmarshal(tmp []byte) error { m.Route.NPaths = uint8(tmp[pos]) pos += 1 // field[2] m.Route.Paths - m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) for j2 := 0; j2 < int(m.Route.NPaths); j2++ { // field[3] m.Route.Paths[j2].SwIfIndex m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -3161,13 +3119,13 @@ func (m *IPRouteDetails) Unmarshal(tmp []byte) error { m.Route.Paths[j2].Preference = uint8(tmp[pos]) pos += 1 // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Nh // field[4] m.Route.Paths[j2].Nh.Address @@ -3276,9 +3234,9 @@ func (m *IPRouteDump) Unmarshal(tmp []byte) error { // IPRouteLookup represents VPP binary API message 'ip_route_lookup'. type IPRouteLookup struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` + Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` } func (m *IPRouteLookup) Reset() { *m = IPRouteLookup{} } @@ -3349,7 +3307,7 @@ func (m *IPRouteLookup) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -3395,7 +3353,7 @@ func (m *IPRouteLookupReply) Size() int { size += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 FibPath + var s2 fib_types.FibPath _ = s2 if j2 < len(m.Route.Paths) { s2 = m.Route.Paths[j2] @@ -3429,7 +3387,7 @@ func (m *IPRouteLookupReply) Size() int { size += 1 // field[3] s2.LabelStack for j3 := 0; j3 < 16; j3++ { - var s3 FibMplsLabel + var s3 fib_types.FibMplsLabel _ = s3 if j3 < len(s2.LabelStack) { s3 = s2.LabelStack[j3] @@ -3483,7 +3441,7 @@ func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) { pos += 1 // field[2] m.Route.Paths for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 FibPath + var v2 fib_types.FibPath if j2 < len(m.Route.Paths) { v2 = m.Route.Paths[j2] } @@ -3529,7 +3487,7 @@ func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) { pos += 1 // field[3] v2.LabelStack for j3 := 0; j3 < 16; j3++ { - var v3 FibMplsLabel + var v3 fib_types.FibMplsLabel if j3 < len(v2.LabelStack) { v3 = v2.LabelStack[j3] } @@ -3567,7 +3525,7 @@ func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { // field[2] m.Route.Prefix // field[3] m.Route.Prefix.Address // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[4] m.Route.Prefix.Address.Un copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -3579,7 +3537,7 @@ func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { m.Route.NPaths = uint8(tmp[pos]) pos += 1 // field[2] m.Route.Paths - m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) for j2 := 0; j2 < int(m.Route.NPaths); j2++ { // field[3] m.Route.Paths[j2].SwIfIndex m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -3597,13 +3555,13 @@ func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { m.Route.Paths[j2].Preference = uint8(tmp[pos]) pos += 1 // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[3] m.Route.Paths[j2].Nh // field[4] m.Route.Paths[j2].Nh.Address @@ -3642,12 +3600,12 @@ func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { // IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. type IPSourceAndPortRangeCheckAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` - LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` - HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } @@ -3746,7 +3704,7 @@ func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -3827,12 +3785,12 @@ func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { // IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. type IPSourceAndPortRangeCheckInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` - TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` - UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` - UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` + TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` + UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` + UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` } func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { @@ -3907,7 +3865,7 @@ func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.TCPInVrfID m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) @@ -4559,8 +4517,8 @@ func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { // IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. type IPUnnumberedDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IPSwIfIndex InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` } func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } @@ -4604,17 +4562,17 @@ func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IPSwIfIndex - m.IPSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.IPSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. type IPUnnumberedDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` } func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } @@ -4653,18 +4611,18 @@ func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. type MfibSignalDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` - IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix fib_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` + IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` } func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } @@ -4746,14 +4704,14 @@ func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(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.Prefix // field[2] m.Prefix.Af - m.Prefix.Af = AddressFamily(tmp[pos]) + m.Prefix.Af = fib_types.AddressFamily(tmp[pos]) pos += 1 // field[2] m.Prefix.GrpAddressLength m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) @@ -4994,8 +4952,8 @@ func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { // SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. type SwInterfaceIP6EnableDisable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` } func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } @@ -5041,7 +4999,7 @@ func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Enable m.Enable = tmp[pos] != 0 @@ -5099,8 +5057,8 @@ func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { // SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. type SwInterfaceIP6SetLinkLocalAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IP IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP fib_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` } func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } @@ -5152,7 +5110,7 @@ func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IP for i := 0; i < len(m.IP); i++ { @@ -5351,6 +5309,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/ip_types/ip_types.ba.go b/examples/binapi/ip_types/ip_types.ba.go index 23ae315..fc7fa87 100644 --- a/examples/binapi/ip_types/ip_types.ba.go +++ b/examples/binapi/ip_types/ip_types.ba.go @@ -19,9 +19,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -270,6 +273,38 @@ type Address struct { func (*Address) GetTypeName() string { return "address" } +func ParseAddress(ip string) (Address, error) { + var address Address + netIP := net.ParseIP(ip) + if netIP == nil { + return address, fmt.Errorf("invalid address: %s", ip) + } + if ip4 := netIP.To4(); ip4 == nil { + address.Af = ADDRESS_IP6 + var ip6addr IP6Address + copy(ip6addr[:], netIP.To16()) + address.Un.SetIP6(ip6addr) + } else { + address.Af = ADDRESS_IP4 + var ip4addr IP4Address + copy(ip4addr[:], netIP.To4()) + address.Un.SetIP4(ip4addr) + } + return address, nil +} + +func (a *Address) ToString() string { + var ip string + if a.Af == ADDRESS_IP6 { + ip6Address := a.Un.GetIP6() + ip = net.IP(ip6Address[:]).To16().String() + } else { + ip4Address := a.Un.GetIP4() + ip = net.IP(ip4Address[:]).To4().String() + } + return ip +} + // IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` @@ -304,6 +339,39 @@ type Prefix struct { func (*Prefix) GetTypeName() string { return "prefix" } +func ParsePrefix(ip string) (prefix Prefix, err error) { + hasPrefix := strings.Contains(ip, "/") + if hasPrefix { + netIP, network, err := net.ParseCIDR(ip) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) + } + } else { + netIP := net.ParseIP(ip) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if netIP.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) + } + } + return prefix, nil +} + +func (p *Prefix) ToString() string { + ip := p.Address.ToString() + return ip + "/" + strconv.Itoa(int(p.Len)) +} + // PrefixMatcher represents VPP binary API type 'prefix_matcher'. type PrefixMatcher struct { Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` @@ -360,6 +428,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/memclnt/memclnt.ba.go b/examples/binapi/memclnt/memclnt.ba.go index d57cc6c..7dba64e 100644 --- a/examples/binapi/memclnt/memclnt.ba.go +++ b/examples/binapi/memclnt/memclnt.ba.go @@ -17,9 +17,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -1445,6 +1448,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/memif/memif.ba.go b/examples/binapi/memif/memif.ba.go index 4fe2f75..bea3160 100644 --- a/examples/binapi/memif/memif.ba.go +++ b/examples/binapi/memif/memif.ba.go @@ -18,9 +18,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -44,12 +47,6 @@ const ( VersionCrc = 0x1a1c95b8 ) -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type LinkDuplex = interface_types.LinkDuplex - // MemifMode represents VPP binary API enum 'memif_mode'. type MemifMode uint32 @@ -107,17 +104,22 @@ func (x MemifRole) String() string { return "MemifRole(" + strconv.Itoa(int(x)) + ")" } -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - -type SubIfFlags = interface_types.SubIfFlags - -type InterfaceIndex = interface_types.InterfaceIndex - // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} + +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} + // MemifCreate represents VPP binary API message 'memif_create'. type MemifCreate struct { Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` @@ -269,8 +271,8 @@ func (m *MemifCreate) Unmarshal(tmp []byte) error { // MemifCreateReply represents VPP binary API message 'memif_create_reply'. type MemifCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + 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 *MemifCreateReply) Reset() { *m = MemifCreateReply{} } @@ -317,14 +319,14 @@ func (m *MemifCreateReply) Unmarshal(tmp []byte) error { m.Retval = int32(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } // MemifDelete represents VPP binary API message 'memif_delete'. type MemifDelete struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MemifDelete) Reset() { *m = MemifDelete{} } @@ -363,7 +365,7 @@ func (m *MemifDelete) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -416,17 +418,17 @@ func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { // MemifDetails represents VPP binary API message 'memif_details'. type MemifDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` - Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` - ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` - BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` } func (m *MemifDetails) Reset() { *m = MemifDetails{} } @@ -523,7 +525,7 @@ func (m *MemifDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.HwAddr for i := 0; i < len(m.HwAddr); i++ { @@ -552,7 +554,7 @@ func (m *MemifDetails) Unmarshal(tmp []byte) error { m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) pos += 2 // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.IfName { @@ -847,6 +849,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/sr/sr.ba.go b/examples/binapi/sr/sr.ba.go index 336cfe2..1803585 100644 --- a/examples/binapi/sr/sr.ba.go +++ b/examples/binapi/sr/sr.ba.go @@ -20,9 +20,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -47,24 +50,6 @@ const ( VersionCrc = 0xd85c77ca ) -type AddressFamily = ip_types.AddressFamily - -type IfStatusFlags = interface_types.IfStatusFlags - -type IfType = interface_types.IfType - -type IPDscp = ip_types.IPDscp - -type IPEcn = ip_types.IPEcn - -type IPProto = ip_types.IPProto - -type LinkDuplex = interface_types.LinkDuplex - -type MtuProto = interface_types.MtuProto - -type RxMode = interface_types.RxMode - // SrBehavior represents VPP binary API enum 'sr_behavior'. type SrBehavior uint8 @@ -179,53 +164,25 @@ func (x SrSteer) String() string { return "SrSteer(" + strconv.Itoa(int(x)) + ")" } -type SubIfFlags = interface_types.SubIfFlags - -type AddressWithPrefix = ip_types.AddressWithPrefix - -type InterfaceIndex = interface_types.InterfaceIndex - -type IP4Address = ip_types.IP4Address - -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix - -type IP6Address = ip_types.IP6Address - -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix - -type Address = ip_types.Address - -type IP4Prefix = ip_types.IP4Prefix - -type IP6Prefix = ip_types.IP6Prefix - -type Mprefix = ip_types.Mprefix - -type Prefix = ip_types.Prefix - -type PrefixMatcher = ip_types.PrefixMatcher - // 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]IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty" struc:"[16]IP6Address"` + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty" struc:"[16]ip_types.IP6Address"` } func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } -type AddressUnion = ip_types.AddressUnion - // SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. type SrLocalsidAddDel struct { - IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` - Localsid IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"` - EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` - Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" 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"` - NhAddr Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` + IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` + Localsid ip_types.IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" 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"` + NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` } func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } @@ -330,7 +287,7 @@ func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { m.Behavior = SrBehavior(tmp[pos]) pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.VlanIndex m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -340,7 +297,7 @@ func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { pos += 4 // field[1] m.NhAddr // field[2] m.NhAddr.Af - m.NhAddr.Af = AddressFamily(tmp[pos]) + m.NhAddr.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[2] m.NhAddr.Un copy(m.NhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -396,13 +353,13 @@ func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { // SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. type SrLocalsidsDetails struct { - Addr IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` - EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` - Behavior SrBehavior `binapi:"sr_behavior,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"` - XconnectNhAddr Address `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"` - XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` + Addr ip_types.IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` + EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` + Behavior SrBehavior `binapi:"sr_behavior,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"` + XconnectNhAddr ip_types.Address `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` } func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } @@ -504,7 +461,7 @@ func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { pos += 4 // field[1] m.XconnectNhAddr // field[2] m.XconnectNhAddr.Af - m.XconnectNhAddr.Af = AddressFamily(tmp[pos]) + m.XconnectNhAddr.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[2] m.XconnectNhAddr.Un copy(m.XconnectNhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -553,12 +510,12 @@ func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { // SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. type SrPoliciesDetails struct { - Bsid IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` - IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` - IsEncap bool `binapi:"bool,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"` + Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` + IsEncap bool `binapi:"bool,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{} } @@ -594,7 +551,7 @@ func (m *SrPoliciesDetails) Size() int { size += 4 // field[2] s1.Sids for j2 := 0; j2 < 16; j2++ { - var s2 IP6Address + var s2 ip_types.IP6Address _ = s2 if j2 < len(s1.Sids) { s2 = s1.Sids[j2] @@ -654,7 +611,7 @@ func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] v1.Sids for j2 := 0; j2 < 16; j2++ { - var v2 IP6Address + var v2 ip_types.IP6Address if j2 < len(v1.Sids) { v2 = v1.Sids[j2] } @@ -750,12 +707,12 @@ func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { // SrPolicyAdd represents VPP binary API message 'sr_policy_add'. type SrPolicyAdd struct { - BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` - IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` + IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,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{} } @@ -785,7 +742,7 @@ func (m *SrPolicyAdd) Size() int { size += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var s2 IP6Address + var s2 ip_types.IP6Address _ = s2 if j2 < len(m.Sids.Sids) { s2 = m.Sids.Sids[j2] @@ -839,7 +796,7 @@ func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var v2 IP6Address + var v2 ip_types.IP6Address if j2 < len(m.Sids.Sids) { v2 = m.Sids.Sids[j2] } @@ -941,8 +898,8 @@ func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { // SrPolicyDel represents VPP binary API message 'sr_policy_del'. type SrPolicyDel struct { - BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + BsidAddr ip_types.IP6Address `binapi:"ip6_address,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{} } @@ -1050,13 +1007,13 @@ func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { // SrPolicyMod represents VPP binary API message 'sr_policy_mod'. type SrPolicyMod struct { - BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - 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 SrPolicyOp `binapi:"sr_policy_op,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"` + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + 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 SrPolicyOp `binapi:"sr_policy_op,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{} } @@ -1088,7 +1045,7 @@ func (m *SrPolicyMod) Size() int { size += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var s2 IP6Address + var s2 ip_types.IP6Address _ = s2 if j2 < len(m.Sids.Sids) { s2 = m.Sids.Sids[j2] @@ -1141,7 +1098,7 @@ func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { pos += 4 // field[2] m.Sids.Sids for j2 := 0; j2 < 16; j2++ { - var v2 IP6Address + var v2 ip_types.IP6Address if j2 < len(m.Sids.Sids) { v2 = m.Sids.Sids[j2] } @@ -1338,7 +1295,7 @@ func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { // SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. type SrSetEncapSource struct { - EncapsSource IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"` + EncapsSource ip_types.IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"` } func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } @@ -1438,13 +1395,13 @@ func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { // SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. type SrSteeringAddDel struct { - IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` - BsidAddr IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` + IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` + BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` } func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } @@ -1551,7 +1508,7 @@ func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -1560,7 +1517,7 @@ func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { m.Prefix.Len = uint8(tmp[pos]) pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.TrafficType m.TrafficType = SrSteer(tmp[pos]) @@ -1616,11 +1573,11 @@ func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { // SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. type SrSteeringPolDetails struct { - TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Bsid IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` + TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` } func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } @@ -1707,7 +1664,7 @@ func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { // field[1] m.Prefix // field[2] m.Prefix.Address // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(tmp[pos]) + m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) pos += 1 // field[3] m.Prefix.Address.Un copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) @@ -1716,7 +1673,7 @@ func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { m.Prefix.Len = uint8(tmp[pos]) pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Bsid for i := 0; i < len(m.Bsid); i++ { @@ -1819,6 +1776,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go index b682d9f..411a9f4 100644 --- a/examples/binapi/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -19,9 +19,12 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" @@ -1654,6 +1657,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf -- cgit 1.2.3-korg