From 39000f461de6b85877db85488b1cc7f1fad9d359 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sun, 29 Jan 2017 17:14:41 +0200 Subject: ipv6 scan & ping Change-Id: I4f8112b4c942d149da5ea3f0ee01ac82d7fe32cc Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/utils/common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (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 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())) -- cgit 1.2.3-korg