X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_interface.py;h=b7c830b06fd205cb76981224426997ac7dd515db;hb=2c4acdd8d47a14867d9658debc674323efc78323;hp=cb1fbafce482e620be1a06f775a99dbca2c393ae;hpb=5c2a23720f433aa5ddcc1b077ddb91f494ff958d;p=vpp.git diff --git a/test/vpp_interface.py b/test/vpp_interface.py index cb1fbafce48..b7c830b06fd 100644 --- a/test/vpp_interface.py +++ b/test/vpp_interface.py @@ -2,9 +2,6 @@ import binascii import socket import abc -import six -from six import moves - from util import Host, mk_ll_addr from vpp_papi import mac_ntop, VppEnum from ipaddress import IPv4Network, IPv6Network @@ -15,8 +12,7 @@ except NameError: text_type = str -@six.add_metaclass(abc.ABCMeta) -class VppInterface(object): +class VppInterface(metaclass=abc.ABCMeta): """Generic VPP interface.""" @property @@ -101,6 +97,10 @@ class VppInterface(object): @property def local_ip6_ll(self): """Local IPv6 link-local address on VPP interface (string).""" + if not self._local_ip6_ll: + self._local_ip6_ll = str( + self.test.vapi.sw_interface_ip6_get_link_local_address( + self.sw_if_index).ip) return self._local_ip6_ll @property @@ -196,7 +196,6 @@ class VppInterface(object): def set_mac(self, 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, mac.packed) return self @@ -238,8 +237,8 @@ class VppInterface(object): "Could not find interface with sw_if_index %d " "in interface dump %s" % (self.sw_if_index, moves.reprlib.repr(r))) - self._local_ip6_ll = mk_ll_addr(self.local_mac) self._remote_ip6_ll = mk_ll_addr(self.remote_mac) + self._local_ip6_ll = None def config_ip4(self): """Configure IPv4 address on the VPP interface.""" @@ -479,12 +478,12 @@ class VppInterface(object): return self.name def get_rx_stats(self): - c = self.test.statistics.get_counter("^/if/rx$") - return c[0][self.sw_if_index] + return (self.test.statistics["/if/rx"] + [:, self.sw_if_index].sum_packets()) def get_tx_stats(self): - c = self.test.statistics.get_counter("^/if/tx$") - return c[0][self.sw_if_index] + return (self.test.statistics["/if/tx"] + [:, self.sw_if_index].sum_packets()) def set_l3_mtu(self, mtu): self.test.vapi.sw_interface_set_mtu(self.sw_if_index, [mtu, 0, 0, 0])