summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py9
1 files changed, 8 insertions, 1 deletions
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 7cb94b28..6b90a3b4 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
@@ -99,7 +99,14 @@ def is_valid_ipv4 (addr):
return True
except (socket.error, TypeError):
return False
-
+
+def is_valid_ipv6(addr):
+ try:
+ socket.inet_pton(socket.AF_INET6, addr)
+ return True
+ except (socket.error, TypeError):
+ 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()))