code
stringlengths
10
58.5k
file_path
stringlengths
53
173
new_metadata[prop] = update[prop] return new_metadata def _update_test_cases(current, update): if not current: return update.copy() new_cases = current.copy() for group, cases in update.items(): updated_cases = cases.copy() if group in new_cases: updat...
KeysightData/SONiC/sonic-mgmt/test_reporting/junit_xml_parser.py_part4
csv_file = open('report_{}.csv'.format(tstamp), "w+") for test in REPORT_LIST: csv_file.write(test+'\n') csv_file.close() if __name__ == "__main__": _run_script()
KeysightData/SONiC/sonic-mgmt/test_reporting/junit_xml_parser.py_part5
import argparse import json import sys import uuid import re import os from junit_xml_parser import ( validate_junit_json_file, validate_junit_xml_path, parse_test_result ) from report_data_storage import KustoConnector def _parse_os_version(image_url): """Parse os version from image url""" os_ve...
KeysightData/SONiC/sonic-mgmt/test_reporting/report_uploader.py_part1
"""Tests for the JUnit XML parser.""" import os import pytest from test_reporting.junit_xml_parser import validate_junit_xml_stream, validate_junit_xml_file from test_reporting.junit_xml_parser import validate_junit_xml_archive, parse_test_result, JUnitXMLValidationError VALID_TEST_RESULT = """<?xml version="1.0" en...
KeysightData/SONiC/sonic-mgmt/test_reporting/tests/test_junit_xml_parser.py_part1
def test_invalid_junit_xml_missing_xml(input_string): with pytest.raises(JUnitXMLValidationError, match="could not parse provided XML stream"): validate_junit_xml_stream(input_string) def test_invalid_junit_xml_too_large(): with pytest.raises(JUnitXMLValidationError, match="provided stream is too larg...
KeysightData/SONiC/sonic-mgmt/test_reporting/tests/test_junit_xml_parser.py_part2
""" This file defines SAI qualification report utils """ import json import os from constant import PRIORI_RESULT_SAVE_DIR, SAI_ADAPTER_FILENAME def store_result(data, file_name): """ Save result to json file Args: data: result data to save file_name: file name """ with open(fil...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/sai_report_utils.py_part1
import argparse import json import os import re import uuid """ This script parses the published artifacts, and outputs a json format result. Examples: - Input 1) log example: 02/24/2023 03:34:54 AM - /tmp/sai_qualify/SAI/ptf/sairif.py:SviLagHostTest - \ sai_adapter.py - INFO - sai_adapter_invok...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/case_scanner_runtime.py_part1
data['test_set'] = 't0' if 'sai_test' in sai_path else 'ptf' data['test_platform'] = test_platform data['sai_obj_attr_key'] = k data['sai_obj_attr_val'] = v data['runnable'] = True data['sai_folder'] = '/'.join(sai_path.split('/')[:-1]) formatted_time = obj[0].split()[0].split('/') dat...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/case_scanner_runtime.py_part2
""" This file scans SAI header """ import json import os import sys from pyclibrary import CParser from constant import (IGNORE_HEADER_FILE_LIST, PRIORI_RESULT_SAVE_DIR, SAI_HEADER_FILENAME, SAI_HEADER_FILENAME_UPLOAD) from data_model.sai_interface_header import SAIInterfaceHeader from sai_repo...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/sai_header_scanner.py_part1
""" This file scans sai_adapter, generating the attribute name and value pairs in SAI interface """ import argparse import ast import json import os from constant import PRIORI_RESULT_SAVE_DIR, SAI_ADAPTER_FILENAME def get_parser(description="SAI Adapter Scanner"): """ Parse command line """ parser ...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/sai_adapter_scanner.py_part1
""" This file scans all SAI interface in a given directory of files. Each file is corresponds to a json result. The key points are AST (abstract syntax tree) and DFS(depth first search). """ import argparse import ast import json import os import uuid from datetime import date from multipledispatch import dispatch f...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/case_scanner.py_part1
test_set, runnable, sai_folder): ''' parse Attribute level (child.func : ast.Attribute) Args: child: AST child node file_name: file name class_name: class name method_name: method name sai_interface: SAI int...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/case_scanner.py_part2
data = json.load(f) return data def parse_decorator_list(self, node: ast.ClassDef) -> bool: ''' Parse decorator list, to distinguish whether the scanned case is runnable Args: node: AST node Return: boolean: runnable or not ''' ...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/case_scanner.py_part3
""" This file defines SAI qualification report constant variables """ PRIORI_RESULT_SAVE_DIR = "result" FINAL_RESULT_SAVE_DIR = "result/scan" SAI_API_PREFIX = "sai_thrift" IGNORE_FILE_LIST = ["sai_adapter.py", "sai_utils.py", "__init__.py"] IGNORE_HEADER_FILE_LIST = ["sai.h", "saiobject.h", "saist...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/constant.py_part1
class TestInvocation(object): """ Structure of invocation Args: id: unique identifier for each record file_name: file name class_name: class name case_name: method name case_invoc: SAI interface saiintf_method_table: SAI interface groupalias test_set:...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/data_model/test_invocation.py_part1
class SAIInterfaceHeader(object): """ Structure of SAI interface header Args: intf_groupname: SAI interface groupname intf_groupalias: SAI interface groupalias intf_alias: SAI interface alias file_name: file name """ def __init__(self, intf_groupname, intf_groupalias...
KeysightData/SONiC/sonic-mgmt/test_reporting/sai_coverage/data_model/sai_interface_header.py_part1