aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/input_data_parser.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2020-02-21 10:11:01 +0100
committerTibor Frank <tifrank@cisco.com>2020-03-03 14:54:07 +0100
commitd9bcff4067f5bc4541d12df15137bfcc297aab39 (patch)
tree338307a4b3724140e6d190f0e4e1f1be41c4f03e /resources/tools/presentation/input_data_parser.py
parent1629fedabe77aef4f31ca4f3fbf5f66d1ec274dd (diff)
PAL: Process Hoststack data
Change-Id: Ib87ad83f3bbb7e71b51b91b9b3e8dc963a76a047 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.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py
index f7869d889a..c43d46014e 100644
--- a/resources/tools/presentation/input_data_parser.py
+++ b/resources/tools/presentation/input_data_parser.py
@@ -29,6 +29,7 @@ from os import remove
from datetime import datetime as dt
from datetime import timedelta
from json import loads
+from json.decoder import JSONDecodeError
import hdrh.histogram
import hdrh.codec
@@ -871,6 +872,40 @@ class ExecutionChecker(ResultVisitor):
return latency, u"FAIL"
+ @staticmethod
+ def _get_hoststack_data(msg, tags):
+ """Get data from the hoststack test message.
+
+ :param msg: The test message to be parsed.
+ :param tags: Test tags.
+ :type msg: str
+ :type tags: list
+ :returns: Parsed data as a JSON dict and the status (PASS/FAIL).
+ :rtype: tuple(dict, str)
+ """
+ result = dict()
+ status = u"FAIL"
+
+ msg = msg.replace(u"'", u'"').replace(u" ", u"")
+ if u"LDPRELOAD" in tags:
+ try:
+ result = loads(msg)
+ status = u"PASS"
+ except JSONDecodeError:
+ pass
+ elif u"VPPECHO" in tags:
+ try:
+ msg_lst = msg.replace(u"}{", u"} {").split(u" ")
+ result = dict(
+ client=loads(msg_lst[0]),
+ server=loads(msg_lst[1])
+ )
+ status = u"PASS"
+ except (JSONDecodeError, IndexError):
+ pass
+
+ return result, status
+
def visit_suite(self, suite):
"""Implements traversing through the suite and its direct children.
@@ -1040,6 +1075,10 @@ class ExecutionChecker(ResultVisitor):
test_result[u"type"] = u"SOAK"
test_result[u"throughput"], test_result[u"status"] = \
self._get_plr_throughput(test.message)
+ elif u"HOSTSTACK" in tags:
+ test_result[u"type"] = u"HOSTSTACK"
+ test_result[u"result"], test_result[u"status"] = \
+ self._get_hoststack_data(test.message, tags)
elif u"TCP" in tags:
test_result[u"type"] = u"TCP"
groups = re.search(self.REGEX_TCP, test.message)
@@ -1152,7 +1191,8 @@ class ExecutionChecker(ResultVisitor):
test_kw.name.count(u"Show Runtime Counters On All Duts"):
self._msg_type = u"test-show-runtime"
self._sh_run_counter += 1
- elif test_kw.name.count(u"Install Dpdk Test") and not self._version:
+ elif test_kw.name.count(u"Install Dpdk Test On All Duts") and \
+ not self._version:
self._msg_type = u"dpdk-version"
else:
return