Commit c7e06e3e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a62e5ccc
This diff is collapsed.
...@@ -272,9 +272,7 @@ ...@@ -272,9 +272,7 @@
{%- if ref.startswith(partition_id) %} {%- if ref.startswith(partition_id) %}
{%- set ref = ref[len(partition_id):] %} {%- set ref = ref[len(partition_id):] %}
{%- endif %} {%- endif %}
{%- if ref.startswith('_') %} {%- set ref = ref.removeprefix('_') %}
{%- set ref = ref[1:] %}
{%- endif %}
{{- ref | tojson }} {{- ref | tojson }}
{%- endmacro %} {%- endmacro %}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
manual_ref_signal_power: true, manual_ref_signal_power: true,
{%- endif %} {%- endif %}
drb_config: {{ lte.cell_drb_config(cell) }} drb_config: "{{ cell_ref }}-drb.cfg"
}, },
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
......
...@@ -9,8 +9,8 @@ from slapos.recipe.template import jinja2_template ...@@ -9,8 +9,8 @@ from slapos.recipe.template import jinja2_template
import json, copy, sys, pprint import json, copy, sys, pprint
# j2render renders config/<config>.jinja2.cfg into config/<config>.cfg with provided json parameters. # j2render renders config/<src> into config/<out> with provided json parameters.
def j2render(config, jcfg): def j2render(src, out, jcfg):
ctx = json.loads(jcfg) ctx = json.loads(jcfg)
assert '_standalone' not in ctx assert '_standalone' not in ctx
ctx['_standalone'] = True ctx['_standalone'] = True
...@@ -23,8 +23,8 @@ def j2render(config, jcfg): ...@@ -23,8 +23,8 @@ def j2render(config, jcfg):
buildout = None # stub buildout = None # stub
r = jinja2_template.Recipe(buildout, "recipe", { r = jinja2_template.Recipe(buildout, "recipe", {
'extensions': 'jinja2.ext.do', 'extensions': 'jinja2.ext.do',
'url': 'config/{}.jinja2.cfg'.format(config), 'url': 'config/{}'.format(src),
'output': 'config/{}.cfg'.format(config), 'output': 'config/{}'.format(out),
'context': textctx, 'context': textctx,
'import-list': ''' 'import-list': '''
rawfile amari_lte.jinja2 amari/lte.jinja2 rawfile amari_lte.jinja2 amari/lte.jinja2
...@@ -43,7 +43,7 @@ def j2render(config, jcfg): ...@@ -43,7 +43,7 @@ def j2render(config, jcfg):
'pprint': lambda obj: pprint.pprint(obj, sys.stderr), 'pprint': lambda obj: pprint.pprint(obj, sys.stderr),
}) })
with open('config/{}.cfg'.format(config), 'w+') as f: with open('config/{}'.format(out), 'w+') as f:
f.write(r._render().decode()) f.write(r._render().decode())
...@@ -66,6 +66,12 @@ class Instance: ...@@ -66,6 +66,12 @@ class Instance:
self.shared_instance_list.append(ishared) self.shared_instance_list.append(ishared)
return ishared return ishared
# py version of jref_of_shared.
def ref_of_shared(ishared):
ref = ishared['slave_title']
ref = ref.removeprefix('_')
return ref
# ---- eNB ---- # ---- eNB ----
...@@ -298,7 +304,20 @@ def do_enb(): ...@@ -298,7 +304,20 @@ def do_enb():
} }
}""" % locals() }""" % locals()
j2render('enb', json_params) j2render('enb.jinja2.cfg', 'enb.cfg', json_params)
# drb.cfg for all cells
for ishared in ienb.shared_instance_list:
ref = ref_of_shared(ishared)
_ = json.loads(ishared['_'])
if 'cell_type' in _:
cell = _
j2render('drb_%s.jinja2.cfg' % cell['cell_type'],
'%s-drb.cfg' % ref,
json.dumps({
'cell_ref': ref,
'cell': cell
}))
# ---- UE ---- # ---- UE ----
...@@ -366,7 +385,7 @@ def do_ue(): ...@@ -366,7 +385,7 @@ def do_ue():
} }
}""" % locals() }""" % locals()
j2render('ue', json_params) j2render('ue.jinja2.cfg', 'ue.cfg', json_params)
def main(): def main():
......
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