Commit 95e1a3bd authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: enb/generic: Tighten defaults

We currently have 2 kinds of software:

- ORS, whose intended usage is small private networks, and
- generic, whose intended usage is small-to-medium networks.

and currently they both share defaults for their parameters inherited from ORS.
But what is appropriate for small private networks, might be not so appropriate
for medium networks.

For example ORS has default enb_id/gnb_id, but in a network with 100 nodes, it
is better to force every node to be explicitly assigned an id and error
otherwise. Similarly for cells ORS has defaults for cell_id, but in network
with many nodes, cell_id needs to be explicitly assigned. With having a default
there is also a chance to misspell the parameter name, and do not notice it
because the software will instantiate without an error but work incorrectly.

So in this patch we tighten the defaults for generic:

- enb_id, mme_list become non-optional for LTE
- gnb_id, afm_list become non-optional for NR
- plmn_list becomes non-optional for both LTE and NR. The format is different
  in between RATs and so later we will use plmn_list and plmn_list_5g when
  merging enb and gnb.

- the following parameters of LTE cells now needs to be explicitly configured:
  rf_mode, dl_earfcn, bandwidth, cell_id, pci, tac.
- the following parameters of  NR cells now needs to be explicitly configured:
  rf_mode, dl_nr_arfcn, nr_band, bandwidth, cell_id, pci.

We rework ORS mode to translate its own set of parameters and defaults into
generic enb/gnb parameters.

We similarly pull some global generic defaults into instance-enb.cfg.jinja2
with the idea that they could be maintained in one central place. In the future
it would be good to automatically load them from JSON schemas to avoid
duplication.

This patch should be backward compatible for ORS, but it introduces the change
in cell_id and pci in rendered enb.cfg which become 1 instead of 0:

    --- a/config/old/enb.cfg
    +++ b/config/out/enb.cfg
    @@ -33,9 +33,9 @@
           n_antenna_dl: 2,
           n_antenna_ul: 2,

    -      cell_id:    0x00,
    +      cell_id:    0x01,
           tac:        0x0001,
    -      n_id_cell:  0,
    +      n_id_cell:  1,
           root_sequence_index: 204,
           dl_earfcn:  36100,
           inactivity_timer: 10000,

The defaults for those parameters according to instance-enb-input-schema.json
are 0x01 and 1. And it looks like enb.jinja2.cfg was changed to emit them starting from
0 instead of 1 in c4d0958e due to probable thinko in that patch because before
that patch those parameters were emitted as 0x01 and 1:

    c4d0958e

and, once again, the schema says their defaults should be 0x01 and 1 as well.

The rest of the changes in rendered enb.cfg and gnb.cfg should not introduce
any semantic difference. Please see the appendix for full details.

--------

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

```
$ ./pythonwitheggs slapos-render-config.py && xdiff -w config/{old,out}
```

