Commit a9766e01 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fc0e561e
#!/usr/bin/env python3
# XXX goes away completely
from jinja2 import Template
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--delete', action='store_true')
args = parser.parse_args()
if args.delete:
directory = os.path.dirname(os.path.realpath(__file__))
test_directory = os.path.join(directory, 'test')
for f in os.listdir(directory):
if 'tdd' in f or 'fdd' in f:
os.remove(os.path.join(directory, f))
for f in os.listdir(test_directory):
if 'testTDD' in f or 'testFDD' in f:
os.remove(os.path.join(test_directory, f))
exit()
global_context = {
'generated_file_message': "This file was generated using a jinja2 template and the render-templates script, don't modify directly."
}
software_list = [
# {
# 'software_name' : 'tdd-ors',
# 'rf_mode' : 'tdd',
# 'trx' : 'sdr',
# 'bbu' : 'ors',
# 'ru' : 'ors',
# }, {
# 'software_name' : 'fdd-ors',
# 'rf_mode' : 'fdd',
# 'trx' : 'sdr',
# 'bbu' : 'ors',
# 'ru' : 'ors',
# }
]
for i in range (len(software_list)):
software_list[i].update({
#'default_lte_bandwidth' : "20 MHz",
#'default_lte_imsi' : "001010123456789",
#'default_lte_k' : "00112233445566778899aabbccddeeff",
'default_lte_inactivity_timer' : 10000,
#'default_nr_bandwidth' : 40,
#'default_nr_imsi' : "001010123456789",
#'default_nr_k' : "00112233445566778899aabbccddeeff",
#'default_nr_ssb_pos_bitmap' : "10000000",
#'default_n_antenna_dl' : 2,
#'default_n_antenna_ul' : 2,
'default_nr_inactivity_timer' : 10000,
})
with open('software.cfg.json.jinja2', 'r') as f:
software_json_template = Template(f.read())
instance_json_template_map = {}
for software_type in ['enb', 'gnb']:
with open('instance-{}-input-schema.json.jinja2'.format(software_type), 'r') as f:
instance_json_template_map[software_type] = Template(f.read())
with open('software.jinja2.cfg', 'r') as f:
software_template = Template(f.read())
with open('test/test.jinja2.py', 'r') as f:
test_template = Template(f.read())
for software in software_list:
with open('software-{}.cfg.json'.format(software['software_name']),
'w+') as f:
f.write(software_json_template.render(**software, **global_context) + '\n')
with open('test/test{}.py'.format(software['software_name'].upper()),
'w+') as f:
f.write(test_template.render(**software, **global_context) + '\n')
with open('software-{}.cfg'.format(software['software_name']),
'w+') as f:
f.write(software_template.render(**software, **global_context) + '\n')
for software_type in ['enb', 'gnb']:
with open('instance-{}-{}-input-schema.json'.format(
software['software_name'],
software_type),
'w+') as f:
f.write(instance_json_template_map[software_type].render(**software, **global_context) + '\n')
File mode changed from 100644 to 100755
...@@ -9,3 +9,5 @@ extends = ...@@ -9,3 +9,5 @@ extends =
# XXX move ors-specific code here # XXX move ors-specific code here
# XXX predefine ru/cells from ORS-specific schema, not from shared instances. # XXX predefine ru/cells from ORS-specific schema, not from shared instances.
# XXX set [default-params] ?
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment