blob: 51cc739ca8d06c1d75c559105b5815adfef1bb5c [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -08002"""Test framework utility functions tests"""
Ole Troan7f991832018-12-06 17:35:12 +01003
4import unittest
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -08005from framework import VppTestRunner
Ole Troan8006c6a2018-12-17 12:02:26 +01006from vpp_papi import mac_pton, mac_ntop
Ole Troan7f991832018-12-06 17:35:12 +01007
8
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -08009class TestUtil (unittest.TestCase):
Ole Troan7f991832018-12-06 17:35:12 +010010 """ MAC to binary and back """
11 def test_mac_to_binary(self):
12 mac = 'aa:bb:cc:dd:ee:ff'
Ole Troan8006c6a2018-12-17 12:02:26 +010013 b = mac_pton(mac)
14 mac2 = mac_ntop(b)
Ole Troan7f991832018-12-06 17:35:12 +010015 self.assertEqual(type(mac), type(mac2))
16 self.assertEqual(mac2, mac)
17
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -080018
Ole Troan7f991832018-12-06 17:35:12 +010019if __name__ == '__main__':
20 unittest.main(testRunner=VppTestRunner)