Commit 9f39dcad authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Start of slaplte package by way of fixing standalone...

software/ors-amarisoft: Start of slaplte package by way of fixing standalone build of enb.cfg and gnb.cfg

Please see individual patches for details.

/cc @lu.xu, @xavier_thompson, @Daetalus
/reviewed-by @jhuge
/reviewed-on nexedi/slapos!1480
parents 4cd01085 421ad29b
......@@ -16,7 +16,11 @@
[template]
filename = instance.cfg
md5sum = e2e286ba8d40790da3da462d55276e29
md5sum = b4f7cf9de06af21a0c4c00d8be5edce7
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
md5sum = c31dffa87765d93327f18ffd89ce36ca
[amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py
......@@ -28,7 +32,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = 91ef336b7e913c07d89b82b27ffad11d
md5sum = a6b710ca5132276d72f90b76b873fe98
[ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
......@@ -80,7 +84,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 815d57a36c7e3b4361230fbd3c76a9ef
md5sum = b52a8584712f9cee338c71a6dedc7dad
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......@@ -108,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum = 8e49dfc9318da43bd817b8891cba24b7
md5sum = a961cc1469bd2534645470f914f12905
[drb_lte.jinja2.cfg]
filename = config/drb_lte.jinja2.cfg
......
{%- import 'slaplte.jinja2' as slaplte with context %}
{#- for standalone testing via slapos-render-config.py
NOTE: keep in sync with ru/libinstance.jinja2.cfg #}
{%- if _standalone is defined %}
{%- set cell_list = {} %}
{%- do slaplte.load_cell(cell_list) %}
{%- endif %}
{%- set cell_count = cell_list|length %}
{%- if slapparameter_dict.get('tdd_ul_dl_config', '[Configuration 2] 5ms 2UL 6DL (default)') == '[Configuration 2] 5ms 2UL 6DL (default)' %}
......
......@@ -32,6 +32,7 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
{%- import 'slaplte.jinja2' as slaplte with context %}
{%- import 'ru_libinstance.jinja2.cfg' as rulib with context %}
{{ rulib.buildout() }}
......@@ -367,6 +368,9 @@ extra-context =
json cell_list {{ rulib.cell_list | tojson }}
key sib23_file sib-config:output
key drb_file drb-config:output
import-list =
rawfile slaplte.jinja2 {{ slaplte_template }}
[publish-connection-information]
<= monitor-publish
......
......@@ -40,6 +40,7 @@ context =
raw ru ${rf-mode:ru}
$${:extra-context}
import-list =
rawfile slaplte.jinja2 ${slaplte.jinja2:target}
rawfile ru_libinstance.jinja2.cfg ${ru_libinstance.jinja2.cfg:target}
rawfile ru_sdr_libinstance.jinja2.cfg ${ru_sdr_libinstance.jinja2.cfg:target}
rawfile ru_lopcomm_libinstance.jinja2.cfg ${ru_lopcomm_libinstance.jinja2.cfg:target}
......@@ -275,6 +276,7 @@ extra-context =
key enb amarisoft:enb
key sdr amarisoft:sdr
raw enb_template ${enb.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target}
raw drb_lte_template ${drb_lte.jinja2.cfg:target}
raw sib23_template ${sib23.jinja2.asn:target}
raw amarisoft_stats_template ${amarisoft-stats.jinja2.py:target}
......
......@@ -3,15 +3,16 @@
Use buildout() macro to emit instance-level code to
handle configured RUs.
NOTE: before importing package slaplte.jinja2 needs to already loaded as
{%- import 'slaplte.jinja2' as slaplte with context %}
NOTE: driver-specific logic is implemented in rudrv.buildout_ru() .
#}
{#- cell_list keeps cell registry #}
{%- set cell_list = slapparameter_dict.get('cell_list', {'default': {}}) %}
{%- for i, k in enumerate(cell_list) %}
{%- set cell = cell_list[k] %}
{%- do cell.setdefault('cpri_port_number', i) %}
{%- endfor %}
{%- set cell_list = {} %}
{%- do slaplte.load_cell(cell_list) %}
{%- macro buildout() %}
......@@ -39,13 +40,6 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
lopcomm=rudrv_lopcomm,
sunwave=rudrv_sunwave) %}
{#- slaptap indicates tap interface, that slapos told us to use,
or 'xxx-notap-xxx' if slapos provided us either nothing or empty string. #}
{%- set slaptap = slap_configuration.get('tap-name', '') %}
{%- if slaptap == '' %}
{%- set slaptap = 'xxx-notap-xxx' %}
{%- endif %}
{#- split slapos tap interface for each RU
fallback to non-split approach for ntap <= 1 to avoid hard-dependecy on setcap/tapsplit
......@@ -58,7 +52,7 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
[vtap]
recipe = plone.recipe.command
ntap = {{ ntap }}
command = {{ netcapdo }} {{ pythonwitheggs }} {{ ru_tapsplit }} {{ slaptap }} ${:ntap}
command = {{ netcapdo }} {{ pythonwitheggs }} {{ ru_tapsplit }} {{ slaplte.tap }} ${:ntap}
update-command = ${:command}
stop-on-error = true
......@@ -68,8 +62,8 @@ ntap = 0
stop-on-error = false
{%- if ntap == 1 %}
{%- do vtap_list.append(slaptap) %}
[vtap.{{ slaptap }}]
{%- do vtap_list.append(slaplte.tap) %}
[vtap.{{ slaplte.tap }}]
network = {{ slap_configuration['tap-ipv6-network'] }}
gateway = {{ slap_configuration['tap-ipv6-gateway'] }}
addr = {{ slap_configuration['tap-ipv6-addr'] }}
......@@ -78,7 +72,7 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }}
{%- else %}
{%- for i in range(1,1+ntap) %}
{%- set tap = '%s-%d' % (slaptap, i) %}
{%- set tap = '%s-%d' % (slaplte.tap, i) %}
{%- do vtap_list.append(tap) %}
[vtap.{{ tap }}]
recipe = slapos.recipe.build
......@@ -96,7 +90,7 @@ init =
# simulate what tapsplit would assign to the tap
# ( tap subinterface will be created for real later at install time - when it
# is too late to update section options )
slapnet = tapsplit.ifnet6('{{ slaptap }}')
slapnet = tapsplit.ifnet6('{{ slaplte.tap }}')
tapnet = tapsplit.netsplit(slapnet, {{ 1+ntap }}) [{{ i }}]
options['network'] = str(tapnet)
......@@ -119,17 +113,6 @@ init =
{%- endfor %}
{#- assign TAP interfaces to RUs #}
{%- for i, (cell_ref, cell) in enumerate(cell_list|dictsort) %}
{%- if len(cell_list) > 1 %}
{%- set ru_tap = "%s-%d" % (slaptap, i+1) %}
{%- else %}
{%- set ru_tap = slaptap %}
{%- endif %}
{%- do cell.update({'_tap': ru_tap}) %}
{%- endfor %}
{#- go through all RUs and for each RU invoke
RU-specific buildout handler #}
{%- set ru_type = {'lopcomm': 'lopcomm', 'm2ru': 'sunwave'}.get(ru, 'sdr') %}
......
{#- Package slaplte provides helpers for configuring Amarisoft LTE services in SlapOS.
- load_cell initializes cell registry.
-#}
{#- tap indicates tap interface, that slapos told us to use,
or 'xxx-notap-xxx' if slapos provided us either nothing or empty string. #}
{%- set tap = slap_configuration.get('tap-name', '') %}
{%- if tap == '' %}
{%- set tap = 'xxx-notap-xxx' %}
{%- endif %}
{#- ---- loading ---- #}
{#- load_cell initializes cell registry.
cell_list keeps configured cells: {} cell reference -> cell parameters
#}
{%- macro load_cell(cell_list) %}
{%- do cell_list.update( slapparameter_dict.get('cell_list', {'default': {}}) ) %}
{%- for i, k in enumerate(cell_list) %}
{%- set cell = cell_list[k] %}
{%- do cell.setdefault('cpri_port_number', i) %}
{%- endfor %}
{#- assign TAP interfaces to RUs #}
{%- for i, (cell_ref, cell) in enumerate(cell_list|dictsort) %}
{%- if len(cell_list) > 1 %}
{%- set ru_tap = "%s-%d" % (tap, i+1) %}
{%- else %}
{%- set ru_tap = tap %}
{%- endif %}
{%- do cell.update({'_tap': ru_tap}) %}
{%- endfor %}
{%- endmacro %}
......@@ -12,6 +12,8 @@ import json
# j2render renders config/<cfg>.jinja2.cfg into config/<cfg>.cfg with provided json parameters.
def j2render(cfg, jcfg):
ctx = json.loads(jcfg)
assert '_standalone' not in ctx
ctx['_standalone'] = True
textctx = ''
for k, v in ctx.items():
textctx += 'json %s %s\n' % (k, json.dumps(v))
......@@ -21,6 +23,8 @@ def j2render(cfg, jcfg):
'url': 'config/{}.jinja2.cfg'.format(cfg),
'output': 'config/{}.cfg'.format(cfg),
'context': textctx,
'import-list': '''
rawfile slaplte.jinja2 slaplte.jinja2''',
})
#print(r.context)
......@@ -34,54 +38,57 @@ def j2render(cfg, jcfg):
f.write(r._render().decode())
config = "gnb"
json_params_empty = """{
"rf_mode": 'fdd',
"slap_configuration": {
},
"directory": {
},
"slapparameter_dict": {
}
}"""
json_params = """{
"rf_mode": "tdd",
"trx": "sdr",
"bbu": "ors",
"ru": "ors",
"one_watt": "True",
"earfcn": 646666,
"nr_arfcn": 646666,
"nr_band": 43,
"tx_gain": 62,
"rx_gain": 43,
"sib23_file": "sib",
"slap_configuration": {
"tap-name": "slaptap9",
"configuration.default_lte_bandwidth": "10 MHz",
"configuration.default_lte_imsi": "001010123456789",
"configuration.default_lte_k": "00112233445566778899aabbccddeeff",
"configuration.default_lte_inactivity_timer": 10000,
"configuration.default_nr_bandwidth": 40,
"configuration.default_nr_imsi": "001010123456789",
"configuration.default_nr_k": "00112233445566778899aabbccddeeff",
"configuration.default_nr_ssb_pos_bitmap": "10000000",
"configuration.default_n_antenna_dl": 2,
"configuration.default_n_antenna_ul": 2,
"configuration.default_nr_inactivity_timer": 10000,
"configuration.com_ws_port": 9001,
"configuration.com_addr": "127.0.1.2",
"configuration.amf_addr": "127.0.1.100",
"configuration.gtp_addr": "127.0.1.1"
},
"directory": {
"log": "log",
"etc": "etc",
"var": "var"
},
"slapparameter_dict": {
"tdd_ul_dl_config": "5ms 8UL 1DL 2/10 (maximum uplink)"
}
}"""
def do(cfg, slapparameter_dict):
jslapparameter_dict = json.dumps(slapparameter_dict)
json_params_empty = """{
"rf_mode": 'fdd',
"slap_configuration": {
},
"directory": {
},
"slapparameter_dict": %(jslapparameter_dict)s
}"""
json_params = """{
"rf_mode": "tdd",
"trx": "sdr",
"bbu": "ors",
"ru": "ors",
"one_watt": "True",
"earfcn": 646666,
"nr_arfcn": 646666,
"nr_band": 43,
"tx_gain": 62,
"rx_gain": 43,
"sib23_file": "sib",
"drb_file": "drb",
"slap_configuration": {
"tap-name": "slaptap9",
"configuration.default_lte_bandwidth": "10 MHz",
"configuration.default_lte_imsi": "001010123456789",
"configuration.default_lte_k": "00112233445566778899aabbccddeeff",
"configuration.default_lte_inactivity_timer": 10000,
"configuration.default_nr_bandwidth": 40,
"configuration.default_nr_imsi": "001010123456789",
"configuration.default_nr_k": "00112233445566778899aabbccddeeff",
"configuration.default_nr_ssb_pos_bitmap": "10000000",
"configuration.default_n_antenna_dl": 2,
"configuration.default_n_antenna_ul": 2,
"configuration.default_nr_inactivity_timer": 10000,
"configuration.com_ws_port": 9001,
"configuration.com_addr": "127.0.1.2",
"configuration.amf_addr": "127.0.1.100",
"configuration.mme_addr": "127.0.1.100",
"configuration.gtp_addr": "127.0.1.1"
},
"directory": {
"log": "log",
"etc": "etc",
"var": "var"
},
"slapparameter_dict": %(jslapparameter_dict)s
}"""
j2render(config, json_params)
j2render(cfg, json_params % locals())
do('enb', {"tdd_ul_dl_config": "[Configuration 6] 5ms 5UL 3DL (maximum uplink)"})
do('gnb', {"tdd_ul_dl_config": "5ms 8UL 1DL 2/10 (maximum uplink)"})
......@@ -147,6 +147,8 @@ filename = ue-lte.jinja2.cfg
[ue-nr.jinja2.cfg]
<= copy-config-to-instance
filename = ue-nr.jinja2.cfg
[slaplte.jinja2]
<= download-base
# Download gadget files
[software.cfg.html]
......
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