Commit f877ed2c authored by Kirill Smelkov's avatar Kirill Smelkov

software/ors-amarisoft: Merge instance-ue-lte.jinja2.cfg +...

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 !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
```
parent 052606f2
Pipeline #32436 failed with stage
in 0 seconds
......@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum = a6c6075e138c2fa4400077acab7c015c
md5sum = f0c42061acf3f89c70d258c74c6af9fc
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
......@@ -90,13 +90,9 @@ md5sum = 86f305a1daa83aa3b663388d12242764
_update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = c807be73b9304f5a4c7483a3776bbc17
[template-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg
md5sum = e2cc2c3133ea45146963ae231d49be8d
[template-ue-nr]
_update_hash_filename_ = instance-ue-nr.jinja2.cfg
md5sum = d541f5b2b4a2de9422748836cc11269d
[template-ue]
_update_hash_filename_ = instance-ue.jinja2.cfg
md5sum = d8153dd5e0978afea018498b29f06fd5
[template-obsolete]
_update_hash_filename_ = instance-obsolete.jinja2.cfg
......
[buildout]
parts =
directory
lte-ue-nr-config
lte-ue-service
check-sdr-busy.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.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_nr_imsi = {{ default_nr_imsi }}
configuration.default_nr_k = {{ default_nr_k }}
[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("ue_nr_config_link", None) %}
[ue-nr-config-dl]
recipe = slapos.recipe.build:download
url = {{ slapparameter_dict.get("ue_nr_config_link") }}
version = {{ slapparameter_dict.get("ue_nr_config_version") }}
offline = false
{% endif %}
[lte-ue-sh-wrapper]
recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
ue-log = ${directory:log}/ue-output.log
inline =
#!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true;
(echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting UE software..." && echo) >> ${:ue-log};
tail -c 1M ${:ue-log} > ${:ue-log}.tmp;
mv ${:ue-log}.tmp ${:ue-log};
{{ ue }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log};
{% endif %}
### User Equipment (UE)
[lte-ue-service]
recipe = slapos.cookbook:wrapper
command-line = ${lte-ue-sh-wrapper:output}
wrapper-path = ${directory:service}/lte-ue
mode = 0775
reserve-cpu = True
pidfile = ${directory:run}/ue.pid
hash-files =
${lte-ue-nr-config:output}
${lte-ue-sh-wrapper:output}
environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft
[config-base]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
context =
section directory directory
section slap_configuration slap-configuration
section pub_info publish-connection-information
key slapparameter_dict slap-configuration:configuration
json do_lte false
json do_nr true
[lte-ue-nr-config]
<= config-base
{% 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
rue_bind_addr = ${slap-configuration:ipv6-random}
com_addr = [${slap-configuration:ipv6-random}]:9002
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
{#- rat indicates with which mode ue is instantiated with - lte | nr #}
{%- set rat = slap_configuration['slap-software-type'] .removeprefix('ue-') %}
{%- do assert(rat in ('lte', 'nr'), rat) %}
[buildout]
parts =
directory
lte-ue-lte-config
lte-ue-config
lte-ue-service
check-sdr-busy.py
monitor-base
......@@ -36,10 +40,13 @@ 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_nr_imsi = {{ default_nr_imsi }}
configuration.default_lte_k = {{default_lte_k}}
configuration.default_nr_k = {{ default_nr_k }}
[directory]
recipe = slapos.cookbook:mkdirectory
......@@ -56,11 +63,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_config_link", None) %}
[ue-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_config_link") }}
version = {{ slapparameter_dict.get("ue_config_version") }}
offline = false
{% endif %}
......@@ -87,7 +94,7 @@ mode = 0775
reserve-cpu = True
pidfile = ${directory:run}/ue.pid
hash-files =
${lte-ue-lte-config:output}
${lte-ue-config:output}
${lte-ue-sh-wrapper:output}
environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib
......@@ -101,13 +108,18 @@ context =
section slap_configuration slap-configuration
section pub_info publish-connection-information
key slapparameter_dict slap-configuration:configuration
{%- if rat == 'lte' %}
json do_lte true
json do_nr false
{%- elif rat == 'nr' %}
json do_lte false
json do_nr true
{%- endif %}
[lte-ue-lte-config]
[lte-ue-config]
<= config-base
{% if slapparameter_dict.get("ue_lte_config_link", None) %}
url = ${ue-lte-config-dl:target}
{% if slapparameter_dict.get("ue_config_link", None) %}
url = ${ue-config-dl:target}
{% else %}
url = {{ ue_template }}
{% endif %}
......
......@@ -245,8 +245,8 @@ recipe = slapos.cookbook:switch-softwaretype
enb = dynamic-template-enb:output
gnb = dynamic-template-gnb:output
core-network = dynamic-template-core-network:output
ue-lte = dynamic-template-ue-lte:output
ue-nr = dynamic-template-ue-nr:output
ue-lte = dynamic-template-ue:output
ue-nr = dynamic-template-ue:output
RootSoftwareInstance = $${:core-network}
obsolete = dynamic-template-obsolete:output
enb-epc = $${:obsolete}
......@@ -351,38 +351,25 @@ extra-context =
key ue_db_path ue-db-config:output
key slave_instance_list slap-configuration:slave-instance-list
[dynamic-template-ue-lte]
[dynamic-template-ue]
< = jinja2-template-base
url = ${template-ue-lte:target}
url = ${template-ue:target}
filename = instance-ue-lte.cfg
extensions = jinja2.ext.do
extra-context =
section slap_configuration slap-configuration
raw monitor_template ${monitor2-template:output}
key ue amarisoft:ue
key sdr amarisoft:sdr
raw ue_template ${ue.jinja2.cfg:target}
raw openssl_location ${openssl:location}
raw default_lte_bandwidth ${default-params:default-lte-bandwidth}
raw default_n_antenna_dl ${default-params:default-n-antenna-dl}
raw default_n_antenna_ul ${default-params:default-n-antenna-ul}
raw default_lte_imsi ${default-params:default-lte-imsi}
raw default_lte_k ${default-params:default-lte-k}
[dynamic-template-ue-nr]
< = jinja2-template-base
url = ${template-ue-nr:target}
filename = instance-ue-nr.cfg
extensions = jinja2.ext.do
extra-context =
raw monitor_template ${monitor2-template:output}
key ue amarisoft:ue
key sdr amarisoft:sdr
raw ue_template ${ue.jinja2.cfg:target}
raw openssl_location ${openssl:location}
raw default_nr_bandwidth ${default-params:default-nr-bandwidth}
raw default_n_antenna_dl ${default-params:default-n-antenna-dl}
raw default_n_antenna_ul ${default-params:default-n-antenna-ul}
raw default_lte_imsi ${default-params:default-lte-imsi}
raw default_nr_imsi ${default-params:default-nr-imsi}
raw default_lte_k ${default-params:default-lte-k}
raw default_nr_k ${default-params:default-nr-k}
[ue-db-config]
......
......@@ -65,10 +65,7 @@ url = ${:_profile_base_location_}/${:_update_hash_filename_}
[template-core-network]
<= download-base
[template-ue-lte]
<= download-base
[template-ue-nr]
[template-ue]
<= download-base
[template-obsolete]
......
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