diff options
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.py | 7 |
1 files changed, 7 insertions, 0 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 72ee8972..f0da9a08 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 @@ -3,6 +3,7 @@ import sys import string import random import time +import socket try: import pwd @@ -86,3 +87,9 @@ class PassiveTimer(object): return (time.time() > self.expr_sec) +def is_valid_ipv4 (addr): + try: + socket.inet_pton(socket.AF_INET, addr) + return True + except socket.error: + return False |