enb.jinja2.cfg 27.9 KB
Newer Older
1
{%- import 'slaplte.jinja2' as slaplte  with context %}
2
{%- set B               = slaplte.B %}
3
{%- set J               = slaplte.J %}
4
{%- set jcell_ru_ref    = slaplte.jcell_ru_ref %}
5
{%- set ierror          = slaplte.ierror %}
6
{%- set bug             = slaplte.bug %}
7 8

{#- for standalone testing via slapos-render-config.py
9
    NOTE: keep in sync with instance-enb.jinja2.cfg and ru/libinstance.jinja2.cfg   #}
10
{%- if _standalone is defined %}
11 12 13 14
{%-   set iru_dict   = {} %}
{%-   set icell_dict = {} %}
{%-   set ipeer_dict = {} %}
{%-   set ipeercell_dict = {} %}
15
{%-   do slaplte.load_iru_and_icell(iru_dict, icell_dict, icell_kind='enb') %}
16 17 18
{%-   do slaplte.load_ipeer(ipeer_dict) %}
{%-   do slaplte.load_ipeercell(ipeercell_dict) %}
{%-   do slaplte.check_loaded_everything()  %}
19 20
{%- endif %}

21

22
{#- do_lte/do_nr indicate whether we have LTE and/or NR cells
23 24 25 26 27
    icell_dict_lte/icell_dict_nr keep LTE/NR parts of icell_dict registry #}
{%- set icell_dict_lte = dict(icell_dict|dictsort | selectattr('1._.cell_type', '==', 'lte')) %}
{%- set icell_dict_nr  = dict(icell_dict|dictsort | selectattr('1._.cell_type', '==', 'nr' )) %}
{%- set do_lte = len(icell_dict_lte) > 0 %}
{%- set do_nr  = len(icell_dict_nr)  > 0 %}
28 29


30 31
{#- handover_config emits handover configuration for specified cell #}
{%- macro handover_config(cell_ref)  %}
32
      ncell_list: [
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
            // Intra-ENB HO
{%-       for cell2_ref, icell2 in icell_dict|dictsort %}
{%-         set cell2 = icell2['_'] %}
{%-         if cell2_ref != cell_ref %} {#- NOTE: HO to both LTE and NR #}
{%-           set ru2_ref = J(jcell_ru_ref(icell2, icell_dict)) %}
{%-           set iru2 = iru_dict[ru2_ref]  %}
{%-           set ru2 = iru2['_'] %}
            {
{%-           if cell2.cell_type == 'lte' %}
              rat:        "eutra",
              cell_id:    {{ slapparameter_dict.enb_id }}{{ cell2.cell_id.removeprefix('0x') }}, // -> {{ B(cell2_ref) }}
              n_id_cell:  {{ cell2.pci }},
              dl_earfcn:  {{ cell2.dl_earfcn }},
              tac:        {{ cell2.tac }},
              allowed_meas_bandwidth: {{ jlte_n_rb_dl(cell2.bandwidth) }},
              antenna_port_1: {{ (ru2.n_antenna_dl > 1)  | tojson }},
{%-           elif cell2.cell_type == 'nr' %}
              rat:        "nr",
              cell_id:    {{ cell2.cell_id }},  // -> {{ B(cell2_ref) }}
{%-           else  %}
{%-             do bug('unreachable') %}
{%-           endif %}
            },
{%-         endif %}
{%-       endfor %}

59
        // Inter-ENB HO
60 61 62
{#- TODO: add info about peers as shared instances - one instance per peer *ENB*.
          then query SlapOS Master about cells configured on that peer ENB and
          put them as peers here #}
63 64
{%-   for peercell_ref, ipeercell in ipeercell_dict|dictsort %}
{%-     set ncell = ipeercell['_']  %}
65
        {
66
{%-     if ncell.cell_type == 'lte' %}
67
          rat:          "eutra",
68
          cell_id:      {{ ncell.e_cell_id }},  // -> {{ B(peercell_ref) }}
69 70 71
          n_id_cell:    {{ ncell.pci }},
          dl_earfcn:    {{ ncell.dl_earfcn }},
          tac:          {{ ncell.tac }},
72 73 74 75
{#-       TODO: consider extending peer/cell/lte with
          .allowed_meas_bandwidth and .antenna_port_1 #}
          allowed_meas_bandwidth: {{ jlte_n_rb_dl(1.4) }},  // (minimum possible bw)
          antenna_port_1: false,      // (conservative stub)
76
{%-     elif ncell.cell_type == 'nr' %}
77
          rat:          "nr",
78
          nr_cell_id:   {{ ncell.nr_cell_id }}, // -> {{ B(peercell_ref) }}
79 80 81 82 83
          gnb_id_bits:  {{ ncell.gnb_id_bits }},
          n_id_cell:    {{ ncell.pci }},
          dl_nr_arfcn:  {{ ncell.dl_nr_arfcn }},
          band:         {{ ncell.nr_band }},
          ssb_nr_arfcn: {{ ncell.ssb_nr_arfcn }},
84
          ul_nr_arfcn:  {{ ncell.ul_nr_arfcn }},
85
          tac:          {{ ncell.tac }},
86 87 88 89 90 91 92 93 94 95 96 97
          ssb_subcarrier_spacing: 30,
          ssb_period: 20,
          ssb_offset: 0,
          ssb_duration: 1,
{%-   else  %}
{%-     do bug('unreachable') %}
{%-   endif %}
        },
{%- endfor %}
      ],
{%- endmacro %}

98 99 100 101 102 103 104 105
{#- 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} %}
106
{{-   _[bandwidth] | tojson }}
107
{%- endmacro %}
108

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
{#- jhostport splits address into (host,port) pair. #}
{%- macro jhostport(addr) %}
{%-   set _ = namespace() %}
{%-   if ':' not in addr  %}
{%-     set _.host = addr %}
{%-     set _.port = None %}
{%-   else  %}
{%-     set head, tail = addr.rsplit(':', 1) %}
{%-     if ':' not in head  %}
{%-       set _.host = head %}
{%-       set _.port = tail %}
{%-     else  %}
{%-       if addr.startswith('[')  %}
{%-         set _.host = addr[1:addr.index(']')]  %}
{%-         set _.port = tail  %}
{%-       else  %}
{%-         set _.host = addr %}
{%-         set _.port = None %}
{%-       endif %}
{%-     endif %}
{%-   endif %}
{{- (_.host, _.port) | tojson }}
{%- endmacro -%}
132

133 134

{#- start of the config -#}
135
{
136 137 138 139 140 141
  log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,s1ap.level=debug,s1ap.max_size=1,x2ap.level=debug,x2ap.max_size=1,rrc.level=debug,rrc.max_size=1,ngap.level=debug,ngap.max_size=1,xnap.level=debug,xnap.max_size=1,
{%- if slapparameter_dict.get('log_phy_debug', False) -%}
    phy.level=debug
{%- else -%}
    phy.level=info
{%- endif -%}
142
    ,file.rotate=200M",
143 144
  log_filename: "{{ directory['log'] }}/enb.log",

145
{# instantiate radio units #}
146
{{ slaplte.ru_config(iru_dict, slapparameter_dict, True) }}
147

148
  com_addr: "{{ slapparameter_dict.com_addr }}:{{ slapparameter_dict.com_ws_port }}",
149
  com_auth: {
150 151
    password: "{{ websocket_password }}",
    unsecure: false,
152
  },
153

154 155 156 157
{%- if slapparameter_dict.get('mbmsgw_addr', '') %}
  mbmsgw_addr: "{{ slapparameter_dict.mbmsgw_addr }}",
{%- endif %}

158
{%  if do_lte %}
159
  // LTE core network
160
  mme_list: [
161
{%-   for _, mme in slapparameter_dict.mme_list |dictsort %}
162
    {
163
      mme_addr: "{{ mme['mme_addr'] }}",
164 165 166
{%-     if mme.get('s1ap_bind_addr', '') %}
      s1ap_bind_addr: "{{ mme['s1ap_bind_addr'] }}",
{%-     endif %}
167
    },
168
{%-   endfor %}
169
  ],
170 171
{%- endif %}

172
{%  if do_nr %}
173
  // NR core network
174
  amf_list: [
175
{%-   for _, amf in slapparameter_dict.amf_list |dictsort %}
176
    {
177
      amf_addr: "{{ amf['amf_addr'] }}",
178 179 180
{%-     if amf.get('ngap_bind_addr', '') %}
      ngap_bind_addr: "{{ amf['ngap_bind_addr'] }}",
{%-     endif %}
181
    },
182
{%-   endfor %}
183 184 185
  ],
{%- endif %}

186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
{#- listen-address for GTP-U - either explicitly given, or autodetect #}
{%- if slapparameter_dict.get('gtp_addr') %}
  gtp_addr: "{{ slapparameter_dict.gtp_addr }}",
{%- else %}
{#-   use loopback if address of core network is on loopback as well #}
{%-   set vcore = []  %}
{%-   if do_lte %}
{%-     do vcore.extend(slapparameter_dict.mme_list |dictsort |map(attribute='1.mme_addr')) %}
{%-   endif %}
{%-   if do_nr %}
{%-     do vcore.extend(slapparameter_dict.amf_list |dictsort |map(attribute='1.amf_addr')) %}
{%-   endif %}
{#-   remove optional :port from addresses and see if they are on loopback #}
{%-   set vip = []  %}
{%-   for a in vcore  %}
{%-     set _ = namespace() %}
{%-     set _.ip   = J(jhostport(a))[0]  %}
{%-     set _.islo = netaddr.IPAddress(_.ip).is_loopback() %}
{%-     do vip.append(_)  %}
{%-   endfor  %}
{%-   if len(vip) > 0  and  all(vip |map(attribute='islo')) %}
  gtp_addr: "{{ gtp_addr_lo }}",
{%-   else  %}
{#-     core is external - use external ipv4/ipv6 #}
{%-     if slapparameter_dict.use_ipv4  %}
  gtp_addr: "{{ gtp_addr_v4 }}",
{%-     else %}
  gtp_addr: "{{ gtp_addr_v6 }}",
{%-     endif %}
{%-   endif %}
{%- endif %}
217

218 219 220 221 222
{#- X2/Xn peers
    TODO: add info about peers as shared instances - one instance per peer *ENB*.
          then query SlapOS Master about cells configured on that peer ENB and
          depending on whether LTE and/or NR cells are there add X2 and/or Xn peers #}
{%- if do_lte %}
223 224
  x2_peers: {{ ipeer_dict|dictsort | selectattr('1._.peer_type', '==', 'lte')
               | map(attribute='1._.x2_addr')
225 226
               | list | tojson }},
{%- endif %}
227
{%- if do_nr  %}
228 229
  xn_peers: {{ ipeer_dict|dictsort | selectattr('1._.peer_type', '==', 'nr')
               | map(attribute='1._.xn_addr')
230
               | list | tojson }},
231 232
{%- endif %}

233

234
{%- if do_lte %}
235
  enb_id: {{ slapparameter_dict.enb_id }},
236 237
{%- endif %}
{%- if do_nr %}
238 239
  gnb_id_bits: {{ slapparameter_dict.gnb_id_bits }},
  gnb_id: {{ slapparameter_dict.gnb_id }},
240 241
  en_dc_support: true,
{%- endif %}
242

243
  // LTE cells
244
  cell_list: [
245
{%- if do_lte %}
246 247 248 249 250
{%- for cell_ref, icell in icell_dict_lte|dictsort %}
{%-   set cell = icell['_'] %}
{%-   set ru_ref = J(jcell_ru_ref(icell, icell_dict)) %}
{%-   set iru = iru_dict[ru_ref]  %}
{%-   set ru = iru['_'] %}
251

252
    // {{ B(cell_ref) }}  ({{ B(ru_ref) }})
253
    {
254
      rf_port:      {{ ru._rf_port }},
255 256
      n_antenna_dl: {{ ru.n_antenna_dl }},
      n_antenna_ul: {{ ru.n_antenna_ul }},
257

258 259 260 261
      cell_id:    {{ cell.cell_id }},
      tac:        {{ cell.tac }},
      n_id_cell:  {{ cell.pci }},
      dl_earfcn:  {{ cell.dl_earfcn }},
262
      ul_earfcn:  {{ cell.ul_earfcn }},
263
      root_sequence_index: {{ cell.root_sequence_index }},
264
      inactivity_timer: {{ cell.inactivity_timer }},
265

266

267
      // Handover
268
{{-   handover_config(cell_ref) }}
269

270
      // Carrier Aggregation: LTE + LTE
271
      scell_list: [
272 273
{%-   for cell2_ref, icell2 in icell_dict_lte|dictsort %}
{%-     set cell2 = icell2['_'] %}
274
{%-     if cell2_ref != cell_ref  %}
275
        {
276
          cell_id: {{ cell2.cell_id }},  // + {{ B(cell2_ref) }}
277
          cross_carrier_scheduling: false,
278 279 280
        },
{%-     endif %}
{%-   endfor %}
281 282
      ],

283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
{%-   if do_nr  %}
      // Dual Connectivity: LTE + NR
      en_dc_scg_cell_list: [
{%-     for cell2_ref, icell2 in icell_dict_nr|dictsort %}
{%-       set cell2 = icell2['_'] %}
{%-       if cell2_ref != cell_ref %}
          {
            cell_id: {{ cell2.cell_id }}, // + {{ B(cell2_ref) }}
          },
{%-       endif %}
{%-     endfor  %}
      ],
{%-   endif %}


298
    // tune LTE parameters for the cell
299
{% if ors %}
300 301
    manual_ref_signal_power: true,
{% endif %}
302

303
{%- set tdd = (cell.rf_mode == 'tdd') %}
304
{%- if tdd %}
305 306 307 308 309
    uldl_config: {{
        {'[Configuration 2] 5ms 2UL 6DL (default)':        2,
         '[Configuration 6] 5ms 5UL 3DL (maximum uplink)': 6}
        [cell.tdd_ul_dl_config]
    }},
310
    sp_config: 7,
311
{%- endif %}
312

313
{%- set n_rb_dl = J(jlte_n_rb_dl(cell.bandwidth)) %}
314
    n_rb_dl: {{ n_rb_dl }},
315
    si_coderate: {{ 0.60  if n_rb_dl == 6  else 0.20 }},
316 317

    pdsch_dedicated: {
318
      p_a: {{ {4: -6, 2: -3}.get(ru.n_antenna_dl, 0) }},
319
      p_b: -1,
320 321
    },

322
    pdcch_format:       {{  1  if n_rb_dl == 6  else 2 }},
323
    prach_config_index: {{  0  if n_rb_dl == 6  else 4 }},
324
    initial_cqi:        {{  5  if n_rb_dl == 6  else 3 }},
325 326

    pucch_dedicated: {
327 328
      n1_pucch_sr_count: 11,
      cqi_pucch_n_rb: 1,
329
{#- for CA with 2 cells it is possible to use PUCCH 1b CS ack/nack #}
330
{%- if len(icell_dict_lte) == 2  %}
331 332 333
      ack_nack_feedback_mode_ca: "cs",
      n1_pucch_an_cs_count: 8,
{#- starting from 3 cells it is always PUCCH 3 for ack/nack in CA #}
334
{%- elif len(icell_dict_lte) >= 3  %}
335 336 337
      ack_nack_feedback_mode_ca: "pucch3",
      n3_pucch_an_n_rb: 3,
{%- endif %}
338
{%- if tdd  %}
339
      tdd_ack_nack_feedback_mode: "multiplexing", /* TDD only */
340
{%- endif %}
341 342
    },

343
{%-       if ru.n_antenna_dl >= 2  %}
344 345
    m_ri: 8,
    transmission_mode: 3,
346
{%-       endif %}
347 348

    srs_dedicated: {
349
{%-       if n_rb_dl == 6  %}
350
      srs_bandwidth_config: 7,
351
      srs_bandwidth: 3,
352
{%-       elif n_rb_dl == 15  %}
353 354
      srs_bandwidth_config: 6,
      srs_bandwidth: 1,
355
{%-       elif n_rb_dl == 25  %}
356 357
      srs_bandwidth_config: 3,
      srs_bandwidth: 1,
358
{%-       elif n_rb_dl == 50  %}
359 360
      srs_bandwidth_config: 2,
      srs_bandwidth: 2,
361
{%-       elif n_rb_dl == 75  %}
362 363
      srs_bandwidth_config: 2,
      srs_bandwidth: 2,
364
{%-       else  %}
365 366
      srs_bandwidth_config: 2,
      srs_bandwidth: 3,
367
{%-       endif %}
368 369
      srs_subframe_config: 3,
      srs_period: 40,
370 371 372
      srs_hopping_bandwidth: 0,
    },

373
    drb_config: "{{ B('%s-drb.cfg' % cell_ref) }}",
374 375 376

    sib_sched_list: [
      {
377
        filename: "{{ B('%s-sib23.asn' % cell_ref) }}",
378 379 380 381 382 383 384 385 386 387 388
        si_periodicity: 16,
      },
    ],
    },
    {%- endfor %}
{%- endif %}
  ],

{%- if do_lte %}
  cell_default: {
    plmn_list: [
389
{%- for _, plmn in slapparameter_dict.plmn_list |dictsort %}
390
      {
391 392 393 394 395
        plmn: "{{ plmn.plmn }}",
        reserved: {{ plmn.get('reserved', false) |tojson }},
        attach_without_pdn: {{ plmn.get('attach_without_pdn', false) |tojson }},
      },
{%- endfor %}
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
    ],
    cyclic_prefix: "normal",

    phich_duration: "normal",
    phich_resource: "1",

    si_value_tag: 0,
    cell_barred: false,
    intra_freq_reselection: true,
    q_rx_lev_min: -70,
    si_window_length: 40,

    si_pdcch_format: 2,

    n_symb_cch: 0,

    prach_freq_offset: -1,

    pusch_dedicated: {
      beta_offset_ack_index: 9,
      beta_offset_ri_index: 6,
      beta_offset_cqi_index: 6,
    },

    pusch_hopping_offset: -1,

    pusch_msg3_mcs: 0,

    dl_256qam: true,
    ul_64qam: true,

    sr_period: 20,

    cqi_period: 40,
430
{%-     if ors %}
431
    mac_config: {
432 433
       ul_max_harq_tx: 5,
       dl_max_harq_tx: 5,
434
    },
435 436 437 438 439 440 441 442
    dpc_pucch_snr_target: 25,
{%-     else %}
    mac_config: {
       ul_max_harq_tx: 28,
       dl_max_harq_tx: 28,
    },
    dpc_pucch_snr_target: 20,
{%-     endif %}
443

444
    pusch_max_its: 6,
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466

    dpc: true,
    dpc_pusch_snr_target: 25,

    cipher_algo_pref: [],
    integ_algo_pref: [2, 1],

    srb_config: [
      {
        id: 1,
        maxRetxThreshold: 32,
        t_Reordering: 45,
        t_PollRetransmit: 60,
      },
      {
        id: 2 ,
        maxRetxThreshold: 32,
        t_Reordering: 45,
        t_PollRetransmit: 60,
      }
    ],

467
{#  TODO fully expose lte meas_config_desc in generic SR #}
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
  meas_config_desc: {
    a1_report_type: "rsrp",
    a1_rsrp: -70,
    a1_hysteresis: 0,
    a1_time_to_trigger: 640,
    a2_report_type: "rsrp",
    a2_rsrp: -80,
    a2_hysteresis: 0,
    a2_time_to_trigger: 640,
    a3_report_type: "rsrp",
    a3_offset: {{ slapparameter_dict.get('lte_handover_a3_offset', 6) }},
    a3_hysteresis: 0,
    a3_time_to_trigger: {{ slapparameter_dict.get('lte_handover_a3_time_to_trigger', 480) }},
  },
  meas_gap_config: "gp0",
  ho_from_meas: true,
484
  },
485 486 487
{%- endif %}

{%  if do_nr %}
488
  // NR cells
489
  nr_cell_list: [
490 491 492 493 494
{%- for cell_ref, icell in icell_dict_nr|dictsort  %}
{%-   set cell = icell['_'] %}
{%-   set ru_ref = J(jcell_ru_ref(icell, icell_dict)) %}
{%-   set iru = iru_dict[ru_ref]  %}
{%-   set ru = iru['_'] %}
495

496
      // {{ B(cell_ref) }}  ({{ B(ru_ref) }})
497 498 499 500 501 502 503 504 505
      {
        rf_port:      {{ ru._rf_port }},
        n_antenna_dl: {{ ru.n_antenna_dl }},
        n_antenna_ul: {{ ru.n_antenna_ul }},

        cell_id:      {{ cell.cell_id }},
        n_id_cell:    {{ cell.pci }},
        band:         {{ cell.nr_band }},
        dl_nr_arfcn:  {{ cell.dl_nr_arfcn }},
506
        ul_nr_arfcn:  {{ cell.ul_nr_arfcn }},
507 508
        bandwidth:    {{ cell.bandwidth }},

509
        subcarrier_spacing: {{ cell.subcarrier_spacing }},
510
        ssb_nr_arfcn:   {{ cell.ssb_nr_arfcn }},
511 512 513 514 515 516
        ssb_pos_bitmap: "{{ cell.ssb_pos_bitmap }}",

        root_sequence_index: {{ cell.root_sequence_index }},
        inactivity_timer: {{ cell.inactivity_timer }},

        // Handover
517
{{-     handover_config(cell_ref) }}
518

519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
        // Carrier Aggregation: NR + NR
        scell_list: [
{%-     for cell2_ref, icell2 in icell_dict_nr|dictsort %}
{%-       set cell2 = icell2['_'] %}
{%-       if cell2_ref != cell_ref %}
          {
            cell_id: {{ cell2.cell_id }},  // + {{ B(cell2_ref) }}
          },
{%-       endif %}
{%-     endfor %}
        ],

        {#- NOTE: NR + LTE Dual Connectivity is setup via EN-DC only - via en_dc_scg_cell_list.
                  nr_dc_scg_cell_list sets up NR+NR Dual Connectivity #}

534 535 536 537 538 539 540 541 542
        // tune NR parameters for the cell
{%-     if ors %}
        manual_ref_signal_power: true,
{%-     if ors['one-watt'] %}
        ss_pbch_block_power: {{ ru.tx_gain - 54 }},
{%-     else %}
        ss_pbch_block_power: {{ ru.tx_gain - 35 }},
{%-     endif -%}
{%-     endif %}
543

544 545
{%-     set tdd = (cell.rf_mode == 'tdd') %}
{%-     set tdd_config =
546 547 548 549
            {'5ms 2UL 7DL 4/6 (default)':                      1,
             '2.5ms 1UL 3DL 2/10':                             2,
             '5ms 8UL 1DL 2/10 (EXPERIMENTAL maximum uplink)': 3,
             '5ms 6UL 3DL 10/2 (high uplink)':                 4}
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
            [cell.tdd_ul_dl_config]
            if tdd  else None  %}
{%      if tdd_config == 1 %}
         tdd_ul_dl_config: {
           pattern1: {
             period: 5,
             dl_slots: 7,
             dl_symbols: 6,
             ul_slots: 2,
             ul_symbols: 4,
           },
         },
{%      elif tdd_config == 2 %}
         tdd_ul_dl_config: {
           pattern1: {
             period: 2.5,
             dl_slots: 3,
             dl_symbols: 10,
             ul_slots: 1,
             ul_symbols: 2,
           },
         },
{%      elif tdd_config == 3 %}
         tdd_ul_dl_config: {
           pattern1: {
              period: 5, /* in ms */
              dl_slots: 1,
              dl_symbols: 10,
              ul_slots: 8,
              ul_symbols: 2,
           },
         },
582 583 584 585 586 587 588 589 590 591
{%      elif tdd_config == 4 %}
         tdd_ul_dl_config: {
           pattern1: {
              period: 5, /* in ms */
              dl_slots: 3,
              dl_symbols: 2,
              ul_slots: 6,
              ul_symbols: 10,
           },
         },
592 593 594 595 596 597
{%      endif %}

        prach: {
{%-     if ru.ru_type == "sunwave" %}
          msg1_frequency_start: 0,
{%-     endif %}
598
          ra_response_window: {{ 20 if tdd else 10 }},
599
        },
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619

        pdcch: {
{%-     if ru.ru_type == "sunwave" %}
          n_rb_coreset0: 48,
          n_symb_coreset0: 1,
          dedicated_coreset: {
            duration: 1,
          },
{%-     endif %}
{%-     if tdd_config == 3 %}
          uss: {
            n_candidates: [ 0, 8, 1, 0, 0 ],
            dci_0_1_and_1_1: true,
          },
{%-     else %}
          uss: {
            n_candidates: [ 0, 2, 1, 0, 0 ],
            dci_0_1_and_1_1: true,
          },
{%-     endif %}
620
        },
621

622 623 624 625 626 627 628
        pdsch: {
{%-     if ru.ru_type == "sunwave" %}
          k0: 0,
          k1: [ 8, 7, 7, 6, 5, 4, 12, 11 ],
{%-     elif tdd_config == 3 %}
          k1: [4, 11],
{%-     endif %}
629
        },
630

631 632 633 634 635 636 637 638
        pusch: {
{%-     if ru.ru_type == "sunwave" %}
          k2: 4,
          msg3_k2: 7,
{%-     elif tdd_config == 3 %}
          k2: [11, 12, 4, 5, 6, 7, 7, 8],
          msg3_k2: 7,
{%-     endif %}
639 640
        },

641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
        csi_rs: {
          nzp_csi_rs_resource: [
            {
{%-         if ru.n_antenna_dl == 1     %}
              n_ports: 1,
              frequency_domain_allocation: "row2",
              bitmap: "100000000000",
              cdm_type: "no_cdm",
{%-         elif ru.n_antenna_dl == 2   %}
              n_ports: 2,
              frequency_domain_allocation: "other",
              bitmap: "100000",
              cdm_type: "fd_cdm2",
{%-         elif ru.n_antenna_dl == 4   %}
              n_ports: 4,
              frequency_domain_allocation: "row4",
              bitmap: "100",
              cdm_type: "fd_cdm2",
{%-         elif ru.n_antenna_dl == 8   %}
              n_ports: 8,
              frequency_domain_allocation: "other",
              bitmap: "110011",
              cdm_type: "fd_cdm2",
{%-         else  %}
665
{%-           do ierror(iru, 'n_antenna_dl=%d is not supported' % ru.n_antenna_dl) %}
666
{%-         endif %}
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
            },
{%-     if tdd_config != 3 %}
            {
              csi_rs_id: 1,
              n_ports: 1,
              frequency_domain_allocation: "row1",
              bitmap: "0001",
              cdm_type: "no_cdm",
              density: 3,
              first_symb: 4,
              rb_start: 0,
              l_crb: -1,
              power_control_offset: 0,
              power_control_offset_ss: 0,
              period: 40,
              offset: 11,
              qcl_info_periodic_csi_rs: 0,
            },
            {
              csi_rs_id: 2,
              n_ports: 1,
              frequency_domain_allocation: "row1",
              bitmap: "0001",
              cdm_type: "no_cdm",
              density: 3,
              first_symb: 8,
              rb_start: 0,
              l_crb: -1,
              power_control_offset: 0,
              power_control_offset_ss: 0,
              period: 40,
              offset: 11,
              qcl_info_periodic_csi_rs: 0,
            },
            {
              csi_rs_id: 3,
              n_ports: 1,
              frequency_domain_allocation: "row1",
              bitmap: "0001",
              cdm_type: "no_cdm",
              density: 3,
              first_symb: 4,
              rb_start: 0,
              l_crb: -1,
              power_control_offset: 0,
              power_control_offset_ss: 0,
              period: 40,
              offset: 12,
              qcl_info_periodic_csi_rs: 0,
            },
            {
              csi_rs_id: 4,
              n_ports: 1,
              frequency_domain_allocation: "row1",
              bitmap: "0001",
              cdm_type: "no_cdm",
              density: 3,
              first_symb: 8,
              rb_start: 0,
              l_crb: -1,
              power_control_offset: 0,
              power_control_offset_ss: 0,
              period: 40,
              offset: 12,
              qcl_info_periodic_csi_rs: 0,
            },
{%-     endif %}
          ],

          nzp_csi_rs_resource_set: [
            {},
{%-     if tdd_config != 3 %}
            {
              csi_rs_set_id: 1,
              nzp_csi_rs_resources: [ 1, 2, 3, 4 ],
              repetition: false,
              trs_info: true,
            },
{%-     endif %}
          ],

          csi_resource_config: [
            {},
            {},
{%-     if tdd_config != 3 %}
            {
              csi_rsc_config_id: 2,
              nzp_csi_rs_resource_set_list: [ 1 ],
              resource_type: "periodic",
            },
{%-     endif %}
          ],

          csi_report_config: [
            {
{%-         if ru.n_antenna_dl > 1  %}
              codebook_config: {
                codebook_type: "type1",
                sub_type: "typeI_SinglePanel",
{%-           if ru.n_antenna_dl == 2 %}
{%-           elif ru.n_antenna_dl == 4 %}
                n1: 2,
                n2: 1,
                codebook_mode: 1,
{%-           elif ru.n_antenna_dl == 8 %}
                n1: 4,
                n2: 1,
                codebook_mode: 1,
{%-           endif %}
              },
{%-         endif %}
            },
          ],
780 781
        },

782
        drb_config: "{{ B('%s-drb.cfg' % cell_ref) }}",
783

784 785
      },
{%- endfor %}
786
  ],
787

788 789
  nr_cell_default: {
    ssb_period: 20,
790 791

    plmn_list: [
792
{%- for _, plmn in slapparameter_dict.plmn_list_5g |dictsort %}
793
      {
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809
        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  %}
        ],
810
      },
811
{%- endfor %}
812
    ],
813

814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
    si_window_length: 40,
    cell_barred: false,
    intra_freq_reselection: true,
    q_rx_lev_min: -70,
    q_qual_min: -20,
    sr_period: 40,
    dmrs_type_a_pos: 2,
    prach: {
      prach_config_index: 160,
      msg1_subcarrier_spacing: 30,
      msg1_fdm: 1,
      msg1_frequency_start: -1,
      zero_correlation_zone_config: 15,
      preamble_received_target_power: -110,
      preamble_trans_max: 7,
      power_ramping_step: 4,
      restricted_set_config: "unrestricted_set",
      ra_contention_resolution_timer: 64,
      ssb_per_prach_occasion: 1,
      cb_preambles_per_ssb: 8,
    },
    pdcch: {
      search_space0_index: 0,
      dedicated_coreset: {
        rb_start: -1,
        l_crb: -1,
        duration: 0,
        precoder_granularity: "sameAsREG_bundle",
      },
      css: {
        n_candidates: [ 0, 0, 4, 0, 0 ],
      },
      rar_al_index: 2,
      si_al_index: 2,
      al_index: 1,
    },
    pdsch: {
      mapping_type: "typeA",
      dmrs_add_pos: 1,
      dmrs_type: 1,
      dmrs_max_len: 1,
      mcs_table: "qam256",
      rar_mcs: 2,
      si_mcs: 6,
    },
    csi_rs: {
      nzp_csi_rs_resource: [
        {
          csi_rs_id: 0,
          density: 1,
          first_symb: 4,
          rb_start: 0,
          l_crb: -1,
          power_control_offset: 0,
          power_control_offset_ss: 0,
          period: 80,
          offset: 1,
          qcl_info_periodic_csi_rs: 0,
        },
      ],
      nzp_csi_rs_resource_set: [
        {
          csi_rs_set_id: 0,
          nzp_csi_rs_resources: [ 0 ],
          repetition: false,
        },
      ],
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993
     csi_im_resource: [
        {
          csi_im_id: 0,
          pattern: 1,
          subcarrier_location: 8,
          symbol_location: 8,
          rb_start: 0,
          l_crb: -1,
          period: 80,
          offset: 1,
        },
      ],
      csi_im_resource_set: [
        {
          csi_im_set_id: 0,
          csi_im_resources: [ 0 ],
        }
      ],
      zp_csi_rs_resource: [
        {
          csi_rs_id: 0,
          frequency_domain_allocation: "row4",
          bitmap: "100",
          n_ports: 4,
          cdm_type: "fd_cdm2",
          first_symb: 8,
          density: 1,
          rb_start: 0,
          l_crb: -1,
          period: 80,
          offset: 1,
        },
      ],
      p_zp_csi_rs_resource_set: [
        {
          zp_csi_rs_resources: [ 0 ],
        },
      ],
      csi_resource_config: [
        {
          csi_rsc_config_id: 0,
          nzp_csi_rs_resource_set_list: [ 0 ],
          resource_type: "periodic",
        },
        {
          csi_rsc_config_id: 1,
          csi_im_resource_set_list: [ 0 ],
          resource_type: "periodic",
        },
      ],
      csi_report_config: [
        {
          resources_for_channel_measurement: 0,
          csi_im_resources_for_interference: 1,
          report_config_type: "periodic",
          period: 80,
          report_quantity: "CRI_RI_PMI_CQI",
          cqi_table: 2,
          subband_size: "value1",
        },
      ],
    },
    pucch: {
      dpc_snr_target: 25,
      pucch_group_hopping: "neither",
      hopping_id: -1,
      p0_nominal: -90,
        pucch1: {
          n_cs: 3,
          n_occ: 3,
          freq_hopping: true,
        },
        pucch2: {
          n_symb: 2,
          n_prb: 1,
          freq_hopping: true,
          simultaneous_harq_ack_csi: false,
          max_code_rate: 0.25,
        },
    },
    pusch: {
      dpc_snr_target: 25,
      mapping_type: "typeA",
      n_symb: 14,
      dmrs_add_pos: 1,
      dmrs_type: 1,
      dmrs_max_len: 1,
      tf_precoding: false,
      mcs_table: "qam256",
      mcs_table_tp: "qam256",
      ldpc_max_its: 5,
      p0_nominal_with_grant: -84,
      msg3_mcs: 4,
      msg3_delta_power: 0,
      beta_offset_ack_index: 9,
    },
    mac_config: {
      msg3_max_harq_tx: 5,
      ul_max_harq_tx: 5,
      dl_max_harq_tx: 5,
      ul_max_consecutive_retx: 30,
      dl_max_consecutive_retx: 30,
      periodic_bsr_timer: 20,
      retx_bsr_timer: 320,
      periodic_phr_timer: 500,
      prohibit_phr_timer: 200,
      phr_tx_power_factor_change: "dB3",
      sr_prohibit_timer: 0,
      sr_trans_max: 64,
    },
    cipher_algo_pref: [],
    integ_algo_pref: [2, 1],

994
{#  TODO fully expose nr meas_config_desc in generic SR #}
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
  meas_config_desc: {
    a1_report_type: "rsrp",
    a1_rsrp: -60,
    a1_hysteresis: 10,
    a1_time_to_trigger: 100,
    a2_report_type: "rsrp",
    a2_rsrp: -70,
    a2_hysteresis: 0,
    a2_time_to_trigger: 100,
    a3_report_type: "rsrp",
    a3_offset: {{ slapparameter_dict.get('nr_handover_a3_offset', 6) }},
    a3_hysteresis: 0,
    a3_time_to_trigger: {{ slapparameter_dict.get('nr_handover_time_to_trigger', 100) }},
    ssb_rsrq_filter_coeff: 3,
    ssb_sinr_filter_coeff: 5
  },
  meas_gap_config: {
    pattern_id: 0
  },


  },
{%- endif %}
1018
}