X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fmodel%2FExportJson.py;h=73e822491cd8fd74ac9d0abaca9b1740ea90e826;hb=refs%2Fchanges%2F65%2F39365%2F9;hp=b0e0158295b55c9d2c729a42c91ffacc29b214b2;hpb=bfbdfaedb044b7643b81f47e76285baedfee9e25;p=csit.git diff --git a/resources/libraries/python/model/ExportJson.py b/resources/libraries/python/model/ExportJson.py index b0e0158295..73e822491c 100644 --- a/resources/libraries/python/model/ExportJson.py +++ b/resources/libraries/python/model/ExportJson.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -23,12 +23,14 @@ as serialization might have introduced subtle errors. import datetime import os.path +from binascii import b2a_base64 from dateutil.parser import parse from robot.api import logger from robot.libraries.BuiltIn import BuiltIn +from zlib import compress from resources.libraries.python.Constants import Constants -from resources.libraries.python.jumpavg.AvgStdevStats import AvgStdevStats +from resources.libraries.python.jumpavg import AvgStdevStats from resources.libraries.python.model.ExportResult import ( export_dut_type_and_version, export_tg_type_and_version ) @@ -65,11 +67,11 @@ class ExportJson(): if u"DEVICETEST" in tags: test_type = u"device" elif u"LDP_NGINX" in tags: - test_type = u"vsap" + test_type = u"hoststack" elif u"HOSTSTACK" in tags: test_type = u"hoststack" elif u"GSO_TRUE" in tags or u"GSO_FALSE" in tags: - test_type = u"gso" + test_type = u"mrr" elif u"RECONF" in tags: test_type = u"reconf" # The remaining 3 options could also apply to DPDK and TRex tests. @@ -357,6 +359,11 @@ class ExportJson(): Results are used to avoid future post processing, making it more efficient to consume. """ + if self.data["telemetry"]: + telemetry_encode = "\n".join(self.data["telemetry"]).encode() + telemetry_compress = compress(telemetry_encode, level=9) + telemetry_base64 = b2a_base64(telemetry_compress, newline=False) + self.data["telemetry"] = [telemetry_base64.decode()] if u"result" not in self.data: return result_node = self.data[u"result"]