diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-04-04 13:22:20 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-04-17 17:30:32 +0000 |
commit | 6407ba56a392f37322001d0ffdca002223b095c0 (patch) | |
tree | 22aca6ba83aa1d1f2bf074b69115d993f8328bb5 /test/test_interface_crud.py | |
parent | 4bdfd59a873dec469896f3848235aa783270a93e (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/test_interface_crud.py')
-rw-r--r-- | test/test_interface_crud.py | 33 |
1 files changed, 33 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) |