diff options
Diffstat (limited to 'src/plugins/memif/test/test_memif.py')
-rw-r--r-- | src/plugins/memif/test/test_memif.py | 57 |
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() |