From 6e1919c3aebabc0977a8ab40b5c60cbd0e7114d0 Mon Sep 17 00:00:00 2001 From: imarom Date: Sun, 13 Nov 2016 17:17:36 +0200 Subject: RX features - pre-resolve stage Signed-off-by: imarom --- .../automation/trex_control_plane/stl/trex_stl_lib/utils/common.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py index f0da9a08..d4ac973d 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py @@ -4,6 +4,7 @@ import string import random import time import socket +import re try: import pwd @@ -93,3 +94,7 @@ def is_valid_ipv4 (addr): return True except socket.error: return False + +def is_valid_mac (mac): + return bool(re.match("[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", mac.lower())) + -- cgit 1.2.3-korg