summaryrefslogtreecommitdiffstats
path: root/test/vpp_interface.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-12-06 17:35:12 +0100
committerNeale Ranns <nranns@cisco.com>2018-12-10 08:01:56 +0000
commit7f99183a20d60cd5c648cc23d7a2f30a594a215b (patch)
treebb3934aab296ce5fa531bfc5ab47921a113ffd26 /test/vpp_interface.py
parent521a8d7df423a0b5aaf259d49ca9230705bc25ee (diff)
Test framework: StringIO fixes for Python3
Add 2/3 support to binarytomac and mactobinary and move to vpp_mac.py Change-Id: I3dc7e4a24486aee22140c781aae7e44e58935877 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test/vpp_interface.py')
-rw-r--r--test/vpp_interface.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index a464bf38984..3235d3f68c6 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -4,7 +4,8 @@ from abc import abstractmethod, ABCMeta
from six import moves
-from util import Host, mk_ll_addr, mactobinary
+from util import Host, mk_ll_addr
+from vpp_mac import mactobinary, binarytomac
class VppInterface(object):
@@ -231,10 +232,9 @@ class VppInterface(object):
r = self.test.vapi.sw_interface_dump()
for intf in r:
if intf.sw_if_index == self.sw_if_index:
- self._name = intf.interface_name.split(b'\0', 1)[0]
- self._local_mac = \
- ':'.join(binascii.hexlify(intf.l2_address)[i:i + 2]
- for i in range(0, 12, 2))
+ self._name = intf.interface_name.split(b'\0',
+ 1)[0].decode('utf8')
+ self._local_mac = binarytomac(intf.l2_address)
self._dump = intf
break
else:
@@ -274,7 +274,7 @@ class VppInterface(object):
:param vrf_id: The FIB table / VRF ID. (Default value = 0)
"""
for host in self._remote_hosts:
- macn = host.mac.replace(":", "").decode('hex')
+ macn = mactobinary(host.mac)
ipn = host.ip4n
self.test.vapi.ip_neighbor_add_del(
self.sw_if_index, macn, ipn)
@@ -305,7 +305,7 @@ class VppInterface(object):
:param vrf_id: The FIB table / VRF ID. (Default value = 0)
"""
for host in self._remote_hosts:
- macn = host.mac.replace(":", "").decode('hex')
+ macn = mactobinary(host.mac)
ipn = host.ip6n
self.test.vapi.ip_neighbor_add_del(
self.sw_if_index, macn, ipn, is_ipv6=1)