blob: eb20531505e6786166788a13e225842111fae137 [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):
Andrew Yourtchenkoa3b7c552020-08-26 14:33:54 +000010 """ Test framework utility tests """
11
12 @classmethod
Andrew Yourtchenko06f32812021-01-14 10:19:08 +000013 def is_tagged_run_solo(cls):
Andrew Yourtchenkoa3b7c552020-08-26 14:33:54 +000014 """ if the test case class is timing-sensitive - return true """
15 return False
16
Ole Troan7f991832018-12-06 17:35:12 +010017 def test_mac_to_binary(self):
Andrew Yourtchenkoa3b7c552020-08-26 14:33:54 +000018 """ MAC to binary and back """
Ole Troan7f991832018-12-06 17:35:12 +010019 mac = 'aa:bb:cc:dd:ee:ff'
Ole Troan8006c6a2018-12-17 12:02:26 +010020 b = mac_pton(mac)
21 mac2 = mac_ntop(b)
Ole Troan7f991832018-12-06 17:35:12 +010022 self.assertEqual(type(mac), type(mac2))
23 self.assertEqual(mac2, mac)
24
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -080025
Ole Troan7f991832018-12-06 17:35:12 +010026if __name__ == '__main__':
27 unittest.main(testRunner=VppTestRunner)