1. 31 Jan, 2024 2 commits
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Switch internal ru.ru_type to be... · 9ee353af
      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'.
      9ee353af
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Inline cell.bandwidth for now · b1ae522b
      Kirill Smelkov authored
      Even though I introduced cell object in 79370ebf (software/ors-amarisoft:
      enb.jinja2.cfg: Stop using C Preprocessor and switch to Jinja2 completely) it
      is currently only cell.bandwidth that is living there, while all other cell
      parameters are still fetched from slapparameter_dict directly.
      
      We will soon introduce cell variable - that will iterate over cell_dict, and
      also keeping global cell won't work due to name shadowing. On the other hand we
      are not yet ready to start migrating all cell parameters to be accessible via
      cell object.
      
      -> So inline code for lte bandwidth parameter until the time comes to rework
      all cell parameters to be accessible via cell object.
      
      Rendered enb.cfg and gnb.cfg stay the same.
      b1ae522b
  2. 30 Jan, 2024 15 commits
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Move rf_config code from enb.jinja2.cfg -> to slaplte.jinja2 · 0ebc2458
      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
      0ebc2458
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Do not recreate slaptapX-* on every idempotent `slapos node instance` run · 43acb9a8
      Kirill Smelkov authored
      To run tapsplit we use plone.recipe.command with both command and
      update-command set to `tapsplit ...`. But tapsplit, when run, fully
      recreates and reinitializes subtap interfaces, which leads to
      interfering with running enb because subtap interfaces, that enb
      started to use, are removed. This is not desirable behaviour.
      
      What we need:
      
      1) create subtap interfaces only once and keep them stable
      2) until configuration changes which should lead to
         * subtaps recreated, and
         * enb restarted
      
      Carefully reading plone.recipe.command documentation shows:
      
        command
          Command to run when the buildout part is installed.
      
        update-command
          Command to run when the buildout part is updated. This happens when
          buildout is run BUT THE CONFIGURATION FOR THIS BUILDOUT PART HAS NOT
          CHANGED.
      
        (emphasis mine)
      
      So the fix looks to be to make update-command noop - this fulfills
      requirement "1". For "2" - I've verified that when configuration
      changes, e.g. number of RU changes, buildout reinstalls [vtap] section
      from scratch, and it also should restart enb, because generated enb.cfg
      changes.
      
      So the fix is fully correct because it satifies all needed requirements.
      
      Amends 49ce8ef5 (software/ors-amarisoft: Provide dedicated TAP interface for each Radio Unit)
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      43acb9a8
    • Kirill Smelkov's avatar
      X ktesting · 62e4182d
      Kirill Smelkov authored
      Test only ors-amarisoft and from kirr/slapos@knext + kirr/slapos.toolbox@next .
      62e4182d
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Increase SNR in handover code · 7c3c96e4
      Kirill Smelkov authored
      Don't repeat slapparameter_dict['ncell_list'][k] - we can introduce a name for
      current neighbour cell, and use that name in the loop. And align entries to
      that they read more clearly.
      
      No non-whitespace changes in rendered enb.cfg and gnb.cfg .
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1526
      /reviewed-by TrustMe
      7c3c96e4
    • 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
    • Kirill Smelkov's avatar
      software/ors-amarisoft: slapos-render-config: Test handover · 3fd11a89
      Kirill Smelkov authored
      Useful to have while doing handover-related changes.
      
      /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 --no-index config/{old,out}
      ```
      
      ```diff
      diff --git a/config/old/enb.cfg b/config/out/enb.cfg
      index 1843e0f24..43301ee13 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -45,6 +45,16 @@
             root_sequence_index: 204,
             dl_earfcn: 36100,
             inactivity_timer: 10000,
      +      // Handover
      +      ncell_list: [
      +        // Inter-ENB HO
      +        {
      +          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 d76b45d3c..2127a2f6b 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -57,6 +57,25 @@
           ssb_pos_bitmap: "10000000",
      
           inactivity_timer: 10000,
      +    // Handover
      +    ncell_list: [
      +      // Inter-ENB HO
      +      {
      +        rat: "nr",
      +        dl_nr_arfcn: 520000,
      +        ssb_nr_arfcn: ,
      +        ul_nr_arfcn: 520000,
      +        n_id_cell: 75,
      +        gnb_id_bits: 22,
      +        nr_cell_id: 0x77712,
      +        tac: 321,
      +        band: 38,
      +        ssb_subcarrier_spacing: 30,
      +        ssb_period: 20,
      +        ssb_offset: 0,
      +        ssb_duration: 1,
      +      }],
      +
      ```
      3fd11a89
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Unify logging · 04323c6d
      Kirill Smelkov authored
      1. Currently we have separate log_options for LTE and NR cases with listing
      different subsystems in each. But in MultiRU one enb will be driving both LTE
      and NR cells at the same time, so we will need to define both LTE- and
      NR-related levels.
      
      -> Merge all log settings into one log_options as a preparatory step
      
      For current state it does not hurt for an LTE if we set e.g. ngap.level, and it
      does not hurt for NR if we set e.g. s1ap.level - since those layers will be
      unused. This way merging log settings for both LTE and NR subsystems is ok.
      
      --------
      
      2. Factorize log_phy_debug handling: instead of duplicating whole
      log_options line and changing only phy.level settings there, construct the
      log_options line programmatically and handle phy.level on its own.
      
      --------
      
      3. Use log/enb.log log_filename for both LTE and NR cases. In the upcoming
      MultiRU there might be several cells activated at the same time and in general
      it will be not possible to say are we doing "enb" or "gnb" now - for example if
      there will be two cells - one LTE and one NR.
      
      -> Use enb.log for log filename uniformly similarly to how the software is
      named (lteenb) even though it can work as both enb and gnb.
      
      For the reference we do the same with enb.xlog in nexedi/slapos!1522 .
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1527
      /reviewed-by TrustMe
      
      Appendix. Diff for rendered enb.cfg and 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 467bb6364..1843e0f24 100644
      --- a/config/old/enb.cfg
      +++ b/config/out/enb.cfg
      @@ -3,9 +3,7 @@
      
       {
      -
      -  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,phy.level=info,file.rotate=1G,file.path=/dev/null",
      -
      +  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",
      
      diff --git a/config/old/gnb.cfg b/config/out/gnb.cfg
      index 18523818a..d76b45d3c 100644
      --- a/config/old/gnb.cfg
      +++ b/config/out/gnb.cfg
      @@ -3,10 +3,8 @@
      
       {
      -
      -  log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,ngap.level=debug,ngap.max_size=1,xnap.level=debug,xnap.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
      -
      -  log_filename: "log/gnb.log",
      +  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",
      
         rf_driver: {
      ```
      04323c6d
    • Kirill Smelkov's avatar
      software/ors-amarisoft: test: Preprocess enb.cfg & co on YAML loading · d8b0a558
      Kirill Smelkov authored
      Current enb config is already quite complex and with MultiRU it will be growing
      more - both with added features and with more sections emitted because there
      will be multiple radio units, multiple cells and cross cell interactions. So
      for clarity we will want to annotate with a comment to which cell or ru object
      a section belongs, or to which cell-cell pair a particular interaction belongs.
      
      Amarisoft supports C-style comments and preprocessor directives out of the box,
      but if we use them in the configuration files, yaml.load, that we use in the
      test to load generated configs, will break, because // and /* ... */ is not
      valid YAML. It looks like Amarisoft does preprocessing as a separate step
      before further loading given configuration via yaml.
      
      So to be able to use the comments and still have tests working we need to do
      the same - in the tests preprocess the files before feeding them to yaml loader.
      
      -> Do that with the help of https://pypi.org/project/pcpp/
      
      In my view that library has good quality and in my experience it worked
      flawlessly. Anyway we need it to only handle comments, not sophisticated CPP
      features, and for that it works just ok.
      
      Add some comments to existing enb.cfg and ue.cfg to make sure it really works.
      Those are simple comments, and in current state it they might seem as not 100%
      necessary, but with more upcoming config changes it would be good to have those
      descriptionary anchors present in the generated configs, so I suggest we add them.
      Anyway they should not do any harm at all.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1526
      /reviewed-by TrustMe
      d8b0a558
    • Kirill Smelkov's avatar
      software/ors-amarisoft: test: Avoid YAMLLoadWarning warning · 82d3852c
      Kirill Smelkov authored
      Currently on every test yaml.load issues a warning that using it without
      explicitly specifying loader is deprecated, for example:
      
          test_enb_conf (testTDD.TestENBParameters) .../slapos/software/ors-amarisoft/test/test.py:29: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
      
      -> Fix the warning by using appropriate loader explicitly.
      
      Use FullLoader since msg.pyyaml.org/load describes it as
      
         Loads the full YAML language. Avoids arbitrary code execution.
         This is currently (PyYAML 5.1+) the default loader called by yaml.load(input) (after issuing the warning).
      
      i.e. we get support for full YAML feature set, do not get code execution and
      make sure that the behaviour stays exactly the same as before, but without the
      warning.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1526
      /reviewed-by TrustMe
      82d3852c
    • Kirill Smelkov's avatar
      software/ors-amarisoft: test: Factor loading YAML config into dedicated function · ff40ed40
      Kirill Smelkov authored
      We are going to do fixes and enhancements to YAML loading processes. Move
      corresponding code to one place before that as the preparatory step.
      
      Place new utility in new test/test.py file - with MultiRU that will be the
      place for tests of generic mode and test.jinja2.py, which will be renamed to
      test_ors.py, will be using utilities from there. So place the utility into new
      place from the start.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1526
      /reviewed-by TrustMe
      ff40ed40
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Merge instance-gnb.jinja2.cfg into instance-enb.jinja2.cfg · 503e50a4
      Kirill Smelkov authored
      In MultiRU one enb will be driving multiple, possible of different kind,
      TDD/FDD and LTE/NR cells all at the same time, because that standard
      functionality of a base station and because original Amarisoft software
      supports that out of the box.
      
      However we currently have enb and gnb services separate and duplicating most of
      each other code.
      
      -> Merge instance-enb.jinja2.cfg and instance-gnb.jinja2.cfg as a preparatory step for MultiRU.
      
      - instance-enb.jinja2.cfg pulls gnb specific bits from instance-gnb.jinja2.cfg
      - instance-gnb.jinja2.cfg goes away effectively switching gnb to use
        ru/libinstance.jinja2.cfg like enb already does
      - For parameters that were duplicated as enb_<X> and gnb_<X>  generic software
        now accepts only enb_<X> with ORS mode wrapper providing backward
        compatibility for gnb_* parameters. For example if gnb_config_link is given
        for a gnb instance, it will be translated to enb_config_link to underlying
        generic enb so that gnb_config_link works correctly.
      
        For ORS we care to provide 100% backward compatibility because there are many ORS'es deployed.
        For generic software we are free to clean things up as needed, because there
        is not much generic deployments at this time.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1522
      /reviewed-by TrustMe
      
      --------
      
      Appendix. Diff between instance-enb.jinja2.cfg and instance-gnb.jinja2.cfg before this patch
      
      ```
      $ git diff --no-index instance-enb.jinja2.cfg instance-gnb.jinja2.cfg
      ```
      
      ```diff
      diff --git a/instance-enb.jinja2.cfg b/instance-gnb.jinja2.cfg
      index 6d4ce7e94..6ee62b3ff 100644
      --- a/instance-enb.jinja2.cfg
      +++ b/instance-gnb.jinja2.cfg
      @@ -1,19 +1,25 @@
       {#- 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
      -  enb-config
      +  gnb-config
         enb-service
         xamari-xlog-service
       {% if slapparameter_dict.get('xlog_fluentbit_forward_host') %}
         xlog-fluentbit-service
       {% endif %}
      +  amarisoft-stats-service
      +  amarisoft-rf-info-service
      +  check-sdr-busy.py
         check-baseband-latency.py
      +  check-amarisoft-stats-log.py
      +  check-rx-saturated.py
         monitor-base
         publish-connection-information
      
      @@ -23,11 +29,6 @@ eggs-directory = {{ eggs_directory }}
       develop-eggs-directory = {{ develop_eggs_directory }}
       offline = true
      
      -{%- import 'slaplte.jinja2'            as slaplte with context  %}
      -{%- import 'ru_libinstance.jinja2.cfg' as rulib   with context  %}
      -{{ rulib.buildout() }}
      -
      -
       [monitor-httpd-conf-parameter]
       httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
       port = ${monitor-instance-parameter:monitor-httpd-port}
      @@ -52,10 +53,11 @@ cert = {{ slap_connection['cert-file'] }}
      
       configuration.com_ws_port = 9001
       configuration.com_addr = 127.0.1.2
      -configuration.mme_addr = 127.0.1.100
      +configuration.amf_addr = 127.0.1.100
       configuration.gtp_addr = 127.0.1.1
      -configuration.default_lte_bandwidth = {{ default_lte_bandwidth }}
      -configuration.default_lte_inactivity_timer = {{ default_lte_inactivity_timer }}
      +configuration.default_nr_bandwidth = {{ default_nr_bandwidth }}
      +configuration.default_nr_inactivity_timer = {{ default_nr_inactivity_timer }}
      +configuration.default_nr_ssb_pos_bitmap = {{ default_nr_ssb_pos_bitmap }}
       configuration.default_n_antenna_dl = {{ default_n_antenna_dl }}
       configuration.default_n_antenna_ul = {{ default_n_antenna_ul }}
      
      @@ -63,6 +65,7 @@ configuration.default_n_antenna_ul = {{ default_n_antenna_ul }}
       recipe = slapos.cookbook:mkdirectory
       software = {{ buildout_directory }}
       home = ${buildout:directory}
      +etc = ${:home}/etc
       var = ${:home}/var
       etc = ${:home}/etc
       bin = ${:home}/bin
      @@ -73,30 +76,32 @@ service = ${:etc}/service
       promise = ${:etc}/promise
       log = ${:var}/log
      
      -{% if slapparameter_dict.get("enb_config_link", None) %}
      -[enb-config-dl]
      +{% if slapparameter_dict.get("gnb_config_link", None) %}
      +[gnb-config-dl]
       recipe = slapos.recipe.build:download
      -url = {{ slapparameter_dict.get("enb_config_link") }}
      -version = {{ slapparameter_dict.get("enb_config_version") }}
      +url = {{ slapparameter_dict.get("gnb_config_link") }}
      +version = {{ slapparameter_dict.get("gnb_config_version") }}
       offline = false
       {% endif %}
      
       [enb-sh-wrapper]
       recipe = slapos.recipe.template
       output = ${directory:bin}/${:_buildout_section_name_}
      -enb-log = ${directory:log}/enb-output.log
      +gnb-log = ${directory:log}/gnb-output.log
       inline =
         #!/bin/sh
       {% if not slapparameter_dict.get("testing", False) %}
         sudo -n /opt/amarisoft/rm-tmp-lte;
         sudo -n /opt/amarisoft/init-sdr;
         sudo -n /opt/amarisoft/init-enb;
      -  (echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting eNB software..." && echo) >> ${:enb-log};
      -  tail -c 1M ${:enb-log} > ${:enb-log}.tmp;
      -  mv ${:enb-log}.tmp ${:enb-log};
      -  {{ enb }}/lteenb ${directory:etc}/enb.cfg >> ${:enb-log} 2>> ${:enb-log};
      +  (echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting gNB software..." && echo) >> ${:gnb-log};
      +  tail -c 1M ${:gnb-log} > ${:gnb-log}.tmp;
      +  mv ${:gnb-log}.tmp ${:gnb-log};
      +  {{ enb }}/lteenb ${directory:etc}/gnb.cfg >> ${:gnb-log} 2>> ${:gnb-log};
      +
       {% endif %}
      
      +### eNodeB (enb)
       [enb-service]
       recipe = slapos.cookbook:wrapper
       command-line = ${enb-sh-wrapper:output}
      @@ -105,7 +110,7 @@ mode = 0775
       reserve-cpu = True
       pidfile = ${directory:run}/enb.pid
       hash-files =
      -  ${enb-config:output}
      +  ${gnb-config:output}
         ${enb-sh-wrapper:output}
       environment =
         LD_LIBRARY_PATH={{ openssl_location }}/lib
      @@ -114,22 +119,23 @@ environment =
       [xamari-xlog-script]
       recipe = slapos.recipe.template
       output = ${directory:bin}/${:_buildout_section_name_}
      -period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
      +period = {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
       stats_logspec = stats[samples,rf]/${:period}s
      -{%- if slapparameter_dict.get("enb_drb_stats_enabled", True) %}
      +{%- if slapparameter_dict.get("gnb_drb_stats_enabled", True) %}
       drb_stats_logspec = x.drb_stats/${:period}s
       {%- else %}
       drb_stats_logspec =
       {%- endif %}
       rotatespec = 100MB.9
       logspec = ${:stats_logspec} ${:drb_stats_logspec}
      -{%- if slapparameter_dict.get("websocket_password", "") %}
      +logspec = ${:stats_logspec} ${:drb_stats_logspec}
      +{% if slapparameter_dict.get("websocket_password", "") %}
       websock = ws://[${slap-configuration:ipv6-random}]:9001
      -{%- else %}
      +{% else %}
       websock = ws://127.0.1.2:9001
      -{%- endif %}
      +{% endif %}
       xamari = {{ buildout_directory }}/bin/xamari
      -logfile = ${monitor-directory:public}/enb.xlog
      +logfile = ${monitor-directory:public}/gnb.xlog
       inline =
         #!/bin/sh
         exec ${:xamari} xlog --rotate ${:rotatespec} ${:websock} ${:logfile} ${:logspec}
      @@ -177,6 +183,52 @@ wrapper-path = ${directory:service}/${:_buildout_section_name_}
       hash-files = ${:fluentbit-config}
       {% endif %}
      
      +[amarisoft-stats-template]
      +recipe = slapos.recipe.template:jinja2
      +extensions = jinja2.ext.do
      +log-output = ${directory:var}/log/amarisoft-stats.json.log
      +context =
      +  section directory directory
      +  key slapparameter_dict slap-configuration:configuration
      +  key log_file :log-output
      +  raw stats_period {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
      +  raw testing {{ slapparameter_dict.get("testing", False) }}
      +  raw python_path {{ buildout_directory}}/bin/pythonwitheggs
      +mode = 0775
      +url = {{ ru_amarisoft_stats_template }}
      +output = ${directory:bin}/amarisoft-stats.py
      +
      +[amarisoft-rf-info-template]
      +recipe = slapos.recipe.template:jinja2
      +extensions = jinja2.ext.do
      +log-output = ${directory:var}/log/amarisoft-rf-info.json.log
      +context =
      +  section directory directory
      +  key slapparameter_dict slap-configuration:configuration
      +  key log_file :log-output
      +  raw stats_period {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
      +  raw testing {{ slapparameter_dict.get("testing", False) }}
      +  raw python_path {{ buildout_directory}}/bin/pythonwitheggs
      +mode = 0775
      +url = {{ ru_amarisoft_rf_info_template }}
      +output = ${directory:bin}/amarisoft-rf-info.py
      +
      +[amarisoft-stats-service]
      +recipe = slapos.cookbook:wrapper
      +command-line = ${amarisoft-stats-template:output}
      +wrapper-path = ${directory:service}/amarisoft-stats
      +mode = 0775
      +hash-files =
      +  ${amarisoft-stats-template:output}
      +
      +[amarisoft-rf-info-service]
      +recipe = slapos.cookbook:wrapper
      +command-line = ${amarisoft-rf-info-template:output}
      +wrapper-path = ${directory:service}/amarisoft-rf-info
      +mode = 0775
      +hash-files =
      +  ${amarisoft-rf-info-template:output}
      +
       [config-base]
       recipe = slapos.recipe.template:jinja2
       extensions = jinja2.ext.do
      @@ -190,53 +242,47 @@ context =
         raw gtp_addr_v4 {{ lan_ipv4 }}
         raw tx_gain {{ RF.tx_gain }}
         raw rx_gain {{ RF.rx_gain }}
      -  raw earfcn  {{ RF.dl_earfcn }}
      +  raw nr_arfcn {{ RF.dl_nr_arfcn }}
      +  raw nr_band {{ RF.nr_band }}
         raw software_name {{ software_name }}
         raw rf_mode {{ rf_mode }}
         raw trx {{ trx }}
         raw bbu {{ bbu }}
         raw ru_type {{ ru }}
      -  json do_lte true
      -  json do_nr  false
      +  json do_lte false
      +  json do_nr  true
         import  netaddr netaddr
         ${:extra-context}
      
      -[sib-config]
      -<= config-base
      -url = {{ sib23_template }}
      -output = ${directory:etc}/sib23.cfg
      -
       [drb-config]
       <= config-base
      -url = {{ drb_lte_template }}
      +url = {{ drb_nr_template }}
       output = ${directory:etc}/drb.cfg
      
      -[enb-config]
      +[gnb-config]
       <= config-base
      -{% if slapparameter_dict.get("enb_config_link", None) %}
      -url = ${enb-config-dl:target}
      +{% if slapparameter_dict.get("gnb_config_link", None) %}
      +url = ${gnb-config-dl:target}
       {% else %}
       url = {{ enb_template }}
       {% endif %}
      -output = ${directory:etc}/enb.cfg
      +output = ${directory:etc}/gnb.cfg
       extra-context =
           import json_module json
      -    json cell_list {{ rulib.cell_list | tojson }}
      -    key sib23_file sib-config:output
           key drb_file   drb-config:output
       import-list =
           rawfile slaplte.jinja2 {{ slaplte_template }}
      
      -
       [publish-connection-information]
       <= monitor-publish
       recipe = slapos.cookbook:publish.serialised
       {%- if slapparameter_dict.get("websocket_password", "") %}
       websocket_url = ws://[${slap-configuration:ipv6-random}]:9001
       {%- endif %}
      -enb-ipv6 = ${slap-configuration:ipv6-random}
      -enb-ipv4 = {{ lan_ipv4 }}
      -current-earfcn  = {{ RF.dl_earfcn }}
      +gnb-ipv6 = ${slap-configuration:ipv6-random}
      +gnb-ipv4 = {{ lan_ipv4 }}
      +current-nr-arfcn = {{ RF.dl_nr_arfcn }}
      +current-nr-band = {{ RF.nr_band }}
       amarisoft-version = {{ lte_version }}
       license-expiration = {{ lte_expiration }}
       monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
      @@ -253,10 +299,35 @@ password = {{ slapparameter_dict['monitor-password'] | string }}
       <= monitor-promise-base
       name = ${:_buildout_section_name_}
      
      +[check-sdr-busy.py]
      +<= macro.promise
      +promise = check_sdr_busy
      +config-testing = {{ slapparameter_dict.get("testing", False) }}
      +config-sdr = {{ sdr }}
      +config-sdr_dev  = 0
      +config-dma_chan = 0
      +
       [check-baseband-latency.py]
       <= macro.promise
       promise = check_baseband_latency
       config-testing = {{ slapparameter_dict.get("testing", False) }}
      -config-amarisoft-stats-log = ${ru_amarisoft-stats-template:log-output}
      -config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
      +config-amarisoft-stats-log = ${amarisoft-stats-template:log-output}
      +config-stats-period = {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
       config-min-rxtx-delay = {{ slapparameter_dict.get("min_rxtx_delay", 0) }}
      +
      +[check-amarisoft-stats-log.py]
      +<= macro.promise
      +promise = check_amarisoft_stats_log
      +output = ${directory:plugins}/check-amarisoft-stats-log.py
      +config-testing = {{ slapparameter_dict.get("testing", False) }}
      +config-amarisoft-stats-log = ${amarisoft-stats-template:log-output}
      +config-stats-period = {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
      +
      +[check-rx-saturated.py]
      +<= macro.promise
      +promise = check_rx_saturated
      +config-testing = {{ slapparameter_dict.get("testing", False) }}
      +config-rf-rx-chan-list = {{ list(range(0, int(slapparameter_dict.get('n_antenna_ul', default_n_antenna_ul)))) }}
      +config-amarisoft-stats-log = ${amarisoft-stats-template:log-output}
      +config-stats-period = {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
      +config-max-rx-sample-db = {{ slapparameter_dict.get("max_rx_sample_db", 0) }}
      ```
      503e50a4
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Start to introduce ORS mode · f3f1cb46
      Kirill Smelkov authored
      In MultiRU we are going to have generic software with flexible configuration
      and many features + ORS software, which wraps the generic part, adds ORS
      specific features, and translates simple ORS schema to generic ones.
      
      Let's first move ORS-specific bits to dedicated place as a preparatory step for that:
      
      - add software-ors.cfg . In the future software-ors.cfg will be the entry point
        for ORS mode, but for now it is only a place from where software-ors-* extend from.
      
      - add instance-ors.cfg . We move ORS-specific code from instance.cfg here and
        set it to use instance-ors-enb.jinja2.cfg when instantiating enb/gnb.
      
      - add instance-ors-enb.jinja2.cfg . This pulls ORS-specific code from
        instance-enb.jinja2.cfg + instance-gnb.jinja2.cfg and wraps them with ORS
        context built by instance-ors.cfg
      
      - in the templates the way to see whether it is ORS or not, and if yes, to access
        ORS parameters is changed: now it is always via checking `ors` object, which
        can be either False for non-ORS mode, or dict for ORS mode, and if it is dict
        the keys inside that dict are ORS specific properties, e.g. ors['one-watt'].
      
        This adjustment is handy to organize ORS mode extension from generic with
        generic setting `json ors false` in the context, and ORS mode undoing that and
        setting ORS context properly. I think the code also reads more clear this way, i.e. with
      
       	{%- if one_watt == "True" %}
      
        changed to
      
      	{%- if ors['one-watt'] %}
      
        because in the second variant it is clear that one-watt is a property of ORS.
      
      The rendered configs for enb.cfg and gnb.cfg stay unchanged.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1522
      /reviewed-by TrustMe
      f3f1cb46
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Rename ors-id -> comp-id · a6a4d2d4
      Kirill Smelkov authored
      We use computer identifier in fluentd forwarding. This identifier was named as
      ors-id, but it applies not only to ORS, but also to generic deployment with
      BBU.
      
      In the next patch we are going to introduce ORS mode and move ORS-specific
      bits to software-ors.cfg and instance-ors.cfg + co. The computer identifier
      will stay in generic part, because it is generic.
      
      -> To avoid ambiguity rename it to be clearly unrelated to ORS specifics.
      
      /cc @jhuge, @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /proposed-for-review-on nexedi/slapos!1522
      /reviewed-by TrustMe
      a6a4d2d4
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Tune PUCCH 1 and PUCCH 3 for CA · eab4a41b
      Kirill Smelkov authored
      When there are multiple cells and CA configured, without those parameters enb fails to start with e.g.
      
          n1_pucch_an_cs_count must be > 0 for the CA Primary cell
      
      Set them on all cell like illustrated in enb-2cc.cfg and enb-3cc.cfg Amarisoft examples.
      
      Not sure selected values are best - I took them from above mentioned examples as is.
      
      Reference to documentation about those parameters:
      
      https://tech-academy.amarisoft.com/lteenb.doc#prop.pucch_dedicated.n1_pucch_an_cs_count
      https://tech-academy.amarisoft.com/lteenb.doc#prop.pucch_dedicated.n3_pucch_an_n_rb
      https://tech-academy.amarisoft.com/lteenb.doc#prop.pucch_dedicated.ack_nack_feedback_mode_ca
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /helped-by @jhuge
      /reviewed-on nexedi/slapos!1519
      eab4a41b
    • Jérome Perrin's avatar
      stack/erp5: version up erp5diff 0.8.1.9 · 67907147
      Jérome Perrin authored
      67907147
  3. 26 Jan, 2024 3 commits
  4. 25 Jan, 2024 7 commits
    • Ivan Tyagov's avatar
      Do not created uneeded folders. · ae49c870
      Ivan Tyagov authored
      See merge request nexedi/slapos!1525
      ae49c870
    • Ivan Tyagov's avatar
      Do not created uneeded folders. · ae7063d1
      Ivan Tyagov authored
      Fix double trailing "/".
      Add sane defaults.
      ae7063d1
    • Alain Takoudjou's avatar
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Merge instance-ue-lte.jinja2.cfg +... · f877ed2c
      Kirill Smelkov authored
      software/ors-amarisoft: Merge instance-ue-lte.jinja2.cfg + instance-ue-nr.jinja2.cfg  -> into instance-ue.jinja2.cfg
      
      This is preparatory step for MultiRU and removes code duplication.
      
      Mostly straightforward, but there is one backward incompatible change: instead
      of ue_lte_config_link and ue_nr_config_link there is now only one
      ue_config_link parameter.
      
      We talked with Lu some time ago and my understanding is that UEsim is not widely
      used. This way I think it is better to clarify things instead of putting
      backward compatibility effort for nothing.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1523
      
      --------
      
      Appendix. Diff between instance-ue-lte.jinja2.cfg and instance-ue-nr.jinja2.cfg before this patch
      
      ```
      $ git diff --no-index instance-ue-lte.jinja2.cfg instance-ue-nr.jinja2.cfg
      ```
      
      ```diff
      diff --git a/instance-ue-lte.jinja2.cfg b/instance-ue-nr.jinja2.cfg
      index 4d4a2e329..8fd238bfb 100644
      --- a/instance-ue-lte.jinja2.cfg
      +++ b/instance-ue-nr.jinja2.cfg
      @@ -1,7 +1,7 @@
       [buildout]
       parts =
         directory
      -  lte-ue-lte-config
      +  lte-ue-nr-config
         lte-ue-service
         check-sdr-busy.py
         monitor-base
      @@ -35,11 +35,11 @@ url = {{ slap_connection['server-url'] }}
       key = {{ slap_connection['key-file'] }}
       cert = {{ slap_connection['cert-file'] }}
      
      -configuration.default_lte_bandwidth = {{ default_lte_bandwidth }}
      +configuration.default_nr_bandwidth = {{ default_nr_bandwidth }}
       configuration.default_n_antenna_dl = {{ default_n_antenna_dl }}
       configuration.default_n_antenna_ul = {{ default_n_antenna_ul }}
      -configuration.default_lte_imsi = {{ default_lte_imsi }}
      -configuration.default_lte_k = {{default_lte_k}}
      +configuration.default_nr_imsi = {{ default_nr_imsi }}
      +configuration.default_nr_k = {{ default_nr_k }}
      
       [directory]
       recipe = slapos.cookbook:mkdirectory
      @@ -56,11 +56,11 @@ service = ${:etc}/service
       promise = ${:etc}/promise
       log = ${:var}/log
      
      -{% if slapparameter_dict.get("ue_lte_config_link", None) %}
      -[ue-lte-config-dl]
      +{% if slapparameter_dict.get("ue_nr_config_link", None) %}
      +[ue-nr-config-dl]
       recipe = slapos.recipe.build:download
      -url = {{ slapparameter_dict.get("ue_lte_config_link") }}
      -version = {{ slapparameter_dict.get("ue_lte_config_version") }}
      +url = {{ slapparameter_dict.get("ue_nr_config_link") }}
      +version = {{ slapparameter_dict.get("ue_nr_config_version") }}
       offline = false
       {% endif %}
      
      @@ -87,7 +87,7 @@ mode = 0775
       reserve-cpu = True
       pidfile = ${directory:run}/ue.pid
       hash-files =
      -  ${lte-ue-lte-config:output}
      +  ${lte-ue-nr-config:output}
         ${lte-ue-sh-wrapper:output}
       environment =
         LD_LIBRARY_PATH={{ openssl_location }}/lib
      @@ -101,18 +101,19 @@ context =
         section slap_configuration slap-configuration
         section pub_info publish-connection-information
         key slapparameter_dict slap-configuration:configuration
      -  json do_lte true
      -  json do_nr  false
      +  json do_lte false
      +  json do_nr  true
      
      -[lte-ue-lte-config]
      +[lte-ue-nr-config]
       <= config-base
      -{% if slapparameter_dict.get("ue_lte_config_link", None) %}
      -url = ${ue-lte-config-dl:target}
      +{% if slapparameter_dict.get("ue_nr_config_link", None) %}
      +url = ${ue-nr-config-dl:target}
       {% else %}
       url = {{ ue_template }}
       {% endif %}
       output = ${directory:etc}/ue.cfg
      
      +
       [publish-connection-information]
       <= monitor-publish
       recipe = slapos.cookbook:publish.serialised
      ```
      f877ed2c
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue.jinja2.cfg: Fix thinko regarding LTE bandwidth · 052606f2
      Kirill Smelkov authored
      As Amarisoft documentation says in UEsim LTE bandwidth is defined in MHz, nor in RB:
      
          https://tech-academy.amarisoft.com/lteue.doc#prop.bandwidth
      
      I checked the history and it was like this since 2015-10-28 release.
      
      -> Fix emitted bandwidth for LTE cell.
      
      Diff for rendered ue-lte.cfg:
      
      ```
      $ git diff --no-index config/{old,out}
      ```
      
      ```diff
      --- a/config/old/ue-lte.cfg
      +++ b/config/out/ue-lte.cfg
      @@ -1,5 +1,4 @@
      
      -#define N_RB_DL             50
      
       {
         log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
      @@ -20,7 +19,7 @@ rf_driver: {
           multi_ue: true,
           cells: [
             {
      -        bandwidth: N_RB_DL,
      +        bandwidth: 10,
               dl_earfcn: 0,
               n_antenna_dl: 2,
               n_antenna_ul: 2,
      ```
      
      By coincidence this removes last usage of C Preprocessor from ue.jinja2.cfg
      and, similarly to enb.jinja2.cfg, makes it to be Jinja2-only.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1521
      052606f2
    • 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
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: Switch ru to be a namespace to hold Radio Unit parameters · 6404f810
      Kirill Smelkov authored
      In the next patch we will switch usage of C Preprocessor to Jinja2, and in jinja2 doing set from under if, as e.g. in
      
          {%- if ru == 'm2ru' %}
          {%-   set n_antenna_ul = 1  %}
          {%- endif %}
      
      does _not_ have the effect of setting n_antenna_ul=1 outside of the if block.
      
      That, however, can be worked around with usage of namespace objects, so the following works as intended:
      
          {%- set x = namespace() %}
          {%- if ru == 'm2ru' %}
          {%-   set x.n_antenna_ul = 1  %}
          {%- endif %}
      
      with x.n_antenna_ul=1 if ru was m2ru.
      
      So taking into account this, and that in MultiRU ru will be denoting
      RadioUnit-related configuration, let's switch ru to be a namespace object with
      ru.ru_type denoting type of attached radio unit.
      
      This both goes as a preparatory step for MultiRU and also allows to switch from
      CPP to Jinja2 in the next patch.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1520
      6404f810
  5. 24 Jan, 2024 5 commits
  6. 23 Jan, 2024 8 commits
    • Titouan Soulard's avatar
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: nr: Move tunable parameters from... · 825a5522
      Kirill Smelkov authored
      software/ors-amarisoft: enb.jinja2.cfg: nr: Move tunable parameters from nr_cell_default to nr_cell_list
      
      This patch is similar and has the same rationale as the previous patch
      (software/ors-amarisoft: enb.jinja2.cfg: lte: Move tunable parameters
      from cell_default to cell_list). Please see its description for context
      and details.
      
      Like with previous patch I've made sure via json_util that effective gnb
      configuration stays exactly the same. Also, since for NR case we move
      more code, and also use enb merging feature(*) I tested that the
      effective gnb configuration stays exactly the same with both
      
        * tdd_config = 3  (5ms 8UL 1DL 2/10 (maximum uplink)),	and
        * tdd_config = 1  (5ms 2UL 7DL 4/6 (default))
      
      In all the cases effective gnb configuration stayed exactly the same
      before and after this patch which proves that effective configuration
      for single cell case remains unchanged.
      
      (*) enb implements merging process for cell/cell_default and
      nr_cell/nr_cell_default as demonstrated below:
      
        cell={a: 10, d:15}  cell_default={a:1, b:2, c:3}       ->  cell={a:10, b:2, c: 3, d: 15}
        cell={x: [{}, 2]}   cell_default={x: [{a:1}]}          ->  cell={x: [{a:1}, 2]}
        cell={x: [{c:11}]}  cell_default={x: [{a:1}, {b:2}]    ->  cell={x: [{a:1, c:11}, {b:2}]}
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1515
      825a5522
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb.jinja2.cfg: lte: Move tunable parameters from cell_default to cell_list · 4f2d9791
      Kirill Smelkov authored
      Currently we set some cell tunable parameters on the cell object itself
      (e.g. dl_earfcn), while other cell tunable parameters on the
      cell_default object, e.g. cell bandwidth. This works ok when there is
      only one cell, but with multiple cells it makes a problem because
      different cells can have e.g. different bandwidth.
      
      So as preparatory step for MultiRU move the code, that sets tunable
      parameters for lte cells, from cell_default to cell object itself.
      
      Rendered config changes but we can verify that the configuration, that
      enb actually uses, stays the same: When enb starts it builds internal
      configuration for all configured cell objects by merging cell_default +
      cell's explicit configuration and using the result as the actual
      configuration for the cell. There is no more cell_default in that actual
      configuration. And also enb emits that actual runtime configuration in
      the beginning of enb.log which we can extract and investigate(*)
      
      So this way we can run enb with old and new generated enb.cfg and then
      compare the actual configuration. It turns out to be empty:
      
          ~/enb# ./lteenb -n x/old/enb.cfg
          ...
          RF0: sample_rate=11.520 MHz dl_freq=1910.000 MHz ul_freq=1910.000 MHz (band 33) dl_ant=2 ul_ant=2
          (enb) quit
          ~/enb# mv log/enb.log log/enb.log.old
      
          ~/enb# ./lteenb -n x/out/enb.cfg
          ...
          RF0: sample_rate=11.520 MHz dl_freq=1910.000 MHz ul_freq=1910.000 MHz (band 33) dl_ant=2 ul_ant=2
          (enb) quit
          ~/enb# mv log/enb.log log/enb.log.new
      
          ~/enb# ../ots/json_util log log/enb.log.old >a
          ~/enb# ../ots/json_util log log/enb.log.new >b
          ~/enb# diff -u a b  # output is empty
      
      which means that effective enb configuration before and after this patch is exactly the same.
      
      For the reference, how internal configuration looks like is provided in the appendix.
      
      (*) see https://tech-academy.amarisoft.com/ExtractConfigFromLog.html for details.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1515
      
      P.S. for now I do not plan to expose full measurement configuration in
           the generic MultiRU and so it stays in cell_default with corresponding TODO.
      
      --------
      
      Appendix. Dump of internal enb configuration for enb.cfg before and after the patch
      
      ```
      $ ../ots/json_util log log/enb.log.old
      ```
      
      ```json
      {
          "cell_list": [
              {
                  "cell_barred": false,
                  "cell_id": 0,
                  "cipher_algo_pref": [],
                  "cqi_period": 40,
                  "cyclic_prefix": "normal",
                  "dl_256qam": true,
                  "dl_earfcn": 36100,
                  "dpc": true,
                  "dpc_pucch_snr_target": 25,
                  "dpc_pusch_snr_target": 25,
                  "drb_config": [ ... ],		# removed for brevity
                  "ho_from_meas": true,
                  "inactivity_timer": 10000,
                  "initial_cqi": 3,
                  "integ_algo_pref": [2, 1],
                  "intra_freq_reselection": true,
                  "m_ri": 8,
                  "mac_config": {
                      "dl_max_harq_tx": 5,
                      "ul_max_harq_tx": 5
                  },
                  "manual_ref_signal_power": true,
                  "meas_config_desc": {
                      "a1_hysteresis": 0,
                      "a1_report_type": "rsrp",
                      "a1_rsrp": -70,
                      "a1_time_to_trigger": 640,
                      "a2_hysteresis": 0,
                      "a2_report_type": "rsrp",
                      "a2_rsrp": -80,
                      "a2_time_to_trigger": 640,
                      "a3_hysteresis": 0,
                      "a3_offset": 6,
                      "a3_report_type": "rsrp",
                      "a3_time_to_trigger": 480
                  },
                  "meas_gap_config": "gp0",
                  "n_antenna_dl": 2,
                  "n_antenna_ul": 2,
                  "n_id_cell": 0,
                  "n_rb_dl": 50,
                  "n_symb_cch": 0,
                  "pdcch_format": 2,
                  "pdsch_dedicated": {
                      "p_a": -3,
                      "p_b": -1
                  },
                  "phich_duration": "normal",
                  "phich_resource": "1",
                  "plmn_list": ["00101"],
                  "prach_config_index": 4,
                  "prach_freq_offset": -1,
                  "pucch_dedicated": {
                      "cqi_pucch_n_rb": 1,
                      "n1_pucch_sr_count": 11,
                      "tdd_ack_nack_feedback_mode": "multiplexing"
                  },
                  "pusch_dedicated": {
                      "beta_offset_ack_index": 9,
                      "beta_offset_cqi_index": 6,
                      "beta_offset_ri_index": 6
                  },
                  "pusch_hopping_offset": -1,
                  "pusch_max_its": 6,
                  "pusch_msg3_mcs": 0,
                  "q_rx_lev_min": -70,
                  "rf_port": 0,
                  "root_sequence_index": 204,
                  "scell_list": [],
                  "si_coderate": 0.2,
                  "si_pdcch_format": 2,
                  "si_value_tag": 0,
                  "si_window_length": 40,
                  "sib_sched_list": [ ... ],		# remove for brevity
                  "sp_config": 7,
                  "sr_period": 20,
                  "srb_config": [
                      {
                          "id": 1,
                          "maxRetxThreshold": 32,
                          "t_PollRetransmit": 60,
                          "t_Reordering": 45
                      },
                      {
                          "id": 2,
                          "maxRetxThreshold": 32,
                          "t_PollRetransmit": 60,
                          "t_Reordering": 45
                      }
                  ],
                  "srs_dedicated": {
                      "srs_bandwidth": 2,
                      "srs_bandwidth_config": 2,
                      "srs_hopping_bandwidth": 0,
                      "srs_period": 40,
                      "srs_subframe_config": 3
                  },
                  "tac": 1,
                  "transmission_mode": 3,
                  "ul_64qam": true,
                  "uldl_config": 6
              }
          ],
          "com_addr": "127.0.1.2:9001",
          "enb_id": 107216,
          "gtp_addr": "127.0.1.1",
          "log_filename": "log/enb.log",
          "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,phy.level=info,file.rotate=1G,file.path=/dev/null",
          "mme_list": [
              {
                  "mme_addr": "127.0.1.100"
              }
          ],
          "rf_driver": {
              "args": "dev0=/dev/sdr0",
              "name": "sdr",
              "realtime": 1,
              "rx_antenna": "tx_rx",
              "tdd_tx_mod": 1
          },
          "rx_gain": 43,
          "tx_gain": 62
      }
      ```
      4f2d9791
    • Kirill Smelkov's avatar
      software/ors-amarisoft: slapos-render-config: Replace *arfcn numbers with valid ones · fe512654
      Kirill Smelkov authored
      So that it is possible to try running enb on generated configs becuase
      with previous numbers enb refuses to start:
      
          ~/enb# ./lteenb  x/old/enb.cfg
          ...
          x/old/enb.cfg:50: field 'dl_earfcn': range is [0:262143] (LTE Cell #0)
      
          ~/enb# ./lteenb  x/old/gnb.cfg
          ...
          x/old/gnb.cfg:54: invalid frequency band (NR Cell #1)
      
      We need enb to be able to start with generated config because enb dumps in its
      enb.log the real configuration that it builds from cell_list + cell_default and
      nr_cell_list + cell_default - which is possible to extract via `json_util` and
      which we want to check after our changes to enb.jinja2.cfg to see if we
      really don't introduce semantic mistakes when e.g. moving things in between
      cell_default to cell_list (see next patch).
      
      With new frequencies enb and gnb both start ok.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1515
      fe512654
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ru/*: Wrap with `if not testing` things that require real environment · e155a995
      Kirill Smelkov authored
      For example there is no slaptap under StandaloneSlapOS and <RU>-netconf-socket
      promise needs real RU hardware to be around and accepting incoming connections.
      
      If we don't wrap such things with `if not testing` running test on testnodes will fail.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1514
      e155a995
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ru/*: Pull testing initialization and default into one place · db05a810
      Kirill Smelkov authored
      Less need to keep default synchronized and less noise in the code. We will need
      to refer to `testing` more in the next patch, so it will help a bit.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1514
      db05a810
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Merge ue-lte.jinja2.cfg and ue-nr.jinja2.cfg into ue.jinja2.cfg · 9179f739
      Kirill Smelkov authored
      Similarly to f365a440 (software/ors-amarisoft: Merge gnb.jinja2.cfg into
      enb.jinja2.cfg) merge LTE and NR configuration files for UEsim into single
      config as the preparation for MultiRU - there UEsim will be also handling TDD,
      FDD, LTE and NR cells and UEs all at the same time.
      
      In this patch for now we only move code without changing it and wrap parts with
      `if do_lte` and `if do_nr` correspondingly.  The end result of rendered
      ue-lte.cfg and ue-nr.cfg stays practically the same as shown in the appendix.
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1513
      
      --------
      
      Appendix. Diff for rendered ue-*.cfg before and after this patch.
      
      ```
      $ ./pythonwitheggs slapos-render-config.py && git diff --no-index -w config/old/ config/out/
      ```
      
      ```diff
      diff --git a/config/old/ue-lte.cfg b/config/out/ue-lte.cfg
      index 7f1530daf..836a95e79 100644
      --- a/config/old/ue-lte.cfg
      +++ b/config/out/ue-lte.cfg
      @@ -1,5 +1,6 @@
      
       #define N_RB_DL             50
      +
       {
         log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/ue.log",
      @@ -14,7 +15,8 @@ rf_driver: {
       },
         tx_gain: 60,
         rx_gain: 40,
      -  cell_groups: [{
      +  cell_groups: [
      +  {
           multi_ue: true,
           cells: [
             {
      @@ -27,7 +29,8 @@ rf_driver: {
           ],
           pdcch_decode_opt: false,
           pdcch_decode_opt_threshold: 0.1,
      -  }],
      +  },
      +  ],
         ue_list: [
           {
           sim_algo: "milenage",
      @@ -38,8 +41,8 @@ rf_driver: {
           impi: "",
           imsi: "001010123456789",
           K: "00112233445566778899aabbccddeeff",
      -    rue_addr: "host1",
           ue_category: 12,
      +    rue_addr: "host1",
           tun_setup_script: "ue-ifup",
           apn: "internet",
           }
      diff --git a/config/old/ue-nr.cfg b/config/out/ue-nr.cfg
      index 41758ab6f..631e1ab1e 100644
      --- a/config/old/ue-nr.cfg
      +++ b/config/out/ue-nr.cfg
      @@ -1,3 +1,5 @@
      +
      +
       {
         log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1,phy.level=info,file.rotate=1G,file.path=/dev/null",
         log_filename: "log/ue.log",
      @@ -12,7 +14,8 @@ rf_driver: {
       },
         tx_gain: 60,
         rx_gain: 40,
      -    cell_groups: [{
      +  cell_groups: [
      +  {
           group_type: "nr",
           multi_ue: false,
           cells: [{
      @@ -26,7 +29,8 @@ rf_driver: {
             n_antenna_ul: 2,
             }
           ],
      -    }],
      +  },
      +  ],
         ue_list: [
           {
           sim_algo: "milenage",
      @@ -37,11 +41,11 @@ rf_driver: {
           impi: "",
           imsi: "001010123456789",
           K: "00112233445566778899aabbccddeeff",
      -      rue_addr: "host2",
           as_release: 15,
           ue_category: "nr",
      +    rue_addr: "host2",
           tun_setup_script: "ue-ifup",
           apn: "internet",
           }
      -    ]
      +  ],
       }
      ```
      9179f739
    • Kirill Smelkov's avatar
      software/ors-amarisoft: slapos-render-config: Also render ue-*.cfg · dce00434
      Kirill Smelkov authored
      This is useful during development while working on ue-*.jinja2.cfg
      
      /cc @lu.xu, @tomo, @xavier_thompson, @Daetalus
      /reviewed-by @jhuge
      /reviewed-on nexedi/slapos!1513
      dce00434