```diff
diff --git a/config/old/enb.cfg b/config/out/enb.cfg
index 89862f1d9..5842dfc22 100644
--- a/config/old/enb.cfg
+++ b/config/out/enb.cfg
@@ -33,9 +33,9 @@
       n_antenna_dl: 2,
       n_antenna_ul: 2,

-      cell_id:    0x00,
+      cell_id:    0x01,
       tac:        0x0001,
-      n_id_cell:  0,
+      n_id_cell:  1,
       root_sequence_index: 204,
       dl_earfcn:  36100,
       inactivity_timer: 10000,
@@ -102,8 +102,11 @@
   ],
   cell_default: {
     plmn_list: [
-      "00101",
-
+      {
+        plmn: "00101",
+        reserved: false,
+        attach_without_pdn: false,
+      },
     ],
     cyclic_prefix: "normal",

diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
index 1df699a22..635c4baf2 100644
--- a/config/old/gnb.cfg
+++ b/config/out/gnb.cfg
@@ -22,7 +22,7 @@
     },
   ],
   gtp_addr: "127.0.1.1",
-
+  xn_peers: [],
   gnb_id_bits: 28,
   gnb_id: 0x12345,
   en_dc_support: true,
@@ -142,6 +142,7 @@

   nr_cell_default: {
     ssb_period: 20,
+
     plmn_list: [
       {
         plmn: "00101",
@@ -151,10 +152,10 @@
           {
             sst: 1,
           },
-
         ],
       },
     ],
+
     si_window_length: 40,
     cell_barred: false,
     intra_freq_reselection: true,
```
parent 9e7c6809
......@@ -166,21 +166,17 @@
{%- endif %}
{%- if do_nr %}
{% if slapparameter_dict.get('xn_peers', '') %}
xn_peers: [
{%- for k in slapparameter_dict['xn_peers'] -%}
"{{ slapparameter_dict['xn_peers'][k]['xn_addr'] }}",
{%- endfor -%}
],
{% endif %}
xn_peers: {{ slapparameter_dict.xn_peers|dictsort
| map(attribute='1.xn_addr')
| list | tojson }},
{%- endif %}
{%- if do_lte %}
enb_id: {{ slapparameter_dict.get('enb_id', '0x1A2D0') }},
enb_id: {{ slapparameter_dict.enb_id }},
{%- endif %}
{%- if do_nr %}
gnb_id_bits: {{ slapparameter_dict.get('gnb_id_bits', 28) }},
gnb_id: {{ slapparameter_dict.get('gnb_id', '0x12345') }},
gnb_id_bits: {{ slapparameter_dict.gnb_id_bits }},
gnb_id: {{ slapparameter_dict.gnb_id }},
en_dc_support: true,
{%- endif %}
......@@ -310,21 +306,13 @@
{%- if do_lte %}
cell_default: {
plmn_list: [
{%- if slapparameter_dict.get('plmn_list', '') %}
{%- for i, k in enumerate(slapparameter_dict['plmn_list']) %}
{%- if i == 0 -%}
{%- for _, plmn in slapparameter_dict.plmn_list |dictsort %}
{
{%- else -%}
, {
{%- endif %}
plmn: "{{ slapparameter_dict['plmn_list'][k]['plmn'] }}",
reserved: {{ str(slapparameter_dict['plmn_list'][k].get('reserved', false)).lower() }},
attach_without_pdn: {{ str(slapparameter_dict['plmn_list'][k].get('attach_without_pdn', false)).lower() }},
}
{%- endfor -%}
{% else %}
"00101",
{% endif %}
plmn: "{{ plmn.plmn }}",
reserved: {{ plmn.get('reserved', false) |tojson }},
attach_without_pdn: {{ plmn.get('attach_without_pdn', false) |tojson }},
},
{%- endfor %}
],
cyclic_prefix: "normal",
......@@ -680,70 +668,30 @@
nr_cell_default: {
ssb_period: 20,
plmn_list: [
{%- if slapparameter_dict.get('plmn_list', '') %}
{%- for i, k in enumerate(slapparameter_dict['plmn_list']) %}
{%- if i == 0 -%}
{
{%- else -%}
, {
{%- endif %}
plmn: "{{ slapparameter_dict['plmn_list'][k]['plmn'] }}",
tac: {{ slapparameter_dict['plmn_list'][k].get('tac', 100) }},
{%- if slapparameter_dict['plmn_list'][k].get('ranac', '') %}
ranac: {{ slapparameter_dict['plmn_list'][k]['ranac'] }},
{%- endif %}
reserved: {{ str(slapparameter_dict['plmn_list'][k].get('reserved', false)).lower() }},
nssai: [
{%- if slapparameter_dict.get('nssai', '') %}
{%- for j, k in enumerate(slapparameter_dict['nssai']) %}
{%- if j == 0 %}
{
{%- else -%}
, {
{%- endif %}
sst: {{ slapparameter_dict['nssai'][k]['sst'] }},
{%- if slapparameter_dict['nssai'][k].get('sd', '') %}
sd: {{ slapparameter_dict['nssai'][k]['sd'] }},
{%- endif %}
}
{%- endfor -%}
{% else %}
{
sst: 1,
},
{% endif %}
],
}
{%- endfor -%}
{% else %}
plmn_list: [
{%- for _, plmn in slapparameter_dict.plmn_list |dictsort %}
{
plmn: "00101",
tac: 100,
reserved: false,
nssai: [
{%- if slapparameter_dict.get('nssai', '') %}
{%- for j, k in enumerate(slapparameter_dict['nssai']) %}
{%- if j == 0 %}
{
{%- else -%}
, {
{%- endif %}
sst: {{ slapparameter_dict['nssai'][k]['sst'] }},
{%- if slapparameter_dict['nssai'][k].get('sd', '') %}
sd: {{ slapparameter_dict['nssai'][k]['sd'] }},
{%- endif %}
}
{%- endfor -%}
{% else %}
{
sst: 1,
},
{% endif %}
],
plmn: "{{ plmn.plmn }}",
tac: {{ plmn.tac }},
{%- if plmn.get('ranac') %}
ranac: {{ plmn.ranac }},
{%- endif %}
reserved: {{ plmn.get('reserved', false) |tojson }},
nssai: [
{%- for _, nssai in slapparameter_dict.nssai |dictsort %}
{
sst: {{ nssai.sst }},
{%- if nssai.get('sd') %}
sd: {{ nssai.sd }},
{%- endif %}
},
{%- endfor %}
],
},
{%- endif %}
{%- endfor %}
],
si_window_length: 40,
cell_barred: false,
intra_freq_reselection: true,
......
......@@ -16,8 +16,7 @@
"enum": [
"fdd",
"tdd"
],
"default": "tdd"
]
},
"tdd_ul_dl_config": {
"title": "TDD",
......@@ -53,8 +52,7 @@
"10 MHz",
"15 MHz",
"20 MHz"
],
"default": "20 MHz"
]
},
"pci": {
"title": "Physical Cell ID",
......@@ -69,7 +67,6 @@
"tac": {
"title": "Tracking Area Code",
"description": "Tracking Area Code in hexadecimal representation (range 0x0000 to 0xffff)",
"default": "0x0001",
"type": "string"
},
"root_sequence_index": {
......@@ -99,9 +96,8 @@
},
"enb_id": {
"title": "eNB ID",
"description": "eNB ID",
"type": "string",
"default": "0x1A2D0"
"description": "eNB ID. (must be set if there are LTE cells)",
"type": "string"
},
"gtp_addr": {
"title": "GTP Address",
......@@ -111,7 +107,7 @@
},
"mme_list": {
"title": "MME list",
"description": "Optionnal. List of MME to which the gNodeB is connected",
"description": "List of MME to which the eNodeB is connected. (must be set if there are LTE cells)",
"patternProperties": {
".*": {
"properties": {
......@@ -124,17 +120,15 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"plmn_list": {
"title": "PLMN list",
"description": "List of PLMNs broadcasted by the eNodeB, at most 6 (default: 00101)",
"description": "List of PLMNs broadcasted by the eNodeB, at most 6. (must be set if there are LTE cells)",
"patternProperties": {
".*": {
"properties": {
"plmn": {
"default": "00101",
"title": "Public Land Mobile Network",
"description": "Public Land Mobile Network",
"type": "string"
......@@ -155,8 +149,7 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"ncell_list": {
"title": "Neighbour Cell Info",
......
......@@ -98,8 +98,7 @@
"enum": [
"fdd",
"tdd"
],
"default": "tdd"
]
},
"tdd_ul_dl_config": {
"title": "TDD",
......@@ -135,8 +134,7 @@
"10 MHz",
"15 MHz",
"20 MHz"
],
"default": "{{ default_lte_bandwidth }}"
]
},
"pci": {
"title": "Physical Cell ID",
......@@ -151,7 +149,6 @@
"tac": {
"title": "Tracking Area Code",
"description": "Tracking Area Code in hexadecimal representation (range 0x0000 to 0xffff)",
"default": "0x0001",
"type": "string"
},
"root_sequence_index": {
......@@ -196,9 +193,11 @@
{%- endif %}
"enb_id": {
"title": "eNB ID",
"description": "eNB ID",
"type": "string",
"description": "eNB ID{% if bbu != 'ors' %}. (must be set if there are LTE cells){% endif %}",
"type": "string"
{%- if bbu == 'ors' %},
"default": "0x1A2D0"
{%- endif %}
},
"gtp_addr": {
"title": "GTP Address",
......@@ -208,7 +207,11 @@
},
"mme_list": {
"title": "MME list",
{%- if bbu == 'ors' %}
"description": "Optionnal. List of MME to which the gNodeB is connected",
{%- else %}
"description": "List of MME to which the eNodeB is connected. (must be set if there are LTE cells)",
{%- endif %}
"patternProperties": {
".*": {
"properties": {
......@@ -221,17 +224,29 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
{%- if bbu == 'ors' %},
"default": {
"1": {
"mme_addr": "127.0.1.100"
}
}
{%- endif %}
},
"plmn_list": {
"title": "PLMN list",
{%- if bbu == 'ors' %}
"description": "List of PLMNs broadcasted by the eNodeB, at most 6 (default: 00101)",
{%- else %}
"description": "List of PLMNs broadcasted by the eNodeB, at most 6. (must be set if there are LTE cells)",
{%- endif %}
"patternProperties": {
".*": {
"properties": {
"plmn": {
{%- if bbu == 'ors' %}
"default": "00101",
{%- endif %}
"title": "Public Land Mobile Network",
"description": "Public Land Mobile Network",
"type": "string"
......@@ -252,8 +267,14 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
{%- if bbu == 'ors' %},
"default": {
"1": {
"plmn": "00101"
}
}
{%- endif %}
},
{%- if bbu == 'ors' %}
"lte_handover_a3_offset": {
......
......@@ -10,23 +10,17 @@
{%- set enb_defaults = {
'com_ws_port': 9001,
'com_addr': '127.0.1.2',
'mme_list': {'1': {'mme_addr': '127.0.1.100'}},
'amf_list': {'1': {'amf_addr': '127.0.1.100'}},
'use_ipv4': False,
'gnb_id_bits': 28,
'nssai': {'1': {'sst': 1}},
"ncell_list": {},
"xn_peers": {},
} %}
{%- set gtp_addr_lo = '127.0.1.1' %}
{%- for k,v in enb_defaults|dictsort %}
{%- do slapparameter_dict.setdefault(k, v) %}
{%- endfor %}
{#- defaults for eNB radio parameters.
NOTE they are installed temporary and will go away after switch to generic multiRU. #}
{%- do RF.setdefault('tx_gain', slapparameter_dict.get('tx_gain', 0)) %}
{%- do RF.setdefault('rx_gain', slapparameter_dict.get('rx_gain', 0)) %}
{%- do RF.setdefault('dl_earfcn', slapparameter_dict.get('dl_earfcn', 0)) %}
{%- do RF.setdefault('dl_nr_arfcn', slapparameter_dict.get('dl_nr_arfcn', 0)) %}
{%- do RF.setdefault('nr_band', slapparameter_dict.get('nr_band', 0)) %}
[buildout]
parts =
directory
......
......@@ -16,8 +16,7 @@
"enum": [
"fdd",
"tdd"
],
"default": "tdd"
]
},
"tdd_ul_dl_config": {
"title": "TDD",
......@@ -51,8 +50,7 @@
"bandwidth": {
"title": "Bandwidth",
"description": "Downlink Bandwidth (in MHz)",
"type": "number",
"default": 40
"type": "number"
},
"ssb_pos_bitmap": {
"title": "SSB Position Bitmap",
......@@ -63,14 +61,12 @@
"pci": {
"title": "Physical Cell ID",
"description": "Physical Cell ID",
"type": "number",
"default": 500
"type": "number"
},
"cell_id": {
"title": "Cell ID",
"description": "Cell ID",
"type": "string",
"default": "0x01"
"type": "string"
},
"root_sequence_index": {
"title": "Root Sequence Index",
......@@ -99,9 +95,8 @@
},
"gnb_id": {
"title": "gNB ID",
"description": "gNB ID",
"type": "string",
"default": "0x12345"
"description": "gNB ID. (must be set if there are NR cells)",
"type": "string"
},
"gnb_id_bits": {
"title": "gNB ID bits",
......@@ -111,7 +106,7 @@
},
"amf_list": {
"title": "AMF list",
"description": "Optionnal. List of AMF to which the gNodeB is connected",
"description": "List of AMF to which the gNodeB is connected. (must set if there are NR cells)",
"patternProperties": {
".*": {
"properties": {
......@@ -124,23 +119,20 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"plmn_list": {
"title": "PLMN list",
"description": "List of PLMNs broadcasted by the gNodeB, at most 12 (default: 00101)",
"description": "List of PLMNs broadcasted by the gNodeB, at most 12. (must set if there are NR cells)",
"patternProperties": {
".*": {
"properties": {
"plmn": {
"default": "00101",
"title": "Public Land Mobile Network",
"description": "Public Land Mobile Network",
"type": "string"
},
"tac": {
"default": 100,
"title": "Tracking Area Code",
"description": "Integer (range 0 to 16777215)",
"type": "number"
......@@ -160,8 +152,7 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
},
"nssai": {
"title": "AMF slices configuration",
......
......@@ -90,8 +90,7 @@
"enum": [
"fdd",
"tdd"
],
"default": "tdd"
]
},
"tdd_ul_dl_config": {
"title": "TDD",
......@@ -125,8 +124,7 @@
"bandwidth": {
"title": "Bandwidth",
"description": "Downlink Bandwidth (in MHz)",
"type": "number",
"default": {{ default_nr_bandwidth }}
"type": "number"
},
"ssb_pos_bitmap": {
"title": "SSB Position Bitmap",
......@@ -137,14 +135,12 @@
"pci": {
"title": "Physical Cell ID",
"description": "Physical Cell ID",
"type": "number",
"default": 500
"type": "number"
},
"cell_id": {
"title": "Cell ID",
"description": "Cell ID",
"type": "string",
"default": "0x01"
"type": "string"
},
"root_sequence_index": {
"title": "Root Sequence Index",
......@@ -188,9 +184,11 @@
{%- endif %}
"gnb_id": {
"title": "gNB ID",
"description": "gNB ID",
"type": "string",
"description": "gNB ID{% if bbu != 'ors' %}. (must be set if there are NR cells){% endif %}",
"type": "string"
{%- if bbu == 'ors' %},
"default": "0x12345"
{%- endif %}
},
"gnb_id_bits": {
"title": "gNB ID bits",
......@@ -200,7 +198,11 @@
},
"amf_list": {
"title": "AMF list",
{%- if bbu == 'ors' %}
"description": "Optionnal. List of AMF to which the gNodeB is connected",
{%- else %}
"description": "List of AMF to which the gNodeB is connected. (must set if there are NR cells)",
{%- endif %}
"patternProperties": {
".*": {
"properties": {
......@@ -213,23 +215,37 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
{%- if bbu == 'ors' %},
"default": {
"1": {
"amf_addr": "127.0.1.100"
}
}
{%- endif %}
},
"plmn_list": {
"title": "PLMN list",
{%- if bbu == 'ors' %}
"description": "List of PLMNs broadcasted by the gNodeB, at most 12 (default: 00101)",
{%- else %}
"description": "List of PLMNs broadcasted by the gNodeB, at most 12. (must set if there are NR cells)",
{%- endif %}
"patternProperties": {
".*": {
"properties": {
"plmn": {
{%- if bbu == 'ors' %}
"default": "00101",
{%- endif %}
"title": "Public Land Mobile Network",
"description": "Public Land Mobile Network",
"type": "string"
},
"tac": {
{%- if bbu == 'ors' %}
"default": 100,
{%- endif %}
"title": "Tracking Area Code",
"description": "Integer (range 0 to 16777215)",
"type": "number"
......@@ -249,8 +265,15 @@
"type": "object"
}
},
"type": "object",
"default": {}
"type": "object"
{%- if bbu == 'ors' %},
"default": {
"1": {
"plmn": "00101",
"tac": 100
}
}
{%- endif %}
},
"nssai": {
"title": "AMF slices configuration",
......
......@@ -121,7 +121,11 @@
}
},
"type": "object",
"default": {}
"default": {
"1": {
"mme_addr": "127.0.1.100"
}
}
},
"plmn_list": {
"title": "PLMN list",
......@@ -152,7 +156,11 @@
}
},
"type": "object",
"default": {}
"default": {
"1": {
"plmn": "00101"
}
}
},
"lte_handover_a3_offset": {
"title": "A3 offset for LTE handover",
......
# instance-ors-enb translates ORS enb/gnb into base enb/gnb.
# instance-ors-enb translates ORS enb/gnb into generic enb/gnb with 1 SDR RU and 1 CELL.
{#- enb_mode indicates with which mode ors' enb is instantiated with - enb | gnb #}
{%- set enb_mode = slap_configuration['slap-software-type'] %}
{%- do assert(enb_mode in ('enb', 'gnb'), enb_mode) %}
{#- defaults for ORS parameters.
TODO automatically load ORS/enb and ORS/gnb defaults from JSON schema #}
{%- set ors_enb_defaults = {
"bandwidth": str(default_lte_bandwidth),
"n_antenna_dl": int(default_n_antenna_dl),
"n_antenna_ul": int(default_n_antenna_ul),
"rf_mode": "tdd",
"tdd_ul_dl_config": "[Configuration 2] 5ms 2UL 6DL (default)",
"pci": 1,
"cell_id": "0x01",
"tac": "0x0001",
"root_sequence_index": 204,
"enb_id": "0x1A2D0",
"mme_list": {'1': {'mme_addr': '127.0.1.100'}},
"plmn_list": {"1": {'plmn': '00101'}},
"inactivity_timer": int(default_lte_inactivity_timer),
} %}
{%- set ors_gnb_defaults = {
"nr_bandwidth": float(default_nr_bandwidth),
"n_antenna_dl": int(default_n_antenna_dl),
"n_antenna_ul": int(default_n_antenna_ul),
"rf_mode": "tdd",
"tdd_ul_dl_config": "5ms 2UL 7DL 4/6 (default)",
"ssb_pos_bitmap": default_nr_ssb_pos_bitmap,
"pci": 500,
"cell_id": "0x01",
"gnb_id": "0x12345",
"gnb_id_bits": 28,
"amf_list": {'1': {'amf_addr': '127.0.1.100'}},
"plmn_list": {'1': {'plmn': '00101', 'tac': 100}},
"inactivity_timer": int(default_nr_inactivity_timer),
} %}
{#- inject ORS defaults #}
{%- do RF.setdefault('tx_gain', ors_version['current-tx-gain']) %}
{%- do RF.setdefault('rx_gain', ors_version['current-rx-gain']) %}
{%- do RF.setdefault('dl_earfcn', ors_version['current-earfcn']) %}
{%- do RF.setdefault('dl_nr_arfcn', ors_version['current-nr-arfcn']) %}
{%- do RF.setdefault('nr_band', ors_version['current-nr-band']) %}
{%- set ors_defaults = {'enb': ors_enb_defaults, 'gnb': ors_gnb_defaults} [enb_mode] %}
{%- for k,v in ors_defaults|dictsort %}
{%- do slapparameter_dict.setdefault(k, v) %}
{%- endfor %}
{#- make real cell_list to be rejected in ORS mode #}
{%- set cell_list = slapparameter_dict.setdefault('cell_list', {}) %}
{%- if len(cell_list) > 0 %}
{%- do error('ORS mode does not support cell_list parameter') %}
{%- endif %}
{#- inject ru+cell synthesized from ORS-specific parameters #}
{%- set ru = {
'ru_type': 'sdr',
'ru_link_type': 'sdr',
'sdr_dev': 0,
'n_antenna_dl': slapparameter_dict.n_antenna_dl,
'n_antenna_ul': slapparameter_dict.n_antenna_ul,
'tx_gain': ors_version['current-tx-gain'],
'rx_gain': ors_version['current-rx-gain'],
}
%}
{%- if enb_mode == 'enb' %}
{%- set cell = {
'dl_earfcn': ors_version['current-earfcn'],
'bandwidth': slapparameter_dict.bandwidth,
'tac': slapparameter_dict.tac,
'root_sequence_index': slapparameter_dict.root_sequence_index,
}
%}
{%- elif enb_mode == 'gnb' %}
{%- set cell = {
'dl_nr_arfcn': ors_version['current-nr-arfcn'],
'nr_band': ors_version['current-nr-band'],
'bandwidth': slapparameter_dict.nr_bandwidth,
'ssb_pos_bitmap': slapparameter_dict.ssb_pos_bitmap,
'root_sequence_index': 1,
}
%}
{%- endif %}
{%- do cell.update({
'rf_mode': slapparameter_dict.rf_mode,
'pci': slapparameter_dict.pci,
'cell_id': slapparameter_dict.cell_id,
'tdd_ul_dl_config': slapparameter_dict.tdd_ul_dl_config,
'inactivity_timer': slapparameter_dict.inactivity_timer,
'ru': ru,
})
%}
{%- do cell_list.update({'CELL': cell}) %}
{#- backward compatibility: if ORS is running in gnb mode, and gnb_* parameters
......
......@@ -113,7 +113,11 @@
}
},
"type": "object",
"default": {}
"default": {
"1": {
"amf_addr": "127.0.1.100"
}
}
},
"plmn_list": {
"title": "PLMN list",
......@@ -149,7 +153,12 @@
}
},
"type": "object",
"default": {}
"default": {
"1": {
"plmn": "00101",
"tac": 100
}
}
},
"nssai": {
"title": "AMF slices configuration",
......
......@@ -21,7 +21,8 @@ extra-context =
key slave_instance_list slap-configuration:slave-instance-list
# ORS-specific enb and gnb
# both are served by instance-ors-enb
# both are served by instance-ors-enb, which translates
# ORS enb/gnb schemas to generic enb/gnb with only one RU and one LTE or NR CELL
[dynamic-template-ors-enb]
< = dynamic-template-enb
url = ${template-ors-enb:target}
......
......@@ -113,7 +113,6 @@ filename = instance-enb.cfg
extensions = jinja2.ext.do
extra-context =
raw monitor_template ${monitor2-template:output}
json RF {}
section comp_id comp-id
section slap_configuration slap-configuration
key lte_version amarisoft:lte-version
......
......@@ -40,6 +40,25 @@
'rx_delay': 11.0,
'tx_dbm': 42.0,
},
'cell/lte': {
'inactivity_timer': default_lte_inactivity_timer,
},
'cell/lte/fdd': {
},
'cell/lte/tdd': {
'tdd_ul_dl_config': '[Configuration 2] 5ms 2UL 6DL (default)',
},
'cell/nr': {
'inactivity_timer': default_nr_inactivity_timer,
'ssb_pos_bitmap': default_nr_ssb_pos_bitmap,
},
'cell/nr/fdd': {
},
'cell/nr/tdd': {
'tdd_ul_dl_config': '5ms 2UL 7DL 4/6 (default)',
},
}
%}
......@@ -90,22 +109,6 @@
#}
{%- macro load_ru_and_cell(ru_dict, cell_dict) %}
{%- set cell_list = slapparameter_dict.get('cell_list', {}) %}
{%- if ors %}
{%- if len(cell_list) > 0 %}
{%- do error('ORS mode does not support cell_list parameter') %}
{%- endif %}
{%- do cell_list.update({'CELL': {
'ru': {
'ru_type': 'sdr',
'ru_link_type': 'sdr',
'sdr_dev': 0,
'n_antenna_dl': int(slapparameter_dict.get('n_antenna_dl', default_n_antenna_dl)),
'n_antenna_ul': int(slapparameter_dict.get('n_antenna_ul', default_n_antenna_ul)),
'tx_gain': RF.tx_gain,
'rx_gain': RF.rx_gain,
}
}}) %}
{%- endif %}
{%- do cell_dict.update(cell_list) %}
{%- for i, (cell_ref, cell) in enumerate(cell_dict|dictsort) %}
......@@ -126,33 +129,7 @@
{%- do ru_dict.update({ru_ref: ru}) %}
{%- do cell.update({'cell_type': 'lte' if do_lte else 'nr'}) %}
{%- do cell.setdefault('rf_mode', slapparameter_dict.get('rf_mode', 'tdd')) %}
{%- 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', RF.dl_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', RF.nr_band) %}
{%- do cell.setdefault('dl_nr_arfcn', RF.dl_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('root_sequence_index', slapparameter_dict.get('root_sequence_index', 1 + i)) %}
{%- do cell.setdefault('inactivity_timer', slapparameter_dict.get('inactivity_timer', default_nr_inactivity_timer)) %}
{%- else %}
{%- do bug('unreachable') %}
{%- endif %}
{%- do _cell_set_defaults(cell, cell_dict) %}
{%- endfor %}
{#- assign RUs rf_port and tx/rx channel indices #}
......@@ -195,6 +172,17 @@
{%- endif %}
{%- endmacro %}
{%- macro _cell_set_defaults(cell, cell_dict) %}
{%- for k, v in defaults['cell/%s' % cell.cell_type].items() %}
{%- do cell.setdefault(k, v) %}
{%- endfor %}
{%- for k, v in defaults['cell/%s/%s' % (cell.cell_type, cell.rf_mode)].items() %}
{%- do cell.setdefault(k, v) %}
{%- endfor %}
{%- set n = len(list(cell_dict|dictsort | selectattr('1.cell_type', '==', cell.cell_type))) %}
{%- do cell.setdefault('root_sequence_index', 1 + 203*(cell.cell_type == 'lte') + n) %}
{%- endmacro %}
{#- ---- building configuration ---- #}
......
......@@ -44,11 +44,14 @@ def do(src, out, rat, slapparameter_dict):
jdo_lte = json.dumps(rat == 'lte')
jdo_nr = json.dumps(rat == 'nr')
defaults = {
"com_ws_port": 9001,
"com_addr": "127.0.1.2",
"mme_list": {"1": {"mme_addr": "127.0.1.100"}},
"amf_list": {"1": {"amf_addr": "127.0.1.100"}},
"gtp_addr": "127.0.1.1",
"com_ws_port": 9001,
"com_addr": "127.0.1.2",
"use_ipv4": False,
"gnb_id_bits": 28,
"nssai": {'1': {'sst': 1}},
"ncell_list": {},
"xn_peers": {},
"gtp_addr": "127.0.1.1",
}
slapparameter_dict = slapparameter_dict.copy()
for k, v in defaults.items():
......@@ -65,25 +68,15 @@ def do(src, out, rat, slapparameter_dict):
"do_lte": %(jdo_lte)s,
"do_nr": %(jdo_nr)s,
"ors": {"one-watt": true},
"RF": {
"dl_earfcn": 36100,
"dl_nr_arfcn": 380000,
"nr_band": 39,
"tx_gain": 62,
"rx_gain": 43
},
"slap_configuration": {
"tap-name": "slaptap9"
},
"default_lte_bandwidth": "10 MHz",
"default_imsi": "001010123456789",
"default_k": "00112233445566778899aabbccddeeff",
"default_lte_inactivity_timer": 10000,
"default_nr_bandwidth": 40,
"default_nr_ssb_pos_bitmap": "10000000",
"default_n_antenna_dl": 2,
"default_n_antenna_ul": 2,
"default_nr_inactivity_timer": 10000,
"directory": {
"log": "log",
"etc": "etc",
......@@ -114,14 +107,52 @@ def do_enb():
'tac': 321,
}
ru = {
'ru_type': 'sdr',
'ru_link_type': 'sdr',
'sdr_dev': 0,
'n_antenna_dl': 2,
'n_antenna_ul': 2,
'tx_gain': 62,
'rx_gain': 43,
}
do('enb.jinja2.cfg', 'enb.cfg', 'lte', {
"rf_mode": "tdd",
"tdd_ul_dl_config": "[Configuration 6] 5ms 5UL 3DL (maximum uplink)",
'enb_id': "0x1A2D0",
'cell_list': {'CELL': {
'rf_mode': 'tdd',
'dl_earfcn': 36100,
'bandwidth': '10 MHz',
'tac': '0x0001',
'root_sequence_index': 204,
'pci': 1,
'cell_id': '0x01',
"tdd_ul_dl_config": "[Configuration 6] 5ms 5UL 3DL (maximum uplink)",
'inactivity_timer': 10000,
'ru': ru,
}},
"mme_list": {"1": {"mme_addr": "127.0.1.100"}},
'plmn_list': {"1": {'plmn': '00101'}},
"ncell_list": {'1': peer_lte},
})
do('enb.jinja2.cfg', 'gnb.cfg', 'nr', {
"rf_mode": "tdd",
"tdd_ul_dl_config": "5ms 8UL 1DL 2/10 (maximum uplink)",
'gnb_id': "0x12345",
'gnb_id_bits': 28,
'cell_list': {'CELL': {
'rf_mode': 'tdd',
'dl_nr_arfcn': 380000,
'nr_band': 39,
'bandwidth': 40,
'ssb_pos_bitmap': "10000000",
'root_sequence_index': 1,
'pci': 500,
'cell_id': '0x01',
"tdd_ul_dl_config": "5ms 8UL 1DL 2/10 (maximum uplink)",
'inactivity_timer': 10000,
'ru': ru,
}},
"amf_list": {"1": {"amf_addr": "127.0.1.100"}},
"plmn_list": {'1': {'plmn': '00101', 'tac': 100}},
"ncell_list": {'1': peer_nr},
})
......
......@@ -152,7 +152,7 @@ def test_enb_conf(self):
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]['root_sequence_index'], int(enb_param_dict['root_sequence_index']))
self.assertEqual(conf['cell_list'][0]['cell_id'], 0)
self.assertEqual(conf['cell_list'][0]['cell_id'], 1)
for p in conf['cell_default']['plmn_list']:
for n in "plmn attach_without_pdn reserved".split():
self.assertEqual(p[n], enb_param_dict['plmn_list'][p['plmn']][n])
......
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