diff options
author | 2016-12-12 17:38:43 +0200 | |
---|---|---|
committer | 2016-12-19 11:23:48 +0200 | |
commit | cc4bd93b660505a7c9d8e370a1220377907fa6d2 (patch) | |
tree | b0296f645a76f50d3ca0a957a70f54a7b3afc23b /scripts/automation/trex_control_plane/stl/trex_stl_lib/utils | |
parent | ac3784a3bad416d45b93cb17be551726e08c545d (diff) |
1) limit number of streams per port to 20k
2) fix showing error in TUI
3) represensation of STLError: show only errors if error, limit by 10 entries
Change-Id: Ib8de9222e7fc09dd67275283857d0d7e9cb5988c
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py index bfb96950..6c5dd2c3 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py @@ -27,6 +27,9 @@ class TextCodesStripper: def strip (s): return re.sub(TextCodesStripper.pattern, '', s) +def clear_formatting(s): + return TextCodesStripper.strip(s) + def format_num (size, suffix = "", compact = True, opts = None): if opts is None: opts = () @@ -129,10 +132,20 @@ def underline(text): return text_attribute(text, 'underline') +start_end_newlines = re.compile('^(\n)*([^\n].*[^\n])?(\n)*$', re.DOTALL) def text_attribute(text, attribute): - return "{start}{txt}{stop}".format(start=TEXT_CODES[attribute]['start'], - txt=text, - stop=TEXT_CODES[attribute]['end']) + match = start_end_newlines.match(text) + try: + startpad, msg, endpad = match.groups('') + except: + startpad = endpad = '' + msg = text + return "{startpad}{startattr}{txt}{endattr}{endpad}".format( + startpad = startpad, + startattr = TEXT_CODES[attribute]['start'], + txt = msg, + endattr = TEXT_CODES[attribute]['end'], + endpad = endpad) FUNC_DICT = {'blue': blue, |