aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_memif.py
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-03-18 13:17:53 +0100
committerOle Trøan <otroan@employees.org>2019-08-20 09:57:10 +0000
commit053204ab039d34a990ff0e14c32ce3b294fcce0e (patch)
tree7261eaf0b905ea456ac536d8f728e89319b16a69 /test/vpp_memif.py
parentdf36f4963f1a590ce9a02f048507c3d4590580ae (diff)
api: Cleanup APIs interface.api
Use of consistent API types for interface.api Type: fix Change-Id: I88206d7d0907cffd564031f73c9a996df2e5e21a 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 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)