Commit 907d3890 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb: Rename cell_list -> cell_dict internally

That data structure is really a dict, not list. It is more clear to name it appropriately.

-> Do the renaming but keep cell_list intact as described in JSON schemas so
   that external interface remains unchanged.

Rendered enb.cfg and gnb.cfg remain the same.
parent eeed4f89
......@@ -6,8 +6,8 @@
{#- 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) %}
{%- set cell_dict = {} %}
{%- do slaplte.load_cell(cell_dict) %}
{%- endif %}
......@@ -105,7 +105,7 @@
log_filename: "{{ directory['log'] }}/enb.log",
{# instantiate radio units #}
{{ slaplte.ru_config(ru, cell_list, slapparameter_dict) }}
{{ slaplte.ru_config(ru, cell_dict, slapparameter_dict) }}
{%- if slapparameter_dict.get('websocket_password', '') %}
com_addr: "[{{ gtp_addr_v6 }}]:{{ slap_configuration['configuration.com_ws_port'] }}",
......@@ -194,17 +194,17 @@
// LTE cells
cell_list: [
{%- if do_lte %}
{%- for i, k in enumerate(cell_list) %}
{%- for i, k in enumerate(cell_dict) %}
{
rf_port: {{ i }},
n_antenna_dl: {{ ru.n_antenna_dl }},
n_antenna_ul: {{ ru.n_antenna_ul }},
cell_id: {{ cell_list[k].get('cell_id', slapparameter_dict.get('cell_id', '0x0' + i|string)) }},
tac: {{ cell_list[k].get('tac', slapparameter_dict.get('tac', '0x0001')) }},
n_id_cell: {{ cell_list[k].get('pci', slapparameter_dict.get('pci', i)) }},
root_sequence_index: {{ cell_list[k].get('root_sequence_index', slapparameter_dict.get('root_sequence_index', 204 + i)) }},
dl_earfcn: {{ cell_list[k].get('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) }},
cell_id: {{ cell_dict[k].get('cell_id', slapparameter_dict.get('cell_id', '0x0' + i|string)) }},
tac: {{ cell_dict[k].get('tac', slapparameter_dict.get('tac', '0x0001')) }},
n_id_cell: {{ cell_dict[k].get('pci', slapparameter_dict.get('pci', i)) }},
root_sequence_index: {{ cell_dict[k].get('root_sequence_index', slapparameter_dict.get('root_sequence_index', 204 + i)) }},
dl_earfcn: {{ cell_dict[k].get('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) }},
inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', default_lte_inactivity_timer) }},
// Handover
......@@ -212,7 +212,7 @@
// Carrier Aggregation
{%- set scell_list = [] %}
{%- for j, l in enumerate(cell_list) %}
{%- for j, l in enumerate(cell_dict) %}
{%- if j != i %}
{%- do scell_list.append([j, l]) %}
{%- endif %}
......@@ -224,7 +224,7 @@
{%- else -%}
, {
{%- endif %}
cell_id: {{ cell_list[l[1]].get('cell_id', '0x0' + l[0]|string) }},
cell_id: {{ cell_dict[l[1]].get('cell_id', '0x0' + l[0]|string) }},
cross_carrier_scheduling: false,
}
{%- endfor %}
......@@ -258,11 +258,11 @@
n1_pucch_sr_count: 11,
cqi_pucch_n_rb: 1,
{#- for CA with 2 cells it is possible to use PUCCH 1b CS ack/nack #}
{%- if len(cell_list) == 2 %}
{%- if len(cell_dict) == 2 %}
ack_nack_feedback_mode_ca: "cs",
n1_pucch_an_cs_count: 8,
{#- starting from 3 cells it is always PUCCH 3 for ack/nack in CA #}
{%- elif len(cell_list) >= 3 %}
{%- elif len(cell_dict) >= 3 %}
ack_nack_feedback_mode_ca: "pucch3",
n3_pucch_an_n_rb: 3,
{%- endif %}
......
......@@ -240,7 +240,7 @@ url = {{ enb_template }}
output = ${directory:etc}/enb.cfg
extra-context =
import json_module json
json cell_list {{ rulib.cell_list | tojson }}
json cell_dict {{ rulib.cell_dict | tojson }}
key sib23_file sib-config:output
key drb_file drb-config:output
import-list =
......
dhcp-leasefile={{ directory['etc'] }}/dnsmasq.leases
port=5354
{%- for (cell_ref, cell) in cell_list|dictsort | selectattr('1._tap', 'defined') %}
{%- for (cell_ref, cell) in cell_dict|dictsort | selectattr('1._tap', 'defined') %}
{%- set ru_tap = cell._tap %}
{%- set vtap = json_module.loads(vtap_jdict[ru_tap]) %}
{%- set plen = netaddr.IPNetwork(vtap.network).prefixlen %}
......
......@@ -10,9 +10,9 @@
NOTE: driver-specific logic is implemented in rudrv .buildout_ru() and .buildout() .
#}
{#- cell_list keeps cell registry #}
{%- set cell_list = {} %}
{%- do slaplte.load_cell(cell_list) %}
{#- cell_dict keeps cell registry #}
{%- set cell_dict = {} %}
{%- do slaplte.load_cell(cell_dict) %}
{%- macro buildout() %}
......@@ -50,7 +50,7 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
provide several TAP interfaces to instances. See discussion at
https://lab.nexedi.com/nexedi/slapos/merge_requests/1471#note_194356
for details. #}
{%- set ntap = len(list(cell_list|dictsort)) %}
{%- set ntap = len(list(cell_dict|dictsort)) %}
{%- set vtap_list = [] %}
[vtap]
recipe = plone.recipe.command
......@@ -144,7 +144,7 @@ context =
import netaddr netaddr
section directory directory
section vtap_jdict vtap_jdict
json cell_list {{ cell_list | tojson }}
json cell_dict {{ cell_dict | tojson }}
{{ part('dnsmasq-service') }}
recipe = slapos.cookbook:wrapper
......@@ -167,7 +167,7 @@ hash-files =
RU-specific buildout handler #}
{%- set ru_type = {'lopcomm': 'lopcomm', 'm2ru': 'sunwave'}.get(ru, 'sdr') %}
{%- set rudrv = rudrv_dict[ru_type] %}
{%- for i, (cell_ref, cell) in enumerate(cell_list|dictsort) %}
{%- for i, (cell_ref, cell) in enumerate(cell_dict|dictsort) %}
{%- set ru_ref = cell_ref if cell_ref != 'default' else 'RU' %}
{%- set n_antenna_ul = int(slapparameter_dict.get('n_antenna_ul', default_n_antenna_ul)) %}
......
......@@ -51,18 +51,18 @@
{#- load_cell initializes cell registry.
cell_list keeps configured cells: {} cell reference -> cell parameters
cell_dict 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] %}
{%- macro load_cell(cell_dict) %}
{%- do cell_dict.update( slapparameter_dict.get('cell_list', {'default': {}}) ) %}
{%- for i, k in enumerate(cell_dict) %}
{%- set cell = cell_dict[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 %}
{%- for i, (cell_ref, cell) in enumerate(cell_dict|dictsort) %}
{%- if len(cell_dict) > 1 %}
{%- set ru_tap = "%s-%d" % (tap, i+1) %}
{%- else %}
{%- set ru_tap = tap %}
......@@ -75,7 +75,7 @@
{#- ---- building configuration ---- #}
{#- ru_config emits RF driver configuration for specified Radio Units. #}
{%- macro ru_config(ru, cell_list, slapparameter_dict) %}
{%- macro ru_config(ru, cell_dict, slapparameter_dict) %}
{% if ru.ru_type == "lopcomm" %}
rf_driver: {
{%- if slapparameter_dict.get('disable_sdr', False) %}
......@@ -84,8 +84,8 @@
name: "sdr",
{%- endif %}
args: "dev0=
{%- for i, k in enumerate(cell_list) %}
{%- set cpri_port = cell_list[k].cpri_port_number %}
{%- for i, k in enumerate(cell_dict) %}
{%- set cpri_port = cell_dict[k].cpri_port_number %}
{%- if i != 0 -%}
,
{%- endif -%}
......@@ -95,7 +95,7 @@
cpri_mapping: "hw",
{%- set cpri_mult = slapparameter_dict.get('cpri_mult', 16) %}
cpri_mult: "
{%- for i, k in enumerate(cell_list) %}
{%- for i, k in enumerate(cell_dict) %}
{%- if i != 0 -%}
,
{%- endif -%}
......@@ -103,30 +103,30 @@
{%- endfor -%}
",
cpri_rx_delay: "
{%- for i, k in enumerate(cell_list) %}
{%- for i, k in enumerate(cell_dict) %}
{%- if i != 0 -%}
,
{%- endif -%}
{{ cell_list[k].get('cpri_rx_delay', 0) }}
{{ cell_dict[k].get('cpri_rx_delay', 0) }}
{%- endfor -%}
",
cpri_tx_delay: "
{%- for i, k in enumerate(cell_list) %}
{%- for i, k in enumerate(cell_dict) %}
{%- if i != 0 -%}
,
{%- endif -%}
{{ cell_list[k].get('cpri_tx_delay', 0) }}
{{ cell_dict[k].get('cpri_tx_delay', 0) }}
{%- endfor -%}
",
cpri_tx_dbm: "
{%- for i, k in enumerate(cell_list) %}
{%- for i, k in enumerate(cell_dict) %}
{%- if i != 0 -%}
,
{%- endif -%}
{{ cell_list[k].get('cpri_tx_dbm', 0) }}
{{ cell_dict[k].get('cpri_tx_dbm', 0) }}
{%- endfor -%}
",
ifname: "{{ cell_list.values() | map(attribute='_tap') | join(',') }}",
ifname: "{{ cell_dict.values() | map(attribute='_tap') | join(',') }}",
},
tx_gain: 0,
rx_gain: 0,
......
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