vpp/test/test_util.py
Paul Vinciguerra dd3c5d250f VTL: Allow running simple unittest.TestCases.
It came to my attention that Ole added a simple test in:
https://gerrit.fd.io/r/#/c/16381/ and the framework forced him
to launch an instance of VPP to test the formatting of a mac address.

This change allows the test framework to run standard unittest.TestCases
without the need to spawn a VPP instance.

Change-Id: I56651ab27c4c6bf920081a526f168a743d643201
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-01-14 13:09:08 +00:00

21 lines
511 B
Python
Executable File

#!/usr/bin/env python
"""Test framework utility functions tests"""
import unittest
from framework import VppTestRunner
from vpp_papi import mac_pton, mac_ntop
class TestUtil (unittest.TestCase):
""" MAC to binary and back """
def test_mac_to_binary(self):
mac = 'aa:bb:cc:dd:ee:ff'
b = mac_pton(mac)
mac2 = mac_ntop(b)
self.assertEqual(type(mac), type(mac2))
self.assertEqual(mac2, mac)
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)