Commit 503e50a4 authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Merge instance-gnb.jinja2.cfg into instance-enb.jinja2.cfg

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 !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) }}
```
parent f3f1cb46
......@@ -16,11 +16,11 @@
[template]
filename = instance.cfg
md5sum = c7579dbbf9da34bb832b92a93267015f
md5sum = fa81cd744e5a9382aa203c3777adc3a8
[template-ors]
filename = instance-ors.cfg
md5sum = 60ed8bb3bee3f9121fb179abd65cc70b
md5sum = 56a2c2b8245e86f3a8ed2eebeb8e88d9
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
......@@ -84,15 +84,11 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 460206ee7730098e1c324907f6fc16d8
md5sum = c8096440bfc2a1ed0e2821ef71e0bd1c
[template-ors-enb]
_update_hash_filename_ = instance-ors-enb.jinja2.cfg
md5sum = 204786f37ea8e34556facd044f201ed3
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = e718dd27f7f85ed9f4aaaaef767c8777
md5sum = f1e6e2fb8854482d570fc3eee4935f84
[template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg
......
{#- enb_mode indicates with which mode enb is instantiated with - enb | gnb #}
{%- set enb_mode = slap_configuration['slap-software-type'] %}
{%- do assert(enb_mode in ('enb', 'gnb'), enb_mode) %}
{#- defaults for 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 =
......@@ -53,9 +59,13 @@ 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 }}
......@@ -191,13 +201,20 @@ context =
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 }}
{%- if enb_mode == 'enb' %}
json do_lte true
json do_nr false
{%- elif enb_mode == 'gnb' %}
json do_lte false
json do_nr true
{%- endif %}
import netaddr netaddr
${:extra-context}
......@@ -208,7 +225,11 @@ output = ${directory:etc}/sib23.cfg
[drb-config]
<= config-base
{%- if enb_mode == 'enb' %}
url = {{ drb_lte_template }}
{%- elif enb_mode == 'gnb' %}
url = {{ drb_nr_template }}
{%- endif %}
output = ${directory:etc}/drb.cfg
[enb-config]
......@@ -236,7 +257,12 @@ websocket_url = ws://[${slap-configuration:ipv6-random}]:9001
{%- endif %}
enb-ipv6 = ${slap-configuration:ipv6-random}
enb-ipv4 = {{ lan_ipv4 }}
{%- if enb_mode == 'enb' %}
current-earfcn = {{ RF.dl_earfcn }}
{%- elif enb_mode == 'gnb' %}
current-nr-arfcn = {{ RF.dl_nr_arfcn }}
current-nr-band = {{ RF.nr_band }}
{%- endif %}
amarisoft-version = {{ lte_version }}
license-expiration = {{ lte_expiration }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......
{#- 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_nr_arfcn', slapparameter_dict.get('dl_nr_arfcn', 0)) %}
{%- do RF.setdefault('nr_band', slapparameter_dict.get('nr_band', 0)) %}
[buildout]
parts =
directory
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
extends = {{ monitor_template }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
partition = {{ slap_connection['partition-id'] }}
url = {{ slap_connection['server-url'] }}
key = {{ slap_connection['key-file'] }}
cert = {{ slap_connection['cert-file'] }}
configuration.com_ws_port = 9001
configuration.com_addr = 127.0.1.2
configuration.amf_addr = 127.0.1.100
configuration.gtp_addr = 127.0.1.1
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 }}
[directory]
recipe = slapos.cookbook:mkdirectory
software = {{ buildout_directory }}
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
etc = ${:home}/etc
bin = ${:home}/bin
tmp = ${:home}/tmp
run = ${:var}/run
script = ${:etc}/run
service = ${:etc}/service
promise = ${:etc}/promise
log = ${:var}/log
{% if slapparameter_dict.get("gnb_config_link", None) %}
[gnb-config-dl]
recipe = slapos.recipe.build:download
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_}
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 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}
wrapper-path = ${directory:service}/enb
mode = 0775
reserve-cpu = True
pidfile = ${directory:run}/enb.pid
hash-files =
${gnb-config:output}
${enb-sh-wrapper:output}
environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft
[xamari-xlog-script]
recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
period = {{ slapparameter_dict.get("gnb_stats_fetch_period", 60) }}
stats_logspec = stats[samples,rf]/${:period}s
{%- 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}
logspec = ${:stats_logspec} ${:drb_stats_logspec}
{% if slapparameter_dict.get("websocket_password", "") %}
websock = ws://[${slap-configuration:ipv6-random}]:9001
{% else %}
websock = ws://127.0.1.2:9001
{% endif %}
xamari = {{ buildout_directory }}/bin/xamari
logfile = ${monitor-directory:public}/gnb.xlog
inline =
#!/bin/sh
exec ${:xamari} xlog --rotate ${:rotatespec} ${:websock} ${:logfile} ${:logspec}
[xamari-xlog-service]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:service}/${:_buildout_section_name_}
command-line = ${xamari-xlog-script:output}
hash-files = ${:command-line}
{% if slapparameter_dict.get('xlog_fluentbit_forward_host') %}
[xlog-fluentbit-config]
recipe = slapos.recipe.template
output = ${directory:etc}/${:_buildout_section_name_}.cfg
logfile = ${xamari-xlog-script:logfile}
forward-host = {{ slapparameter_dict.get('xlog_fluentbit_forward_host', '') }}
forward-port = {{ slapparameter_dict.get('xlog_fluentbit_forward_port', '') }}
forward-shared-key = {{ slapparameter_dict.get('xlog_fluentbit_forward_shared_key', '') }}
forward-self-hostname = {{ comp_id['comp-id'] }}
inline =
[SERVICE]
flush 5
[INPUT]
name tail
path ${:logfile}
Read_from_Head True
[OUTPUT]
name forward
match *
Host ${:forward-host}
{%- if slapparameter_dict.get('xlog_fluentbit_forward_port') %}
Port ${:forward-port}
{%- endif %}
Shared_Key ${:forward-shared-key}
Self_Hostname ${:forward-self-hostname}
tls on
tls.verify off
[xlog-fluentbit-service]
recipe = slapos.cookbook:wrapper
fluentbit = {{ fluent_bit_location }}/bin/fluent-bit
fluentbit-config = ${xlog-fluentbit-config:output}
command-line = ${:fluentbit} -c ${:fluentbit-config}
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
extra-context =
context =
json ors false
section directory directory
section slap_configuration slap-configuration
key slapparameter_dict slap-configuration:configuration
key gtp_addr_v6 slap-configuration:ipv6-random
raw gtp_addr_v4 {{ lan_ipv4 }}
raw tx_gain {{ RF.tx_gain }}
raw rx_gain {{ RF.rx_gain }}
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 false
json do_nr true
import netaddr netaddr
${:extra-context}
[drb-config]
<= config-base
url = {{ drb_nr_template }}
output = ${directory:etc}/drb.cfg
[gnb-config]
<= config-base
{% if slapparameter_dict.get("gnb_config_link", None) %}
url = ${gnb-config-dl:target}
{% else %}
url = {{ enb_template }}
{% endif %}
output = ${directory:etc}/gnb.cfg
extra-context =
import json_module json
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 %}
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
[monitor-instance-parameter]
{% if slapparameter_dict.get("name", None) %}
monitor-title = {{ slapparameter_dict['name'] | string }}
{% endif %}
{% if slapparameter_dict.get("monitor-password", None) %}
password = {{ slapparameter_dict['monitor-password'] | string }}
{% endif %}
[macro.promise]
<= 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 = ${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) }}
......@@ -13,12 +13,27 @@
{%- do RF.setdefault('nr_band', ors_version['current-nr-band']) %}
# code of base enb/gnb
{% if enb_mode == 'enb' %}
{%- include 'instance-enb-base.jinja2.cfg' %}
{%- elif enb_mode == 'gnb' %}
{%- include 'instance-gnb-base.jinja2.cfg' %}
{#- backward compatibility: if ORS is running in gnb mode, and gnb_* parameters
are present, replace their generic enb_* counterparts with gnb_* ones #}
{%- if enb_mode == 'gnb' %}
{%- set _ = slapparameter_dict %}
{%- if 'gnb_config_link' in _ %}
{%- do _.update({
'enb_config_link': _.gnb_config_link,
'enb_config_version': _.get('gnb_config_version'),
}) %}
{%- endif %}
{%- if 'gnb_stats_fetch_period' in _ %}
{%- do _.update({'enb_stats_fetch_period': _.gnb_stats_fetch_period}) %}
{%- endif %}
{%- if 'gnb_drb_stats_enabled' in _ %}
{%- do _.update({'enb_drb_stats_enabled': _.gnb_drb_stats_enabled}) %}
{%- endif %}
{%- endif %}
# code of base enb
{% include 'instance-enb-base.jinja2.cfg' %}
# let all templates know we are running in ORS mode
......
......@@ -32,7 +32,6 @@ extra-context +=
section ors_version ors-version
import-list +=
rawfile instance-enb-base.jinja2.cfg ${template-enb:target}
rawfile instance-gnb-base.jinja2.cfg ${template-gnb:target}
[ors-version]
recipe = slapos.recipe.build
......
......@@ -105,7 +105,7 @@ init =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
enb = dynamic-template-enb:output
gnb = dynamic-template-gnb:output
gnb = dynamic-template-enb:output
core-network = dynamic-template-core-network:output
ue-lte = dynamic-template-ue:output
ue-nr = dynamic-template-ue:output
......@@ -157,33 +157,6 @@ extra-context =
raw openssh_location ${openssh:location}
raw openssh_output_keygen ${openssh-output:keygen}
[dynamic-template-gnb]
< = jinja2-template-base
url = ${template-gnb:target}
filename = instance-gnb.cfg
extensions = jinja2.ext.do
extra-context =
raw monitor_template ${monitor2-template:output}
json RF {}
section comp_id comp-id
key lte_version amarisoft:lte-version
key lte_expiration amarisoft:lte-expiration
key enb amarisoft:enb
key sdr amarisoft:sdr
raw enb_template ${enb.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target}
raw drb_nr_template ${drb_nr.jinja2.cfg:target}
raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py:target}
raw ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target}
raw openssl_location ${openssl:location}
raw default_nr_bandwidth ${default-params:default-nr-bandwidth}
raw default_nr_ssb_pos_bitmap ${default-params:default-nr-ssb-pos-bitmap}
raw default_nr_inactivity_timer ${default-params:default-nr-inactivity-timer}
raw default_n_antenna_dl ${default-params:default-n-antenna-dl}
raw default_n_antenna_ul ${default-params:default-n-antenna-ul}
raw python_path ${python3:location}
raw fluent_bit_location ${fluent-bit:location}
[dynamic-template-core-network]
< = jinja2-template-base
url = ${template-core-network:target}
......
......@@ -59,9 +59,6 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_}
[template-enb]
<= download-base
[template-gnb]
<= download-base
[template-core-network]
<= download-base
......
......@@ -177,7 +177,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -222,7 +222,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
......@@ -173,7 +173,7 @@ def test_enb_conf(self):
def test_gnb_conf1(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......@@ -218,7 +218,7 @@ def test_gnb_conf1(self):
def test_gnb_conf2(self):
conf_file = glob.glob(os.path.join(
self.slap.instance_directory, '*', 'etc', 'gnb.cfg'))[0]
self.slap.instance_directory, '*', 'etc', 'enb.cfg'))[0]
with open(conf_file, 'r') as f:
conf = yaml.load(f)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment