aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_memif.py
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-03-01 08:55:49 +0100
committerOle Trøan <otroan@employees.org>2019-03-15 10:24:22 +0000
commite63325e3ca03c847963863446345e6c80a2c0cfd (patch)
treecae33764e6186727697e91862c32f2b08334866b /test/vpp_memif.py
parent4ba4edd15085ce31145ef5da6342e435c57c1150 (diff)
API: Cleanup APIs interface.api
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
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 4ad9ffde4d7..88b9189032d 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:
@@ -87,8 +89,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(self.role, self.mode, self.rx_queues,
@@ -101,11 +103,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:
@@ -121,9 +125,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)