X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_interface.py;h=719f77b36c7a31ee2821f71f256c4e60cfc9f772;hb=8006c6a;hp=a464bf3898437716dc180bd9270bf2e15d12ad75;hpb=6e4c6ad92e59045f0babf5af5093cb8402ec37fb;p=vpp.git diff --git a/test/vpp_interface.py b/test/vpp_interface.py index a464bf38984..719f77b36c7 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_papi import mac_pton, mac_ntop class VppInterface(object): @@ -190,11 +191,10 @@ class VppInterface(object): self._hosts_by_ip6 = {} def set_mac(self, mac): - self._local_mac = mac - self._local_ip6_ll = mk_ll_addr(mac) + self._local_mac = str(mac) + self._local_ip6_ll = mk_ll_addr(self._local_mac) self.test.vapi.sw_interface_set_mac_address( - self.sw_if_index, - mactobinary(self._local_mac)) + self.sw_if_index, mac.packed) def set_sw_if_index(self, sw_if_index): self._sw_if_index = sw_if_index @@ -231,10 +231,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 = mac_ntop(intf.l2_address) self._dump = intf break else: @@ -274,7 +273,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 = mac_pton(host.mac) ipn = host.ip4n self.test.vapi.ip_neighbor_add_del( self.sw_if_index, macn, ipn) @@ -305,7 +304,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 = mac_pton(host.mac) ipn = host.ip6n self.test.vapi.ip_neighbor_add_del( self.sw_if_index, macn, ipn, is_ipv6=1)