Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python |
Paul Vinciguerra | dd3c5d2 | 2019-01-13 16:09:10 -0800 | [diff] [blame^] | 2 | """Test framework utility functions tests""" |
Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 3 | |
| 4 | import unittest |
Paul Vinciguerra | dd3c5d2 | 2019-01-13 16:09:10 -0800 | [diff] [blame^] | 5 | from framework import VppTestRunner |
Ole Troan | 8006c6a | 2018-12-17 12:02:26 +0100 | [diff] [blame] | 6 | from vpp_papi import mac_pton, mac_ntop |
Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 7 | |
| 8 | |
Paul Vinciguerra | dd3c5d2 | 2019-01-13 16:09:10 -0800 | [diff] [blame^] | 9 | class TestUtil (unittest.TestCase): |
Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 10 | """ MAC to binary and back """ |
| 11 | def test_mac_to_binary(self): |
| 12 | mac = 'aa:bb:cc:dd:ee:ff' |
Ole Troan | 8006c6a | 2018-12-17 12:02:26 +0100 | [diff] [blame] | 13 | b = mac_pton(mac) |
| 14 | mac2 = mac_ntop(b) |
Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 15 | self.assertEqual(type(mac), type(mac2)) |
| 16 | self.assertEqual(mac2, mac) |
| 17 | |
Paul Vinciguerra | dd3c5d2 | 2019-01-13 16:09:10 -0800 | [diff] [blame^] | 18 | |
Ole Troan | 7f99183 | 2018-12-06 17:35:12 +0100 | [diff] [blame] | 19 | if __name__ == '__main__': |
| 20 | unittest.main(testRunner=VppTestRunner) |