aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/test/test_memif.py
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-08-21 10:51:21 +0200
committerOle Trøan <otroan@employees.org>2019-09-09 14:29:48 +0000
commit546f955b3dad6c0866a8ba778d0cfe1ef43d81d4 (patch)
tree6113bab6ae3dec547b6cc6467b0fb8db114e7728 /src/plugins/memif/test/test_memif.py
parentbdf3ebe358787ef240dc9fadc515dfd178dfef7b (diff)
memif: API cleanup
Use consistent API types. memif_create now enables zero-copy by default. Add no_zero_copy param to memif_create which if set, disables zero copy. Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I11df8b9212c40de179ee71dc9da14039b982ede5 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/plugins/memif/test/test_memif.py')
-rw-r--r--src/plugins/memif/test/test_memif.py57
1 files changed, 40 insertions, 17 deletions
diff --git a/src/plugins/memif/test/test_memif.py b/src/plugins/memif/test/test_memif.py
index 6413cfdbf20..8182a41a620 100644
--- a/src/plugins/memif/test/test_memif.py
+++ b/src/plugins/memif/test/test_memif.py
@@ -7,9 +7,10 @@ import six
from framework import VppTestCase, VppTestRunner, running_extended_tests
from remote_test import RemoteClass, RemoteVppTestCase
-from vpp_memif import MEMIF_MODE, MEMIF_ROLE, remove_all_memif_vpp_config, \
+from vpp_memif import remove_all_memif_vpp_config, \
VppSocketFilename, VppMemif
from vpp_ip_route import VppIpRoute, VppRoutePath
+from vpp_papi import VppEnum
class TestMemif(VppTestCase):
@@ -122,7 +123,7 @@ class TestMemif(VppTestCase):
self.assertTrue(memif.wait_for_link_up(5))
dump = memif.query_vpp_config()
- if memif.role == MEMIF_ROLE.SLAVE:
+ if memif.role == VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE:
self.assertEqual(dump.ring_size, memif.ring_size)
self.assertEqual(dump.buffer_size, memif.buffer_size)
else:
@@ -145,9 +146,12 @@ class TestMemif(VppTestCase):
def test_memif_create_delete(self):
""" Memif create/delete interface """
- memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)
+ memif = VppMemif(
+ self,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET)
self._create_delete_test_one_interface(memif)
- memif.role = MEMIF_ROLE.MASTER
+ memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER
self._create_delete_test_one_interface(memif)
def test_memif_create_custom_socket(self):
@@ -174,34 +178,47 @@ class TestMemif(VppTestCase):
b"sock/memif3.sock",
add_default_folder=True))
- memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)
+ memif = VppMemif(
+ self,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET)
for sock in memif_sockets:
sock.add_vpp_config()
memif.socket_id = sock.socket_id
- memif.role = MEMIF_ROLE.SLAVE
+ memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE
self._create_delete_test_one_interface(memif)
- memif.role = MEMIF_ROLE.MASTER
+ memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER
self._create_delete_test_one_interface(memif)
def test_memif_connect(self):
""" Memif connect """
- memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET,
- ring_size=1024, buffer_size=2048)
+ memif = VppMemif(
+ self,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET,
+ ring_size=1024,
+ buffer_size=2048,
+ secret="abc")
remote_socket = VppSocketFilename(self.remote_test, 1,
b"%s/memif.sock" % six.ensure_binary(
self.tempdir, encoding='utf-8'))
remote_socket.add_vpp_config()
- remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER,
- MEMIF_MODE.ETHERNET, socket_id=1,
- ring_size=1024, buffer_size=2048)
+ remote_memif = VppMemif(
+ self.remote_test,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET,
+ socket_id=1,
+ ring_size=1024,
+ buffer_size=2048,
+ secret="abc")
self._connect_test_interface_pair(memif, remote_memif)
- memif.role = MEMIF_ROLE.MASTER
- remote_memif.role = MEMIF_ROLE.SLAVE
+ memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER
+ remote_memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE
self._connect_test_interface_pair(memif, remote_memif)
@@ -227,15 +244,21 @@ class TestMemif(VppTestCase):
def test_memif_ping(self):
""" Memif ping """
- memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)
+ memif = VppMemif(
+ self,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET)
remote_socket = VppSocketFilename(self.remote_test, 1,
b"%s/memif.sock" % six.ensure_binary(
self.tempdir, encoding='utf-8'))
remote_socket.add_vpp_config()
- remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER,
- MEMIF_MODE.ETHERNET, socket_id=1)
+ remote_memif = VppMemif(
+ self.remote_test,
+ VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER,
+ VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET,
+ socket_id=1)
memif.add_vpp_config()
memif.config_ip4()