From 75ce59e5652f9094beab854d263a850cfc81a3de Mon Sep 17 00:00:00 2001
From: imarom <imarom@cisco.com>
Date: Sun, 8 May 2016 10:57:57 +0300
Subject: PCAP refinement

---
 .../trex_control_plane/stl/trex_stl_lib/utils/text_opts.py   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils')

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 5c0dfb14..7e0bf9e4 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
@@ -150,11 +150,15 @@ def format_text(text, *args):
 
 
 def format_threshold (value, red_zone, green_zone):
-    if value >= red_zone[0] and value <= red_zone[1]:
-        return format_text("{0}".format(value), 'red')
+    try:
+        if value >= red_zone[0] and value <= red_zone[1]:
+            return format_text("{0}".format(value), 'red')
 
-    if value >= green_zone[0] and value <= green_zone[1]:
-        return format_text("{0}".format(value), 'green')
+        if value >= green_zone[0] and value <= green_zone[1]:
+            return format_text("{0}".format(value), 'green')
+    except TypeError:
+        # if value is not comparable or not a number - skip this
+        pass
 
     return "{0}".format(value)
 
-- 
cgit