From 6182075a09042c2d72f16a434b7978615143f589 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Sun, 21 Feb 2016 18:01:36 +0200 Subject: 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; --- .../automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py') 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) -- cgit 1.2.3-korg