1. 13 Feb, 2024 40 commits
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Stop doing software*-base.cfg · 241c7116
      Kirill Smelkov authored
      Both software.cfg and software-ors.cfg became trivial wrappers over their bases
      - so move bases to be directly software.
      241c7116
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Stop rendering software*.cfg · 6b252b1c
      Kirill Smelkov authored
      After previous patch this rendering became unneeded. And after we stop
      render-templates becomes unneeded too, so say goodbye to it as well.
      6b252b1c
    • 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: Move LTE and NR cell definitions to... · 253f36e0
      Kirill Smelkov authored
      software/ors-amarisoft: enb/generic: Move LTE and NR cell definitions to schemas under cell/lte/ and cell/nr/
      
      And reuse bits from there for ORS cell-related parameters.
      
      Preparatory step to handle cell as separate object and a bit less code duplication.
      253f36e0
    • Kirill Smelkov's avatar
      b0d1a1ea
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb/generic: lte: Switch bandwidth to MHz · 84e417ac
      Kirill Smelkov authored
      For uniformity with NR which already has bandwidth specified as number in MHz.
      
      For ORS mode everything stays as is which inputs bandwidth as string with MHz
      suffix, e.g. "20 MHz" instead of number `20`.
      84e417ac
    • 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/generic: Do not expose handover measurement config publicly yet · 5b2a2eee
      Kirill Smelkov authored
      We currently have support for a3_offset and a3_time_to_trigger only, while
      there is also a3_hysteresis plus at least a1_*, a2_* and probably other parameters.
      
      Simple A3-only based meas_config tuning might be appropriate for ORS, but for
      generic enb it is better to expose full control which I do not currently feel
      good to implement right now. So do not expose it at all on generic to avoid
      establishing a public API yet.
      
      enb.jinja2.cfg already has corresponding comments:
      
        {#  TODO fully expose lte meas_config_desc in generic SR #}
          meas_config_desc: {
          ...
      
        {#  TODO fully expose nr meas_config_desc in generic SR #}
          meas_config_desc: {
      5b2a2eee
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Start to generalize software.cfg.json · 7d4a76ad
      Kirill Smelkov authored
      - Indicate that it is not for ORS, but for generic case.
      - Move ue to the end, to where it logically belongs.
      - Indicate shared instances clearly with clear visually appearing indent.
        For now it is only about SIM card, but later we will be adding more kinds of
        shared instances, so it will be needed to clearly see on the UR if an item is
        a kind of service, or a shared instance of a service.
      7d4a76ad
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Stop autogenerating software*.cfg.json · 681a8d6e
      Kirill Smelkov authored
      There is now only 2 kinds of softwares - ORS and generic, and their cfg.json
      will diverge with ORS staying as it is now for backward compatibility, and
      generic gaining more features and more kind of shared instances. That means
      that it no longer makes sense to render those two from a common source.
      
      -> Stop rendering them and leave previous rendered result in place for further manual edits.
      681a8d6e
    • Kirill Smelkov's avatar
      software/ors-amarisoft: software.cfg.json: Start index from 1, not 0 · ace534b8
      Kirill Smelkov authored
      Previously, e.g. for ORS it was:
      
          enb                 index=0
          gnb                 index=1
          core-network        index=2
          core-network-slave  index=3
      
      which resulted in the following appearance order on SlapOS Master UI:
      
          gnb
          core-network
          core-network-slave
          enb
      
      Note that enb comes last instead of being first as originally intended.
      
      That happens because SlapOS Master treats index=0 as being unset and puts all
      items with unset index in the end.
      
      -> Fix this by starting explicitly-set indices from 1.
      
      Now, for ORS, the order on UI is
      
          enb
          gnb
          core-network
          core-network-slave
      ace534b8
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Fix json-schemas complain about missing response schemas · 147c9a79
      Kirill Smelkov authored
      As explained in the previous patch now once we have software.cfg and
      software.cfg.json, json-schemas started to analyze them instead of skipping
      software/ors-amarisoft/ completely, and it started to complain about missing
      response schemas, for example:
      
          ERROR: test_ors-amarisoft_software_cfg_json (slapos.test.test_json_schema.TestJSONSchemaValidation)
          ----------------------------------------------------------------------
          Traceback (most recent call last):
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 909, in resolve_from_url
              document = self.store[url]
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/_utils.py", line 28, in __getitem__
              return self.store[self.normalize(uri)]
          KeyError: 'file:///srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'
      
          During handling of the above exception, another exception occurred:
      
          Traceback (most recent call last):
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1503, in open_local_file
              stats = os.stat(localfile)
          FileNotFoundError: [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'
      
          During handling of the above exception, another exception occurred:
      
          Traceback (most recent call last):
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 912, in resolve_from_url
              document = self.resolve_remote(url)
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 1018, in resolve_remote
              with urlopen(uri) as url:
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 214, in urlopen
              return opener.open(url, data, timeout)
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 517, in open
              response = self._open(req, data)
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 534, in _open
              result = self._call_chain(self.handle_open, protocol, protocol +
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 494, in _call_chain
              result = func(*args)
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1481, in file_open
              return self.open_local_file(req)
            File "/srv/slapgrid/slappart91/srv/runner/shared/python3/dd8479ce2a2b9dff51f7185535dd0403/lib/python3.9/urllib/request.py", line 1520, in open_local_file
              raise URLError(exp)
          urllib.error.URLError: <urlopen error [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'>
      
          During handling of the above exception, another exception occurred:
      
          Traceback (most recent call last):
            File "/srv/slapgrid/slappart91/srv/project/slapos/slapos/test/test_json_schema.py", line 72, in run
              resolver.resolve(software_type_definition['response'])
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 898, in resolve
              return url, self._remote_cache(url)
            File "/srv/slapgrid/slappart91/srv/runner/software/45a1e838784afb18daf420009d925c78/eggs/jsonschema-4.17.3-py3.9.egg/jsonschema/validators.py", line 914, in resolve_from_url
              raise exceptions.RefResolutionError(exc)
          jsonschema.exceptions.RefResolutionError: <urlopen error [Errno 2] No such file or directory: '/srv/slapgrid/slappart91/srv/project/slapos/software/ors-amarisoft/instance-ue-schema.json'>
      
      -> Fix this and all other similar errors by adding stub response schemas for all objects that is possible to instantiate.
      147c9a79
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Fix json-schemas complain about spaces in software.cfg.json · 96c4bcf4
      Kirill Smelkov authored
      Previously json-schemas tests were passing on software/ors-amarisoft but the
      status was misleading: since json-schemas check only software.cfg.json, and
      until recently - before the patch to switch RU type to be a runtime parameter,
      there was _no_ such file in here, nothing about software-*.cfg.json was checked at all.
      
      But after the switch we started to have software.cfg and software.cfg.json
      files which json schemas checks and errors start to appear.
      
      Here we fix the following error popping up due to extra blank lines around "ue" entry in software.cfg.json:
      
          FAIL: test_ors-amarisoft_software_cfg_json_format (slapos.test.test_json_schema.TestJSONSchemaValidation)
          ----------------------------------------------------------------------
          Traceback (most recent call last):
            File "/srv/slapgrid/slappart91/srv/project/slapos/slapos/test/test_json_schema.py", line 85, in run
              self.assertEqual(
          AssertionError: Lists differ: ['{',[145 chars]{', '    "ue": {', '      "title": "UE",', '  [1344 chars] '}'] != ['{',[145 chars]{', '', '    "ue": {', '      "title": "UE",',[1352 chars] '}']
      
          First differing element 5:
          '    "ue": {'
          ''
      
          Second list contains 2 additional elements.
          First extra element 48:
          '  }'
      
          Diff is 1703 characters long. Set self.maxDiff to None to see it.
      96c4bcf4
    • 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: Handle multiple cells · f3dc307e
      Kirill Smelkov authored
      Similarly with cell_list, organize a loop in under nr_cell_list and emit
      configuration for each NR cell we have.
      
      Tests will be added later as full tests for generic MultiRU.
      
      Only trivial space and comments changes in rendered gnb.cfg
      
      Backward compatibility: no change for ORS and everything else.
      f3dc307e
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: lte: Simplify Carrier Aggregation code · 49e9b6e7
      Kirill Smelkov authored
      So far CA was setup only for lte case and it is possible to simplify generation
      of all pair of cells to be done without extra loop and state.
      
      Tests will be added later as full tests for generic MultiRU.
      
      Backward compatibility: no change for ORS, which has only one cell, and
      rendered enb.cfg and gnb.cfg stay the same.
      49e9b6e7
    • 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: Push Lopcomm-specific parameters to be per-RU · 206f486e
      Kirill Smelkov authored
      Like e.g. txa0cc00_center_frequency, rxa0cc00_center_frequency_earfcn, etc -
      because different units needs to use different parameters.
      
      cron_schedule is renamed to -> reset_schedule to better reflect its meaning.
      
      user-authorized-key remains to be global as this is per-eNB nor per-RU
      property, but is likely unneded in the future. Corresponding FIXME is added to
      highlight this.
      
      Backward compatibility: no change for ORS; lopcomm parameters become per-cell and need adaptation.
      206f486e
    • 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: lte: Fix tdd_ul_dl_config default in schema · 70e23e6d
      Kirill Smelkov authored
      For LTE tdd_ul_dl_config is
      
          enum [
               "[Configuration 2] 5ms 2UL 6DL (default)",
               "[Configuration 6] 5ms 5UL 3DL (maximum uplink)"
          ],
      
      but default was outside of that enum. The code in enb.jinja2.cfg actually uses
      the first option from the enum as the default.
      
      -> Fix default in schema.
      
      tdd_ul_dl_config in NR seems to be already correct.
      70e23e6d
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: cpri_port parameter is unused · 2c9525cb
      Kirill Smelkov authored
      There is cell_list.*.cpri_port_number that is used insted from the beginning.
      
      -> Remove unused cpri_port from scheamas.
      2c9525cb
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue: Switch UE type to be runtime parameter · e0743e89
      Kirill Smelkov authored
      Previously type of emulated UE was static parameter of particular software
      release - it was possible to simulate UE and attach to cells only of the RAT of
      particular template.
      
      In MultiRU it will be possible to generally emulate all kind of UEs - both LTE
      and NR all at the same time, and attach them to LTE and NR cells
      simultaneously.
      
      -> Switch type of UE to be runtime parameter as a preparatory step for that.
      
      URLs of software releases changes (we remove lte and nr in names), but here we
      do not care about backward compatibility because currently there are just a few
      UEsim deployments and migration should be easy.
      e0743e89
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue: Reuse SIM object in UE schemas · e5374cdf
      Kirill Smelkov authored
      Less code duplication
      e5374cdf
    • Kirill Smelkov's avatar
      software/ors-amarisoft: Move JSON schema of SIM card to sim/ · 068b712c
      Kirill Smelkov authored
      SIM card object is useful to have not only for Core Network - we will also use
      it for UE configutation. Move SIM schema into common place as a preparatory step.
      068b712c
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue: Make default K and IMSI to be common for LTE and NR · af96697d
      Kirill Smelkov authored
      K and IMSI are orthogonal to RAT and, similarly to how we keep default
      n_antenna_dl/ul independent of RAT we can do so with this default UE parameters.
      af96697d
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue: Don't run UEsim tests in ORS mode · 197c4459
      Kirill Smelkov authored
      ORS does not support UEsim as indicated by `if bbu != ors` in software.cfg.json.jinja2.
      
      Amends f3f1cb46 (software/ors-amarisoft: Start to introduce ORS mode) because
      that patch started to really reject instantiating ue-* on ORS.
      197c4459
    • Kirill Smelkov's avatar
      software/ors-amarisoft: ue: Don't render UEsim input schemas for ORS · 198b1113
      Kirill Smelkov authored
      Those were unused because software.cfg.json.jinja2 explicitly enables UEsim only for bbu != 'ors'.
      198b1113
    • Kirill Smelkov's avatar
      software/ors-amarisoft: render-templates: Rework --delete to be precise · 753a9935
      Kirill Smelkov authored
      Soon we are going to make rf_mode a runtime parameter and so there
      won't be TDD and FDD in software names anymore.
      
      Prepare to that and make --delete to remove the exact set of files that
      render-template actually generates instead of becoming a noop after "runtime
      rf_mode" restructuring.
      753a9935
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb+ue: Query slapparameter_dict from master only once · 2149bc2d
      Kirill Smelkov authored
      We are currently querying it in instance.cfg and later, once again, in e.g. instance-enb.jinja2.cfg .
      
      However ORS mode will need to adjust slapparameter_dict with ORS defaults
      and pass it further to generic enb. So it won't work if we use
      slapparameter_dict obtained the second time because the second query will
      return unadjusted original slapparameter_dict.
      
      In this patch we are only doing preparatory step - redo the code not query the
      master from instance-{enb,ue}.jinja2.cfg and work with slapparameter_dict and
      slap_configuration already queried by instance.cfg
      
      For UE the change is trivial.
      
      For eNB instance-enb.jinja2.cfg used to set the defaults for com, mme, amf and
      gtp in the same section used for the second query. We rework those defaults to
      be applied to slapparameter_dict via jinja2 - via the same way we are going to
      later use in ORS mode.
      
      Handling defaults for everything besides gtp_addr is straightforward. For
      gtp_addr it has the semantic difference when explicitly given, and given only
      implicitly. In the latter case the intent of original code is to autodetect
      whether to use an address on loopback, or externally-visible address.
      
      Original code used the check for emptiness of mme_list/amf_list as the
      condition for "use loopback". Since now those lists, after applying their
      defaults, are never empty we rework the code to see if core address is on the
      loopback or not, and use auto-GTP-on-loopback only if core is also on loopback.
      This should, hopefully, be more convenient as it also works ok out of the box
      if core is on loopback, but its address was explicitly specified. Previously
      for such cases gtp_addr was also needed to be specified, and now it should work
      without that.
      
      No change to rendered enb.cfg and gnb.cfg besides whitespace.
      
      Adjust ipv6-random usage in core-network for consistency with enb as well.
      2149bc2d
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb: dnsmasq-service :port and :ip are unused and misleading · 86e9a774
      Kirill Smelkov authored
      For example it is the port that is setup in ru/dnsmasq.jinja2.cfg that is used,
      not :port and there it is 5354, i.e. different. :ip is also not used anywhere.
      
      -> Remove them to avoid confusion.
      86e9a774
    • 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+ue: Make ru_type and do_lte/do_nr to be accessible at instance level · fbb0d0c1
      Kirill Smelkov authored
      Not only inside rendered enb.jinja2.cfg and ue.jinja2.cfg because we will need
      that information in slaplte and slaplte is imported by instance-enb and
      instance-ue.
      fbb0d0c1
    • Kirill Smelkov's avatar
      software/ors-amarisoft: enb+ue: Stop using slap_configuration to propagate LTE and NR defaults · 563a21ca
      Kirill Smelkov authored
      instance-enb and instance-ue currently setup that slap_configuration with
      LTE/NR defaults to be accessible from enb.jinja2.cfg and ue.jinja2.cfg. But we
      will soon need to have access to those defaults from slaplte.jinja2 as well,
      and it will break if left as is because when slaplte is imported from e.g.
      enb.jinja2 - it will work, but when slaplte is imported from instance-enb it
      will break because parent of instance-enb (instance.cfg) does not setup
      defaults in slap_configuration at that level.
      
      The fix is to either duplicate slap_configuration at instance.cfg level, or to
      switch access to the defaults to go via original default_* parameters.
      
      We go the second way for simplicity.
      563a21ca
    • 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: enb.jinja2.cfg: Inline cell.bandwidth for now · 4bd14aff
      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.
      4bd14aff
    • 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