ct_us_001_rig.json : cleaned up spaces

lf_json_convert.py new tool for converting json to but used in cookbooks

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-09-28 16:43:14 -06:00
parent f4e45aadeb
commit 373323f9c7
2 changed files with 63 additions and 5 deletions

View File

@@ -45,8 +45,4 @@
"1.1.wiphy6":{"KEY":"1.1.wiphy6","RADIO":"1.1.wiphy6","DRIVER":"iwlwifi(AX210)","CAPABILITIES":"802.11abgn-AX","MAX_STA":"1","MAX_VAP":"1","MAX_VIFS":"1"},
"1.1.wiphy7":{"KEY":"1.1.wiphy7","RADIO":"1.1.wiphy7","DRIVER":"mt7915e()","CAPABILITIES":"802.11abgn-AX","MAX_STA":"19","MAX_VAP":"16","MAX_VIFS":"19"}
}
}
}

View File

@@ -0,0 +1,62 @@
#!/usr/bin/env python3
'''
File: read in .json and convert for cookbook
Usage: lf_json_convert.py --file <file>
Example: lf_json_convert.py --file <file.json>
'''
# visit http://127.0.0.1:8050/ in your web browser.
import sys
import os
import importlib
import argparse
class file_convert():
def __init__(self,
_file = ''):
self.file = _file
self.file2 = "{}_edit".format(_file)
# Helper methods
def json_file(self):
file_fd = open(self.file, 'r')
file2_fd = open(self.file2, 'w+')
file2_fd.write('{\n')
file2_fd.write('"text": [ "<pre>{",')
for line in file_fd:
#print(line)
line = line.replace('"','&quot;').replace('\n','')
line = '"' + line + '\\n",'
file2_fd.write('{}\n'.format(line))
file2_fd.write('"</pre>"]\n')
file2_fd.write('},')
file_fd.close()
file2_fd.close()
# Feature, Sum up the subtests passed/failed from the kpi files for each run, poke those into the database, and generate a kpi graph for them.
def main():
parser = argparse.ArgumentParser(
prog='lf_json_convert.py',
formatter_class=argparse.RawTextHelpFormatter,
epilog='''\
lf_json_convert.py converts json for cookbook the output is <file>_edit
''',
description='''\
File: read in .json and convert for cookbook
Usage: lf_json_convert.py --file <file>
Example: lf_json_convert.py --file <file.json>
''')
parser.add_argument('--file', help='--file file.json', required=True) #TODO is this needed
args = parser.parse_args()
__file = args.file
convert = file_convert(_file = __file)
convert.json_file()
if __name__ == '__main__':
main()