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 !1480
parents 4cd01085 421ad29b
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = e2e286ba8d40790da3da462d55276e29 md5sum = b4f7cf9de06af21a0c4c00d8be5edce7
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
md5sum = c31dffa87765d93327f18ffd89ce36ca
[amarisoft-stats.jinja2.py] [amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py _update_hash_filename_ = amarisoft-stats.jinja2.py
...@@ -28,7 +32,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883 ...@@ -28,7 +32,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ru_libinstance.jinja2.cfg] [ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg _update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = 91ef336b7e913c07d89b82b27ffad11d md5sum = a6b710ca5132276d72f90b76b873fe98
[ru_sdr_libinstance.jinja2.cfg] [ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg _update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
...@@ -80,7 +84,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e ...@@ -80,7 +84,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 815d57a36c7e3b4361230fbd3c76a9ef md5sum = b52a8584712f9cee338c71a6dedc7dad
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
...@@ -108,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149 ...@@ -108,7 +112,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
md5sum = 8e49dfc9318da43bd817b8891cba24b7 md5sum = a961cc1469bd2534645470f914f12905
[drb_lte.jinja2.cfg] [drb_lte.jinja2.cfg]
filename = config/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 %} {%- 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)' %} {%- 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 }} ...@@ -32,6 +32,7 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
{%- import 'slaplte.jinja2' as slaplte with context %}
{%- import 'ru_libinstance.jinja2.cfg' as rulib with context %} {%- import 'ru_libinstance.jinja2.cfg' as rulib with context %}
{{ rulib.buildout() }} {{ rulib.buildout() }}
...@@ -367,6 +368,9 @@ extra-context = ...@@ -367,6 +368,9 @@ extra-context =
json cell_list {{ rulib.cell_list | tojson }} json cell_list {{ rulib.cell_list | tojson }}
key sib23_file sib-config:output key sib23_file sib-config:output
key drb_file drb-config:output key drb_file drb-config:output
import-list =
rawfile slaplte.jinja2 {{ slaplte_template }}
[publish-connection-information] [publish-connection-information]
<= monitor-publish <= monitor-publish
......
...@@ -40,6 +40,7 @@ context = ...@@ -40,6 +40,7 @@ context =
raw ru ${rf-mode:ru} raw ru ${rf-mode:ru}
$${:extra-context} $${:extra-context}
import-list = import-list =
rawfile slaplte.jinja2 ${slaplte.jinja2:target}
rawfile ru_libinstance.jinja2.cfg ${ru_libinstance.jinja2.cfg: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_sdr_libinstance.jinja2.cfg ${ru_sdr_libinstance.jinja2.cfg:target}
rawfile ru_lopcomm_libinstance.jinja2.cfg ${ru_lopcomm_libinstance.jinja2.cfg:target} rawfile ru_lopcomm_libinstance.jinja2.cfg ${ru_lopcomm_libinstance.jinja2.cfg:target}
...@@ -275,6 +276,7 @@ extra-context = ...@@ -275,6 +276,7 @@ extra-context =
key enb amarisoft:enb key enb amarisoft:enb
key sdr amarisoft:sdr key sdr amarisoft:sdr
raw enb_template ${enb.jinja2.cfg:target} raw enb_template ${enb.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target}
raw drb_lte_template ${drb_lte.jinja2.cfg:target} raw drb_lte_template ${drb_lte.jinja2.cfg:target}
raw sib23_template ${sib23.jinja2.asn:target} raw sib23_template ${sib23.jinja2.asn:target}
raw amarisoft_stats_template ${amarisoft-stats.jinja2.py:target} raw amarisoft_stats_template ${amarisoft-stats.jinja2.py:target}
......
...@@ -3,15 +3,16 @@ ...@@ -3,15 +3,16 @@
Use buildout() macro to emit instance-level code to Use buildout() macro to emit instance-level code to
handle configured RUs. 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() . NOTE: driver-specific logic is implemented in rudrv.buildout_ru() .
#} #}
{#- cell_list keeps cell registry #} {#- cell_list keeps cell registry #}
{%- set cell_list = slapparameter_dict.get('cell_list', {'default': {}}) %} {%- set cell_list = {} %}
{%- for i, k in enumerate(cell_list) %} {%- do slaplte.load_cell(cell_list) %}
{%- set cell = cell_list[k] %}
{%- do cell.setdefault('cpri_port_number', i) %}
{%- endfor %}
{%- macro buildout() %} {%- macro buildout() %}
...@@ -39,13 +40,6 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }} ...@@ -39,13 +40,6 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
lopcomm=rudrv_lopcomm, lopcomm=rudrv_lopcomm,
sunwave=rudrv_sunwave) %} 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 {#- split slapos tap interface for each RU
fallback to non-split approach for ntap <= 1 to avoid hard-dependecy on setcap/tapsplit 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) }} ...@@ -58,7 +52,7 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
[vtap] [vtap]
recipe = plone.recipe.command recipe = plone.recipe.command
ntap = {{ ntap }} ntap = {{ ntap }}
command = {{ netcapdo }} {{ pythonwitheggs }} {{ ru_tapsplit }} {{ slaptap }} ${:ntap} command = {{ netcapdo }} {{ pythonwitheggs }} {{ ru_tapsplit }} {{ slaplte.tap }} ${:ntap}
update-command = ${:command} update-command = ${:command}
stop-on-error = true stop-on-error = true
...@@ -68,8 +62,8 @@ ntap = 0 ...@@ -68,8 +62,8 @@ ntap = 0
stop-on-error = false stop-on-error = false
{%- if ntap == 1 %} {%- if ntap == 1 %}
{%- do vtap_list.append(slaptap) %} {%- do vtap_list.append(slaplte.tap) %}
[vtap.{{ slaptap }}] [vtap.{{ slaplte.tap }}]
network = {{ slap_configuration['tap-ipv6-network'] }} network = {{ slap_configuration['tap-ipv6-network'] }}
gateway = {{ slap_configuration['tap-ipv6-gateway'] }} gateway = {{ slap_configuration['tap-ipv6-gateway'] }}
addr = {{ slap_configuration['tap-ipv6-addr'] }} addr = {{ slap_configuration['tap-ipv6-addr'] }}
...@@ -78,7 +72,7 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }} ...@@ -78,7 +72,7 @@ addr = {{ slap_configuration['tap-ipv6-addr'] }}
{%- else %} {%- else %}
{%- for i in range(1,1+ntap) %} {%- 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) %} {%- do vtap_list.append(tap) %}
[vtap.{{ tap }}] [vtap.{{ tap }}]
recipe = slapos.recipe.build recipe = slapos.recipe.build
...@@ -96,7 +90,7 @@ init = ...@@ -96,7 +90,7 @@ init =
# simulate what tapsplit would assign to the tap # simulate what tapsplit would assign to the tap
# ( tap subinterface will be created for real later at install time - when it # ( tap subinterface will be created for real later at install time - when it
# is too late to update section options ) # is too late to update section options )
slapnet = tapsplit.ifnet6('{{ slaptap }}') slapnet = tapsplit.ifnet6('{{ slaplte.tap }}')
tapnet = tapsplit.netsplit(slapnet, {{ 1+ntap }}) [{{ i }}] tapnet = tapsplit.netsplit(slapnet, {{ 1+ntap }}) [{{ i }}]
options['network'] = str(tapnet) options['network'] = str(tapnet)
...@@ -119,17 +113,6 @@ init = ...@@ -119,17 +113,6 @@ init =
{%- endfor %} {%- 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 {#- go through all RUs and for each RU invoke
RU-specific buildout handler #} RU-specific buildout handler #}
{%- set ru_type = {'lopcomm': 'lopcomm', 'm2ru': 'sunwave'}.get(ru, 'sdr') %} {%- 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 ...@@ -12,6 +12,8 @@ import json
# j2render renders config/<cfg>.jinja2.cfg into config/<cfg>.cfg with provided json parameters. # j2render renders config/<cfg>.jinja2.cfg into config/<cfg>.cfg with provided json parameters.
def j2render(cfg, jcfg): def j2render(cfg, jcfg):
ctx = json.loads(jcfg) ctx = json.loads(jcfg)
assert '_standalone' not in ctx
ctx['_standalone'] = True
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))
...@@ -21,6 +23,8 @@ def j2render(cfg, jcfg): ...@@ -21,6 +23,8 @@ def j2render(cfg, jcfg):
'url': 'config/{}.jinja2.cfg'.format(cfg), 'url': 'config/{}.jinja2.cfg'.format(cfg),
'output': 'config/{}.cfg'.format(cfg), 'output': 'config/{}.cfg'.format(cfg),
'context': textctx, 'context': textctx,
'import-list': '''
rawfile slaplte.jinja2 slaplte.jinja2''',
}) })
#print(r.context) #print(r.context)
...@@ -34,17 +38,17 @@ def j2render(cfg, jcfg): ...@@ -34,17 +38,17 @@ def j2render(cfg, jcfg):
f.write(r._render().decode()) f.write(r._render().decode())
config = "gnb" def do(cfg, slapparameter_dict):
json_params_empty = """{ jslapparameter_dict = json.dumps(slapparameter_dict)
json_params_empty = """{
"rf_mode": 'fdd', "rf_mode": 'fdd',
"slap_configuration": { "slap_configuration": {
}, },
"directory": { "directory": {
}, },
"slapparameter_dict": { "slapparameter_dict": %(jslapparameter_dict)s
} }"""
}""" json_params = """{
json_params = """{
"rf_mode": "tdd", "rf_mode": "tdd",
"trx": "sdr", "trx": "sdr",
"bbu": "ors", "bbu": "ors",
...@@ -56,6 +60,7 @@ json_params = """{ ...@@ -56,6 +60,7 @@ json_params = """{
"tx_gain": 62, "tx_gain": 62,
"rx_gain": 43, "rx_gain": 43,
"sib23_file": "sib", "sib23_file": "sib",
"drb_file": "drb",
"slap_configuration": { "slap_configuration": {
"tap-name": "slaptap9", "tap-name": "slaptap9",
"configuration.default_lte_bandwidth": "10 MHz", "configuration.default_lte_bandwidth": "10 MHz",
...@@ -72,6 +77,7 @@ json_params = """{ ...@@ -72,6 +77,7 @@ json_params = """{
"configuration.com_ws_port": 9001, "configuration.com_ws_port": 9001,
"configuration.com_addr": "127.0.1.2", "configuration.com_addr": "127.0.1.2",
"configuration.amf_addr": "127.0.1.100", "configuration.amf_addr": "127.0.1.100",
"configuration.mme_addr": "127.0.1.100",
"configuration.gtp_addr": "127.0.1.1" "configuration.gtp_addr": "127.0.1.1"
}, },
"directory": { "directory": {
...@@ -79,9 +85,10 @@ json_params = """{ ...@@ -79,9 +85,10 @@ json_params = """{
"etc": "etc", "etc": "etc",
"var": "var" "var": "var"
}, },
"slapparameter_dict": { "slapparameter_dict": %(jslapparameter_dict)s
"tdd_ul_dl_config": "5ms 8UL 1DL 2/10 (maximum uplink)" }"""
}
}"""
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 ...@@ -147,6 +147,8 @@ filename = ue-lte.jinja2.cfg
[ue-nr.jinja2.cfg] [ue-nr.jinja2.cfg]
<= copy-config-to-instance <= copy-config-to-instance
filename = ue-nr.jinja2.cfg filename = ue-nr.jinja2.cfg
[slaplte.jinja2]
<= download-base
# Download gadget files # Download gadget files
[software.cfg.html] [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