X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_neighbor.py;h=6172d8f871df0d93656cdc848981194492dc568f;hb=59f71132e;hp=7391447ff9b6cfc69ab6f7c47d5b2d2a895f34e9;hpb=37029305c671f4e2d091d6f6c22142634e409043;p=vpp.git diff --git a/test/vpp_neighbor.py b/test/vpp_neighbor.py index 7391447ff9b..6172d8f871d 100644 --- a/test/vpp_neighbor.py +++ b/test/vpp_neighbor.py @@ -5,15 +5,22 @@ """ from ipaddress import ip_address -from vpp_object import * +from vpp_object import VppObject from vpp_papi import mac_pton, VppEnum +try: + text_type = unicode +except NameError: + text_type = str def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None): - ip_addr = ip_address(unicode(nbr_addr)) + ip_addr = ip_address(text_type(nbr_addr)) e = VppEnum.vl_api_ip_neighbor_flags_t - nbrs = test.vapi.ip_neighbor_dump(sw_if_index, - is_ipv6=(6 is ip_addr.version)) + if 6 == ip_addr.version: + af = VppEnum.vl_api_address_family_t.ADDRESS_IP6 + else: + af = VppEnum.vl_api_address_family_t.ADDRESS_IP4 + nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, af=af) for n in nbrs: if ip_addr == n.neighbor.ip_address and \ @@ -54,6 +61,7 @@ class VppNeighbor(VppObject): flags=self.flags) self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) + return self def remove_vpp_config(self): self._test.vapi.ip_neighbor_add_del( @@ -73,9 +81,6 @@ class VppNeighbor(VppObject): self.nbr_addr, self.is_static()) - def __str__(self): - return self.object_id() - def object_id(self): return ("%d:%s" % (self.sw_if_index, self.nbr_addr))