summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-04-04 13:22:20 -0700
committerDave Wallace <dwallacelf@gmail.com>2019-04-17 17:30:32 +0000
commit6407ba56a392f37322001d0ffdca002223b095c0 (patch)
tree22aca6ba83aa1d1f2bf074b69115d993f8328bb5 /test
parent4bdfd59a873dec469896f3848235aa783270a93e (diff)
api: Add to interface crud - read by sw_if_index.
Change-Id: I02c857da4cf6da5e0e55c1e48b63716af7ade0a9 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_interface_crud.py33
-rw-r--r--test/vpp_papi_provider.py1
2 files changed, 34 insertions, 0 deletions
diff --git a/test/test_interface_crud.py b/test/test_interface_crud.py
index e19f770c155..b41b2fe5b7c 100644
--- a/test/test_interface_crud.py
+++ b/test/test_interface_crud.py
@@ -151,5 +151,38 @@ class TestLoopbackInterfaceCRUD(VppTestCase):
self.pg0.assert_nothing_captured()
+class TestInterfaceDumpApiLocalOnly(VppTestCase):
+ """test_interface_crud.TestInterfaceDumpApiLocalOnly"""
+
+ def test_sw_if_index_0(self):
+ rv = self.vapi.sw_interface_dump(sw_if_index=0)
+ self.assertEqual(rv[0].sw_if_index, 0)
+
+ def test_sw_if_index_twiddle0(self):
+ rv = self.vapi.sw_interface_dump(sw_if_index=0xffffffff)
+ self.assertEqual(rv[0].sw_if_index, 0)
+
+ def test_sw_if_index_1_not_existing(self):
+ rv = self.vapi.sw_interface_dump(sw_if_index=1)
+ self.assertEqual(len(rv), 0, 'expected no records.')
+
+
+class TestInterfaceDumpApi(VppTestCase):
+ """test_interface_crud.TestInterfaceDumpApi"""
+
+ def test_sw_if_index_1(self):
+ self.vapi.create_loopback_instance(is_specified=1,
+ user_instance=10)
+ self.vapi.create_loopback_instance(is_specified=1,
+ user_instance=5)
+
+ # Can I get back the specified record?
+ rv = self.vapi.sw_interface_dump(sw_if_index=1)
+ self.assertEqual(rv[0].sw_if_index, 1, rv)
+
+ # verify 3 interfaces
+ rv = self.vapi.sw_interface_dump(sw_if_index=0xffffffff)
+ self.assertEqual(len(rv), 3, 'Expected 3 interfaces.')
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 62175e2310d..06fa31bd586 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -170,6 +170,7 @@ defaultmapping = {
'svs_route_add_del': {'is_add': 1, },
'svs_table_add_del': {'is_add': 1, },
'sw_interface_add_del_address': {'is_add': 1, },
+ 'sw_interface_dump': {'sw_if_index': 4294967295, },
'sw_interface_ip6nd_ra_prefix': {'val_lifetime': 4294967295,
'pref_lifetime': 4294967295, },
'sw_interface_set_ip_directed_broadcast': {'enable': 1, },