summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-02-21 18:01:36 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-02-21 18:01:36 +0200
commit6182075a09042c2d72f16a434b7978615143f589 (patch)
treea1638ca143c1e4dc029fa865aa42cb48d2c8c1ff /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py
parent2f75f197b0f948aa53e88e479d85cf83a64057c4 (diff)
typo in step and min/max_value; support old-type classes in validate_type; assert positive values in python; hlt fix vlan vm + test for it;
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py
index 0a6e64fb..aa09b0a1 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py
@@ -2,6 +2,7 @@
from collections import namedtuple
from utils.text_opts import *
from trex_stl_exceptions import *
+import types
RpcCmdData = namedtuple('RpcCmdData', ['method', 'params'])
TupleRC = namedtuple('RC', ['rc', 'data', 'is_warn'])
@@ -102,7 +103,9 @@ def RC_WARN (warn):
def validate_type(arg_name, arg, valid_types):
if type(valid_types) is list:
valid_types = tuple(valid_types)
- if type(valid_types) is type or type(valid_types) is tuple:
+ if (type(valid_types) is type or # single type, not array of types
+ type(valid_types) is tuple or # several valid types as tuple
+ type(valid_types) is types.ClassType): # old style class
if isinstance(arg, valid_types):
return
raise STLTypeError(arg_name, type(arg), valid_types)