From 3b2db9002c14f9e0742622f2d503c5801d443827 Mon Sep 17 00:00:00 2001 From: Jakub Grajciar Date: Mon, 26 Aug 2019 11:25:52 +0200 Subject: devices: af_packet API cleanup Use consistent API types. - fix af_packet_dump dumping deleted interface Type: fix Signed-off-by: Jakub Grajciar Change-Id: Ie8d138e30c8c51a2306bb2ad9ac0b7a49d5412bf Signed-off-by: Jakub Grajciar --- test/test_af_packet.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/test_af_packet.py (limited to 'test/test_af_packet.py') diff --git a/test/test_af_packet.py b/test/test_af_packet.py new file mode 100644 index 00000000000..9017fb71cbf --- /dev/null +++ b/test/test_af_packet.py @@ -0,0 +1,39 @@ +import unittest +import os +import psutil + +from framework import VppTestCase, VppTestRunner +from vpp_devices import VppAFPacketInterface + + +class TestAFPacket(VppTestCase): + """ Host interface Test Case """ + + host_if_name = 'afp0' + + @classmethod + def setUpClass(cls): + super(TestAFPacket, cls).setUpClass() + os.system('ip tuntap add dev ' + cls.host_if_name + ' mode tap') + + @classmethod + def tearDownClass(cls): + super(TestAFPacket, cls).tearDownClass() + os.system('ip link delete ' + cls.host_if_name) + + def test_tap_add_del(self): + """Create host interface""" + # check if host interface exists + self.assertTrue( + psutil.net_if_addrs().get( + self.host_if_name), + 'Host interface ' + + self.host_if_name + + ' does not exist') + afp0 = VppAFPacketInterface(self, self.host_if_name) + afp0.add_vpp_config() + self.assertTrue(afp0.query_vpp_config()) + + +if __name__ == '__main__': + unittest.main(testRunner=VppTestRunner) -- cgit 1.2.3-korg