summaryrefslogtreecommitdiffstats
path: root/test/vpp_nhrp.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-04-18 10:23:56 +0000
committerOle Trøan <otroan@employees.org>2019-12-04 22:45:11 +0000
commit5f8f6173328f8d77feea5fd100e150c3094c11f0 (patch)
tree16849c6e7619b227a93ce9846f344da2cc96ef2d /test/vpp_nhrp.py
parent79619c10142e15754e2f0b2ba26c20d415e7c36f (diff)
gre: Multi-point interfaces
Type: feature Change-Id: I0129ad6ace44a50a8a3b26db8e445cd06b2b49e8 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_nhrp.py')
-rw-r--r--test/vpp_nhrp.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/vpp_nhrp.py b/test/vpp_nhrp.py
new file mode 100644
index 00000000000..e04e3054fd2
--- /dev/null
+++ b/test/vpp_nhrp.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+"""
+ NHRP objects
+"""
+
+from vpp_object import VppObject
+
+
+def find_nhrp(test, ne):
+ ns = test.vapi.nhrp_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.nhrp_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.nhrp_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_nhrp(self._test, self)
+
+ def object_id(self):
+ return ("nhrp-%s-%s" % (self.itf, self.peer))