Commit 79370ebf authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb.jinja2.cfg: Stop using C Preprocessor and switch to Jinja2 completely

To support multiple Radio Units and multiple cells, we will need to loop over them
and emit corresponding configuration parts taking RU/Cell parameters into
account for each part. We currently handle some such parameters at Jinja2 level
(e.g. dl_earfcn), while some other parameters at CPP level (e.g. cell
bandwidth) and rely on enb to preprocess generated enb.cfg with CPP on its own.

While CPP works ok for simple 1RU-1CELL cases, and CPP is also the tool that Amarisoft
itself uses in its examples, it has the limitation that it cannot cooperate
with loops. In other words there can be only one global N_RB_DL #define, and it
cannot be different for different cells while we are looping over them at
Jinja2 level. That means that we cannot use CPP to handle multiple cells.

For this reason switch enb.jinja2.cfg to be using Jinja2 only without CPP.

While rendered enb.cfg/gnb.cfg change, we can see that they change in expected
way, with leaving only blocks that should be active for input parameters. See
the Appendix for details.

The switch is straightforward but one thing deserves to be mentioned: due to
limitation of Jinja2, where macros can return only strings, we use JSON
encoding to be able to return arbitrary types - integers, floats, dicts, etc,
and use a convention to name such macros with j prefix and wrap their usage
with J so that whole invocation does not add much noise. See added slaplte.J
documentation for details.

/cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
/reviewed-by @jhuge
/reviewed-on !1520

--------

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

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

