summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-03-18 10:18:03 +0100
committerOndrej Fabry <ofabry@cisco.com>2020-03-18 10:18:03 +0100
commit9f27eeff53ee501b8641595baa7cbc2f0014a68c (patch)
tree205c7983c791eaf32789af39105cc8fa7cee221f /core
parentd4d3b9c6fa67fe454f8d8adc7502b3b645ecab10 (diff)
Fix import path in examples/binapiv0.3.1
Change-Id: I6af1ae2778b73f37be09c64a2948417e576f02ab Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'core')
-rw-r--r--core/channel_test.go23
-rw-r--r--core/connection_test.go11
2 files changed, 18 insertions, 16 deletions
diff --git a/core/channel_test.go b/core/channel_test.go
index 10416ef..b8d07b5 100644
--- a/core/channel_test.go
+++ b/core/channel_test.go
@@ -22,6 +22,7 @@ import (
"git.fd.io/govpp.git/adapter/mock"
"git.fd.io/govpp.git/api"
+ "git.fd.io/govpp.git/examples/binapi/interface_types"
"git.fd.io/govpp.git/examples/binapi/interfaces"
"git.fd.io/govpp.git/examples/binapi/memif"
"git.fd.io/govpp.git/examples/binapi/vpe"
@@ -128,7 +129,7 @@ func TestMultiRequestReplySwInterfaceMemifDump(t *testing.T) {
var msgs []api.Message
for i := 1; i <= 10; i++ {
msgs = append(msgs, &memif.MemifDetails{
- SwIfIndex: uint32(i),
+ SwIfIndex: interfaces.InterfaceIndex(i),
})
}
ctx.mockVpp.MockReply(msgs...)
@@ -159,8 +160,8 @@ func TestNotificationEvent(t *testing.T) {
// mock event and force its delivery
ctx.mockVpp.MockReply(&interfaces.SwInterfaceEvent{
- SwIfIndex: 2,
- LinkUpDown: 1,
+ SwIfIndex: 2,
+ Flags: interface_types.IF_STATUS_API_FLAG_LINK_UP,
})
ctx.mockVpp.SendMsg(0, []byte(""))
@@ -178,7 +179,7 @@ func TestNotificationEvent(t *testing.T) {
// verify the received notifications
Expect(notif.SwIfIndex).To(BeEquivalentTo(2), "Incorrect SwIfIndex value for SwInterfaceSetFlags")
- Expect(notif.LinkUpDown).To(BeEquivalentTo(1), "Incorrect LinkUpDown value for SwInterfaceSetFlags")
+ Expect(notif.Flags).To(BeEquivalentTo(interface_types.IF_STATUS_API_FLAG_LINK_UP), "Incorrect LinkUpDown value for SwInterfaceSetFlags")
err = sub.Unsubscribe()
Expect(err).ShouldNot(HaveOccurred())
@@ -287,7 +288,7 @@ func TestMultiRequestDouble(t *testing.T) {
for i := 1; i <= 3; i++ {
msgs = append(msgs, mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: uint32(i),
+ SwIfIndex: interfaces.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
@@ -300,7 +301,7 @@ func TestMultiRequestDouble(t *testing.T) {
msgs = append(msgs,
mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: uint32(i),
+ SwIfIndex: interfaces.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
@@ -368,8 +369,8 @@ func TestReceiveReplyAfterTimeout(t *testing.T) {
)
req := &interfaces.SwInterfaceSetFlags{
- SwIfIndex: 1,
- AdminUpDown: 1,
+ SwIfIndex: 1,
+ Flags: interface_types.IF_STATUS_API_FLAG_ADMIN_UP,
}
reply := &interfaces.SwInterfaceSetFlagsReply{}
@@ -426,7 +427,7 @@ func TestReceiveReplyAfterTimeoutMultiRequest(t *testing.T) {
for i := 1; i <= 3; i++ {
msgs = append(msgs, mock.MsgWithContext{
Msg: &interfaces.SwInterfaceDetails{
- SwIfIndex: uint32(i),
+ SwIfIndex: interfaces.InterfaceIndex(i),
InterfaceName: "if-name-test",
},
Multipart: true,
@@ -440,8 +441,8 @@ func TestReceiveReplyAfterTimeoutMultiRequest(t *testing.T) {
ctx.mockVpp.MockReplyWithContext(mock.MsgWithContext{Msg: &interfaces.SwInterfaceSetFlagsReply{}, SeqNum: 3})
req := &interfaces.SwInterfaceSetFlags{
- SwIfIndex: 1,
- AdminUpDown: 1,
+ SwIfIndex: 1,
+ Flags: interface_types.IF_STATUS_API_FLAG_ADMIN_UP,
}
reply := &interfaces.SwInterfaceSetFlagsReply{}
diff --git a/core/connection_test.go b/core/connection_test.go
index 71f1a18..e6ef5d5 100644
--- a/core/connection_test.go
+++ b/core/connection_test.go
@@ -17,13 +17,14 @@ package core_test
import (
"testing"
+ . "github.com/onsi/gomega"
+
"git.fd.io/govpp.git/adapter/mock"
"git.fd.io/govpp.git/api"
"git.fd.io/govpp.git/codec"
"git.fd.io/govpp.git/core"
"git.fd.io/govpp.git/examples/binapi/interfaces"
"git.fd.io/govpp.git/examples/binapi/vpe"
- . "github.com/onsi/gomega"
)
type testCtx struct {
@@ -94,14 +95,14 @@ func TestCodec(t *testing.T) {
msgCodec := &codec.MsgCodec{}
// request
- data, err := msgCodec.EncodeMsg(&interfaces.CreateLoopback{MacAddress: []byte{1, 2, 3, 4, 5, 6}}, 11)
+ data, err := msgCodec.EncodeMsg(&interfaces.CreateLoopback{MacAddress: interfaces.MacAddress{1, 2, 3, 4, 5, 6}}, 11)
Expect(err).ShouldNot(HaveOccurred())
Expect(data).ShouldNot(BeEmpty())
msg1 := &interfaces.CreateLoopback{}
err = msgCodec.DecodeMsg(data, msg1)
Expect(err).ShouldNot(HaveOccurred())
- Expect(msg1.MacAddress).To(BeEquivalentTo([]byte{1, 2, 3, 4, 5, 6}))
+ Expect(msg1.MacAddress).To(BeEquivalentTo(interfaces.MacAddress{1, 2, 3, 4, 5, 6}))
// reply
data, err = msgCodec.EncodeMsg(&vpe.ControlPingReply{Retval: 55}, 22)
@@ -160,7 +161,7 @@ func TestMultiRequestsWithSequenceNumbers(t *testing.T) {
var msgs []api.Message
for i := 0; i < 10; i++ {
- msgs = append(msgs, &interfaces.SwInterfaceDetails{SwIfIndex: uint32(i)})
+ msgs = append(msgs, &interfaces.SwInterfaceDetails{SwIfIndex: interfaces.InterfaceIndex(i)})
}
ctx.mockVpp.MockReply(msgs...)
ctx.mockVpp.MockReply(&vpe.ControlPingReply{})
@@ -279,7 +280,7 @@ func TestMultiRequestsWithErrors(t *testing.T) {
}
for i := 0; i < 10; i++ {
msgs = append(msgs, mock.MsgWithContext{
- Msg: &interfaces.SwInterfaceDetails{SwIfIndex: uint32(i)},
+ Msg: &interfaces.SwInterfaceDetails{SwIfIndex: interfaces.InterfaceIndex(i)},
SeqNum: 1,
Multipart: true,
})