X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_neighbor.py;h=7815a286fef7be2b3aa3cba2dd0b4b2f5b409efe;hb=8006c6a;hp=c08132d1d40ba42405c6e4da98debbbe0bbdb37b;hpb=59ae61ee7587502c0446655ecbe3daa296498f56;p=vpp.git diff --git a/test/vpp_neighbor.py b/test/vpp_neighbor.py index c08132d1d40..7815a286fef 100644 --- a/test/vpp_neighbor.py +++ b/test/vpp_neighbor.py @@ -6,7 +6,7 @@ from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 from vpp_object import * -from util import mactobinary +from vpp_papi import mac_pton def find_nbr(test, sw_if_index, ip_addr, is_static=0, inet=AF_INET, mac=None): @@ -22,7 +22,7 @@ def find_nbr(test, sw_if_index, ip_addr, is_static=0, inet=AF_INET, mac=None): if nbr_addr == n.ip_address[:s] \ and is_static == n.is_static: if mac: - if n.mac_address == mactobinary(mac): + if n.mac_address == mac_pton(mac): return True else: return True @@ -38,7 +38,7 @@ class VppNeighbor(VppObject): af=AF_INET, is_static=False, is_no_fib_entry=0): self._test = test self.sw_if_index = sw_if_index - self.mac_addr = mactobinary(mac_addr) + self.mac_addr = mac_pton(mac_addr) self.af = af self.is_static = is_static self.is_no_fib_entry = is_no_fib_entry @@ -46,7 +46,7 @@ class VppNeighbor(VppObject): self.nbr_addr_n = inet_pton(af, nbr_addr) def add_vpp_config(self): - self._test.vapi.ip_neighbor_add_del( + r = self._test.vapi.ip_neighbor_add_del( self.sw_if_index, self.mac_addr, self.nbr_addr_n, @@ -54,6 +54,7 @@ class VppNeighbor(VppObject): is_ipv6=1 if AF_INET6 == self.af else 0, is_static=self.is_static, is_no_adj_fib=self.is_no_fib_entry) + self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): @@ -77,3 +78,7 @@ class VppNeighbor(VppObject): def object_id(self): return ("%d:%s" % (self.sw_if_index, self.nbr_addr)) + + def get_stats(self): + c = self._test.statistics.get_counter("/net/adjacency") + return c[0][self.stats_index]