Commit 41d23ce2 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb.jinja2.cfg: Factor handover code into one place

We currently have LTE-specific handover configuration in under cell_list and
NR-specific handover configuration in under nr_cell_list. Those configuration
are different.

However in upcoming MultiRU we will need to handle LTE->NR handover, NR->LTE
handover, and also Intra-ENB handover in addition to Inter-ENB handover we
currently do.

-> Move handover code into common function as a preparatory step for that.

In the future the handover code for LTE and NR cells will be the same, so it
makes sense to move that code to common place to avoid duplication.

For rendered enb.cfg this unification introduces only space and trivial
changes as shown in the appendix.

/cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
/proposed-for-review-on !1528
/reviewed-by TrustMe

Appendix. Diff for rendered enb.cfg and gnb.cfg before and after this patch

```
$ git diff -w --no-index config/{old,out}
```

```diff
diff --git a/config/old/enb.cfg b/config/out/enb.cfg
index 43301ee13..9dcca16c7 100644
--- a/config/old/enb.cfg
+++ b/config/out/enb.cfg
@@ -45,16 +45,18 @@
       root_sequence_index: 204,
       dl_earfcn: 36100,
       inactivity_timer: 10000,
+
       // Handover
       ncell_list: [
         // Inter-ENB HO
         {
+          rat: "eutra",
           n_id_cell: 35,
           dl_earfcn: 700,
           cell_id: 0x12345,
           tac: 123,
-        }],
-
+        },
+      ],

       // Carrier Aggregation
       scell_list: [
diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
index 2127a2f6b..23b07d6e1 100644
--- a/config/old/gnb.cfg
+++ b/config/out/gnb.cfg
@@ -57,6 +57,7 @@
     ssb_pos_bitmap: "10000000",

     inactivity_timer: 10000,
+
       // Handover
       ncell_list: [
         // Inter-ENB HO
@@ -74,8 +75,8 @@
           ssb_period: 20,
           ssb_offset: 0,
           ssb_duration: 1,
-      }],
-
+        },
+      ],

     // tune NR parameters for the cell
     manual_ref_signal_power: true,
```
parent 3fd11a89
...@@ -24,7 +24,7 @@ md5sum = 56a2c2b8245e86f3a8ed2eebeb8e88d9 ...@@ -24,7 +24,7 @@ md5sum = 56a2c2b8245e86f3a8ed2eebeb8e88d9
[slaplte.jinja2] [slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2 _update_hash_filename_ = slaplte.jinja2
md5sum = 8d635cffcfc7985ac2550aed3b6eb44d md5sum = 566efd38f12e6d42769399f421e77d6c
[ru_amarisoft-stats.jinja2.py] [ru_amarisoft-stats.jinja2.py]
_update_hash_filename_ = ru/amarisoft-stats.jinja2.py _update_hash_filename_ = ru/amarisoft-stats.jinja2.py
...@@ -108,7 +108,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149 ...@@ -108,7 +108,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
md5sum = 25028d84a3dcea300eb40789c5da8e2b md5sum = bc364da8033606bc8e6d9ae8bc7f718a
[drb_lte.jinja2.cfg] [drb_lte.jinja2.cfg]
filename = config/drb_lte.jinja2.cfg filename = config/drb_lte.jinja2.cfg
......
{%- import 'slaplte.jinja2' as slaplte with context %} {%- import 'slaplte.jinja2' as slaplte with context %}
{%- set J = slaplte.J %} {%- set J = slaplte.J %}
{%- set ierror = slaplte.ierror %} {%- set ierror = slaplte.ierror %}
{%- set bug = slaplte.bug %}
{#- 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 #}
...@@ -20,6 +21,40 @@ ...@@ -20,6 +21,40 @@
{%- set cell = namespace() %} {%- set cell = namespace() %}
{#- handover_config emits handover configuration #}
{%- macro handover_config() %}
ncell_list: [
// Inter-ENB HO
{%- for k in slapparameter_dict.get('ncell_list', {}) %}
{
{%- if do_lte %}
rat: "eutra",
n_id_cell: {{ slapparameter_dict['ncell_list'][k].get('pci', '') }},
dl_earfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_earfcn', '') }},
cell_id: {{ slapparameter_dict['ncell_list'][k].get('cell_id', '') }},
tac: {{ slapparameter_dict['ncell_list'][k].get('tac', 1) }},
{%- elif do_nr %}
rat: "nr",
dl_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_nr_arfcn', '') }},
ssb_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('ssb_nr_arfcn', '') }},
ul_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_nr_arfcn', '') }},
n_id_cell: {{ slapparameter_dict['ncell_list'][k].get('pci', '') }},
gnb_id_bits: {{ slapparameter_dict['ncell_list'][k].get('gnb_id_bits', '') }},
nr_cell_id: {{ slapparameter_dict['ncell_list'][k].get('nr_cell_id', '') }},
tac: {{ slapparameter_dict['ncell_list'][k].get('tac', 1) }},
band: {{ slapparameter_dict['ncell_list'][k].get('nr_band', '') }},
ssb_subcarrier_spacing: 30,
ssb_period: 20,
ssb_offset: 0,
ssb_duration: 1,
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
},
{%- endfor %}
],
{%- endmacro %}
{#- jlte_n_rb_dl returns n_rb_dl for an LTE bandwidth. #} {#- jlte_n_rb_dl returns n_rb_dl for an LTE bandwidth. #}
{%- macro jlte_n_rb_dl(bandwidth) %} {%- macro jlte_n_rb_dl(bandwidth) %}
{%- set _ = {1.4: 6, {%- set _ = {1.4: 6,
...@@ -259,24 +294,8 @@ ...@@ -259,24 +294,8 @@
dl_earfcn: {{ cell_list[k].get('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) }}, dl_earfcn: {{ cell_list[k].get('dl_earfcn', slapparameter_dict.get('dl_earfcn', earfcn)) }},
inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', slap_configuration['configuration.default_lte_inactivity_timer']) }}, inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', slap_configuration['configuration.default_lte_inactivity_timer']) }},
{%- if slapparameter_dict.get('ncell_list', '') %}
// Handover // Handover
ncell_list: [ {{- handover_config() }}
// Inter-ENB HO
{%- for i, k in enumerate(slapparameter_dict['ncell_list']) %}
{%- if i == 0 %}
{
{%- else -%}
, {
{%- endif %}
n_id_cell: {{ slapparameter_dict['ncell_list'][k].get('pci', '') }},
dl_earfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_earfcn', '') }},
cell_id: {{ slapparameter_dict['ncell_list'][k].get('cell_id', '') }},
tac: {{ slapparameter_dict['ncell_list'][k].get('tac', 1) }},
}
{%- endfor -%}
],
{% endif %}
// Carrier Aggregation // Carrier Aggregation
{%- set scell_list = [] %} {%- set scell_list = [] %}
...@@ -503,33 +522,8 @@ ...@@ -503,33 +522,8 @@
inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', slap_configuration['configuration.default_nr_inactivity_timer']) }}, inactivity_timer: {{ slapparameter_dict.get('inactivity_timer', slap_configuration['configuration.default_nr_inactivity_timer']) }},
{%- if slapparameter_dict.get('ncell_list', '') %}
// Handover // Handover
ncell_list: [ {{- handover_config() }}
// Inter-ENB HO
{%- for i, k in enumerate(slapparameter_dict['ncell_list']) %}
{%- if i == 0 %}
{
{%- else -%}
, {
{%- endif %}
rat: "nr",
dl_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_nr_arfcn', '') }},
ssb_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('ssb_nr_arfcn', '') }},
ul_nr_arfcn: {{ slapparameter_dict['ncell_list'][k].get('dl_nr_arfcn', '') }},
n_id_cell: {{ slapparameter_dict['ncell_list'][k].get('pci', '') }},
gnb_id_bits: {{ slapparameter_dict['ncell_list'][k].get('gnb_id_bits', '') }},
nr_cell_id: {{ slapparameter_dict['ncell_list'][k].get('nr_cell_id', '') }},
tac: {{ slapparameter_dict['ncell_list'][k].get('tac', 1) }},
band: {{ slapparameter_dict['ncell_list'][k].get('nr_band', '') }},
ssb_subcarrier_spacing: 30,
ssb_period: 20,
ssb_offset: 0,
ssb_duration: 1,
}
{%- endfor -%}
],
{% endif %}
// tune NR parameters for the cell // tune NR parameters for the cell
{%- if ors %} {%- if ors %}
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
{%- endif %} {%- endif %}
{#- bug indicates an error in template logic.
it should not happen. #}
{%- macro bug(msg) %}
{%- do assert(False, 'BUG: %s' % (msg,)) %}
{%- endmacro %}
{#- error reports instantiation error. #} {#- error reports instantiation error. #}
{%- macro error(msg) %} {%- macro error(msg) %}
{%- set msg = 'Instantiation Error: %s\n' % msg %} {%- set msg = 'Instantiation Error: %s\n' % msg %}
......
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