-func TestRequestReplyTapConnect(t *testing.T) {
- ctx := setupTest(t)
- defer ctx.teardownTest()
-
- ctx.mockVpp.MockReply(&tap.TapConnectReply{
- Retval: 10,
- SwIfIndex: 1,
- })
- request := &tap.TapConnect{
- TapName: []byte("test-tap-name"),
- UseRandomMac: 1,
- }
- reply := &tap.TapConnectReply{}
-
- err := ctx.ch.SendRequest(request).ReceiveReply(reply)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(reply.Retval).To(BeEquivalentTo(10), "Incorrect retval value for TapConnectReply")
- Expect(reply.SwIfIndex).To(BeEquivalentTo(1), "Incorrect SwIfIndex value for TapConnectReply")
-}
-
-func TestRequestReplyTapModify(t *testing.T) {
- ctx := setupTest(t)
- defer ctx.teardownTest()
-
- ctx.mockVpp.MockReply(&tap.TapModifyReply{
- Retval: 15,
- SwIfIndex: 2,
- })
- request := &tap.TapModify{
- TapName: []byte("test-tap-modify"),
- UseRandomMac: 1,
- CustomDevInstance: 1,
- }
- reply := &tap.TapModifyReply{}
-
- err := ctx.ch.SendRequest(request).ReceiveReply(reply)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(reply.Retval).To(BeEquivalentTo(15), "Incorrect retval value for TapModifyReply")
- Expect(reply.SwIfIndex).To(BeEquivalentTo(2), "Incorrect SwIfIndex value for TapModifyReply")
-}
-
-func TestRequestReplyTapDelete(t *testing.T) {
- ctx := setupTest(t)
- defer ctx.teardownTest()
-
- ctx.mockVpp.MockReply(&tap.TapDeleteReply{
- Retval: 20,
- })
- request := &tap.TapDelete{
- SwIfIndex: 3,
- }
- reply := &tap.TapDeleteReply{}
-
- err := ctx.ch.SendRequest(request).ReceiveReply(reply)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(reply.Retval).To(BeEquivalentTo(20), "Incorrect retval value for TapDeleteReply")
-}
-
-func TestRequestReplySwInterfaceTapDump(t *testing.T) {
- ctx := setupTest(t)
- defer ctx.teardownTest()
-
- byteName := []byte("dev-name-test")
- ctx.mockVpp.MockReply(&tap.SwInterfaceTapDetails{
- SwIfIndex: 25,
- DevName: byteName,
- })
- request := &tap.SwInterfaceTapDump{}
- reply := &tap.SwInterfaceTapDetails{}
-
- err := ctx.ch.SendRequest(request).ReceiveReply(reply)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(reply.SwIfIndex).To(BeEquivalentTo(25), "Incorrect SwIfIndex value for SwInterfaceTapDetails")
- Expect(reply.DevName).ToNot(BeNil(), "Incorrect DevName value for SwInterfaceTapDetails")
-}
-