```diff
diff --git a/config/old/enb.cfg b/config/out/enb.cfg
index 23e56c9a9..ee2661640 100644
--- a/config/old/enb.cfg
+++ b/config/out/enb.cfg
@@ -1,14 +1,6 @@

-#define TDD                 1
-
-#define N_RB_DL             50
-
-#define N_ANTENNA_DL        2
-
-#define N_ANTENNA_UL        2
-

 {

@@ -44,8 +36,8 @@
   cell_list: [
     {
       rf_port: 0,
-      n_antenna_dl: N_ANTENNA_DL,
-      n_antenna_ul: N_ANTENNA_UL,
+      n_antenna_dl: 2,
+      n_antenna_ul: 2,

       cell_id: 0x00,
       tac: 0x0001,
@@ -59,83 +51,33 @@

     manual_ref_signal_power: true,

-
-#if TDD == 1
     uldl_config: 6,
     sp_config: 7,
-#endif
-
-    n_rb_dl: N_RB_DL,
-#if N_RB_DL == 6
-    si_coderate: 0.30,
-#else
-    si_coderate: 0.20,
-#endif
+    n_rb_dl: 50,
+    si_coderate: 0.2,

     pdsch_dedicated: {
-#if N_ANTENNA_DL == 4
-      p_a: -6,
-#elif N_ANTENNA_DL == 2
       p_a: -3,
-#else
-      p_a: 0,
-#endif
       p_b: -1,
     },

-#if N_RB_DL == 6
-    pdcch_format: 1,
-#else
-    pdcch_format: 2,
-#endif
-
-#if N_RB_DL == 6
-    prach_config_index: 15,
-#else
+    pdcch_format:       2,
     prach_config_index: 4,
-#endif
-
-#if N_RB_DL == 6
-    initial_cqi: 5,
-#else
-    initial_cqi: 3,
-#endif
+    initial_cqi:        3,

     pucch_dedicated: {
       n1_pucch_sr_count: 11,
       cqi_pucch_n_rb: 1,
       n1_pucch_an_cs_count: 8,
       n3_pucch_an_n_rb: 3,
-#if TDD == 1
       tdd_ack_nack_feedback_mode: "multiplexing", /* TDD only */
-#endif
     },
-
-#if N_ANTENNA_DL >= 2
     m_ri: 8,
     transmission_mode: 3,
-#endif

     srs_dedicated: {
-#if N_RB_DL == 6
-      srs_bandwidth_config: 7,
-      srs_bandwidth: 1,
-#elif N_RB_DL == 15
-      srs_bandwidth_config: 6,
-      srs_bandwidth: 1,
-#elif N_RB_DL == 25
-      srs_bandwidth_config: 3,
-      srs_bandwidth: 1,
-#elif N_RB_DL == 50
       srs_bandwidth_config: 2,
       srs_bandwidth: 2,
-#elif N_RB_DL == 75
-      srs_bandwidth_config: 2,
-      srs_bandwidth: 2,
-#else
-      srs_bandwidth_config: 2,
-      srs_bandwidth: 3,
-#endif
       srs_subframe_config: 3,
       srs_period: 40,
       srs_hopping_bandwidth: 0,
diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
index 5bfd3bb01..0b6a1445c 100644
--- a/config/old/gnb.cfg
+++ b/config/out/gnb.cfg
@@ -1,13 +1,6 @@

-#define TDD                 1
-
-
-#define N_ANTENNA_DL        2
-
-#define N_ANTENNA_UL        2
-

 {

@@ -50,8 +43,8 @@
   nr_cell_list: [
   {
     rf_port: 0,
-    n_antenna_dl: N_ANTENNA_DL,
-    n_antenna_ul: N_ANTENNA_UL,
+    n_antenna_dl: 2,
+    n_antenna_ul: 2,

     cell_id: 0x01,
     n_id_cell: 500,
@@ -108,29 +101,10 @@
     csi_rs: {
       nzp_csi_rs_resource: [
         {
-#if N_ANTENNA_DL == 1
-          n_ports: 1,
-          frequency_domain_allocation: "row2",
-          bitmap: "100000000000",
-          cdm_type: "no_cdm",
-#elif N_ANTENNA_DL == 2
           n_ports: 2,
           frequency_domain_allocation: "other",
           bitmap: "100000",
           cdm_type: "fd_cdm2",
-#elif N_ANTENNA_DL == 4
-          n_ports: 4,
-          frequency_domain_allocation: "row4",
-          bitmap: "100",
-          cdm_type: "fd_cdm2",
-#elif N_ANTENNA_DL == 8
-          n_ports: 8,
-          frequency_domain_allocation: "other",
-          bitmap: "110011",
-          cdm_type: "fd_cdm2",
-#else
-#error unsupported number of DL antennas
-#endif
         },

       ],
@@ -148,22 +122,10 @@

       csi_report_config: [
         {
-#if N_ANTENNA_DL > 1
           codebook_config: {
             codebook_type: "type1",
             sub_type: "typeI_SinglePanel",
-#if N_ANTENNA_DL == 2
-#elif N_ANTENNA_DL == 4
-            n1: 2,
-            n2: 1,
-            codebook_mode: 1,
-#elif N_ANTENNA_DL == 8
-            n1: 4,
-            n2: 1,
-            codebook_mode: 1,
-#endif
           },
-#endif
         },
       ],
     },
```
parent 6404f810
...@@ -20,7 +20,7 @@ md5sum = a6c6075e138c2fa4400077acab7c015c ...@@ -20,7 +20,7 @@ md5sum = a6c6075e138c2fa4400077acab7c015c
[slaplte.jinja2] [slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2 _update_hash_filename_ = slaplte.jinja2
md5sum = c31dffa87765d93327f18ffd89ce36ca md5sum = 8d635cffcfc7985ac2550aed3b6eb44d
[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
...@@ -80,11 +80,11 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e ...@@ -80,11 +80,11 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 08cc07722022bfd9eee4fdd0044a2caf md5sum = de0452a804b972a23ed96b99814fdaed
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = 6c13d7b2dea85a222fe4e589dd50df87 md5sum = 86f305a1daa83aa3b663388d12242764
[template-core-network] [template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg _update_hash_filename_ = instance-core-network.jinja2.cfg
...@@ -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 = 211d7d93ed5fa4e6c08001a59c1e7762 md5sum = dc19f5362fe0e23ba814da39f7520c15
[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 ierror = slaplte.ierror %}
{#- 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 #}
...@@ -13,8 +15,21 @@ ...@@ -13,8 +15,21 @@
{%- do assert(not (do_lte and do_nr)) %} {%- do assert(not (do_lte and do_nr)) %}
{#- ru is namespace object that holds Radio Unit related parameters #} {#- ru and cell are namespace objects that hold Radio Unit and Cell related parameters #}
{%- set ru = namespace(ru_type=ru_type) %} {%- set ru = namespace(ru_type=ru_type) %}
{%- set cell = namespace() %}
{#- jlte_n_rb_dl returns n_rb_dl for an LTE bandwidth. #}
{%- macro jlte_n_rb_dl(bandwidth) %}
{%- set _ = {1.4: 6,
3: 15,
5: 25,
10: 50,
15: 75,
20: 100} %}
{{- _[float(bandwidth.removesuffix(' MHz'))] | tojson }}
{%- endmacro %}
{%- if do_lte %} {%- if do_lte %}
...@@ -35,33 +50,15 @@ ...@@ -35,33 +50,15 @@
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{% if rf_mode == 'tdd' %}
#define TDD 1
{% else %}
#define TDD 0
{% endif %}
{%- if do_lte %} {%- if do_lte %}
{%- if slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '1.4 MHz' %} {%- set cell.bandwidth = slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) %}
#define N_RB_DL 6
{%- elif slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '3 MHz' %}
#define N_RB_DL 15
{%- elif slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '5 MHz' %}
#define N_RB_DL 25
{%- elif slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '10 MHz' %}
#define N_RB_DL 50
{%- elif slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '15 MHz' %}
#define N_RB_DL 75
{%- elif slapparameter_dict.get('bandwidth', slap_configuration['configuration.default_lte_bandwidth']) == '20 MHz' %}
#define N_RB_DL 100
{%- endif %}
{%- endif %} {%- endif %}
#define N_ANTENNA_DL {{ slapparameter_dict.get('n_antenna_dl', slap_configuration['configuration.default_n_antenna_dl']) }} {%- set ru.n_antenna_dl = slapparameter_dict.get('n_antenna_dl', int(slap_configuration['configuration.default_n_antenna_dl'])) %}
{% if ru.ru_type == "m2ru" %} {% if ru.ru_type == "m2ru" %}
#define N_ANTENNA_UL {{ slapparameter_dict.get('n_antenna_ul', 1) }} {%- set ru.n_antenna_ul = slapparameter_dict.get('n_antenna_ul', 1) %}
{% else %} {% else %}
#define N_ANTENNA_UL {{ slapparameter_dict.get('n_antenna_ul', slap_configuration['configuration.default_n_antenna_ul']) }} {%- set ru.n_antenna_ul = slapparameter_dict.get('n_antenna_ul', int(slap_configuration['configuration.default_n_antenna_ul'])) %}
{% endif %} {% endif %}
{ {
...@@ -258,8 +255,8 @@ ...@@ -258,8 +255,8 @@
{%- for i, k in enumerate(cell_list) %} {%- for i, k in enumerate(cell_list) %}
{ {
rf_port: {{ i }}, rf_port: {{ i }},
n_antenna_dl: N_ANTENNA_DL, n_antenna_dl: {{ ru.n_antenna_dl }},
n_antenna_ul: 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_list[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_list[k].get('tac', slapparameter_dict.get('tac', '0x0001')) }},
...@@ -307,80 +304,58 @@ ...@@ -307,80 +304,58 @@
manual_ref_signal_power: true, manual_ref_signal_power: true,
{% endif %} {% endif %}
#if TDD == 1 {%- set tdd = (rf_mode == 'tdd') %}
{%- if tdd %}
uldl_config: {{ tdd_config }}, uldl_config: {{ tdd_config }},
sp_config: 7, sp_config: 7,
#endif {%- endif %}
n_rb_dl: N_RB_DL, {%- set n_rb_dl = J(jlte_n_rb_dl(cell.bandwidth)) %}
#if N_RB_DL == 6 n_rb_dl: {{ n_rb_dl }},
si_coderate: 0.30, si_coderate: {{ 0.30 if n_rb_dl == 6 else 0.20 }},
#else
si_coderate: 0.20,
#endif
pdsch_dedicated: { pdsch_dedicated: {
#if N_ANTENNA_DL == 4 p_a: {{ {4: -6, 2: -3}.get(ru.n_antenna_dl, 0) }},
p_a: -6,
#elif N_ANTENNA_DL == 2
p_a: -3,
#else
p_a: 0,
#endif
p_b: -1, p_b: -1,
}, },
#if N_RB_DL == 6 pdcch_format: {{ 1 if n_rb_dl == 6 else 2 }},
pdcch_format: 1, prach_config_index: {{ 15 if n_rb_dl == 6 else 4 }},
#else initial_cqi: {{ 5 if n_rb_dl == 6 else 3 }},
pdcch_format: 2,
#endif
#if N_RB_DL == 6
prach_config_index: 15,
#else
prach_config_index: 4,
#endif
#if N_RB_DL == 6
initial_cqi: 5,
#else
initial_cqi: 3,
#endif
pucch_dedicated: { pucch_dedicated: {
n1_pucch_sr_count: 11, n1_pucch_sr_count: 11,
cqi_pucch_n_rb: 1, cqi_pucch_n_rb: 1,
#if TDD == 1 {%- if tdd %}
tdd_ack_nack_feedback_mode: "multiplexing", /* TDD only */ tdd_ack_nack_feedback_mode: "multiplexing", /* TDD only */
#endif {%- endif %}
}, },
#if N_ANTENNA_DL >= 2 {%- if ru.n_antenna_dl >= 2 %}
m_ri: 8, m_ri: 8,
transmission_mode: 3, transmission_mode: 3,
#endif {%- endif %}
srs_dedicated: { srs_dedicated: {
#if N_RB_DL == 6 {%- if n_rb_dl == 6 %}
srs_bandwidth_config: 7, srs_bandwidth_config: 7,
srs_bandwidth: 1, srs_bandwidth: 1,
#elif N_RB_DL == 15 {%- elif n_rb_dl == 15 %}
srs_bandwidth_config: 6, srs_bandwidth_config: 6,
srs_bandwidth: 1, srs_bandwidth: 1,
#elif N_RB_DL == 25 {%- elif n_rb_dl == 25 %}
srs_bandwidth_config: 3, srs_bandwidth_config: 3,
srs_bandwidth: 1, srs_bandwidth: 1,
#elif N_RB_DL == 50 {%- elif n_rb_dl == 50 %}
srs_bandwidth_config: 2, srs_bandwidth_config: 2,
srs_bandwidth: 2, srs_bandwidth: 2,
#elif N_RB_DL == 75 {%- elif n_rb_dl == 75 %}
srs_bandwidth_config: 2, srs_bandwidth_config: 2,
srs_bandwidth: 2, srs_bandwidth: 2,
#else {%- else %}
srs_bandwidth_config: 2, srs_bandwidth_config: 2,
srs_bandwidth: 3, srs_bandwidth: 3,
#endif {%- endif %}
srs_subframe_config: 3, srs_subframe_config: 3,
srs_period: 40, srs_period: 40,
srs_hopping_bandwidth: 0, srs_hopping_bandwidth: 0,
...@@ -505,8 +480,8 @@ ...@@ -505,8 +480,8 @@
nr_cell_list: [ nr_cell_list: [
{ {
rf_port: 0, rf_port: 0,
n_antenna_dl: N_ANTENNA_DL, n_antenna_dl: {{ ru.n_antenna_dl }},
n_antenna_ul: N_ANTENNA_UL, n_antenna_ul: {{ ru.n_antenna_ul }},
cell_id: {{ slapparameter_dict.get('cell_id', '0x01') }}, cell_id: {{ slapparameter_dict.get('cell_id', '0x01') }},
n_id_cell: {{ slapparameter_dict.get('pci', 500) }}, n_id_cell: {{ slapparameter_dict.get('pci', 500) }},
...@@ -636,29 +611,29 @@ ...@@ -636,29 +611,29 @@
csi_rs: { csi_rs: {
nzp_csi_rs_resource: [ nzp_csi_rs_resource: [
{ {
#if N_ANTENNA_DL == 1 {%- if ru.n_antenna_dl == 1 %}
n_ports: 1, n_ports: 1,
frequency_domain_allocation: "row2", frequency_domain_allocation: "row2",
bitmap: "100000000000", bitmap: "100000000000",
cdm_type: "no_cdm", cdm_type: "no_cdm",
#elif N_ANTENNA_DL == 2 {%- elif ru.n_antenna_dl == 2 %}
n_ports: 2, n_ports: 2,
frequency_domain_allocation: "other", frequency_domain_allocation: "other",
bitmap: "100000", bitmap: "100000",
cdm_type: "fd_cdm2", cdm_type: "fd_cdm2",
#elif N_ANTENNA_DL == 4 {%- elif ru.n_antenna_dl == 4 %}
n_ports: 4, n_ports: 4,
frequency_domain_allocation: "row4", frequency_domain_allocation: "row4",
bitmap: "100", bitmap: "100",
cdm_type: "fd_cdm2", cdm_type: "fd_cdm2",
#elif N_ANTENNA_DL == 8 {%- elif ru.n_antenna_dl == 8 %}
n_ports: 8, n_ports: 8,
frequency_domain_allocation: "other", frequency_domain_allocation: "other",
bitmap: "110011", bitmap: "110011",
cdm_type: "fd_cdm2", cdm_type: "fd_cdm2",
#else {%- else %}
#error unsupported number of DL antennas {%- do error('n_antenna_dl=%d is not supported' % ru.n_antenna_dl) %}
#endif {%- endif %}
}, },
{% if tdd_config != 3 %} {% if tdd_config != 3 %}
{ {
...@@ -754,22 +729,22 @@ ...@@ -754,22 +729,22 @@
csi_report_config: [ csi_report_config: [
{ {
#if N_ANTENNA_DL > 1 {%- if ru.n_antenna_dl > 1 %}
codebook_config: { codebook_config: {
codebook_type: "type1", codebook_type: "type1",
sub_type: "typeI_SinglePanel", sub_type: "typeI_SinglePanel",
#if N_ANTENNA_DL == 2 {%- if ru.n_antenna_dl == 2 %}
#elif N_ANTENNA_DL == 4 {%- elif ru.n_antenna_dl == 4 %}
n1: 2, n1: 2,
n2: 1, n2: 1,
codebook_mode: 1, codebook_mode: 1,
#elif N_ANTENNA_DL == 8 {%- elif ru.n_antenna_dl == 8 %}
n1: 4, n1: 4,
n2: 1, n2: 1,
codebook_mode: 1, codebook_mode: 1,
#endif {%- endif %}
}, },
#endif {%- endif %}
}, },
], ],
}, },
......
...@@ -214,6 +214,7 @@ url = {{ enb_template }} ...@@ -214,6 +214,7 @@ url = {{ enb_template }}
{% endif %} {% endif %}
output = ${directory:etc}/enb.cfg output = ${directory:etc}/enb.cfg
extra-context = extra-context =
import json_module json
json cell_list {{ rulib.cell_list | tojson }} json cell_list {{ rulib.cell_list | 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
......
...@@ -261,6 +261,7 @@ url = {{ enb_template }} ...@@ -261,6 +261,7 @@ url = {{ enb_template }}
{% endif %} {% endif %}
output = ${directory:etc}/gnb.cfg output = ${directory:etc}/gnb.cfg
extra-context = extra-context =
import json_module json
key drb_file drb-config:output key drb_file drb-config:output
import-list = import-list =
rawfile slaplte.jinja2 {{ slaplte_template }} rawfile slaplte.jinja2 {{ slaplte_template }}
......
{#- Package slaplte provides helpers for configuring Amarisoft LTE services in SlapOS. {#- Package slaplte provides helpers for configuring Amarisoft LTE services in SlapOS.
- load_cell initializes cell registry. - load_cell initializes cell registry.
The following utilities are also provided:
- J should be used around macro calls to retrieve returned objects.
- error reports instantiation error.
-#} -#}
{#- J is used around macro calls to retrieve returned objects.
It is needed to workaround jinja2 limitation that macro can return only
strings - not arbitrary objects: we return objects as JSON-encoded string
and J decodes them.
By convention macros that return JSON-encoded objects start with "j" prefix.
Usage example:
set obj = J(jmymacro(...))
#}
{%- set J = json_module.loads %}
{#- tap indicates tap interface, that slapos told us to use, {#- tap indicates tap interface, that slapos told us to use,
or 'xxx-notap-xxx' if slapos provided us either nothing or empty string. #} or 'xxx-notap-xxx' if slapos provided us either nothing or empty string. #}
{%- set tap = slap_configuration.get('tap-name', '') %} {%- set tap = slap_configuration.get('tap-name', '') %}
...@@ -12,6 +32,14 @@ ...@@ -12,6 +32,14 @@
{%- endif %} {%- endif %}
{#- error reports instantiation error. #}
{%- macro error(msg) %}
{%- set msg = 'Instantiation Error: %s\n' % msg %}
{%- do assert(False, msg) %}
{%- endmacro %}
{#- ---- loading ---- #} {#- ---- loading ---- #}
{#- load_cell initializes cell registry. {#- load_cell initializes cell registry.
......
...@@ -17,6 +17,7 @@ def j2render(src, out, jcfg): ...@@ -17,6 +17,7 @@ def j2render(src, out, jcfg):
textctx = '' textctx = ''
for k, v in ctx.items(): for k, v in ctx.items():
textctx += 'json %s %s\n' % (k, json.dumps(v)) textctx += 'json %s %s\n' % (k, json.dumps(v))
textctx += 'import json_module json\n'
buildout = None # stub buildout = None # stub
r = jinja2_template.Recipe(buildout, "recipe", { r = jinja2_template.Recipe(buildout, "recipe", {
'extensions': 'jinja2.ext.do', 'extensions': 'jinja2.ext.do',
......
...@@ -146,8 +146,13 @@ def test_enb_conf(self): ...@@ -146,8 +146,13 @@ def test_enb_conf(self):
self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain']) self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain'])
self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain']) self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain'])
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
{%- if rf_mode == 'tdd' %}
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertEqual(conf['cell_list'][0]['uldl_config'], 6)
{%- else %}
self.assertNotIn('uldl_config', conf['cell_list'][0])
{%- endif %}
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +174,6 @@ def test_enb_conf(self): ...@@ -169,11 +174,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +188,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +188,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +219,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +219,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -146,8 +146,9 @@ def test_enb_conf(self): ...@@ -146,8 +146,9 @@ def test_enb_conf(self):
self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain']) self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain'])
self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain']) self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain'])
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertNotIn('uldl_config', conf['cell_list'][0])
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -146,8 +146,9 @@ def test_enb_conf(self): ...@@ -146,8 +146,9 @@ def test_enb_conf(self):
self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain']) self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain'])
self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain']) self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain'])
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertNotIn('uldl_config', conf['cell_list'][0])
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -146,8 +146,9 @@ def test_enb_conf(self): ...@@ -146,8 +146,9 @@ def test_enb_conf(self):
self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain']) self.assertEqual(conf['tx_gain'], enb_param_dict['tx_gain'])
self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain']) self.assertEqual(conf['rx_gain'], enb_param_dict['rx_gain'])
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertNotIn('uldl_config', conf['cell_list'][0])
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -148,6 +148,7 @@ def test_enb_conf(self): ...@@ -148,6 +148,7 @@ def test_enb_conf(self):
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertEqual(conf['cell_list'][0]['uldl_config'], 6)
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -148,6 +148,7 @@ def test_enb_conf(self): ...@@ -148,6 +148,7 @@ def test_enb_conf(self):
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertEqual(conf['cell_list'][0]['uldl_config'], 6)
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
...@@ -148,6 +148,7 @@ def test_enb_conf(self): ...@@ -148,6 +148,7 @@ def test_enb_conf(self):
self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer']) self.assertEqual(conf['cell_list'][0]['inactivity_timer'], enb_param_dict['inactivity_timer'])
self.assertEqual(conf['cell_list'][0]['uldl_config'], 6) self.assertEqual(conf['cell_list'][0]['uldl_config'], 6)
self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn']) self.assertEqual(conf['cell_list'][0]['dl_earfcn'], enb_param_dict['dl_earfcn'])
self.assertEqual(conf['cell_list'][0]['n_rb_dl'], 50)
self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16)) self.assertEqual(conf['enb_id'], int(enb_param_dict['enb_id'], 16))
self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci']) self.assertEqual(conf['cell_list'][0]['n_id_cell'], enb_param_dict['pci'])
self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16)) self.assertEqual(conf['cell_list'][0]['tac'], int(enb_param_dict['tac'], 16))
...@@ -169,11 +170,6 @@ def test_enb_conf(self): ...@@ -169,11 +170,6 @@ def test_enb_conf(self):
self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16)) self.assertEqual(p['cell_id'], int(conf_ncell['cell_id'], 16))
self.assertEqual(p['tac'], conf_ncell['tac']) self.assertEqual(p['tac'], conf_ncell['tac'])
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define N_RB_DL'):
self.assertIn('50', l)
def test_gnb_conf1(self): def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
...@@ -188,6 +184,7 @@ def test_gnb_conf1(self): ...@@ -188,6 +184,7 @@ def test_gnb_conf1(self):
self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn']) self.assertEqual(conf['nr_cell_list'][0]['dl_nr_arfcn'], gnb_param_dict1['dl_nr_arfcn'])
self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band']) self.assertEqual(conf['nr_cell_list'][0]['band'], gnb_param_dict1['nr_band'])
self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap']) self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
self.assertEqual(conf['nr_cell_list'][0]['bandwidth'], gnb_param_dict1['nr_bandwidth'])
self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci']) self.assertEqual(conf['nr_cell_list'][0]['n_id_cell'], gnb_param_dict1['pci'])
self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16)) self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits']) self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
...@@ -218,11 +215,6 @@ def test_gnb_conf1(self): ...@@ -218,11 +215,6 @@ def test_gnb_conf1(self):
self.assertEqual(int(tdd_config['ul_slots']), 1) self.assertEqual(int(tdd_config['ul_slots']), 1)
self.assertEqual(int(tdd_config['ul_symbols']), 2) self.assertEqual(int(tdd_config['ul_symbols']), 2)
with open(conf_file, 'r') as f:
for l in f:
if l.startswith('#define NR_BANDWIDTH'):
self.assertIn(str(gnb_param_dict1['nr_bandwidth']), l)
def test_gnb_conf2(self): def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join( conf_file = glob.glob(os.path.join(
......
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