Commit 60d87368 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb: Start to generalize the code to handle multiple cells

As with Radio Units organize a registry of cells and start to handle that
registry generally everywhere.

Cell registry is still populated from cell_list and slapparameter_dict.

Tests will be added later as full tests for generic MultiRU.

Rendered enb.cfg and gnb.cfg stay the same modulo one whitespace change.
parent e78eea3f
// DRB configuration for LTE cell.
// DRB configuration for LTE cell {{ cell_ref }} @ {{ ru_ref }}.
// DRB configuration vary in beteen FDD and TDD modes.
{% set T_REORDERING = {'fdd': 35, 'tdd': 65} [rf_mode] %}
......
// DRB configuration for NR cell.
// DRB configuration for NR cell {{ cell_ref }} @ {{ ru_ref }}.
[
{
......
......@@ -63,25 +63,6 @@
{%- endmacro %}
{%- if do_lte %}
{%- if slapparameter_dict.get('tdd_ul_dl_config', '[Configuration 2] 5ms 2UL 6DL (default)') == '[Configuration 2] 5ms 2UL 6DL (default)' %}
{%- set tdd_config = 2 %}
{%- elif slapparameter_dict.get('tdd_ul_dl_config', '[Configuration 2] 5ms 2UL 6DL (default)') == '[Configuration 6] 5ms 5UL 3DL (maximum uplink)' %}
{%- set tdd_config = 6 %}
{%- endif %}
{%- endif %}
{%- if do_nr %}
{%- if slapparameter_dict.get('tdd_ul_dl_config', '5ms 2UL 7DL 4/6 (default)') == '5ms 2UL 7DL 4/6 (default)' %}
{%- set tdd_config = 1 %}
{%- elif slapparameter_dict.get('tdd_ul_dl_config', '5ms 2UL 7DL 4/6 (default)') == '2.5ms 1UL 3DL 2/10' %}
{%- set tdd_config = 2 %}
{%- elif slapparameter_dict.get('tdd_ul_dl_config', '5ms 2UL 7DL 4/6 (default)') == '5ms 8UL 1DL 2/10 (maximum uplink)' %}
{%- set tdd_config = 3 %}
{%- endif %}
{%- endif %}
{
log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,s1ap.level=debug,s1ap.max_size=1,x2ap.level=debug,x2ap.max_size=1,rrc.level=debug,rrc.max_size=1,ngap.level=debug,ngap.max_size=1,xnap.level=debug,xnap.max_size=1,
{%- if slapparameter_dict.get('log_phy_debug', False) -%}
......@@ -192,12 +173,12 @@
n_antenna_dl: {{ ru.n_antenna_dl }},
n_antenna_ul: {{ ru.n_antenna_ul }},
cell_id: {{ cell.get('cell_id', slapparameter_dict.get('cell_id', '0x0' + i|string)) }},
tac: {{ cell.get('tac', slapparameter_dict.get('tac', '0x0001')) }},
n_id_cell: {{ cell.get('pci', slapparameter_dict.get('pci', i)) }},
root_sequence_index: {{ cell.get('root_sequence_index', slapparameter_dict.get('root_sequence_index', 204 + i)) }},
dl_earfcn: {{ cell.get('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) }},
inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', default_lte_inactivity_timer) }},
cell_id: {{ cell.cell_id }},
tac: {{ cell.tac }},
n_id_cell: {{ cell.pci }},
root_sequence_index: {{ cell.root_sequence_index }},
dl_earfcn: {{ cell.dl_earfcn }},
inactivity_timer: {{ cell.inactivity_timer }},
// Handover
{{- handover_config() }}
......@@ -216,7 +197,7 @@
{%- else -%}
, {
{%- endif %}
cell_id: {{ cell_dict[l[1]].get('cell_id', '0x0' + l[0]|string) }},
cell_id: {{ cell_dict[l[1]].cell_id }},
cross_carrier_scheduling: false,
}
{%- endfor %}
......@@ -227,13 +208,17 @@
manual_ref_signal_power: true,
{% endif %}
{%- set tdd = (rf_mode == 'tdd') %}
{%- set tdd = (cell.rf_mode == 'tdd') %}
{%- if tdd %}
uldl_config: {{ tdd_config }},
uldl_config: {{
{'[Configuration 2] 5ms 2UL 6DL (default)': 2,
'[Configuration 6] 5ms 5UL 3DL (maximum uplink)': 6}
[cell.tdd_ul_dl_config]
}},
sp_config: 7,
{%- endif %}
{%- set n_rb_dl = J(jlte_n_rb_dl(slapparameter_dict.get('bandwidth', default_lte_bandwidth))) %}
{%- set n_rb_dl = J(jlte_n_rb_dl(cell.bandwidth)) %}
n_rb_dl: {{ n_rb_dl }},
si_coderate: {{ 0.30 if n_rb_dl == 6 else 0.20 }},
......@@ -293,11 +278,11 @@
srs_hopping_bandwidth: 0,
},
drb_config: "{{ drb_file }}",
drb_config: "{{ '%s-drb.cfg' % cell_ref }}",
sib_sched_list: [
{
filename: "{{ sib23_file }}",
filename: "{{ '%s-sib23.asn' % cell_ref }}",
si_periodicity: 16,
},
],
......@@ -409,8 +394,9 @@
{%- endif %}
{% if do_nr %}
{%- do assert(len(ru_dict) == 1, 'MultiCELL/MultiRU is TODO for NR') %}
{%- do assert(len(ru_dict) == len(cell_dict) == 1, 'MultiCELL/MultiRU is TODO for NR') %}
{%- set ru = list(ru_dict.values())[0] %}
{%- set cell = list(cell_dict.values())[0] %}
// NR cells
nr_cell_list: [
{
......@@ -418,16 +404,16 @@
n_antenna_dl: {{ ru.n_antenna_dl }},
n_antenna_ul: {{ ru.n_antenna_ul }},
cell_id: {{ slapparameter_dict.get('cell_id', '0x01') }},
n_id_cell: {{ slapparameter_dict.get('pci', 500) }},
band: {{ nr_band }},
dl_nr_arfcn: {{ nr_arfcn }},
bandwidth: {{ slapparameter_dict.get('nr_bandwidth', default_nr_bandwidth) }},
cell_id: {{ cell.cell_id }},
n_id_cell: {{ cell.pci }},
band: {{ cell.nr_band }},
dl_nr_arfcn: {{ cell.dl_nr_arfcn }},
bandwidth: {{ cell.bandwidth }},
subcarrier_spacing: 30,
ssb_pos_bitmap: "{{ slapparameter_dict.get('ssb_pos_bitmap', default_nr_ssb_pos_bitmap) }}",
ssb_pos_bitmap: "{{ cell.ssb_pos_bitmap }}",
inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', default_nr_inactivity_timer) }},
inactivity_timer: {{ cell.inactivity_timer }},
// Handover
{{- handover_config() }}
......@@ -442,6 +428,13 @@
{%- endif -%}
{%- endif %}
{%- set tdd = (cell.rf_mode == 'tdd') %}
{%- set tdd_config =
{'5ms 2UL 7DL 4/6 (default)': 1,
'2.5ms 1UL 3DL 2/10': 2,
'5ms 8UL 1DL 2/10 (maximum uplink)': 3}
[cell.tdd_ul_dl_config]
if tdd else None %}
{% if tdd_config == 1 %}
tdd_ul_dl_config: {
pattern1: {
......@@ -663,7 +656,7 @@
],
},
drb_config: "{{ drb_file }}",
drb_config: "{{ '%s-drb.cfg' % cell_ref }}",
},
],
nr_cell_default: {
......
/* SIB2/SIB3 for {{ cell.cell_type | upper }} cell {{ cell_ref }} @ {{ ru_ref }}. */
{
message c1: systemInformation: {
criticalExtensions systemInformation-r8: {
......@@ -38,9 +39,9 @@
pdsch-ConfigCommon {
{% if ors %}
{%- if ors['one-watt'] %}
referenceSignalPower {{ (tx_gain | int) - 54 }}, /* patched by eNB */
referenceSignalPower {{ (ru.tx_gain | int) - 54 }}, /* patched by eNB */
{%- else %}
referenceSignalPower {{ (tx_gain | int) - 35 }}, /* patched by eNB */
referenceSignalPower {{ (ru.tx_gain | int) - 35 }}, /* patched by eNB */
{%- endif %}
{% else %}
referenceSignalPower -8, /* patched by eNB */
......
......@@ -214,20 +214,6 @@ context =
import netaddr netaddr
${:extra-context}
[sib-config]
<= config-base
url = {{ sib23_template }}
output = ${directory:etc}/sib23.cfg
[drb-config]
<= config-base
{%- if enb_mode == 'enb' %}
url = {{ drb_lte_template }}
{%- elif enb_mode == 'gnb' %}
url = {{ drb_nr_template }}
{%- endif %}
output = ${directory:etc}/drb.cfg
[enb-config]
<= config-base
{% if slapparameter_dict.get("enb_config_link", None) %}
......@@ -240,8 +226,6 @@ extra-context =
import json_module json
json ru_dict {{ rulib.ru_dict | tojson }}
json cell_dict {{ rulib.cell_dict | tojson }}
key sib23_file sib-config:output
key drb_file drb-config:output
import-list =
rawfile slaplte.jinja2 {{ slaplte_template }}
......
......@@ -208,7 +208,35 @@ config-max-rx-sample-db = {{ slapparameter_dict.get("max_rx_sample_db", 0) }}
{{ rudrv.buildout() }}
{%- do rudrv_init.update({ru.ru_type: 1}) %}
{%- endif %}
{{ rudrv.buildout_ru(ru_ref, ru) }}
{{ rudrv.buildout_ru(ru_ref, ru, ru.cell_ref, cell_dict[ru.cell_ref]) }}
{%- endfor %}
{#- handle configured cells #}
{%- for cell_ref, cell in cell_dict|dictsort %}
{%- set ru_ref = cell.ru_ref %}
{%- set ru = ru_dict[ru_ref] %}
{#- generate CELL-drb.cfg and CELL-sib23.asn #}
{{ part('drb-config-%s' % cell_ref) }}
<= config-base
url = {{ {'lte': drb_lte_template, 'nr': drb_nr_template} [cell.cell_type] }}
output = ${directory:etc}/{{'%s-drb.cfg' % cell_ref}}
extra-context =
json cell_ref {{ cell_ref | tojson }}
json cell {{ cell | tojson }}
json ru_ref {{ ru_ref | tojson }}
json ru {{ ru | tojson }}
{{ part('sib23-config-%s' % cell_ref) }}
<= config-base
url = {{ sib23_template }}
output = ${directory:etc}/{{'%s-sib23.asn' % cell_ref}}
extra-context =
json cell_ref {{ cell_ref | tojson }}
json cell {{ cell | tojson }}
json ru_ref {{ ru_ref | tojson }}
json ru {{ ru | tojson }}
{%- endfor %}
{#- retrieve rf and stats[rf,samples] data from amarisoft service for promises
......
......@@ -88,14 +88,23 @@
<!-- TX/RX carriers -->
{%- if cell.cell_type == 'lte' %}
{%- set dl_arfcn = cell.dl_earfcn %}
{%- set bw = int(float(cell.bandwidth.removesuffix(' MHz')) * 1e6) %}
{%- elif cell.cell_type == 'nr' %}
{%- set dl_arfcn = cell.dl_nr_arfcn %}
{%- set bw = int(cell.bandwidth * 1e6) %}
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
<tx-array-carriers>
<name>{{ TxCarrier }}</name>
<absolute-frequency-center>{{ slapparameter_dict.get('dl_earfcn', 300) }}</absolute-frequency-center>
<absolute-frequency-center>{{ dl_arfcn }}</absolute-frequency-center>
<center-of-channel-bandwidth>{{ 1000000*slapparameter_dict.get('txa0cc00_center_frequency', 2140) }}</center-of-channel-bandwidth>
<channel-bandwidth>{{ {'1.4 MHz': 1400000, '3 MHz': 3000000, '5 MHz': 5000000, '10 MHz': 10000000, '15 MHz': 15000000, '20 MHz': 20000000}.get(slapparameter_dict.get('bandwidth'), '20 MHz') }}</channel-bandwidth>
<channel-bandwidth>{{ bw }}</channel-bandwidth>
<active>{{ slapparameter_dict.get('txa0cc00_active', 'INACTIVE') }}</active>
<rw-type>LTE</rw-type>
<rw-duplex-scheme>FDD</rw-duplex-scheme>
<rw-type>{{ cell.cell_type | upper }}</rw-type>
<rw-duplex-scheme>{{ cell.rf_mode | upper }}</rw-duplex-scheme>
<gain>{{ slapparameter_dict.get('txa0cc00_gain', '-20') }}</gain>
<downlink-radio-frame-offset>0</downlink-radio-frame-offset>
<downlink-sfn-offset>0</downlink-sfn-offset>
......@@ -104,7 +113,7 @@
<name>{{ RxCarrier }}</name>
<absolute-frequency-center>{{ slapparameter_dict.get('rxa0cc00_center_frequency_earfcn', 18300) }}</absolute-frequency-center>
<center-of-channel-bandwidth>{{ 1000000*slapparameter_dict.get('rxa0cc00_center_frequency', 1950) }}</center-of-channel-bandwidth>
<channel-bandwidth>{{ {'1.4 MHz': 1400000, '3 MHz': 3000000, '5 MHz': 5000000, '10 MHz': 10000000, '15 MHz': 15000000, '20 MHz': 20000000}.get(slapparameter_dict.get('bandwidth'), '20 MHz') }}</channel-bandwidth>
<channel-bandwidth>{{ bw }}</channel-bandwidth>
<active>{{ slapparameter_dict.get('rxa0cc00_active', 'INACTIVE') }}</active>
<downlink-radio-frame-offset>0</downlink-radio-frame-offset>
<downlink-sfn-offset>0</downlink-sfn-offset>
......
{#- Package ru/lopcomm/libinstance provides instance code for handling Lopcomm ORAN Radio Units. #}
{%- macro buildout_ru(ru_ref, ru) %}
{%- macro buildout_ru(ru_ref, ru, cell_ref, cell) %}
{#- indicate whether RU is listening for netconf #}
......@@ -66,6 +66,7 @@ url = {{ ru_lopcomm_cu_config_template }}
output = ${directory:etc}/{{ru_ref}}-cu_config.xml
extra-context =
json ru {{ ru | tojson }}
json cell {{ cell | tojson }}
[{{ru_ref}}-config-template]
recipe = slapos.recipe.template:jinja2
......
{#- Package ru/sdr/libinstance provides instance code for handling SDR Radio Units. #}
{%- macro buildout_ru(ru_ref, ru) %}
{%- macro buildout_ru(ru_ref, ru, cell_ref, cell) %}
{#- nothing SDR-specific #}
{%- endmacro %}
......
{#- Package ru/sunwave/libinstance provides instance code for handling SunWave Radio Units. #}
{%- macro buildout_ru(ru_ref, ru) %}
{%- macro buildout_ru(ru_ref, ru, cell_ref, cell) %}
{#- nothing SunWave-specific #}
{%- endmacro %}
......
......@@ -136,6 +136,34 @@
{%- do _ru_set_defaults(ru) %}
{%- do ru_dict.update({ru_ref: ru}) %}
{%- do cell.update({'cell_type': 'lte' if do_lte else 'nr'}) %}
{%- do cell.update({'rf_mode': rf_mode}) %}
{%- if do_lte %}
{%- if cell.rf_mode == 'tdd' %}
{%- do cell.setdefault('tdd_ul_dl_config', slapparameter_dict.get('tdd_ul_dl_config', '[Configuration 2] 5ms 2UL 6DL (default)')) %}
{%- endif %}
{%- do cell.setdefault('cell_id', slapparameter_dict.get('cell_id', '0x0' + i|string)) %}
{%- do cell.setdefault('tac', slapparameter_dict.get('tac', '0x0001')) %}
{%- do cell.setdefault('pci', slapparameter_dict.get('pci', i)) %}
{%- do cell.setdefault('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) %}
{%- do cell.setdefault('bandwidth', slapparameter_dict.get('bandwidth', default_lte_bandwidth)) %}
{%- do cell.setdefault('root_sequence_index', slapparameter_dict.get('root_sequence_index', 204 + i)) %}
{%- do cell.setdefault('inactivity_timer', slapparameter_dict.get('inactivity_timer', default_lte_inactivity_timer)) %}
{%- elif do_nr %}
{%- if cell.rf_mode == 'tdd' %}
{%- do cell.setdefault('tdd_ul_dl_config', slapparameter_dict.get('tdd_ul_dl_config', '5ms 2UL 7DL 4/6 (default)')) %}
{%- endif %}
{%- do cell.setdefault('cell_id', slapparameter_dict.get('cell_id', '0x01')) %}
{%- do cell.setdefault('pci', slapparameter_dict.get('pci', 500)) %}
{%- do cell.setdefault('nr_band', nr_band) %}
{%- do cell.setdefault('dl_nr_arfcn', nr_arfcn) %}
{%- do cell.setdefault('bandwidth', slapparameter_dict.get('nr_bandwidth', default_nr_bandwidth)) %}
{%- do cell.setdefault('ssb_pos_bitmap', slapparameter_dict.get('ssb_pos_bitmap', default_nr_ssb_pos_bitmap)) %}
{%- do cell.setdefault('inactivity_timer', slapparameter_dict.get('inactivity_timer', default_nr_inactivity_timer)) %}
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
{%- endfor %}
{#- assign RUs rf_port and tx/rx channel indices #}
......
......@@ -63,8 +63,6 @@ def do(src, out, rat, slapparameter_dict):
"nr_band": 39,
"tx_gain": 62,
"rx_gain": 43,
"sib23_file": "sib",
"drb_file": "drb",
"slap_configuration": {
"tap-name": "slaptap9",
"configuration.com_ws_port": 9001,
......@@ -123,6 +121,8 @@ def do_enb():
"ncell_list": {'1': peer_nr},
})
# TODO render drb.cfg + sib.asn for all cells
def do_ue():
do('ue.jinja2.cfg', 'ue-lte.cfg', 'lte', {'rue_addr': 'host1'})
......
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