Commit 9d8e5003 authored by Joanne Hugé's avatar Joanne Hugé

simpleran: fix amarisoft version

User is still allowed to input a hidden parameter
to change the version
parent 6494727b
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = bb6cb40fe200d03435c5c5eae27af958 md5sum = aa7feb77723afc25bb9403179d6a3f0f
[template-ors] [template-ors]
filename = instance-ors.cfg filename = instance-ors.cfg
md5sum = 8c2abee8eb0a538ad8ae1a84e140af69 md5sum = 1bcf1d10fdcc7f77172b93bf2c50241f
[slaplte.jinja2] [slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2 _update_hash_filename_ = slaplte.jinja2
...@@ -36,7 +36,7 @@ md5sum = 0a3a1ecde45a898502f1c66cb26b7d91 ...@@ -36,7 +36,7 @@ md5sum = 0a3a1ecde45a898502f1c66cb26b7d91
[ru_libinstance.jinja2.cfg] [ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg _update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = e436824a4325636fcd479b9711a94044 md5sum = babef867c5744649a7e3e6c99f390663
[ru_sdr_libinstance.jinja2.cfg] [ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg _update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
...@@ -60,7 +60,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e ...@@ -60,7 +60,7 @@ md5sum = 52da9fe3a569199e35ad89ae1a44c30e
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = b116b58365600f12129d458750b57c71 md5sum = 825c912044fdb5c48f36d092db4170f3
[template-ors-enb] [template-ors-enb]
_update_hash_filename_ = instance-ors-enb.jinja2.cfg _update_hash_filename_ = instance-ors-enb.jinja2.cfg
...@@ -72,11 +72,11 @@ md5sum = f4389a92fb111447e7976e452db78607 ...@@ -72,11 +72,11 @@ md5sum = f4389a92fb111447e7976e452db78607
[template-core-network] [template-core-network]
_update_hash_filename_ = instance-core-network.jinja2.cfg _update_hash_filename_ = instance-core-network.jinja2.cfg
md5sum = dab992c02a363e00cdc86f102a7ae489 md5sum = 87a40b4ebd3baf19771e74bb78d85bcb
[template-ue] [template-ue]
_update_hash_filename_ = instance-ue.jinja2.cfg _update_hash_filename_ = instance-ue.jinja2.cfg
md5sum = 0c387a13a57f7270595b74e11be8eb36 md5sum = 1686588ab92d7c9a4bd24402edd0c888
[template-obsolete] [template-obsolete]
_update_hash_filename_ = instance-obsolete.jinja2.cfg _update_hash_filename_ = instance-obsolete.jinja2.cfg
...@@ -108,7 +108,7 @@ md5sum = 9dbd93036c15c87c6de74b88b34062b6 ...@@ -108,7 +108,7 @@ md5sum = 9dbd93036c15c87c6de74b88b34062b6
[mme.jinja2.cfg] [mme.jinja2.cfg]
filename = config/mme.jinja2.cfg filename = config/mme.jinja2.cfg
md5sum = b86f0e7a0d890771d56aee22838d6487 md5sum = d1df6c004ca74330699969818aec3252
[dnsmasq-core-network.jinja2.cfg] [dnsmasq-core-network.jinja2.cfg]
filename = config/dnsmasq-core-network.jinja2.cfg filename = config/dnsmasq-core-network.jinja2.cfg
......
...@@ -68,14 +68,12 @@ ...@@ -68,14 +68,12 @@
fifteen_bearers: false, fifteen_bearers: false,
{%- if support_ims == 'True' %}
ims_list: [ ims_list: [
{ {
ims_addr: "{{ slap_configuration['configuration.ims_addr'] }}", ims_addr: "{{ slap_configuration['configuration.ims_addr'] }}",
bind_addr: "{{ slap_configuration['configuration.ims_bind'] }}", bind_addr: "{{ slap_configuration['configuration.ims_bind'] }}",
} }
], ],
{%- endif %}
pdn_list: [ pdn_list: [
{ {
...@@ -101,7 +99,6 @@ ...@@ -101,7 +99,6 @@
}, },
], ],
}, },
{%- if support_ims == 'True' %}
{ {
access_point_name: "ims", access_point_name: "ims",
pdn_type: "ipv4v6", pdn_type: "ipv4v6",
...@@ -126,7 +123,6 @@ ...@@ -126,7 +123,6 @@
}, },
], ],
}, },
{%- endif %}
], ],
tun_setup_script: "{{ ifup_empty }}", tun_setup_script: "{{ ifup_empty }}",
......
{%- if lte_version|replace("-", "")|int < 20240502 %} {%- set amarisoft_version = slapparameter_dict.setdefault("amarisoft_version", amarisoft['version']) %}
{%- set support_ims = false %} {%- set amarisoft_dir = slapparameter_dict.setdefault("amarisoft_dir", amarisoft['dir']) %}
{%- else %} {%- set amarisoft_path = amarisoft_dir + "/v" + amarisoft_version %}
{%- set support_ims = true %}
{%- endif %}
{%- set dns_slave_instance_list = [] %} {%- set dns_slave_instance_list = [] %}
{%- set sim_slave_instance_list = [] %} {%- set sim_slave_instance_list = [] %}
...@@ -78,9 +76,7 @@ parts = ...@@ -78,9 +76,7 @@ parts =
mme-service mme-service
ims-config ims-config
mt-call-config mt-call-config
{%- if support_ims %}
ims-service ims-service
{%- endif %}
monitor-base monitor-base
check-interface-up.py check-interface-up.py
publish-connection-information publish-connection-information
...@@ -156,7 +152,7 @@ inline = ...@@ -156,7 +152,7 @@ inline =
(echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting IMS software..." && echo) >> ${:ims-log}; (echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting IMS software..." && echo) >> ${:ims-log};
tail -c 1M ${:ims-log} > ${:ims-log}.tmp; tail -c 1M ${:ims-log} > ${:ims-log}.tmp;
mv ${:ims-log}.tmp ${:ims-log}; mv ${:ims-log}.tmp ${:ims-log};
{{ ims }}/lteims ${directory:etc}/ims.cfg >> ${:ims-log} 2>> ${:ims-log}; {{ amarisoft_path }}/{{ amarisoft['ims_dir'] }}/lteims ${directory:etc}/ims.cfg >> ${:ims-log} 2>> ${:ims-log};
{% endif %} {% endif %}
### IMS ### IMS
...@@ -173,7 +169,7 @@ hash-files = ...@@ -173,7 +169,7 @@ hash-files =
${ims-sh-wrapper:output} ${ims-sh-wrapper:output}
environment = environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft AMARISOFT_PATH={{ amarisoft_dir }}/{{ amarisoft['license_dir'] }}
[mme-sh-wrapper] [mme-sh-wrapper]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -182,12 +178,12 @@ mme-log = ${directory:log}/mme-output.log ...@@ -182,12 +178,12 @@ mme-log = ${directory:log}/mme-output.log
inline = inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %} {% if not slapparameter_dict.get("testing", False) %}
sudo -n /opt/amarisoft/init-mme; sudo -n {{ amarisoft_dir }}/init-mme;
rm -f ${directory:var}/lte_ue.db; rm -f ${directory:var}/lte_ue.db;
(echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting MME software..." && echo) >> ${:mme-log}; (echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting MME software..." && echo) >> ${:mme-log};
tail -c 1M ${:mme-log} > ${:mme-log}.tmp; tail -c 1M ${:mme-log} > ${:mme-log}.tmp;
mv ${:mme-log}.tmp ${:mme-log}; mv ${:mme-log}.tmp ${:mme-log};
{{ mme }}/ltemme ${directory:etc}/mme.cfg >> ${:mme-log} 2>> ${:mme-log}; {{ amarisoft_path }}/{{ amarisoft['mme_dir'] }}/ltemme ${directory:etc}/mme.cfg >> ${:mme-log} 2>> ${:mme-log};
{% endif %} {% endif %}
### MME ### MME
...@@ -205,7 +201,7 @@ hash-files = ...@@ -205,7 +201,7 @@ hash-files =
${mme-sh-wrapper:output} ${mme-sh-wrapper:output}
environment = environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib LD_LIBRARY_PATH={{ openssl_location }}/lib:{{ nghttp2_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft AMARISOFT_PATH={{ amarisoft_dir }}/{{ amarisoft['license_dir'] }}
### EMPTY mme-ifup script ### EMPTY mme-ifup script
[mme-ifup-empty] [mme-ifup-empty]
...@@ -269,8 +265,6 @@ context = ...@@ -269,8 +265,6 @@ context =
<= config-base <= config-base
url = {{ mme_template }} url = {{ mme_template }}
output = ${directory:etc}/mme.cfg output = ${directory:etc}/mme.cfg
extra-context =
raw support_ims {{ support_ims }}
{% if slapparameter_dict.get("local_domain", '') %} {% if slapparameter_dict.get("local_domain", '') %}
[dnsmasq-config] [dnsmasq-config]
...@@ -321,15 +315,12 @@ password = {{ slapparameter_dict['monitor-password'] | string }} ...@@ -321,15 +315,12 @@ password = {{ slapparameter_dict['monitor-password'] | string }}
[publish-connection-information] [publish-connection-information]
<= monitor-publish <= monitor-publish
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
{%- if support_ims %}
ims = Enabled
{%- else %}
ims = Unsupported (Amarisoft version >= 2024-05-02 is required), 5G may not work with your UE
{%- endif %}
core-network-ipv6 = {{ my_ipv6 }} core-network-ipv6 = {{ my_ipv6 }}
core-network-ipv4 = {{ lan_ipv4 }} core-network-ipv4 = {{ lan_ipv4 }}
amarisoft-version = {{ lte_version }} amarisoft-version = {{ amarisoft_version}}
license-expiration = {{ lte_expiration }} amarisoft-host-id = {{ amarisoft['lteenb_host_id'] }}
amarisoft-available-versions = {{ amarisoft['version_installed'] }}
license-expiration = {{ amarisoft['ltemme_expiration'] }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
sim-list = {{ imsi_list | join(', ') }} sim-list = {{ imsi_list | join(', ') }}
......
# instance-enb implements eNB/gNB service. # instance-enb implements eNB/gNB service.
{%- set amarisoft_version = slapparameter_dict.setdefault("amarisoft_version", amarisoft['version']) %}
{%- set amarisoft_dir = slapparameter_dict.setdefault("amarisoft_dir", amarisoft['dir']) %}
{%- set amarisoft_path = amarisoft_dir + "/v" + amarisoft_version %}
{#- defaults for global eNB/gNB parameters. {#- defaults for global eNB/gNB parameters.
TODO automatically load enb defaults from JSON schema #} TODO automatically load enb defaults from JSON schema #}
{%- set enb_defaults = { {%- set enb_defaults = {
...@@ -104,15 +108,14 @@ inline = ...@@ -104,15 +108,14 @@ inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %} {% if not slapparameter_dict.get("testing", False) %}
# Amarisoft init scripts # Amarisoft init scripts
sudo -n /opt/amarisoft/rm-tmp-lte sudo -n {{ amarisoft_dir }}/rm-tmp-lte
sudo -n /opt/amarisoft/init-sdr sudo -n {{ amarisoft_dir }}/init-sdr {{ amarisoft_path }}
sudo -n /opt/amarisoft/init-enb sudo -n {{ amarisoft_dir }}/init-enb
# Add useful information to enb-info log # Add useful information to enb-info log
(echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting eNB software...") >> ${:enb-info-log} (echo && echo && date "+[%Y/%m/%d %T.%N %Z] Starting eNB software...") >> ${:enb-info-log}
(echo -n "PCB: " ; for o in t b v s ; do sudo -n /opt/amarisoft/get-sdr-info -$o 2> /dev/null ; echo -n " " ; done ; echo) >> ${:enb-info-log} (echo -n "PCB: " ; for o in t b v s ; do sudo -n {{ amarisoft['sdr_dir'] }}/get-sdr-info -$o 2> /dev/null ; echo -n " " ; done ; echo) >> ${:enb-info-log}
(AMARISOFT_PATH=/dev/null {{ enb }}/lteenb ${directory:etc}/enb.cfg 2>&1 >/dev/null | sed -n 's/^.*\(Host ID.*\)$/\1/gp') >> ${:enb-info-log}
echo "System info: $(uname -a)" >> ${:enb-info-log} echo "System info: $(uname -a)" >> ${:enb-info-log}
({{ sdr }}/sdr_util version && echo) >> ${:enb-info-log} ({{ amarisoft_path }}/{{ amarisoft['sdr_dir'] }}/sdr_util version && echo) >> ${:enb-info-log}
# Remove obsolete logs # Remove obsolete logs
rm -f ${directory:log}/enb-2024* rm -f ${directory:log}/enb-2024*
rm -f ${directory:log}/gnb* rm -f ${directory:log}/gnb*
...@@ -129,7 +132,7 @@ inline = ...@@ -129,7 +132,7 @@ inline =
tail -c 100M ${:enb-info-archive-log} > ${:enb-info-archive-log}.tmp tail -c 100M ${:enb-info-archive-log} > ${:enb-info-archive-log}.tmp
mv ${:enb-info-archive-log}.tmp ${:enb-info-archive-log} mv ${:enb-info-archive-log}.tmp ${:enb-info-archive-log}
# Launch lteenb # Launch lteenb
{{ enb }}/lteenb ${directory:etc}/enb.cfg >> ${:enb-info-log} 2>> ${:enb-info-log} {{ amarisoft_path }}/{{ amarisoft['enb_dir'] }}/lteenb ${directory:etc}/enb.cfg >> ${:enb-info-log} 2>> ${:enb-info-log}
{% endif %} {% endif %}
[enb-service] [enb-service]
...@@ -144,7 +147,7 @@ hash-files = ...@@ -144,7 +147,7 @@ hash-files =
${enb-sh-wrapper:output} ${enb-sh-wrapper:output}
environment = environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib LD_LIBRARY_PATH={{ openssl_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft AMARISOFT_PATH={{ amarisoft_dir }}/{{ amarisoft['license_dir'] }}
[xamari-xlog-script] [xamari-xlog-script]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -170,6 +173,19 @@ wrapper-path = ${directory:service}/${:_buildout_section_name_} ...@@ -170,6 +173,19 @@ wrapper-path = ${directory:service}/${:_buildout_section_name_}
command-line = ${xamari-xlog-script:output} command-line = ${xamari-xlog-script:output}
hash-files = ${:command-line} hash-files = ${:command-line}
[request-parameters]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Wendelin Telecom Registration
software-url = {{ slapparameter_dict.wendelin_telecom_software_release_url }}
shared = true
{%- if not slapparameter_dict.xlog_forwarding_enabled or slapparameter_dict.get("xlog_fluentbit_forward_host") %}
state = destroyed
{%- else %}
config-fluentbit-tag = ${xlog-fluentbit-tag:xlog-fluentbit-tag}
return = gateway-host
{%- endif %}
[request-wendelin-telecom-shared] [request-wendelin-telecom-shared]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:requestoptional recipe = slapos.cookbook:requestoptional
...@@ -307,8 +323,10 @@ websocket-port = 443 ...@@ -307,8 +323,10 @@ websocket-port = 443
websocket-password = ${websocket-password:passwd} websocket-password = ${websocket-password:passwd}
enb-ipv6 = {{ my_ipv6 }} enb-ipv6 = {{ my_ipv6 }}
enb-ipv4 = {{ lan_ipv4 }} enb-ipv4 = {{ lan_ipv4 }}
amarisoft-version = {{ lte_version }} amarisoft-version = {{ amarisoft['version'] }}
license-expiration = {{ lte_expiration }} amarisoft-host-id = {{ amarisoft['lteenb_host_id'] }}
amarisoft-available-versions = {{ amarisoft['version_installed'] }}
license-expiration = {{ amarisoft['lteenb_expiration'] }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
ru-list = {{ dumps(rulib.iru_dict.keys() | sort) }} ru-list = {{ dumps(rulib.iru_dict.keys() | sort) }}
cell-list = {{ dumps(rulib.icell_dict.keys() | sort) }} cell-list = {{ dumps(rulib.icell_dict.keys() | sort) }}
......
...@@ -48,6 +48,7 @@ import-list += ...@@ -48,6 +48,7 @@ import-list +=
[ors-version] [ors-version]
recipe = slapos.recipe.build recipe = slapos.recipe.build
configuration = $${slap-configuration:configuration} configuration = $${slap-configuration:configuration}
sdr-dir = $${sdr:dir}
init = init =
import subprocess import subprocess
range_map = { range_map = {
...@@ -168,7 +169,7 @@ init = ...@@ -168,7 +169,7 @@ init =
if options['configuration'].get('testing', False): if options['configuration'].get('testing', False):
return {'t': 'TDD', 'b': 'B39', 'v': '4.2', 's': 'B53'}[cmd].encode() return {'t': 'TDD', 'b': 'B39', 'v': '4.2', 's': 'B53'}[cmd].encode()
return subprocess.check_output( return subprocess.check_output(
["sudo", "-n", "/opt/amarisoft/get-sdr-info", "-" + cmd] ["sudo", "-n", options['sdr-dir'] + "/get-sdr-info", "-" + cmd]
) )
version = get_sdr_info('v').decode() version = get_sdr_info('v').decode()
options['version'] = float(version) if version != 'UNKNOWN' else 0 options['version'] = float(version) if version != 'UNKNOWN' else 0
......
# instance-ue implements UEsim service. # instance-ue implements UEsim service.
#
{%- set amarisoft_version = slapparameter_dict.setdefault("amarisoft_version", amarisoft['version']) %}
{%- set amarisoft_dir = slapparameter_dict.setdefault("amarisoft_dir", amarisoft['dir']) %}
{%- set amarisoft_path = amarisoft_dir + "/v" + amarisoft_version %}
{#- defaults for global UE parameters. {#- defaults for global UE parameters.
TODO automatically load ue defaults from JSON schema #} TODO automatically load ue defaults from JSON schema #}
{%- set ue_defaults = { {%- set ue_defaults = {
...@@ -77,9 +81,9 @@ ue-start-date = ${directory:run}/enb-start.date ...@@ -77,9 +81,9 @@ ue-start-date = ${directory:run}/enb-start.date
inline = inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %} {% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true; sudo {{ amarisoft_dir }}/rm-tmp-lte | true;
sudo -n /opt/amarisoft/init-sdr; sudo -n {{ amarisoft_dir }}/init-sdr {{ amarisoft_path }};
sudo -n /opt/amarisoft/init-ue; sudo -n {{ amarisoft_dir }}/init-ue;
stat ${:ue-start-date} && mv ${:ue-radio-log} ${directory:log}/ue-$(cat ${:ue-start-date}).log stat ${:ue-start-date} && mv ${:ue-radio-log} ${directory:log}/ue-$(cat ${:ue-start-date}).log
rm -f $(ls -1t ${directory:log}/ue-2* | tail -n+50) rm -f $(ls -1t ${directory:log}/ue-2* | tail -n+50)
date +"%Y-%m-%d-%T" > ${:ue-start-date} date +"%Y-%m-%d-%T" > ${:ue-start-date}
...@@ -87,9 +91,9 @@ inline = ...@@ -87,9 +91,9 @@ inline =
tail -c 1M ${:ue-log} > ${:ue-log}.tmp; tail -c 1M ${:ue-log} > ${:ue-log}.tmp;
mv ${:ue-log}.tmp ${:ue-log}; mv ${:ue-log}.tmp ${:ue-log};
{%- if ors %} {%- if ors %}
echo "power_on" | sudo -n {{ ue }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log}; echo "power_on" | sudo -n {{ amarisoft_path }}/{{ amarisoft['ue_dir'] }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log};
{%- else %} {%- else %}
{{ ue }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log}; {{ amarisoft_path }}/{{ amarisoft['ue_dir'] }}/lteue ${directory:etc}/ue.cfg >> ${:ue-log} 2>> ${:ue-log};
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
...@@ -106,7 +110,7 @@ hash-files = ...@@ -106,7 +110,7 @@ hash-files =
${lte-ue-sh-wrapper:output} ${lte-ue-sh-wrapper:output}
environment = environment =
LD_LIBRARY_PATH={{ openssl_location }}/lib LD_LIBRARY_PATH={{ openssl_location }}/lib
AMARISOFT_PATH=/opt/amarisoft/.amarisoft AMARISOFT_PATH={{ amarisoft_dir }}/{{ amarisoft['license_dir'] }}
[config-base] [config-base]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
...@@ -80,37 +80,56 @@ init = ...@@ -80,37 +80,56 @@ init =
assert 'xbuildout' not in sys.modules assert 'xbuildout' not in sys.modules
sys.modules['xbuildout'] = xbuildout sys.modules['xbuildout'] = xbuildout
[sdr]
recipe = slapos.recipe.build
dir = /opt/sdr
init =
pass
[amarisoft] [amarisoft]
recipe = slapos.recipe.build recipe = slapos.recipe.build
fixed_version = 2024-11-21.1732633257
configuration = $${slap-configuration:configuration}
init = init =
import os, re import os, re
# Set Amarisoft directory
options['dir'] = options['configuration'].get('amarisoft_dir', '/opt/amarisoft')
# Get Available Amarisoft versions
options['version_installed'] = ', '.join(filter(lambda x: re.match(r"v[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{10}", x), os.listdir(options['dir'])))
# Set Amarisoft version to use
slapconf_version = options['configuration'].get('amarisoft_version', False)
if slapconf_version and \
slapconf_version in options['version_installed']:
options['version'] = slapconf_version
else:
options['version'] = options['fixed_version']
# Set Binaries and license directories
binary_dir = options['dir'] + "/v" + options['version'].
options['license_dir'] = options['dir'] + '/.amarisoft'
options['sdr_dir'] = options['binary_dir'] + '/trx_sdr'
options['enb_dir'] = options['binary_dir'] + '/enb'
options['mme_dir'] = options['binary_dir'] + '/mme'
options['ims_dir'] = options['binary_dir'] + '/mme'
options['ue_dir'] = options['binary_dir'] + '/ue'
# Get License expiration and host IDs
options.update({'lteenb_expiration': 'Unknown', 'ltemme_expiration': 'Unknown'})
options.update({'lteenb_host_id': 'Unknown', 'ltemme_host_id': 'Unknown'})
try: try:
lte_version = sorted(filter(lambda x: re.match(r"v[0-9]{4}-[0-9]{2}-[0-9]{2}", x), os.listdir('/opt/amarisoft')))[-1][1:] for filename in os.listdir(options['license_dir']):
except FileNotFoundError:
lte_version = 'LTEVERSION'
path = "/opt/amarisoft/v" + lte_version
options['lte-version'] = lte_version
options['path'] = path
options['sdr'] = path + "/trx_sdr"
options['enb'] = path + "/enb"
options['mme'] = path + "/mme"
options['ims'] = path + "/mme"
options['ue'] = path + "/ue"
import os
lte_expiration = "Unknown"
amarisoft_dir = '/opt/amarisoft/.amarisoft'
try:
for filename in os.listdir(amarisoft_dir):
if filename.endswith('.key'): if filename.endswith('.key'):
with open(os.path.join(amarisoft_dir, filename), 'r') as f: with open(os.path.join(options['license_dir'], filename), 'r') as f:
f.seek(260) f.seek(260)
for l in f: for l in f:
if l.startswith('host_id='):
host_id = l.split('=')[1].strip()
if l.startswith('product_id='):
product_id = l.split('=')[1].strip()
if l.startswith('version='): if l.startswith('version='):
lte_expiration = l.split('=')[1].strip() expiration = l.split('=')[1].strip()
options[product_id + '_expiration'] = expiration
options[product_id + '_host_id'] = host_id
except FileNotFoundError: except FileNotFoundError:
pass pass
options['lte-expiration'] = lte_expiration
[lan-ip] [lan-ip]
recipe = slapos.recipe.build recipe = slapos.recipe.build
...@@ -151,10 +170,7 @@ extra-context = ...@@ -151,10 +170,7 @@ extra-context =
raw monitor_template ${monitor2-template:output} raw monitor_template ${monitor2-template:output}
section comp_id comp-id section comp_id comp-id
section slap_configuration slap-configuration section slap_configuration slap-configuration
key lte_version amarisoft:lte-version section amarisoft amarisoft
key lte_expiration amarisoft:lte-expiration
key enb amarisoft:enb
key sdr amarisoft:sdr
raw enb_template ${enb.jinja2.cfg:target} raw enb_template ${enb.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target} raw slaplte_template ${slaplte.jinja2:target}
raw drb_lte_template ${drb_lte.jinja2.cfg:target} raw drb_lte_template ${drb_lte.jinja2.cfg:target}
...@@ -178,10 +194,7 @@ filename = instance-core-network.cfg ...@@ -178,10 +194,7 @@ filename = instance-core-network.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
raw monitor_template ${monitor2-template:output} raw monitor_template ${monitor2-template:output}
key lte_version amarisoft:lte-version section amarisoft amarisoft
key lte_expiration amarisoft:lte-expiration
key mme amarisoft:mme
key ims amarisoft:ims
raw mme_template ${mme.jinja2.cfg:target} raw mme_template ${mme.jinja2.cfg:target}
raw dnsmasq_template ${dnsmasq-core-network.jinja2.cfg:target} raw dnsmasq_template ${dnsmasq-core-network.jinja2.cfg:target}
raw ims_template ${ims.jinja2.cfg:target} raw ims_template ${ims.jinja2.cfg:target}
...@@ -202,13 +215,11 @@ filename = instance-ue.cfg ...@@ -202,13 +215,11 @@ filename = instance-ue.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
section slap_configuration slap-configuration section slap_configuration slap-configuration
section amarisoft amarisoft
raw monitor_template ${monitor2-template:output} raw monitor_template ${monitor2-template:output}
key ue amarisoft:ue
key sdr amarisoft:sdr
raw ue_template ${ue.jinja2.cfg:target} raw ue_template ${ue.jinja2.cfg:target}
raw slaplte_template ${slaplte.jinja2:target} raw slaplte_template ${slaplte.jinja2:target}
raw openssl_location ${openssl:location} raw openssl_location ${openssl:location}
raw ru_amarisoft_stats_template ${ru_amarisoft-stats.jinja2.py: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 ru_amarisoft_rf_info_template ${ru_amarisoft-rf-info.jinja2.py:target}
raw ru_tapsplit ${ru_tapsplit:target} raw ru_tapsplit ${ru_tapsplit:target}
......
...@@ -196,7 +196,7 @@ hash-files = ...@@ -196,7 +196,7 @@ hash-files =
{%- for (i, n) in enumerate(ru.sdr_dev_list) %} {%- for (i, n) in enumerate(ru.sdr_dev_list) %}
{{ promise('%s-sdr-busy%s' % (ru_ref, '-%d' % (i+1) if i > 0 else '')) }} {{ promise('%s-sdr-busy%s' % (ru_ref, '-%d' % (i+1) if i > 0 else '')) }}
promise = check_sdr_busy promise = check_sdr_busy
config-sdr = {{ sdr }} config-sdr = {{ amarisoft['sdr_dir'] }}
config-sdr_dev = {{ n }} config-sdr_dev = {{ n }}
config-dma_chan = 0 config-dma_chan = 0
{%- endfor %} {%- endfor %}
...@@ -204,7 +204,7 @@ config-dma_chan = 0 ...@@ -204,7 +204,7 @@ config-dma_chan = 0
{%- elif ru.ru_link_type == 'cpri' %} {%- elif ru.ru_link_type == 'cpri' %}
{{ promise('%s-sdr-busy' % ru_ref) }} {{ promise('%s-sdr-busy' % ru_ref) }}
promise = check_sdr_busy promise = check_sdr_busy
config-sdr = {{ sdr }} config-sdr = {{ amarisoft['sdr_dir'] }}
config-sdr_dev = {{ ru.cpri_link.sdr_dev }} config-sdr_dev = {{ ru.cpri_link.sdr_dev }}
config-dma_chan = {{ ru.cpri_link.sfp_port }} config-dma_chan = {{ ru.cpri_link.sfp_port }}
......
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