Commit 93dfe5a7 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Jérome Perrin

software/ors-amarisoft: Start to put common code to load cells and radio units...

software/ors-amarisoft: Start to put common code to load cells and radio units and handle them into slaplte package

We will soon need to use that shared code not only from radio library under ru/ ,
but also from enb.jinja2.cfg and to fix slapos-render-config.

/cc @jhuge, @lu.xu, @xavier_thompson, @Daetalus
parent 061c000c
......@@ -16,7 +16,11 @@
[template]
filename = instance.cfg
md5sum = e2e286ba8d40790da3da462d55276e29
md5sum = 827d549fae50b81c753a22c94a366095
[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 = fe49c51b683e1934c1b542591c97550b
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......
......@@ -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() }}
......
......@@ -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}
......
......@@ -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 %}
......@@ -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