summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-01-29 17:14:41 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-02-02 13:42:36 +0200
commit39000f461de6b85877db85488b1cc7f1fad9d359 (patch)
tree8ffa214f3876009bf8778881c63b6c245244ac41 /scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
parent790059069915a700905f4746b22a9a4a6cadc6ad (diff)
ipv6 scan & ping
Change-Id: I4f8112b4c942d149da5ea3f0ee01ac82d7fe32cc Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
index 53db533c..cb2c9814 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
@@ -1,6 +1,6 @@
import argparse
from collections import namedtuple, OrderedDict
-from .common import list_intersect, list_difference, is_valid_ipv4, is_valid_mac, list_remove_dup
+from .common import list_intersect, list_difference, is_valid_ipv4, is_valid_ipv6, is_valid_mac, list_remove_dup
from .text_opts import format_text
from ..trex_stl_types import *
from .constants import ON_OFF_DICT, UP_DOWN_DICT, FLOW_CTRL_DICT
@@ -26,6 +26,7 @@ FILE_FROM_DB
SERVER_IP
STREAM_FROM_PATH_OR_FILE
DURATION
+TIMEOUT
FORCE
DRY_RUN
XTERM
@@ -36,6 +37,7 @@ MIN_IPG
SPEEDUP
COUNT
PROMISCUOUS
+MULTICAST
LINK_STATUS
LED_STATUS
TUNABLES
@@ -57,7 +59,7 @@ RETRIES
SINGLE_PORT
DST_MAC
-PING_IPV4
+PING_IP
PING_COUNT
PKT_SIZE
@@ -263,6 +265,12 @@ def check_ipv4_addr (ipv4_str):
return ipv4_str
+def check_ip_addr(addr):
+ if not (is_valid_ipv4(addr) or is_valid_ipv6(addr)):
+ raise argparse.ArgumentTypeError("invalid IPv4/6 address: '{0}'".format(addr))
+
+ return addr
+
def check_pkt_size (pkt_size):
try:
pkt_size = int(pkt_size)
@@ -357,6 +365,10 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
{'help': "Set port promiscuous on/off",
'choices': ON_OFF_DICT}),
+ MULTICAST: ArgumentPack(['--mult'],
+ {'help': "Set port multicast on/off",
+ 'choices': ON_OFF_DICT}),
+
LINK_STATUS: ArgumentPack(['--link'],
{'help': 'Set link status up/down',
'choices': UP_DOWN_DICT}),
@@ -446,11 +458,11 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
'help': 'source port for the action',
'required': True}),
- PING_IPV4: ArgumentPack(['-d'],
- {'help': 'which IPv4 to ping',
- 'dest': 'ping_ipv4',
+ PING_IP: ArgumentPack(['-d'],
+ {'help': 'which IPv4/6 to ping',
+ 'dest': 'ping_ip',
'required': True,
- 'type': check_ipv4_addr}),
+ 'type': check_ip_addr}),
PING_COUNT: ArgumentPack(['-n', '--count'],
{'help': 'How many times to ping [default is 5]',
@@ -479,6 +491,14 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
'default': -1.0,
'help': "Set duration time for job."}),
+ TIMEOUT: ArgumentPack(['-t'],
+ {'action': "store",
+ 'metavar': 'TIMEOUT',
+ 'dest': 'timeout',
+ 'type': int,
+ 'default': None,
+ 'help': "Timeout for operation in seconds."}),
+
FORCE: ArgumentPack(['--force'],
{"action": "store_true",
'default': False,