summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
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, },