Commit b0c37a4a authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Start to generalize existing lopcomm/multicell into multiRU slowly

Lopcomm part of the SR already has some partial support for cell_list: if
multiple cells are defined there enb.cfg will have multiple CPRI radio units
and multiple cells configured. But so far all promises, except cpri-link, were
done only for one RU.

-> Fix that by starting to generalize RUlib code to handle multiple radio
units, invoking model-specific RU driver for each RU, and adjusting ru/lopcomm
instance code to correctly generate and activate different promises for
different radio units.

After the patch multiRU support is still very incomplete, but it is a step forward.

/cc @xavier_thompson, @Daetalus
/reviewed-by @lu.xu
/partly-reviewed-by @jhuge
/reviewed-at nexedi/slapos!1467
parent 4ba9cae1
......@@ -28,19 +28,19 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = ef4b9c9ccbb4627c0d74293802e83d57
md5sum = 09cc6f04c43ef3a00519f585716343d9
[ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
md5sum = 4be142fcd890e0f1c9573c8e724062fb
md5sum = c20b620111a4dc4bc2bcae57c2007cbe
[ru_lopcomm_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/lopcomm/libinstance.jinja2.cfg
md5sum = 7b84e582f149da52013740251a2e7ce4
md5sum = e67ccf369ccd016e38c5be42442edeae
[ru_sunwave_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sunwave/libinstance.jinja2.cfg
md5sum = 5c5248494bcd9d27d50636ee9fab7c87
md5sum = 0450e9fa50844e4d6e51d608625c57f6
[ru_lopcomm_ncclient_common.py]
_update_hash_filename_ = ru/lopcomm/ncclient_common.py
......@@ -64,15 +64,15 @@ md5sum = 63472d5dc9bd46923d3941b5189e2ccd
[ru_lopcomm_software.jinja2.py]
_update_hash_filename_ = ru/lopcomm/software.jinja2.py
md5sum = 2cd8515253b75e2ab13cc77399762851
md5sum = f36eef13210ff519f6a6e56f081f397a
[ru_lopcomm_supervision.jinja2.py]
_update_hash_filename_ = ru/lopcomm/supervision.jinja2.py
md5sum = 243d9fbf640b8dc8bf63d69b07b8afed
md5sum = 11623b42a0b6271ba0abc8b40e7630e5
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 104d63450ec08d67bc6e82a9dacee6ae
md5sum = b93939eb4c924ca41e78cd3db0a2daf0
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......@@ -100,7 +100,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum = 9e10632057d64068313267ecee999e97
md5sum = 46e326c84ed096909595d56512da0de7
[sib23.jinja2.asn]
filename = config/sib23.jinja2.asn
......
{%- set cell_list = slapparameter_dict.get('cell_list', {'default': {}}) %}
{%- 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)' %}
......@@ -44,7 +43,7 @@
{%- endif %}
args: "dev0=
{%- for i, k in enumerate(cell_list) %}
{%- set cpri_port = cell_list[k].get('cpri_port_number', i) %}
{%- set cpri_port = cell_list[k].cpri_port_number %}
{%- if i != 0 -%}
,
{%- endif -%}
......
......@@ -345,6 +345,7 @@ url = {{ enb_template }}
{% endif %}
output = ${directory:etc}/enb.cfg
extra-context =
json cell_list {{ rulib.cell_list | tojson }}
key sib23_file sib-config:output
[publish-connection-information]
......
{#- Package ru/libinstance provides common instance code for handling Radio Units and cells.
Use buildout() macro to emit instance-level code to
handle configured RU.
handle configured RUs.
NOTE: driver-specific logic is implemented in rudrv.buildout() .
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 %}
{%- macro buildout() %}
{#- part emits new buildout section and registers it into buildout.parts #}
{%- set parts_list = [] %}
......@@ -31,10 +39,14 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
lopcomm=rudrv_lopcomm,
sunwave=rudrv_sunwave) %}
{#- invoke RU-specific buildout handler #}
{#- go through all RUs and for each RU invoke
RU-specific buildout handler #}
{%- set ru_type = {'lopcomm': 'lopcomm', 'm2ru': 'sunwave'}.get(ru, 'sdr') %}
{%- set rudrv = rudrv_dict[ru_type] %}
{{ rudrv.buildout() }}
{%- for cell_ref, cell in cell_list|dictsort %}
{%- set ru_ref = cell_ref if cell_ref != 'default' else 'RU' %}
{{ rudrv.buildout_ru(ru_ref, cell) }}
{%- endfor %}
[buildout]
......
{#- Package ru/lopcomm/libinstance provides instance code for handling Lopcomm ORAN Radio Units. #}
{%- macro buildout() %}
{%- macro buildout_ru(ru_ref, cell) %}
{#- indicate whether RU is listening for netconf #}
{{ promise('lopcomm-rrh-netconf-socket') }}
{{ promise('%s-netconf-socket' % ru_ref) }}
promise = check_socket_listening
config-host = ${slap-configuration:tap-ipv6-gateway}
config-port = 830
......@@ -12,11 +12,13 @@ config-port = 830
{#- monitor state of netconf connection + keep on touching RU watchdog #}
[lopcomm-rrh-supervision-template]
[{{ru_ref}}-supervision-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-supervision.log
supervision-reply-json-log-output = ${directory:var}/log/lopcomm-rrh-supervision-reply.json.log
_logbase = ${directory:var}/log/{{ru_ref}}-supervision
log-output = ${:_logbase}.log
supervision-reply-json-log-output = ${:_logbase}-reply.json.log
is_netconf_connected = ${directory:etc}/{{ru_ref}}.is_netconf_connected
context =
section directory directory
section slap_configuration slap-configuration
......@@ -26,33 +28,35 @@ context =
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
raw etc_path ${directory:etc}
key is_netconf_connected :is_netconf_connected
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_supervision_template }}
output = ${directory:bin}/lopcomm-rrh-supervision.py
output = ${directory:bin}/{{ru_ref}}-supervision.py
[lopcomm-rrh-supervision-service]
{{ part('%s-supervision-service' % ru_ref) }}
recipe = slapos.cookbook:wrapper
command-line = ${lopcomm-rrh-supervision-template:output}
wrapper-path = ${directory:service}/lopcomm-rrh-supervision
command-line = ${ {{- ru_ref}}-supervision-template:output}
wrapper-path = ${directory:service}/{{ru_ref}}-supervision
mode = 0775
hash-files =
${lopcomm-rrh-supervision-template:output}
${:command-line}
{{ promise('lopcomm-rrh-netconf-connection') }}
{{ promise('%s-netconf-connection' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${directory:etc}/is_netconf_connected ]
config-command = [ -f ${ {{-ru_ref}}-supervision-template:is_netconf_connected} ]
{#- push firmware to RU #}
[lopcomm-rrh-software-template]
[{{ru_ref}}-software-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-software.log
software-reply-json-log-output = ${directory:var}/log/lopcomm-rrh-software-reply.json.log
_logbase = ${directory:var}/log/{{ru_ref}}-software
log-output = ${:_logbase}.log
software-reply-json-log-output = ${:_logbase}-reply.json.log
remote-file-path = sftp://${user-info:pw-name}@[${slap-configuration:ipv6-random}]:${sshd-port:port}{{ru_lopcomm_firmware_path}}
is_firmware_updated = ${directory:etc}/{{ru_ref}}.is_firmware_updated
context =
section directory directory
section slap_configuration slap-configuration
......@@ -63,16 +67,16 @@ context =
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
raw etc_path ${directory:etc}
key is_firmware_updated :is_firmware_updated
raw firmware_name {{ru_lopcomm_firmware_filename}}
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_software_template }}
output = ${directory:script}/lopcomm-rrh-software.py
output = ${directory:script}/{{ru_ref}}-software.py
{{ promise('lopcomm-firmware') }}
{{ promise('%s-firmware' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${directory:etc}/is_firmware_updated ]
config-command = [ -f ${ {{-ru_ref}}-software-template:is_firmware_updated} ]
{#- push config to RU #}
......@@ -85,19 +89,19 @@ version = {{ slapparameter_dict.get("cu_config_version") }}
offline = false
{% endif %}
[lopcomm-cu-config]
[{{ru_ref}}-cu-config]
<= config-base
{% if slapparameter_dict.get("cu_config_link", None) %}
url = ${cu-config-dl:target}
{% else %}
url = {{ ru_lopcomm_cu_config_template }}
{% endif %}
output = ${directory:etc}/cu_config.xml
output = ${directory:etc}/{{ru_ref}}-cu_config.xml
[lopcomm-rrh-config-template]
[{{ru_ref}}-config-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-config.log
log-output = ${directory:var}/log/{{ru_ref}}-config.log
context =
section directory directory
section slap_configuration slap-configuration
......@@ -107,28 +111,29 @@ context =
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
raw CreateProcessingEle_template {{ ru_lopcomm_CreateProcessingEle_template }}
key cu_config_template lopcomm-cu-config:output
key cu_config_template {{ru_ref}}-cu-config:output
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_config_template }}
output = ${directory:script}/lopcomm-rrh-config.py
output = ${directory:script}/{{ru_ref}}-config.py
{{ promise('lopcomm-config-log') }}
{{ promise('%s-config-log' % ru_ref) }}
promise = check_lopcomm_config_log
config-config-log = ${lopcomm-rrh-config-template:log-output}
config-config-log = ${ {{- ru_ref}}-config-template:log-output}
{#- handle notifications from RU #}
[lopcomm-rrh-stats-template]
[{{ru_ref}}-stats-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-stats.log
json-log-output = ${directory:var}/log/lopcomm-rrh-stats.json.log
cfg-json-log-output = ${directory:var}/log/lopcomm-rrh-config.json.log
supervision-json-log-output = ${directory:var}/log/lopcomm-rrh-supervision.json.log
ncsession-json-log-output = ${directory:var}/log/lopcomm-rrh-ncsession.json.log
software-json-log-output = ${directory:var}/log/lopcomm-rrh-software.json.log
_logbase = ${directory:var}/log/{{ru_ref}}
log-output = ${:_logbase}-stats.log
json-log-output = ${:_logbase}-stats.json.log
cfg-json-log-output = ${:_logbase}-config.json.log
supervision-json-log-output = ${:_logbase}-supervision.json.log
ncsession-json-log-output = ${:_logbase}-ncsession.json.log
software-json-log-output = ${:_logbase}-software.json.log
context =
section directory directory
section slap_configuration slap-configuration
......@@ -145,64 +150,61 @@ context =
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_stats_template }}
output = ${directory:bin}/lopcomm-rrh-stats.py
output = ${directory:bin}/{{ru_ref}}-stats.py
[lopcomm-rrh-stats-service]
{{ part('%s-stats-service' % ru_ref) }}
recipe = slapos.cookbook:wrapper
command-line = ${lopcomm-rrh-stats-template:output}
wrapper-path = ${directory:service}/lopcomm-rrh-stats
command-line = ${ {{- ru_ref}}-stats-template:output}
wrapper-path = ${directory:service}/{{ru_ref}}-stats
mode = 0775
hash-files =
${lopcomm-rrh-stats-template:output}
${:command-line}
{{ promise('lopcomm-vswr') }}
{{ promise('%s-vswr' % ru_ref) }}
promise = check_lopcomm_vswr
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-rssi') }}
{{ promise('%s-rssi' % ru_ref) }}
promise = check_lopcomm_rssi
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-pa-current') }}
{{ promise('%s-pa-current' % ru_ref) }}
promise = check_lopcomm_pa_current
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-pa-output-power') }}
{{ promise('%s-pa-output-power' % ru_ref) }}
promise = check_lopcomm_pa_output_power
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-sync') }}
{{ promise('%s-sync' % ru_ref) }}
promise = check_lopcomm_sync
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-lof') }}
{{ promise('%s-lof' % ru_ref) }}
promise = check_lopcomm_lof
config-netconf-log = ${lopcomm-rrh-stats-template:json-log-output}
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
{{ promise('lopcomm-stats-log') }}
{{ promise('%s-stats-log' % ru_ref) }}
promise = check_lopcomm_stats_log
config-stats-log = ${lopcomm-rrh-stats-template:log-output}
config-stats-log = ${ {{- ru_ref}}-stats-template:log-output}
{%- set cell_list = slapparameter_dict.get('cell_list', {'default': {}}) %}
{%- for i, k in enumerate(cell_list) %}
{%- set sfp_port = cell_list[k].get('cpri_port_number', i) %}
{{ promise('SFP%d-cpri-lock' % sfp_port) }}
{{ promise('%s-cpri-lock' % ru_ref) }}
promise = check_cpri_lock
config-sdr_dev = {{ slapparameter_dict.get('sdr_number', 0) }}
config-sfp_port = {{ sfp_port }}
config-sfp_port = {{ cell.cpri_port_number }}
config-amarisoft-rf-info-log = ${amarisoft-rf-info-template:log-output}
{%- endfor %}
{#- reset RU periodically #}
{%- if slapparameter_dict.get("cron_schedule") %}
[lopcomm-rrh-reset-info-template]
[{{ru_ref}}-reset-info-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-reset-info.log
json-log-output = ${directory:var}/log/lopcomm-rrh-reset-info.json.log
_logbase = ${directory:var}/log/{{ru_ref}}-reset-info
log-output = ${:_logbase}.log
json-log-output = ${:_logbase}.json.log
context =
section slap_configuration slap-configuration
key log_file :log-output
......@@ -213,13 +215,14 @@ context =
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_reset_info_template }}
output = ${directory:bin}/lopcomm-rrh-reset-info.py
output = ${directory:bin}/{{ru_ref}}-reset-info.py
[lopcomm-rrh-reset-template]
[{{ru_ref}}-reset-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-reset.log
json-log-output = ${directory:var}/log/lopcomm-rrh-reset.json.log
_logbase = ${directory:var}/log/{{ru_ref}}-reset
log-output = ${:_logbase}.log
json-log-output = ${:_logbase}.json.log
context =
section slap_configuration slap-configuration
key log_file :log-output
......@@ -228,22 +231,22 @@ context =
import netaddr netaddr
mode = 0775
url = {{ ru_lopcomm_reset_template }}
output = ${directory:etc}/lopcomm-rrh-reset.py
output = ${directory:etc}/{{ru_ref}}-reset.py
{{ part('lopcomm-reset-cron') }}
{{ part('%s-reset-cron' % ru_ref) }}
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = rrh-resest
name = {{ru_ref}}-reset
frequency = {{ slapparameter_dict.get("cron_schedule", "") }}
command = {{ buildout_directory}}/bin/pythonwitheggs ${lopcomm-rrh-reset-template:output}
command = {{ buildout_directory}}/bin/pythonwitheggs ${ {{- ru_ref}}-reset-template:output}
{{ part('lopcomm-reset-info-service') }}
{{ part('%s-reset-info-service' % ru_ref) }}
recipe = slapos.cookbook:wrapper
command-line = ${lopcomm-rrh-reset-info-template:output}
wrapper-path = ${directory:service}/lopcomm-rrh-reset-info
command-line = ${ {{- ru_ref}}-reset-info-template:output}
wrapper-path = ${directory:service}/{{ru_ref}}-reset-info
mode = 0775
hash-files =
${lopcomm-rrh-reset-info-template:output}
${:command-line}
{%- endif %}
......
......@@ -15,7 +15,7 @@ if __name__ == '__main__':
)
while True:
try:
firmware_check_file= os.path.join('{{etc_path}}','is_firmware_updated')
firmware_check_file= '{{ is_firmware_updated }}'
nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
# Fetch software inventory
......
......@@ -14,7 +14,7 @@ if __name__ == '__main__':
supervision_reply_json_log_file="{{ supervision_reply_json_log_file }}"
)
try:
netconf_check_file = os.path.join('{{etc_path}}', 'is_netconf_connected')
netconf_check_file = '{{ is_netconf_connected }}'
nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
supervision_subscription_rpc_xml = """
......
{#- Package ru/sdr/libinstance provides instance code for handling SDR Radio Units. #}
{%- macro buildout() %}
{%- macro buildout_ru(ru_ref, cell) %}
{#- nothing SDR-specific #}
{%- endmacro %}
{#- Package ru/sunwave/libinstance provides instance code for handling SunWave Radio Units. #}
{%- macro buildout() %}
{%- macro buildout_ru(ru_ref, cell) %}
{#- nothing SunWave-specific #}
{%- endmacro %}
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