An error occurred fetching the project authors.
  1. 13 Feb, 2024 12 commits
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb+ue: Switch to JSON schemas as the primary source... · bd55f250
      Kirill Smelkov authored
      software/ors-amarisoft: enb+ue: Switch to JSON schemas as the primary source of defaults; stop rendering them
      
      JSON schemas for eNB/gNB and UE specify defaults for many parameters and the
      software release use those defaults when parameters are not explicitly
      specified on the instantiation.
      
      Some primary defaults - for bandwidth and n_antenna DL/UL - were setup in
      render-templates and propagated through all places to avoid duplicating them.
      
      Defaults for many other parameters were duplicated in both JSON schemas and in
      the code that handles those parameters.
      
      To avoid this duplication we either need to extend render-templates and put
      defaults for all the other many parameters there, or just switch to JSON
      schemas to be primary source of those defaults, and use the schemas on
      instantiation by automatically loading them and extracting defaults for all
      parameters from there.
      
      I decided to go the second way because it avoids additional layer of rendering
      and the need to keep on remembering not to put raw defaults in the JSON
      schemas. Evidently this is the same approach that Rapid CDN is going to take
      (see nexedi/slapos!1380 for details).
      
      In this patch we stop rendering JSON schemas and keep their last rendered
      result. In the later patches we will handle formed duplication there and go on
      to further merge enb and gnb.
      
      UE is handled brutally for now, because it will be much reworked after.
      
      Actually loading JSON schemas is left as TODO as I do not have resources to
      implement that now. Still this step is needed as precondition for further
      patches. I hope bit of duplication for enb/gnb parameters is ok, given that
      they are now centrally maintained and corresponding TODO warning is in place.
      bd55f250
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb/generic: Tighten defaults · 95e1a3bd
      Kirill Smelkov authored
      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:
      
          nexedi/slapos@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,
      ```
      95e1a3bd
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Set rf_driver.args="---" if no RUs are configured · 9e7c6809
      Kirill Smelkov authored
      Else enb treats args="" unset and implicitly uses /dev/sdr0 by default.
      
      We do not want implicit default behaviour -> we want to see an error.
      9e7c6809
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Switch RU to be a runtime parameter · c4ecf5a0
      Kirill Smelkov authored
      Previously RU type was static parameter of particular software - it was
      possible to instantiate cells only with selected RU type for particular template.
      
      In MultiRU it will be possible to generally instantiate all kind of cells -
      LTE/NR and TDD/FDD all at the same time and each served by a different kind of Radio Unit.
      
      -> Switch RU to be runtime parameter as a preparatory step for that.
      
      There is now only two software releases:
      
        - ORS (software-ors.cfg), and
        - generic (software.cfg).
      
      ORS behaviour stays the same as before here by patch.
      
      For generic each cell in cell_list now needs to explicitly specify which kind
      of RU it wants to use and with which parameters. There are less defaults: for
      example which CPRI board and SFP port to use now needs to be explicitly
      specified.
      
      Only ORS tests are left for now. The old test{LOPCOMM,M2RU,ANY} did not
      exercised any driver-specific functionality and until recently were not run at
      all due to '-' in their file name. We remove them for now and we will add tests
      for generic in a soon follow-up patch after switching LTE/NR cell type to also
      be a runtime parameter.
      
      Backward compatibility:
      
        * nothing changes for ORS
        * for generic all RU-related parameters are now moved from cell_list to
          cell_list.ru, there are several renames and besides ru_type ru_link_type also
          needs to be specified. Please see new RU-related JSON schemas added into
          ru/ for details. Cell_list itself now also does not provide a default with
          one cell - if no cells are configured no cells are instantiated.
      
      --------
      
      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 1b39f7044..89862f1d9 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -6,7 +6,7 @@
      
         // Radio Units
         rf_driver: {
      -      // default-RU 2T2R  (ors)
      +      // CELL-RU 2T2R  (sdr)
             name: "sdr",
             args: "dev0=/dev/sdr0",
             rx_antenna:"tx_rx",
      @@ -27,7 +27,7 @@
         // LTE cells
         cell_list: [
      
      -    // default  (default-RU)
      +    // CELL  (CELL-RU)
           {
             rf_port:      0,
             n_antenna_dl: 2,
      @@ -90,11 +90,11 @@
             srs_hopping_bandwidth: 0,
           },
      
      -    drb_config: "default-drb.cfg",
      +    drb_config: "CELL-drb.cfg",
      
           sib_sched_list: [
             {
      -        filename: "default-sib23.asn",
      +        filename: "CELL-sib23.asn",
               si_periodicity: 16,
             },
           ],
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index 05deb5ada..1df699a22 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -6,7 +6,7 @@
      
         // Radio Units
         rf_driver: {
      -      // default-RU 2T2R  (ors)
      +      // CELL-RU 2T2R  (sdr)
             name: "sdr",
             args: "dev0=/dev/sdr0",
             rx_antenna:"tx_rx",
      @@ -35,7 +35,7 @@
         // NR cells
         nr_cell_list: [
      
      -      // default  (default-RU)
      +      // CELL  (CELL-RU)
             {
               rf_port:      0,
               n_antenna_dl: 2,
      @@ -136,7 +136,7 @@
                 ],
               },
      
      -        drb_config: "default-drb.cfg",
      +        drb_config: "CELL-drb.cfg",
             },
         ],
      ```
      c4ecf5a0
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Switch rf_mode to be runtime parameter · b111a2c1
      Kirill Smelkov authored
      Previously rf_mode was static parameter of particular software - it was
      possible to instantiate cells only of the mode selected for particular template.
      
      In MultiRU it will be possible to generally instantiate all kind of cells -
      LTE/NR and TDD/FDD all at the same time.
      
      -> Switch rf_mode to be runtime parameter as a preparatory step for that.
      
      Software for ORS becomes just software-ors.cfg with software-tdd-ors.cfg
      providing backward compatibility proxy as we have many ORS'es currently
      deployed with that software-release URL. For other softwares backward
      compatibility is not preserved including for software-fdd-ors.cfg because we
      practically have very few deployments with those.
      
      To show tdd_ul_dl_config only for TDD we use conditional feature of new JSON-editor.
      
      Backward compatibility: nothing changes for ORS, for everything else rf_mode
      now needs to be explicitly set in cell parameters if it is not TDD.
      
      Rendered enb.cfg and gnb.cfg stay the same.
      b111a2c1
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: nr: Let root_sequence_index to also be cell parameter · 8e13be90
      Kirill Smelkov authored
      For uniformity with LTE where it already is.
      
      We do not expose it in ORS schema because it will be exposed only in generic
      LTE and NR schemas, but for ORS schemas I prefer to keep them intact myself.
      
      Tests will be added later as full tests for generic MultiRU.
      
      Backward compatibility: no change for ORS and everything else.
      
      Diff for rendered configs:
      
      $ ./pythonwitheggs slapos-render-config.py && git diff -w --no-index config/{old,out}
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index 5849bb924..b8a385a71 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -56,6 +56,7 @@
           subcarrier_spacing: 30,
           ssb_pos_bitmap: "10000000",
      
      +    root_sequence_index: 1,
           inactivity_timer: 10000,
      
             // Handover
      @@ -176,7 +176,6 @@
           intra_freq_reselection: true,
           q_rx_lev_min: -70,
           q_qual_min: -20,
      -    root_sequence_index: 1,
           sr_period: 40,
           dmrs_type_a_pos: 2,
           prach: {
      8e13be90
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Start to generalize the code to handle multiple cells · d015c20c
      Kirill Smelkov authored
      As with Radio Units organize a registry of cells and start to handle that
      registry generally everywhere. Make parameters that configure cells, for
      example tdd_ul_dl_config, dl_earfcn, bandwidth, pci, etc to be per-cell.
      
      Cell registry is still populated from cell_list and slapparameter_dict.
      
      Tests will be added later as full tests for generic MultiRU.
      
      Rendered enb.cfg and gnb.cfg stay practically the same.
      
      Backward compatibility: no change for ORS; For everything else cell parameters
      stop to be global and are moved to cell_list.
      
      --------
      
      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 5c6743c21..1b39f7044 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -1,6 +1,3 @@
      -
      -
      -
       {
         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,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/enb.log",
      @@ -93,11 +90,11 @@
             srs_hopping_bandwidth: 0,
           },
      
      -    drb_config: "drb",
      +    drb_config: "default-drb.cfg",
      
           sib_sched_list: [
             {
      -        filename: "sib",
      +        filename: "default-sib23.asn",
               si_periodicity: 16,
             },
           ],
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index 6b04559c6..1fa637925 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -1,6 +1,3 @@
      -
      -
      -
       {
         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,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/enb.log",
      @@ -77,7 +74,6 @@
           manual_ref_signal_power: true,
           ss_pbch_block_power: 8,
      
      -
           tdd_ul_dl_config: {
             pattern1: {
                period: 5, /* in ms */
      @@ -148,7 +144,7 @@
             ],
           },
      
      -    drb_config: "drb",
      +    drb_config: "default-drb.cfg",
         },
         ],
         nr_cell_default: {
      ```
      d015c20c
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Push CPRI-related properties to be per-RU · cbe59f7c
      Kirill Smelkov authored
      Most were already so, but sdr_number and cpri_mult were not. We need to be able
      to use different SDR boards and with different CPRI speed, so make those
      parameters to be per-RU as well.
      
      Backward compatibility: no change for ORS; For CPRI-based cases sdr_number and cpri_mult become per-RU.
      cbe59f7c
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Start to generalize the code to handle multiple Radio Units · 0a285a34
      Kirill Smelkov authored
      Add code to organize a registry of Radio Units and handle that registry generally everywhere.
      
      RU registry is still populated from cell_list and in practice there still can
      be radio units only of the same type, but besides slaplte.load_ru_and_cell
      which is aware of that, the rest of the code tries to do everything as if
      RUs of different type could be present simultaneously.
      
      Now it is not only lopcomm who can do multiCELL, but also sunwave and SDR as well.
      
      gNB also starts to gain support for cell_list, because cell_list loading is
      uniformly applied to both eNB and gNB. However, since enb.cfg is not yet
      prepared to handle multiple NR cells yet, there is an assert that in case of NR
      there is only one RU/cell present there. We will remove this limitation in a
      follow-up patch.
      
      Later we will also change the loading to load RU descriptions from shared instances
      and they won't be constrained to be Radio Units of the same type. But we need
      to prepare a lot to be able to do that.
      
      One more step forward towards MultiRU.
      
      Tests will be added later as full tests for generic MultiRU.
      
      Backward compatibility: no change for ORS and practically no breaking change for everything else.
      
      --------
      
      Appendix. Diff for rendered enb.cfg and gnb.cfg before and after this patch:
      
      ```
      $ ./pythonwitheggs slapos-render-config.py && git diff -w --no-index config/{old,out}
      ```
      
      ```diff
      diff --git a/config/old/enb.cfg b/config/out/enb.cfg
      index 884483b0a..cafdf42be 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -1,24 +1,22 @@
      
      -
       {
         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,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/enb.log",
      
      -
      +  // Radio Units
         rf_driver: {
      +      // default-RU 2T2R  (ors)
             name: "sdr",
             args: "dev0=/dev/sdr0",
      -
             rx_antenna:"tx_rx",
             tdd_tx_mod: 1,
         },
      -  tx_gain: 62,
      -  rx_gain: 43,
      -
      +  tx_gain: [62, 62],
      +  rx_gain: [43, 43],
         com_addr: "127.0.1.2:9001",
         // LTE core network
         mme_list: [
      @@ -36,6 +34,8 @@
      
         // LTE cells
         cell_list: [
      +
      +    // default  (default-RU)
           {
             rf_port:      0,
             n_antenna_dl: 2,
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index fd57ca3dc..7818b4ea8 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -1,24 +1,22 @@
      
      -
       {
         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,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/enb.log",
      
      -
      +  // Radio Units
         rf_driver: {
      +      // default-RU 2T2R  (ors)
             name: "sdr",
             args: "dev0=/dev/sdr0",
      -
             rx_antenna:"tx_rx",
             tdd_tx_mod: 1,
         },
      -  tx_gain: 62,
      -  rx_gain: 43,
      -
      +  tx_gain: [62, 62],
      +  rx_gain: [43, 43],
         com_addr: "127.0.1.2:9001",
         // NR core network
         amf_list: [
      ```
      0a285a34
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: Rename cell_list -> cell_dict internally · 0f8ee720
      Kirill Smelkov authored
      That data structure is really a dict, not list. It is more clear to name it appropriately.
      
      -> Do the renaming but keep cell_list intact as described in JSON schemas so
         that external interface remains unchanged.
      
      Rendered enb.cfg and gnb.cfg remain the same.
      0f8ee720
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Switch internal ru.ru_type to be... · 1c0317be
      Kirill Smelkov authored
      software/ors-amarisoft: enb.jinja2.cfg: Switch internal ru.ru_type to be 'sunwave' for Sunwave M2RU Radio Unit
      
      ru/libinstance and everything inside there already refer to that unit as 'sunwave'.
      Do the same for uniformity in enb.cfg and because we already refer to Lopcomm
      ORAN Radio Unit as just 'lopcomm'.
      
      In the future, if we will need to distinguish different models of one
      manufacturer, we could extend ru type to be e.g. manufacturer/model or do
      something similar.
      
      Template rendering is still done with ru='m2ru' coming from outside but
      internally it is now ru.ru_type='sunwave' instead of ru.ru_type='m2ru'.
      1c0317be
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Move rf_config code from enb.jinja2.cfg -> to slaplte.jinja2 · 4079c440
      Kirill Smelkov authored
      To handle multiple radio units we will need to rework this code significantly.
      Move this to a dedicated routine as a preparatory step. The code moves out of
      enb.cfg because later it will be also used in UEsim to configure simulator
      radio units as well.
      
      No non-whitespace changes in rendered enb.cfg and gnb.cfg .
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      4079c440
  2. 30 Jan, 2024 1 commit
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Factor handover code into one place · 41d23ce2
      Kirill Smelkov authored
      We currently have LTE-specific handover configuration in under cell_list and
      NR-specific handover configuration in under nr_cell_list. Those configuration
      are different.
      
      However in upcoming MultiRU we will need to handle LTE->NR handover, NR->LTE
      handover, and also Intra-ENB handover in addition to Inter-ENB handover we
      currently do.
      
      -> Move handover code into common function as a preparatory step for that.
      
      In the future the handover code for LTE and NR cells will be the same, so it
      makes sense to move that code to common place to avoid duplication.
      
      For rendered enb.cfg this unification introduces only space and trivial
      changes as shown in the appendix.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1528
      /reviewed-by TrustMe
      
      Appendix. Diff for rendered enb.cfg and gnb.cfg before and after this patch
      
      ```
      $ git diff -w --no-index config/{old,out}
      ```
      
      ```diff
      diff --git a/config/old/enb.cfg b/config/out/enb.cfg
      index 43301ee13..9dcca16c7 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -45,16 +45,18 @@
             root_sequence_index: 204,
             dl_earfcn: 36100,
             inactivity_timer: 10000,
      +
             // Handover
             ncell_list: [
               // Inter-ENB HO
               {
      +          rat: "eutra",
                 n_id_cell: 35,
                 dl_earfcn: 700,
                 cell_id: 0x12345,
                 tac: 123,
      -        }],
      -
      +        },
      +      ],
      
             // Carrier Aggregation
             scell_list: [
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index 2127a2f6b..23b07d6e1 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -57,6 +57,7 @@
           ssb_pos_bitmap: "10000000",
      
           inactivity_timer: 10000,
      +
             // Handover
             ncell_list: [
               // Inter-ENB HO
      @@ -74,8 +75,8 @@
                 ssb_period: 20,
                 ssb_offset: 0,
                 ssb_duration: 1,
      -      }],
      -
      +        },
      +      ],
      
           // tune NR parameters for the cell
           manual_ref_signal_power: true,
      ```
      41d23ce2
  3. 25 Jan, 2024 1 commit
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Stop using C Preprocessor and switch to Jinja2 completely · 79370ebf
      Kirill Smelkov authored
      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 nexedi/slapos!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
               },
             ],
           },
      ```
      79370ebf
  4. 21 Nov, 2023 1 commit