aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Lavor <vlavor@cisco.com>2020-07-01 12:18:54 +0200
committerVladimir Lavor <vlavor@cisco.com>2020-07-02 15:23:07 +0200
commitc7ae74a95d1bd6fefcbb061f5f045c60c11e32fc (patch)
treef04013af76e1e3c38266cc2606312cd0c9f443d3
parentdf67791c6ffc96331f75aec7d3addfe2efca7739 (diff)
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 <vlavor@cisco.com>
-rw-r--r--binapigen/generate.go138
-rw-r--r--binapigen/generate_test.go134
-rw-r--r--binapigen/types.go12
-rw-r--r--codec/msg_codec_test.go3
-rw-r--r--core/channel_test.go8
-rw-r--r--core/connection_test.go5
-rw-r--r--examples/binapi/acl/acl.ba.go189
-rw-r--r--examples/binapi/af_packet/af_packet.ba.go51
-rw-r--r--examples/binapi/fib_types/fib_types.ba.go14
-rw-r--r--examples/binapi/interface_types/interface_types.ba.go6
-rw-r--r--examples/binapi/interfaces/interfaces.ba.go331
-rw-r--r--examples/binapi/ip/ip.ba.go323
-rw-r--r--examples/binapi/ip_types/ip_types.ba.go71
-rw-r--r--examples/binapi/memclnt/memclnt.ba.go6
-rw-r--r--examples/binapi/memif/memif.ba.go69
-rw-r--r--examples/binapi/sr/sr.ba.go182
-rw-r--r--examples/binapi/vpe/vpe.ba.go6
-rw-r--r--examples/simple-client/simple_client.go16
-rw-r--r--examples/union-example/union_example.go74
19 files changed, 951 insertions, 687 deletions
diff --git a/binapigen/generate.go b/binapigen/generate.go
index 8a34445..d35427f 100644
--- a/binapigen/generate.go
+++ b/binapigen/generate.go
@@ -118,9 +118,12 @@ func generateImports(ctx *GenFile, w io.Writer) {
fmt.Fprintln(w, ` "bytes"`)
fmt.Fprintln(w, ` "context"`)
fmt.Fprintln(w, ` "encoding/binary"`)
+ fmt.Fprintln(w, ` "fmt"`)
fmt.Fprintln(w, ` "io"`)
fmt.Fprintln(w, ` "math"`)
+ fmt.Fprintln(w, ` "net"`)
fmt.Fprintln(w, ` "strconv"`)
+ fmt.Fprintln(w, ` "strings"`)
fmt.Fprintln(w)
fmt.Fprintf(w, "\tapi \"%s\"\n", "git.fd.io/govpp.git/api")
fmt.Fprintf(w, "\tcodec \"%s\"\n", "git.fd.io/govpp.git/codec")
@@ -164,7 +167,9 @@ func generateTypes(ctx *GenFile, w io.Writer) {
if len(ctx.file.Enums) > 0 {
for _, enum := range ctx.file.Enums {
if imp, ok := ctx.file.imports[enum.Name]; ok {
- generateImportedAlias(ctx, w, enum.GoName, imp)
+ if strings.HasSuffix(ctx.file.Name, "_types") {
+ generateImportedAlias(ctx, w, enum.GoName, imp)
+ }
continue
}
generateEnum(ctx, w, enum)
@@ -175,7 +180,9 @@ func generateTypes(ctx *GenFile, w io.Writer) {
if len(ctx.file.Aliases) > 0 {
for _, alias := range ctx.file.Aliases {
if imp, ok := ctx.file.imports[alias.Name]; ok {
- generateImportedAlias(ctx, w, alias.GoName, imp)
+ if strings.HasSuffix(ctx.file.Name, "_types") {
+ generateImportedAlias(ctx, w, alias.GoName, imp)
+ }
continue
}
generateAlias(ctx, w, alias)
@@ -186,7 +193,9 @@ func generateTypes(ctx *GenFile, w io.Writer) {
if len(ctx.file.Structs) > 0 {
for _, typ := range ctx.file.Structs {
if imp, ok := ctx.file.imports[typ.Name]; ok {
- generateImportedAlias(ctx, w, typ.GoName, imp)
+ if strings.HasSuffix(ctx.file.Name, "_types") {
+ generateImportedAlias(ctx, w, typ.GoName, imp)
+ }
continue
}
generateStruct(ctx, w, typ)
@@ -197,7 +206,9 @@ func generateTypes(ctx *GenFile, w io.Writer) {
if len(ctx.file.Unions) > 0 {
for _, union := range ctx.file.Unions {
if imp, ok := ctx.file.imports[union.Name]; ok {
- generateImportedAlias(ctx, w, union.GoName, imp)
+ if strings.HasSuffix(ctx.file.Name, "_types") {
+ generateImportedAlias(ctx, w, union.GoName, imp)
+ }
continue
}
generateUnion(ctx, w, union)
@@ -245,9 +256,12 @@ func generateImportRefs(ctx *GenFile, w io.Writer) {
fmt.Fprintf(w, "var _ = context.Background\n")
fmt.Fprintf(w, "var _ = io.Copy\n")
fmt.Fprintf(w, "var _ = strconv.Itoa\n")
+ fmt.Fprintf(w, "var _ = strings.Contains\n")
fmt.Fprintf(w, "var _ = struc.Pack\n")
fmt.Fprintf(w, "var _ = binary.BigEndian\n")
fmt.Fprintf(w, "var _ = math.Float32bits\n")
+ fmt.Fprintf(w, "var _ = net.ParseIP\n")
+ fmt.Fprintf(w, "var _ = fmt.Errorf\n")
}
func generateComment(ctx *GenFile, w io.Writer, goName string, vppName string, objKind string) {
@@ -325,6 +339,13 @@ func generateAlias(ctx *GenFile, w io.Writer, alias *Alias) {
dataType := convertToGoType(ctx.file, alias.Type)
fmt.Fprintf(w, "%s\n", dataType)
+ // generate alias-specific methods
+ switch alias.Name {
+ case "mac_address":
+ fmt.Fprintln(w)
+ generateMacAddressConversion(w, name)
+ }
+
fmt.Fprintln(w)
}
@@ -356,6 +377,16 @@ func generateStruct(ctx *GenFile, w io.Writer, typ *Struct) {
// generate name getter
generateTypeNameGetter(w, name, typ.Name)
+ // generate type-specific methods
+ switch typ.Name {
+ case "address":
+ fmt.Fprintln(w)
+ generateIPAddressConversion(w, name)
+ case "prefix":
+ fmt.Fprintln(w)
+ generatePrefixConversion(w, name)
+ }
+
fmt.Fprintln(w)
}
@@ -1198,6 +1229,105 @@ func generateTypeNameGetter(w io.Writer, structName, msgName string) {
fmt.Fprintf(w, "func (*%s) GetTypeName() string { return %q }\n", structName, msgName)
}
+func generateIPAddressConversion(w io.Writer, structName string) {
+ f1 := func(ipVer, ipVerExt int) string {
+ return fmt.Sprintf(`address.Af = ADDRESS_IP%[1]d
+ var ip%[1]daddr IP%[1]dAddress
+ copy(ip%[1]daddr[:], netIP.To%[2]d())
+ address.Un.SetIP%[1]d(ip%[1]daddr)`, ipVer, ipVerExt)
+ }
+ f2 := func(ipVer, ipVerExt int) string {
+ return fmt.Sprintf("ip%[1]dAddress := a.Un.GetIP%[1]d()\nip = net.IP(ip%[1]dAddress[:]).To%[2]d().String()",
+ ipVer, ipVerExt)
+ }
+ // IP to Address
+ fmt.Fprintf(w, `func ParseAddress(ip string) (%[1]s, error) {
+ var address %[1]s
+ netIP := net.ParseIP(ip)
+ if netIP == nil {
+ return address, fmt.Errorf("invalid address: %[2]s", ip)
+ }
+ if ip4 := netIP.To4(); ip4 == nil {
+ %[3]s
+ } else {
+ %[4]s
+ }
+ return address, nil
+}
+`, structName, "%s", f1(6, 16), f1(4, 4))
+ fmt.Fprintln(w)
+
+ // Address to IP
+ fmt.Fprintln(w)
+ fmt.Fprintf(w, `func (a *%[1]s) ToString() string {
+ var ip string
+ if a.Af == ADDRESS_IP6 {
+ %[2]s
+ } else {
+ %[3]s
+ }
+ return ip
+}`, structName, f2(6, 16), f2(4, 4))
+}
+
+func generatePrefixConversion(w io.Writer, structName string) {
+ fErr := func() string {
+ return fmt.Sprintf(`if err != nil {
+ return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
+ }`, "%s", "%v")
+ }
+
+ // IP to Prefix
+ fmt.Fprintf(w, `func ParsePrefix(ip string) (prefix %[1]s, err error) {
+ hasPrefix := strings.Contains(ip, "/")
+ if hasPrefix {
+ netIP, network, err := net.ParseCIDR(ip)
+ %[2]s
+ maskSize, _ := network.Mask.Size()
+ prefix.Len = byte(maskSize)
+ prefix.Address, err = ParseAddress(netIP.String())
+ %[2]s
+ } 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())
+ %[2]s
+ }
+ return prefix, nil
+}`, structName, fErr(), nil)
+ fmt.Fprintln(w)
+
+ // Prefix to IP
+ fmt.Fprintln(w)
+ fmt.Fprintf(w, `func (p *%[1]s) ToString() string {
+ ip := p.Address.ToString()
+ return ip + "/" + strconv.Itoa(int(p.Len))
+ }`, structName)
+}
+
+func generateMacAddressConversion(w io.Writer, structName string) {
+ // string to MAC
+ fmt.Fprintf(w, `func ParseMAC(mac string) (parsed %[1]s, err error) {
+ var hw net.HardwareAddr
+ if hw, err = net.ParseMAC(mac); err != nil {
+ return
+ }
+ copy(parsed[:], hw[:])
+ return
+}`, structName)
+ fmt.Fprintln(w)
+
+ // MAC to string
+ fmt.Fprintln(w)
+ fmt.Fprintf(w, `func (m *%[1]s) ToString() string {
+ return net.HardwareAddr(m[:]).String()
+ }`, structName)
+}
+
func generateCrcGetter(w io.Writer, structName, crc string) {
crc = strings.TrimPrefix(crc, "0x")
fmt.Fprintf(w, "func (*%s) GetCrcString() string { return %q }\n", structName, crc)
diff --git a/binapigen/generate_test.go b/binapigen/generate_test.go
index aab62cd..46cc5eb 100644
--- a/binapigen/generate_test.go
+++ b/binapigen/generate_test.go
@@ -15,7 +15,10 @@
package binapigen
import (
+ "git.fd.io/govpp.git/examples/binapi/interfaces"
+ "git.fd.io/govpp.git/examples/binapi/ip_types"
"os"
+ "strings"
"testing"
. "github.com/onsi/gomega"
@@ -97,6 +100,137 @@ func TestGenerateFromFileGeneratePackageError(t *testing.T) {
Expect(err).Should(HaveOccurred())
}
+func TestGeneratedParseAddress(t *testing.T) {
+ RegisterTestingT(t)
+
+ var data = []struct {
+ input string
+ result ip_types.Address
+ }{
+ {"192.168.0.1", ip_types.Address{
+ Af: ip_types.ADDRESS_IP4,
+ Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}),
+ }},
+ {"aac1:0:ab45::", ip_types.Address{
+ Af: ip_types.ADDRESS_IP6,
+ Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ }},
+ }
+
+ for _, entry := range data {
+ t.Run(entry.input, func(t *testing.T) {
+ parsedAddress, err := ip_types.ParseAddress(entry.input)
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(parsedAddress).To(Equal(entry.result))
+
+ originAddress := parsedAddress.ToString()
+ Expect(originAddress).To(Equal(entry.input))
+ })
+ }
+}
+
+func TestGeneratedParseAddressError(t *testing.T) {
+ RegisterTestingT(t)
+
+ _, err := ip_types.ParseAddress("malformed_ip")
+ Expect(err).Should(HaveOccurred())
+}
+
+func TestGeneratedParsePrefix(t *testing.T) {
+ RegisterTestingT(t)
+
+ var data = []struct {
+ input string
+ result ip_types.Prefix
+ }{
+ {"192.168.0.1/24", ip_types.Prefix{
+ Address: ip_types.Address{
+ Af: ip_types.ADDRESS_IP4,
+ Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}),
+ },
+ Len: 24,
+ }},
+ {"192.168.0.1", ip_types.Prefix{
+ Address: ip_types.Address{
+ Af: ip_types.ADDRESS_IP4,
+ Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}),
+ },
+ Len: 32,
+ }},
+ {"aac1:0:ab45::/96", ip_types.Prefix{
+ Address: ip_types.Address{
+ Af: ip_types.ADDRESS_IP6,
+ Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ },
+ Len: 96,
+ }},
+ {"aac1:0:ab45::", ip_types.Prefix{
+ Address: ip_types.Address{
+ Af: ip_types.ADDRESS_IP6,
+ Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}),
+ },
+ Len: 128,
+ }},
+ }
+
+ for _, entry := range data {
+ t.Run(entry.input, func(t *testing.T) {
+ parsedAddress, err := ip_types.ParsePrefix(entry.input)
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(parsedAddress).To(Equal(entry.result))
+
+ // Parsed IP without prefix receives a default one
+ // so the input data must be adjusted
+ if entry.result.Address.Af == ip_types.ADDRESS_IP4 && !strings.Contains(entry.input, "/") {
+ entry.input = entry.input + "/32"
+ }
+ if entry.result.Address.Af == ip_types.ADDRESS_IP6 && !strings.Contains(entry.input, "/") {
+ entry.input = entry.input + "/128"
+ }
+ originAddress := parsedAddress.ToString()
+ Expect(originAddress).To(Equal(entry.input))
+ })
+ }
+}
+
+func TestGeneratedParsePrefixError(t *testing.T) {
+ RegisterTestingT(t)
+
+ _, err := ip_types.ParsePrefix("malformed_ip")
+ Expect(err).Should(HaveOccurred())
+}
+
+func TestGeneratedParseMAC(t *testing.T) {
+ RegisterTestingT(t)
+
+ var data = []struct {
+ input string
+ result interfaces.MacAddress
+ }{
+ {"b7:b9:bb:a1:5c:af", interfaces.MacAddress{183, 185, 187, 161, 92, 175}},
+ {"47:4b:c7:3e:06:c8", interfaces.MacAddress{71, 75, 199, 62, 6, 200}},
+ {"a7:cc:9f:10:18:e3", interfaces.MacAddress{167, 204, 159, 16, 24, 227}},
+ }
+
+ for _, entry := range data {
+ t.Run(entry.input, func(t *testing.T) {
+ parsedMac, err := interfaces.ParseMAC(entry.input)
+ Expect(err).ShouldNot(HaveOccurred())
+ Expect(parsedMac).To(Equal(entry.result))
+
+ originAddress := parsedMac.ToString()
+ Expect(originAddress).To(Equal(entry.input))
+ })
+ }
+}
+
+func TestGeneratedParseMACError(t *testing.T) {
+ RegisterTestingT(t)
+
+ _, err := interfaces.ParseMAC("malformed_mac")
+ Expect(err).Should(HaveOccurred())
+}
+
/*func TestGetContext(t *testing.T) {
RegisterTestingT(t)
outDir := "test_output_directory"
diff --git a/binapigen/types.go b/binapigen/types.go
index 0dbbeb1..96ae870 100644
--- a/binapigen/types.go
+++ b/binapigen/types.go
@@ -15,6 +15,7 @@
package binapigen
import (
+ "fmt"
"strings"
"github.com/sirupsen/logrus"
@@ -213,14 +214,23 @@ func getActualType(file *File, typ string) (actual string) {
return typ
}
-// convertToGoType translates the VPP binary API type into Go type
+// convertToGoType translates the VPP binary API type into Go type.
+// Imported types are with import prefix.
func convertToGoType(file *File, binapiType string) (typ string) {
if t, ok := binapiTypes[binapiType]; ok {
// basic types
typ = t
} else if r, ok := file.refmap[binapiType]; ok {
// specific types (enums/types/unions)
+ var prefix string
typ = camelCaseName(r)
+ // look in imports using name and type name eventually
+ if imp, ok := file.imports[typ]; ok {
+ prefix = fmt.Sprintf("%s.", imp)
+ } else if imp, ok := file.imports[fromApiType(binapiType)]; ok {
+ prefix = fmt.Sprintf("%s.", imp)
+ }
+ typ = fmt.Sprintf("%s%s", prefix, typ)
} else {
switch binapiType {
case "bool", "string":
diff --git a/codec/msg_codec_test.go b/codec/msg_codec_test.go
index 7f06f0f..c950fd8 100644
--- a/codec/msg_codec_test.go
+++ b/codec/msg_codec_test.go
@@ -2,6 +2,7 @@ package codec_test
import (
"bytes"
+ "git.fd.io/govpp.git/examples/binapi/ip_types"
"testing"
"git.fd.io/govpp.git/api"
@@ -50,7 +51,7 @@ func TestEncode(t *testing.T) {
Route: ip.IPRoute{
TableID: 0,
StatsIndex: 0,
- Prefix: ip.Prefix{},
+ Prefix: ip_types.Prefix{},
NPaths: 0,
},
},
diff --git a/core/channel_test.go b/core/channel_test.go
index 6775519..d06e2b3 100644
--- a/core/channel_test.go
+++ b/core/channel_test.go
@@ -129,7 +129,7 @@ func TestMultiRequestReplySwInterfaceMemifDump(t *testing.T) {
var msgs []api.Message
for i := 1; i <= 10; i++ {
msgs = append(msgs, &memif.MemifDetails{
- SwIfIndex: interfaces.InterfaceIndex(i),
+ SwIfIndex: interface_types.InterfaceIndex(i),
})
}
ctx.mockVpp.MockReply(msgs...)
@@ -288,7 +288,7 @@ func TestMultiRequestDouble(t *testing.T) {
for i := 1; i <= 3; i++ {
msgs = append(msgs, mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: interfaces.InterfaceIndex(i),
+ SwIfIndex: interface_types.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
@@ -301,7 +301,7 @@ func TestMultiRequestDouble(t *testing.T) {
msgs = append(msgs,
mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: interfaces.InterfaceIndex(i),
+ SwIfIndex: interface_types.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
@@ -427,7 +427,7 @@ func TestReceiveReplyAfterTimeoutMultiRequest(t *testing.T) {
for i := 1; i <= 3; i++ {
msgs = append(msgs, mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: interfaces.InterfaceIndex(i),
+ SwIfIndex: interface_types.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
diff --git a/core/connection_test.go b/core/connection_test.go
index 643d4a3..453bbce 100644
--- a/core/connection_test.go
+++ b/core/connection_test.go
@@ -15,6 +15,7 @@
package core_test
import (
+ "git.fd.io/govpp.git/examples/binapi/interface_types"
"testing"
. "github.com/onsi/gomega"
@@ -161,7 +162,7 @@ func TestMultiRequestsWithSequenceNumbers(t *testing.T) {
var msgs []api.Message
for i := 0; i < 10; i++ {
- msgs = append(msgs, &interfaces.SwInterfaceDetails{SwIfIndex: interfaces.InterfaceIndex(i)})
+ msgs = append(msgs, &interfaces.SwInterfaceDetails{SwIfIndex: interface_types.InterfaceIndex(i)})
}
ctx.mockVpp.MockReply(msgs...)
ctx.mockVpp.MockReply(&vpe.ControlPingReply{})
@@ -280,7 +281,7 @@ func TestMultiRequestsWithErrors(t *testing.T) {
}
for i := 0; i < 10; i++ {
msgs = append(msgs, mock.MsgWithContext{
- Msg: &interfaces.SwInterfaceDetails{SwIfIndex: interfaces.InterfaceIndex(i)},
+ Msg: &interfaces.SwInterfaceDetails{SwIfIndex: interface_types.InterfaceIndex(i)},
SeqNum: 1,
Multipart: true,
})
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
diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go
index 803b2e1..7aeaa0b 100644
--- a/examples/simple-client/simple_client.go
+++ b/examples/simple-client/simple_client.go
@@ -119,7 +119,7 @@ func vppVersion(ch api.Channel) {
}
// createLoopback sends request to create loopback interface.
-func createLoopback(ch api.Channel) interfaces.InterfaceIndex {
+func createLoopback(ch api.Channel) interface_types.InterfaceIndex {
fmt.Println("Creating loopback interface")
req := &interfaces.CreateLoopback{}
@@ -163,16 +163,16 @@ func interfaceDump(ch api.Channel) {
}
// addIPAddress sends request to add IP address to interface.
-func addIPAddress(ch api.Channel, index interfaces.InterfaceIndex) {
+func addIPAddress(ch api.Channel, index interface_types.InterfaceIndex) {
fmt.Printf("Adding IP address to interface to interface index %d\n", index)
req := &interfaces.SwInterfaceAddDelAddress{
SwIfIndex: index,
IsAdd: true,
- Prefix: interfaces.AddressWithPrefix{
- Address: interfaces.Address{
+ Prefix: ip_types.AddressWithPrefix{
+ Address: ip_types.Address{
Af: ip_types.ADDRESS_IP4,
- Un: ip_types.AddressUnionIP4(interfaces.IP4Address{10, 10, 0, uint8(index)}),
+ Un: ip_types.AddressUnionIP4(ip_types.IP4Address{10, 10, 0, uint8(index)}),
},
Len: 32,
},
@@ -189,11 +189,11 @@ func addIPAddress(ch api.Channel, index interfaces.InterfaceIndex) {
fmt.Println()
}
-func ipAddressDump(ch api.Channel, index interfaces.InterfaceIndex) {
+func ipAddressDump(ch api.Channel, index interface_types.InterfaceIndex) {
fmt.Printf("Dumping IP addresses for interface index %d\n", index)
req := &ip.IPAddressDump{
- SwIfIndex: ip.InterfaceIndex(index),
+ SwIfIndex: index,
}
reqCtx := ch.SendMultiRequest(req)
@@ -217,7 +217,7 @@ func ipAddressDump(ch api.Channel, index interfaces.InterfaceIndex) {
// interfaceNotifications shows the usage of notification API. Note that for notifications,
// you are supposed to create your own Go channel with your preferred buffer size. If the channel's
// buffer is full, the notifications will not be delivered into it.
-func interfaceNotifications(ch api.Channel, index interfaces.InterfaceIndex) {
+func interfaceNotifications(ch api.Channel, index interface_types.InterfaceIndex) {
fmt.Printf("Subscribing to notificaiton events for interface index %d\n", index)
notifChan := make(chan api.Message, 100)
diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go
index 6d4619d..cdba2fa 100644
--- a/examples/union-example/union_example.go
+++ b/examples/union-example/union_example.go
@@ -17,13 +17,12 @@ package main
import (
"fmt"
- "log"
- "net"
- "reflect"
-
"git.fd.io/govpp.git/codec"
+ "git.fd.io/govpp.git/examples/binapi/interfaces"
"git.fd.io/govpp.git/examples/binapi/ip"
"git.fd.io/govpp.git/examples/binapi/ip_types"
+ "log"
+ "reflect"
)
func init() {
@@ -33,26 +32,35 @@ func init() {
func main() {
constructExample()
- encodingExample()
+ encodingExampleIP()
// convert IP from string form into Address type containing union
convertIP("10.10.1.1")
convertIP("ff80::1")
+
+ // convert IP from string form into Prefix type
+ convertIPPrefix("20.10.1.1/24")
+ convertIPPrefix("21.10.1.1")
+ convertIPPrefix("ff90::1/64")
+ convertIPPrefix("ff91::1")
+
+ // convert MAC address from string into MacAddress
+ convertToMacAddress("00:10:ab:4f:00:01")
}
func constructExample() {
var union ip_types.AddressUnion
// create AddressUnion with AdressUnionXXX constructors
- union = ip_types.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10})
- union = ip_types.AddressUnionIP6(ip.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02})
+ union = ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 1, 10})
+ union = ip_types.AddressUnionIP6(ip_types.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02})
// set AddressUnion with SetXXX methods
- union.SetIP4(ip.IP4Address{192, 168, 1, 10})
- union.SetIP6(ip.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02})
+ union.SetIP4(ip_types.IP4Address{192, 168, 1, 10})
+ union.SetIP6(ip_types.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02})
}
-func encodingExample() {
+func encodingExampleIP() {
var c = codec.DefaultCodec
// encode this message
@@ -60,7 +68,7 @@ func encodingExample() {
Punt: ip.PuntRedirect{
Nh: ip_types.Address{
Af: ip_types.ADDRESS_IP4,
- Un: ip_types.AddressUnionIP4(ip.IP4Address{192, 168, 1, 10}),
+ Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 1, 10}),
},
},
IsAdd: true,
@@ -86,29 +94,37 @@ func encodingExample() {
}
func convertIP(ip string) {
- addr, err := ipToAddress(ip)
+ addr, err := ip_types.ParseAddress(ip)
if err != nil {
- log.Printf("error converting IP: %v", err)
+ log.Printf("error converting IP to Address: %v", err)
return
}
fmt.Printf("converted IP %q to: %+v\n", ip, addr)
+
+ ipStr := addr.ToString()
+ fmt.Printf("Address converted back to string IP %+v to: %q\n", addr, ipStr)
}
-func ipToAddress(ipstr string) (addr ip.Address, err error) {
- netIP := net.ParseIP(ipstr)
- if netIP == nil {
- return ip.Address{}, fmt.Errorf("invalid IP: %q", ipstr)
- }
- if ip4 := netIP.To4(); ip4 == nil {
- addr.Af = ip_types.ADDRESS_IP6
- var ip6addr ip.IP6Address
- copy(ip6addr[:], netIP.To16())
- addr.Un.SetIP6(ip6addr)
- } else {
- addr.Af = ip_types.ADDRESS_IP4
- var ip4addr ip.IP4Address
- copy(ip4addr[:], ip4.To4())
- addr.Un.SetIP4(ip4addr)
+func convertIPPrefix(ip string) {
+ prefix, err := ip_types.ParsePrefix(ip)
+ if err != nil {
+ log.Printf("error converting prefix to IP4Prefix: %v", err)
+ return
}
- return
+ fmt.Printf("converted prefix %q to: %+v\n", ip, prefix)
+
+ ipStr := prefix.ToString()
+ fmt.Printf("IP4Prefix converted back to string prefix %+v to: %q\n", prefix, ipStr)
}
+
+func convertToMacAddress(mac string) {
+ parsedMac, err := interfaces.ParseMAC(mac)
+ if err != nil {
+ log.Printf("error converting MAC to MacAddress: %v", err)
+ return
+ }
+ fmt.Printf("converted prefix %q to: %+v\n", mac, parsedMac)
+
+ macStr := parsedMac.ToString()
+ fmt.Printf("MacAddress converted back to string %+v to: %q\n", parsedMac, macStr)
+} \ No newline at end of file