aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/input_data_parser.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-06-15 14:24:26 +0200
committerTibor Frank <tifrank@cisco.com>2021-06-16 10:22:10 +0200
commitbb1a7058e8bbcbe998fdfd8dd5ed46e13fb90db7 (patch)
tree55b3bec37c117692184e5bfe48b0e091a79aca32 /resources/tools/presentation/input_data_parser.py
parent2072a56eeca53f00cff1b5d888d24f7271ae1fb4 (diff)
Report: Add vsap
Change-Id: I3e8719ab2da0d9b4ae1b24c6b8479724064c8dce 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.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py
index 364cdbdbad..2cc2447ec0 100644
--- a/resources/tools/presentation/input_data_parser.py
+++ b/resources/tools/presentation/input_data_parser.py
@@ -239,6 +239,15 @@ class ExecutionChecker(ResultVisitor):
)
REGEX_MRR_MSG_INFO = re.compile(r'.*\[(.*)\]')
+ REGEX_VSAP_MSG_INFO = re.compile(
+ r'Transfer Rate: (\d*.\d*).*\n'
+ r'Latency: (\d*.\d*).*\n'
+ r'Completed requests: (\d*).*\n'
+ r'Failed requests: (\d*).*\n'
+ r'Total data transferred: (\d*).*\n'
+ r'Connection [cr]ps rate:\s*(\d*.\d*)'
+ )
+
# Needed for CPS and PPS tests
REGEX_NDRPDR_LAT_BASE = re.compile(
r'LATENCY.*\[\'(.*)\', \'(.*)\'\]\s\n.*\n.*\n'
@@ -927,6 +936,39 @@ class ExecutionChecker(ResultVisitor):
return result, status
+ def _get_vsap_data(self, msg, tags):
+ """Get data from the vsap 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"
+
+ groups = re.search(self.REGEX_VSAP_MSG_INFO, msg)
+ if groups is not None:
+ try:
+ result[u"transfer-rate"] = float(groups.group(1)) * 1e3
+ result[u"latency"] = float(groups.group(2))
+ result[u"completed-requests"] = int(groups.group(3))
+ result[u"failed-requests"] = int(groups.group(4))
+ result[u"bytes-transferred"] = int(groups.group(5))
+ if u"TCP_CPS"in tags:
+ result[u"cps"] = float(groups.group(6))
+ elif u"TCP_RPS" in tags:
+ result[u"rps"] = float(groups.group(6))
+ else:
+ return result, status
+ status = u"PASS"
+ except (IndexError, ValueError):
+ pass
+
+ return result, status
+
def visit_suite(self, suite):
"""Implements traversing through the suite and its direct children.
@@ -1125,6 +1167,10 @@ class ExecutionChecker(ResultVisitor):
if test.status == u"PASS":
test_result[u"result"], test_result[u"status"] = \
self._get_hoststack_data(test.message, tags)
+ elif u"LDP_NGINX" in tags:
+ test_result[u"type"] = u"LDP_NGINX"
+ test_result[u"result"], test_result[u"status"] = \
+ self._get_vsap_data(test.message, tags)
# elif u"TCP" in tags: # This might be not used
# test_result[u"type"] = u"TCP"
# if test.status == u"PASS":