aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_memif.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vpp_memif.py')
-rw-r--r--test/vpp_memif.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/vpp_memif.py b/test/vpp_memif.py
index 7fa45092740..befcc2840c5 100644
--- a/test/vpp_memif.py
+++ b/test/vpp_memif.py
@@ -3,6 +3,8 @@ import socket
import six
from vpp_object import VppObject
+from vpp_ip import VppIpPrefix
+from vpp_papi import VppEnum
class MEMIF_ROLE:
@@ -84,8 +86,8 @@ class VppMemif(VppObject):
self.buffer_size = buffer_size
self.hw_addr = hw_addr
self.sw_if_index = None
- self.ip4_addr = "192.168.%d.%d" % (self.if_id + 1, self.role + 1)
- self.ip4_addr_len = 24
+ self.ip_prefix = VppIpPrefix("192.168.%d.%d" %
+ (self.if_id + 1, self.role + 1), 24)
def add_vpp_config(self):
rv = self._test.vapi.memif_create(
@@ -112,11 +114,13 @@ class VppMemif(VppObject):
def admin_up(self):
if self.sw_if_index:
- return self._test.vapi.sw_interface_set_flags(self.sw_if_index, 1)
+ return self._test.vapi.sw_interface_set_flags(
+ sw_if_index=self.sw_if_index, flags=1)
def admin_down(self):
if self.sw_if_index:
- return self._test.vapi.sw_interface_set_flags(self.sw_if_index, 0)
+ return self._test.vapi.sw_interface_set_flags(
+ sw_if_index=self.sw_if_index, flags=0)
def wait_for_link_up(self, timeout, step=1):
if not self.sw_if_index:
@@ -132,9 +136,7 @@ class VppMemif(VppObject):
def config_ip4(self):
return self._test.vapi.sw_interface_add_del_address(
- sw_if_index=self.sw_if_index, address=socket.inet_pton(
- socket.AF_INET, self.ip4_addr),
- address_length=self.ip4_addr_len)
+ sw_if_index=self.sw_if_index, prefix=self.ip_prefix.encode())
def remove_vpp_config(self):
self._test.vapi.memif_delete(self.sw_if_index)