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