aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/input_data_parser.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2020-02-13 15:58:42 +0100
committerTibor Frank <tifrank@cisco.com>2020-02-13 15:58:42 +0100
commitc5e88fad52b62bc421165423702055c881b0cf03 (patch)
tree3778c4befd01a772ffa7abdf9814552d22fde407 /resources/tools/presentation/input_data_parser.py
parent5d7ed165425bfbc62bfe3c32cf5ca22aee4fe537 (diff)
Report: Tables with detailed results for MRR
Change-Id: I5506bbdc6bc5e5de4f219fa349659ddf9d0e55a8 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/input_data_parser.py')
-rw-r--r--resources/tools/presentation/input_data_parser.py49
1 files changed, 40 insertions, 9 deletions
diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py
index 5d9234e941..a619bd20a8 100644
--- a/resources/tools/presentation/input_data_parser.py
+++ b/resources/tools/presentation/input_data_parser.py
@@ -220,6 +220,8 @@ class ExecutionChecker(ResultVisitor):
r'Latency at 50% PDR:.*\[\'(.*)\', \'(.*)\'\].*\n'
r'Latency at 10% PDR:.*\[\'(.*)\', \'(.*)\'\].*\n'
)
+ REGEX_MRR_MSG_INFO = re.compile(r'.*\[(.*)\]')
+
# TODO: Remove when not needed
REGEX_NDRPDR_LAT_BASE = re.compile(
r'LATENCY.*\[\'(.*)\', \'(.*)\'\]\s\n.*\n.*\n'
@@ -355,15 +357,34 @@ class ExecutionChecker(ResultVisitor):
"""
return self._data
+ def _get_data_from_mrr_test_msg(self, msg):
+ """Get info from message of MRR performance tests.
+
+ :param msg: Message to be processed.
+ :type msg: str
+ :returns: Processed message or original message if a problem occurs.
+ :rtype: str
+ """
+
+ groups = re.search(self.REGEX_MRR_MSG_INFO, msg)
+ if not groups or groups.lastindex != 1:
+ return msg
+
+ try:
+ data = groups.group(1).split(u", ")
+ except (AttributeError, IndexError, ValueError, KeyError):
+ return msg
+
+ out_str = u"["
+ try:
+ for item in data:
+ out_str += f"{float(item):.2f}, "
+ return out_str[:-2] + u"]"
+ except (AttributeError, IndexError, ValueError, KeyError):
+ return msg
+
def _get_data_from_perf_test_msg(self, msg):
- """Get
- - NDR_LOWER
- - LATENCY
- - NDR_UPPER
- - PDR_LOWER
- - LATENCY
- - PDR_UPPER
- from message of NDRPDR performance tests.
+ """Get info from message of NDRPDR performance tests.
:param msg: Message to be processed.
:type msg: str
@@ -947,7 +968,7 @@ class ExecutionChecker(ResultVisitor):
replace(u'\r', u'').\
replace(u'[', u' |br| [').\
replace(u' |br| [', u'[', 1)
- test_result[u"msg"] = self._get_data_from_perf_test_msg(test.message).\
+ test_result[u"msg"] = test.message.\
replace(u'\n', u' |br| ').\
replace(u'\r', u'').\
replace(u'"', u"'")
@@ -989,6 +1010,11 @@ class ExecutionChecker(ResultVisitor):
if test.status == u"PASS":
if u"NDRPDR" in tags:
+ test_result[u"msg"] = self._get_data_from_perf_test_msg(
+ test.message). \
+ replace(u'\n', u' |br| '). \
+ replace(u'\r', u''). \
+ replace(u'"', u"'")
test_result[u"type"] = u"NDRPDR"
test_result[u"throughput"], test_result[u"status"] = \
self._get_ndrpdr_throughput(test.message)
@@ -1003,6 +1029,11 @@ class ExecutionChecker(ResultVisitor):
groups = re.search(self.REGEX_TCP, test.message)
test_result[u"result"] = int(groups.group(2))
elif u"MRR" in tags or u"FRMOBL" in tags or u"BMRR" in tags:
+ test_result[u"msg"] = self._get_data_from_mrr_test_msg(
+ test.message). \
+ replace(u'\n', u' |br| '). \
+ replace(u'\r', u''). \
+ replace(u'"', u"'")
if u"MRR" in tags:
test_result[u"type"] = u"MRR"
else: