blob: 421afce4d5d4a20d7b0feb623be861da0d5001a7 [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
Andrew Yourtchenkoc8eae8d2021-01-20 20:30:36 +000017 @classmethod
18 def has_tag(cls, tag):
19 """ if the test case has a given tag - return true """
20 try:
21 return tag in cls.test_tags
22 except AttributeError:
23 pass
24 return False
25
Ole Troan7f991832018-12-06 17:35:12 +010026 def test_mac_to_binary(self):
Andrew Yourtchenkoa3b7c552020-08-26 14:33:54 +000027 """ MAC to binary and back """
Ole Troan7f991832018-12-06 17:35:12 +010028 mac = 'aa:bb:cc:dd:ee:ff'
Ole Troan8006c6a2018-12-17 12:02:26 +010029 b = mac_pton(mac)
30 mac2 = mac_ntop(b)
Ole Troan7f991832018-12-06 17:35:12 +010031 self.assertEqual(type(mac), type(mac2))
32 self.assertEqual(mac2, mac)
33
Paul Vinciguerradd3c5d22019-01-13 16:09:10 -080034
Ole Troan7f991832018-12-06 17:35:12 +010035if __name__ == '__main__':
36 unittest.main(testRunner=VppTestRunner)