summaryrefslogtreecommitdiffstats
path: root/test/vpp_teib.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-02-03 10:55:09 +0000
committerDamjan Marion <dmarion@me.com>2020-02-04 09:44:58 +0000
commit03ce46219cd0fabfd4918822c5b9fed9ef880de8 (patch)
treef33c291dba25bcbe856602e6c63ce9d8ef4cc96c /test/vpp_teib.py
parent0860b2e19365c092f10dd1ce639caaded0e87ded (diff)
teib: Rename NHRP to TEIB
Type: refactor The Tunnel Endpoint Informatiob Base (TEIB) is a better description of what it is (a mapping between tunnel endpoint address, in the overlay, and next-hop address, in the underlay) whereas NHRP is one instanc eof a control protocol that might add such endpoints. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Idcb2ad0b6543d3e5d9f6e96f9d14dafb5ce2aa85
Diffstat (limited to 'test/vpp_teib.py')
-rw-r--r--test/vpp_teib.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/vpp_teib.py b/test/vpp_teib.py
new file mode 100644
index 00000000000..e117ac39302
--- /dev/null
+++ b/test/vpp_teib.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+"""
+ NHRP objects
+"""
+
+from vpp_object import VppObject
+
+
+def find_teib(test, ne):
+ ns = test.vapi.teib_dump()
+ for n in ns:
+ if ne.peer == str(n.entry.peer) \
+ and ne.itf._sw_if_index == n.entry.sw_if_index:
+ return True
+ return False
+
+
+class VppNhrp(VppObject):
+
+ def __init__(self, test, itf, peer, nh, table_id=0):
+ self._test = test
+ self.table_id = table_id
+ self.peer = peer
+ self.itf = itf
+ self.nh = nh
+
+ def add_vpp_config(self):
+ r = self._test.vapi.teib_entry_add_del(
+ is_add=1,
+ entry={
+ 'nh_table_id': self.table_id,
+ 'sw_if_index': self.itf.sw_if_index,
+ 'peer': self.peer,
+ 'nh': self.nh,
+ })
+ self._test.registry.register(self, self._test.logger)
+
+ def remove_vpp_config(self):
+ r = self._test.vapi.teib_entry_add_del(
+ is_add=0,
+ entry={
+ 'nh_table_id': self.table_id,
+ 'sw_if_index': self.itf.sw_if_index,
+ 'peer': self.peer,
+ })
+
+ def query_vpp_config(self):
+ return find_teib(self._test, self)
+
+ def object_id(self):
+ return ("teib-%s-%s" % (self.itf, self.peer))