summaryrefslogtreecommitdiffstats
path: root/test/bfd.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2017-01-11 08:16:53 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-11 19:49:31 +0000
commit10db26f7bfed97022734fb808bd56532fdda48c5 (patch)
tree7a9bd58b90229ebc0838bb1563dc40a7bd8ffc76 /test/bfd.py
parentcab65ec86b6c04d7a4674312989b5be0c0e394a4 (diff)
BFD: fix bfd_udp_add API
Fix reporting of bs_index in the return message. Enhance test suite to cover this case. Change-Id: I37d35b850818bc1a05abe67ca919c22aeac978b6 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/bfd.py')
-rw-r--r--test/bfd.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/bfd.py b/test/bfd.py
index fe63264e731..57a5bd86751 100644
--- a/test/bfd.py
+++ b/test/bfd.py
@@ -145,8 +145,8 @@ class VppBFDUDPSession(VppObject):
session = s
break
if session is None:
- raise Exception(
- "Could not find BFD session in VPP response: %s" % repr(result))
+ raise Exception("Could not find BFD session in VPP response: %s" %
+ repr(result))
return session.state
@property
@@ -185,6 +185,7 @@ class VppBFDUDPSession(VppObject):
self.peer_addr_n,
is_ipv6=is_ipv6)
self._bs_index = result.bs_index
+ self._test.registry.register(self, self.test.logger)
def query_vpp_config(self):
result = self.test.vapi.bfd_udp_session_dump()
@@ -202,7 +203,7 @@ class VppBFDUDPSession(VppObject):
return True
def remove_vpp_config(self):
- if hasattr(self, '_bs_index'):
+ if self._bs_index is not None:
is_ipv6 = 1 if AF_INET6 == self._af else 0
self.test.vapi.bfd_udp_del(
self._interface.sw_if_index,
@@ -213,5 +214,8 @@ class VppBFDUDPSession(VppObject):
def object_id(self):
return "bfd-udp-%d" % self.bs_index
+ def __str__(self):
+ return self.object_id()
+
def admin_up(self):
self.test.vapi.bfd_session_set_flags(self.bs_index, 1)