Commit 6bca7aa8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 09f73362
{%- import 'slaplte.jinja2' as slaplte with context %} {%- import 'slaplte.jinja2' as slaplte with context %}
{%- set B = slaplte.B %}
{%- set J = slaplte.J %} {%- set J = slaplte.J %}
{%- set jcell_ru_ref = slaplte.jcell_ru_ref %} {%- set jcell_ru_ref = slaplte.jcell_ru_ref %}
{%- set B = xbuildout.encode %}
{#- for standalone testing via slapos-render-config.py {#- for standalone testing via slapos-render-config.py
NOTE: keep in sync with instance-enb.jinja2.cfg and ru/libinstance.jinja2.cfg #} NOTE: keep in sync with instance-enb.jinja2.cfg and ru/libinstance.jinja2.cfg #}
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
// LTE cells // LTE cells
cell_list: [ cell_list: [
// CELL_a (RU1) // CELL__a (RU1)
{ {
rf_port: 0, rf_port: 0,
n_antenna_dl: 2, n_antenna_dl: 2,
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
// Intra-ENB HO // Intra-ENB HO
{ {
rat: "nr", rat: "nr",
cell_id: 0x02, // -> CELL_b cell_id: 0x02, // -> CELL__b
}, },
// Inter-ENB HO // Inter-ENB HO
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
// Dual Connectivity: LTE + NR // Dual Connectivity: LTE + NR
en_dc_scg_cell_list: [ en_dc_scg_cell_list: [
{ {
cell_id: 0x02, // + CELL_b cell_id: 0x02, // + CELL__b
}, },
], ],
...@@ -140,11 +140,11 @@ ...@@ -140,11 +140,11 @@
srs_hopping_bandwidth: 0, srs_hopping_bandwidth: 0,
}, },
drb_config: "CELL_a-drb.cfg", drb_config: "CELL__a-drb.cfg",
sib_sched_list: [ sib_sched_list: [
{ {
filename: "CELL_a-sib23.asn", filename: "CELL__a-sib23.asn",
si_periodicity: 16, si_periodicity: 16,
}, },
], ],
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
// NR cells // NR cells
nr_cell_list: [ nr_cell_list: [
// CELL_b (RU2) // CELL__b (RU2)
{ {
rf_port: 1, rf_port: 1,
n_antenna_dl: 2, n_antenna_dl: 2,
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
// Intra-ENB HO // Intra-ENB HO
{ {
rat: "eutra", rat: "eutra",
cell_id: 0x1001201, // -> CELL_a cell_id: 0x1001201, // -> CELL__a
n_id_cell: 1, n_id_cell: 1,
dl_earfcn: 38050, dl_earfcn: 38050,
tac: 0x1234, tac: 0x1234,
...@@ -438,7 +438,7 @@ ...@@ -438,7 +438,7 @@
}, },
drb_config: "CELL_b-drb.cfg", drb_config: "CELL__b-drb.cfg",
}, },
], ],
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
// XXX vvv <- ru.txrx_active ? XXX how to handle txrx_active for SDR ? // XXX vvv <- ru.txrx_active ? XXX how to handle txrx_active for SDR ?
// (tx_gain=-1000 does not work - it still sets tx_gain to min.possible value 14) // (tx_gain=-1000 does not work - it still sets tx_gain to min.possible value 14)
name: "sdr", name: "sdr",
// _UCELL1_ru 2T1R (sdr) // __UCELL1__ru 2T1R (sdr)
// _UCELL2_ru 2T2R (sdr) // __UCELL2__ru 2T2R (sdr)
args: "dev0=/dev/sdr0,dev1=/dev/sdr2", args: "dev0=/dev/sdr0,dev1=/dev/sdr2",
rx_antenna:"tx_rx", rx_antenna:"tx_rx",
tdd_tx_mod: 1, tdd_tx_mod: 1,
......
...@@ -79,6 +79,10 @@ ...@@ -79,6 +79,10 @@
} }
%} %}
{#- XXX explain #}
{%- set B = xbuildout.encode %}
{#- J is used around macro calls to retrieve returned objects. {#- J is used around macro calls to retrieve returned objects.
It is needed to workaround jinja2 limitation that macro can return only It is needed to workaround jinja2 limitation that macro can return only
...@@ -419,7 +423,7 @@ ...@@ -419,7 +423,7 @@
{%- set rx_gainv = [] %} {#- rx_gain by rx channel #} {%- set rx_gainv = [] %} {#- rx_gain by rx channel #}
{%- for (ru_ref, iru) in iru_dict.items() | sort(attribute="1._._rf_port") %} {%- for (ru_ref, iru) in iru_dict.items() | sort(attribute="1._._rf_port") %}
{%- set ru = iru['_'] %} {%- set ru = iru['_'] %}
// {{ dumps(ru_ref) }} {{ ru.n_antenna_dl }}T{{ ru.n_antenna_ul }}R ({{ ru.ru_type }}) // {{ B(ru_ref) }} {{ ru.n_antenna_dl }}T{{ ru.n_antenna_ul }}R ({{ ru.ru_type }})
{%- if ru.ru_type == 'sdr' %} {%- if ru.ru_type == 'sdr' %}
{%- do ru_sdr_dict.update({len(dev_argv): ru}) %} {%- do ru_sdr_dict.update({len(dev_argv): ru}) %}
{%- for n in ru.sdr_dev_list %} {%- for n in ru.sdr_dev_list %}
......
...@@ -6,7 +6,19 @@ ...@@ -6,7 +6,19 @@
import zc.buildout.buildout # XXX workaround for https://lab.nexedi.com/nexedi/slapos.recipe.template/merge_requests/9 import zc.buildout.buildout # XXX workaround for https://lab.nexedi.com/nexedi/slapos.recipe.template/merge_requests/9
from slapos.recipe.template import jinja2_template from slapos.recipe.template import jinja2_template
import json, copy, sys, os, pprint, glob import json, copy, sys, os, pprint, glob, types
# ~ import xbuildout (see instance.cfg:activate-eggs)
def readfile(path):
with open(path) as f:
return f.read()
xbuildout = types.ModuleType('xbuildout')
exec(readfile('ru/xbuildout.py'), xbuildout.__dict__)
assert 'xbuildout' not in sys.modules
sys.modules['xbuildout'] = xbuildout
B = xbuildout.encode
# j2render renders config/<src> into config/out/<out> with provided json parameters. # j2render renders config/<src> into config/out/<out> with provided json parameters.
...@@ -19,6 +31,7 @@ def j2render(src, out, jcfg): ...@@ -19,6 +31,7 @@ def j2render(src, out, jcfg):
textctx = '' textctx = ''
for k, v in ctx.items(): for k, v in ctx.items():
textctx += 'json %s %s\n' % (k, json.dumps(v)) textctx += 'json %s %s\n' % (k, json.dumps(v))
textctx += 'import xbuildout xbuildout\n'
textctx += 'import json_module json\n' textctx += 'import json_module json\n'
textctx += 'import nrarfcn_module nrarfcn\n' textctx += 'import nrarfcn_module nrarfcn\n'
textctx += 'import xearfcn_module xlte.earfcn\n' textctx += 'import xearfcn_module xlte.earfcn\n'
...@@ -466,11 +479,11 @@ def do_enb(): ...@@ -466,11 +479,11 @@ def do_enb():
'ru': ru, 'ru': ru,
}) })
j2render('drb_%s.jinja2.cfg' % cell['cell_type'], j2render('drb_%s.jinja2.cfg' % cell['cell_type'],
'%s-drb.cfg' % cell_ref, B('%s-drb.cfg' % cell_ref),
jctx) jctx)
j2render('sib23.jinja2.asn', j2render('sib23.jinja2.asn',
'%s-sib23.asn' % cell_ref, B('%s-sib23.asn' % cell_ref),
jctx) jctx)
......
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