Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
nat: TCP state tracking based on RFC 7857/RFC 6146
[vpp.git]
/
test
/
vpp_neighbor.py
diff --git
a/test/vpp_neighbor.py
b/test/vpp_neighbor.py
index
7391447
..
9ba8700
100644
(file)
--- a/
test/vpp_neighbor.py
+++ b/
test/vpp_neighbor.py
@@
-5,18
+5,23
@@
"""
from ipaddress import ip_address
"""
from ipaddress import ip_address
-from vpp_object import
*
+from vpp_object import
VppObject
from vpp_papi import mac_pton, VppEnum
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):
def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None):
- ip_addr = ip_address(
unicod
e(nbr_addr))
+ ip_addr = ip_address(
text_typ
e(nbr_addr))
e = VppEnum.vl_api_ip_neighbor_flags_t
e = VppEnum.vl_api_ip_neighbor_flags_t
- nbrs = test.vapi.ip_neighbor_dump(sw_if_index,
-
is_ipv6=(6 is ip_addr.version)
)
+ nbrs = test.vapi.ip_neighbor_dump(sw_if_index
=sw_if_index
,
+
af=ip_addr.vapi_af
)
for n in nbrs:
for n in nbrs:
- if ip_addr == n.neighbor.ip_address and \
+ if sw_if_index == n.neighbor.sw_if_index and \
+ ip_addr == n.neighbor.ip_address and \
is_static == (n.neighbor.flags & e.IP_API_NEIGHBOR_FLAG_STATIC):
if mac:
if mac == str(n.neighbor.mac_address):
is_static == (n.neighbor.flags & e.IP_API_NEIGHBOR_FLAG_STATIC):
if mac:
if mac == str(n.neighbor.mac_address):
@@
-54,6
+59,7
@@
class VppNeighbor(VppObject):
flags=self.flags)
self.stats_index = r.stats_index
self._test.registry.register(self, self._test.logger)
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(
def remove_vpp_config(self):
self._test.vapi.ip_neighbor_add_del(
@@
-73,12
+79,9
@@
class VppNeighbor(VppObject):
self.nbr_addr,
self.is_static())
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))
def get_stats(self):
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")
+ c = self._test.statistics
["/net/adjacency"]
return c[0][self.stats_index]
return c[0][self.stats_index]