2018-12-06 17:35:12 +01:00
|
|
|
#!/usr/bin/env python
|
2019-01-13 16:09:10 -08:00
|
|
|
"""Test framework utility functions tests"""
|
2018-12-06 17:35:12 +01:00
|
|
|
|
|
|
|
import unittest
|
2019-01-13 16:09:10 -08:00
|
|
|
from framework import VppTestRunner
|
2018-12-17 12:02:26 +01:00
|
|
|
from vpp_papi import mac_pton, mac_ntop
|
2018-12-06 17:35:12 +01:00
|
|
|
|
|
|
|
|
2019-01-13 16:09:10 -08:00
|
|
|
class TestUtil (unittest.TestCase):
|
2018-12-06 17:35:12 +01:00
|
|
|
""" MAC to binary and back """
|
|
|
|
def test_mac_to_binary(self):
|
|
|
|
mac = 'aa:bb:cc:dd:ee:ff'
|
2018-12-17 12:02:26 +01:00
|
|
|
b = mac_pton(mac)
|
|
|
|
mac2 = mac_ntop(b)
|
2018-12-06 17:35:12 +01:00
|
|
|
self.assertEqual(type(mac), type(mac2))
|
|
|
|
self.assertEqual(mac2, mac)
|
|
|
|
|
2019-01-13 16:09:10 -08:00
|
|
|
|
2018-12-06 17:35:12 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(testRunner=VppTestRunner)
|