Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 1 | import unittest |
| 2 | import os |
| 3 | |
| 4 | from framework import VppTestCase, VppTestRunner |
| 5 | from vpp_devices import VppTAPInterface |
| 6 | |
| 7 | |
| 8 | def check_tuntap_driver_access(): |
| 9 | return os.access("/dev/net/tun", os.R_OK or os.W_OK) |
| 10 | |
| 11 | |
| 12 | @unittest.skipUnless(check_tuntap_driver_access(), "Permission denied") |
| 13 | class TestTAP(VppTestCase): |
| 14 | """ TAP Test Case """ |
| 15 | |
| 16 | def test_tap_add_del(self): |
| 17 | """Create TAP interface""" |
| 18 | tap0 = VppTAPInterface(self, tap_id=0) |
| 19 | tap0.add_vpp_config() |
| 20 | self.assertTrue(tap0.query_vpp_config()) |
| 21 | |
| 22 | |
| 23 | if __name__ == '__main__': |
| 24 | unittest.main(testRunner=VppTestRunner) |