Commit ff1b2ca5 authored by Joanne Hugé's avatar Joanne Hugé

ors-amarisoft: Add tests

parent dddc13b0
Pipeline #23001 failed with stage
in 0 seconds
...@@ -24,7 +24,7 @@ md5sum = b10c10a9408a934052fd0960f31a75fc ...@@ -24,7 +24,7 @@ md5sum = b10c10a9408a934052fd0960f31a75fc
[template-lte-enb] [template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = c5a82279b6ada358c74a90c3b660bf55 md5sum = c450b8c307d20738a98bcb4f6ffeee16
[template-lte-gnb-epc] [template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg _update_hash_filename_ = instance-gnb-epc.jinja2.cfg
...@@ -36,11 +36,11 @@ md5sum = 2cfe5679374559ab94478b987d646d83 ...@@ -36,11 +36,11 @@ md5sum = 2cfe5679374559ab94478b987d646d83
[template-lte-gnb] [template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = eabbdb8ced563180f0bba8ca06e4bac4 md5sum = 9732653a0e2c7fe91d80da80762430d2
[template-lte-mme] [template-lte-mme]
_update_hash_filename_ = instance-mme.jinja2.cfg _update_hash_filename_ = instance-mme.jinja2.cfg
md5sum = 2c2d2dc4fd6b7a9100642e34812a5140 md5sum = 51b8762d4691f525d0228fa1f286e772
[ue_db.jinja2.cfg] [ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg filename = config/ue_db.jinja2.cfg
...@@ -48,7 +48,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149 ...@@ -48,7 +48,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
md5sum = 4b66551e04edff724b08d6bb90f7342c md5sum = faed74244d0c539dea53a0377ad0e103
[sib23.asn] [sib23.asn]
filename = config/sib23.asn filename = config/sib23.asn
...@@ -64,16 +64,16 @@ md5sum = 1ba2e065bdf14a6411e95e80db17dcfd ...@@ -64,16 +64,16 @@ md5sum = 1ba2e065bdf14a6411e95e80db17dcfd
[mme.jinja2.cfg] [mme.jinja2.cfg]
filename = config/mme.jinja2.cfg filename = config/mme.jinja2.cfg
md5sum = a96c33a0a2a301f204cac8642267ad97 md5sum = 0c1e086de705f074654a794a2248cad0
[ims.jinja2.cfg] [ims.jinja2.cfg]
filename = config/ims.jinja2.cfg filename = config/ims.jinja2.cfg
md5sum = 36281b03597252cf75169417d02fc28c md5sum = 36281b03597252cf75169417d02fc28c
[sdr-busy-promise] [sdr-busy-promise]
_update_hash_filename_ = promise/check_sdr_busy.py _update_hash_filename_ = promise/check_sdr_busy.jinja2.py
md5sum = f7436ff76fea58e37a401d4712275422 md5sum = 93dacb1da15310eb70d0815711a06cdf
[interface-up-promise] [interface-up-promise]
_update_hash_filename_ = promise/check_interface_up.py _update_hash_filename_ = promise/check_interface_up.jinja2.py
md5sum = 505efcbe04e717088924f2267b10c2b9 md5sum = 63d3bbac7b6f480ee0c510e80aa1ccf7
...@@ -56,9 +56,7 @@ ...@@ -56,9 +56,7 @@
{%- endif %} {%- endif %}
plmn: "{{ slapparameter_dict['plmn_list'][k]['plmn'] }}", plmn: "{{ slapparameter_dict['plmn_list'][k]['plmn'] }}",
reserved: {{ str(slapparameter_dict['plmn_list'][k].get('reserved', false)).lower() }}, reserved: {{ str(slapparameter_dict['plmn_list'][k].get('reserved', false)).lower() }},
{%- if slapparameter_dict['plmn_list'][k].get('attach_without_pdn', '') %} attach_without_pdn: {{ str(slapparameter_dict['plmn_list'][k].get('attach_without_pdn', false)).lower() }},
attach_without_pdn: {{ str(slapparameter_dict['plmn_list'][k]['attach_without_pdn']).lower() }},
{%- endif %}
} }
{%- endfor -%} {%- endfor -%}
{% else %} {% else %}
......
...@@ -51,15 +51,15 @@ ...@@ -51,15 +51,15 @@
pdn_list: [ pdn_list: [
{ {
pdn_type: "ipv4", pdn_type: "ipv4",
tun_ifname: "{{ slap_configuration['tun-name'] }}", tun_ifname: "{{ slap_configuration.get('tun-name', '') }}",
access_point_name: ["default", "internet", "ims", "sos"], access_point_name: ["default", "internet", "ims", "sos"],
first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).first) + 2 }}", {% if slap_configuration.get('tun-name', '') %}
last_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).last) - 1 }}", first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv4-network', '')).first) + 2 }}",
last_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration.get('tun-ipv4-network', '')).last) - 1 }}",
{% endif %}
ip_addr_shift: 2, ip_addr_shift: 2,
dns_addr: "8.8.8.8", dns_addr: "8.8.8.8",
// TODO: enable this instead of Google's DNS above p_cscf_addr: ["{{ slap_configuration.get('tun-ipv4-addr', '') }}"],
// dns_addr: "{{ slap_configuration['tun-ipv4-addr'] }}",
p_cscf_addr: ["{{ slap_configuration['tun-ipv4-addr'] }}"],
erabs: [ erabs: [
{ {
......
...@@ -73,8 +73,10 @@ recipe = slapos.recipe.template ...@@ -73,8 +73,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_} output = ${directory:bin}/${:_buildout_section_name_}
inline = inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true; sudo /opt/amarisoft/rm-tmp-lte | true;
{{ enb }}/lteenb ${directory:etc}/enb.cfg >> ${directory:log}/enb-output.log 2>> ${directory:log}/enb-output.log {{ enb }}/lteenb ${directory:etc}/enb.cfg >> ${directory:log}/enb-output.log 2>> ${directory:log}/enb-output.log
{% endif %}
### eNodeB (enb) ### eNodeB (enb)
[lte-enb-service] [lte-enb-service]
...@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }} ...@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }}
password = {{ slapparameter_dict['monitor-password'] | string }} password = {{ slapparameter_dict['monitor-password'] | string }}
{% endif %} {% endif %}
[sdr-busy-promise-template]
recipe = slapos.recipe.template:jinja2
url = {{ sdr_busy_promise }}
output = ${directory:etc}/check-sdr-busy.py
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
# Add custom promise to check if /dev/sdr0 is busy # Add custom promise to check if /dev/sdr0 is busy
[sdr-busy-promise] [sdr-busy-promise]
recipe = slapos.cookbook:promise.plugin recipe = slapos.cookbook:promise.plugin
eggs = slapos.core eggs = slapos.core
file = {{ sdr_busy_promise }} file = ${sdr-busy-promise-template:output}
output = ${directory:plugins}/check-sdr-busy.py output = ${directory:plugins}/check-sdr-busy.py
...@@ -74,8 +74,10 @@ recipe = slapos.recipe.template ...@@ -74,8 +74,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_} output = ${directory:bin}/${:_buildout_section_name_}
inline = inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true; sudo /opt/amarisoft/rm-tmp-lte | true;
{{ enb }}/lteenb ${directory:etc}/gnb.cfg >> ${directory:log}/gnb-output.log 2>> ${directory:log}/gnb-output.log {{ enb }}/lteenb ${directory:etc}/gnb.cfg >> ${directory:log}/gnb-output.log 2>> ${directory:log}/gnb-output.log
{% endif %}
### eNodeB (enb) ### eNodeB (enb)
[lte-enb-service] [lte-enb-service]
...@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }} ...@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }}
password = {{ slapparameter_dict['monitor-password'] | string }} password = {{ slapparameter_dict['monitor-password'] | string }}
{% endif %} {% endif %}
[sdr-busy-promise-template]
recipe = slapos.recipe.template:jinja2
url = {{ sdr_busy_promise }}
output = ${directory:etc}/check-sdr-busy.py
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
# Add custom promise to check if /dev/sdr0 is busy # Add custom promise to check if /dev/sdr0 is busy
[sdr-busy-promise] [sdr-busy-promise]
recipe = slapos.cookbook:promise.plugin recipe = slapos.cookbook:promise.plugin
eggs = slapos.core eggs = slapos.core
file = {{ sdr_busy_promise }} file = ${sdr-busy-promise-template:output}
output = ${directory:plugins}/check-sdr-busy.py output = ${directory:plugins}/check-sdr-busy.py
...@@ -84,8 +84,10 @@ recipe = slapos.recipe.template ...@@ -84,8 +84,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_} output = ${directory:bin}/${:_buildout_section_name_}
inline = inline =
#!/bin/sh #!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
rm -f ${directory:var}/lte_ue.db; rm -f ${directory:var}/lte_ue.db;
{{ mme }}/ltemme ${directory:etc}/mme.cfg >> ${directory:log}/mme-output.log 2>> ${directory:log}/mme-output.log {{ mme }}/ltemme ${directory:etc}/mme.cfg >> ${directory:log}/mme-output.log 2>> ${directory:log}/mme-output.log
{% endif %}
### MME ### MME
[lte-mme-service] [lte-mme-service]
...@@ -152,10 +154,17 @@ recipe = slapos.cookbook:publish.serialised ...@@ -152,10 +154,17 @@ recipe = slapos.cookbook:publish.serialised
epc-ipv6 = ${slap-configuration:ipv6-random} epc-ipv6 = ${slap-configuration:ipv6-random}
epc-ipv4 = {{ epc_ipv4 }} epc-ipv4 = {{ epc_ipv4 }}
# Add custom promise to check if /dev/sdr0 is busy [tun-up-promise-template]
recipe = slapos.recipe.template:jinja2
url = {{ interface_up_promise }}
output = ${directory:etc}/check-tun-up.py
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
# Add custom promise to check if tun is up
[tun-up-promise] [tun-up-promise]
recipe = slapos.cookbook:promise.plugin recipe = slapos.cookbook:promise.plugin
eggs = slapos.core eggs = slapos.core
file = {{ interface_up_promise }} file = ${tun-up-promise-template:output}
output = ${directory:plugins}/check-tun-up.py output = ${directory:plugins}/check-tun-up.py
config-ifname = ${slap-configuration:tun-name}
...@@ -27,7 +27,12 @@ class RunPromise(GenericPromise): ...@@ -27,7 +27,12 @@ class RunPromise(GenericPromise):
In this case, check whether the file exists. In this case, check whether the file exists.
""" """
ifname = self.getConfig('ifname') ifname = "{{ slapparameter_dict.get('tun-name', '') }}"
testing = {{ slapparameter_dict.get('testing', False) }}
if testing:
self.logger.info("skipping promise")
return
f = open('/sys/class/net/%s/operstate' % ifname, 'r') f = open('/sys/class/net/%s/operstate' % ifname, 'r')
if f.read() == 'up\n': if f.read() == 'up\n':
......
...@@ -27,7 +27,13 @@ class RunPromise(GenericPromise): ...@@ -27,7 +27,13 @@ class RunPromise(GenericPromise):
In this case, check whether the file exists. In this case, check whether the file exists.
""" """
testing = {{ slapparameter_dict.get('testing', False) }}
sdr_dev = '/dev/sdr0' sdr_dev = '/dev/sdr0'
if testing:
self.logger.info("skipping promise")
return
try: try:
open(sdr_dev, 'w').close() open(sdr_dev, 'w').close()
self.logger.error("eNB is not using %s", sdr_dev) self.logger.error("eNB is not using %s", sdr_dev)
......
...@@ -108,11 +108,16 @@ with open('instance-gnb-input-schema.jinja2.json', 'r') as f: ...@@ -108,11 +108,16 @@ with open('instance-gnb-input-schema.jinja2.json', 'r') as f:
instance_gnb_json_template = Template(f.read()) instance_gnb_json_template = Template(f.read())
with open('software.jinja2.cfg', 'r') as f: with open('software.jinja2.cfg', 'r') as f:
software_template = Template(f.read()) software_template = Template(f.read())
with open('test/test.jinja2.py', 'r') as f:
test_template = Template(f.read())
for rf_mode_context in rf_mode_context_list: for rf_mode_context in rf_mode_context_list:
with open('software-{}.cfg.json'.format(rf_mode_context['rf_mode']), with open('software-{}.cfg.json'.format(rf_mode_context['rf_mode']),
'w+') as f: 'w+') as f:
f.write(software_json_template.render(**rf_mode_context, **global_context) + '\n') f.write(software_json_template.render(**rf_mode_context, **global_context) + '\n')
with open('test/test{}.py'.format(rf_mode_context['rf_mode'].upper()),
'w+') as f:
f.write(test_template.render(**rf_mode_context, **global_context) + '\n')
with open('software-{}.cfg'.format(rf_mode_context['rf_mode']), with open('software-{}.cfg'.format(rf_mode_context['rf_mode']),
'w+') as f: 'w+') as f:
f.write(software_template.render(**rf_mode_context, **global_context) + '\n') f.write(software_template.render(**rf_mode_context, **global_context) + '\n')
......
Tests for ors-amarisoft software release
##############################################################################
#
# Copyright (c) 2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from setuptools import setup, find_packages
version = '0.0.1.dev0'
name = 'slapos.test.ors_amarisoft'
with open("README.md") as f:
long_description = f.read()
setup(
name=name,
version=version,
description="Test for SlapOS' ors-amarisoft",
long_description=long_description,
long_description_content_type='text/markdown',
maintainer="Nexedi",
maintainer_email="info@nexedi.com",
url="https://lab.nexedi.com/nexedi/slapos",
packages=find_packages(),
install_requires=[
'slapos.core',
'slapos.libnetworkcache',
'slapos.cookbook',
],
zip_safe=True,
test_suite='test',
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -120,6 +120,11 @@ setup = ${slapos-repository:location}/software/slaprunner/test/ ...@@ -120,6 +120,11 @@ setup = ${slapos-repository:location}/software/slaprunner/test/
egg = slapos.test.metabase egg = slapos.test.metabase
setup = ${slapos-repository:location}/software/metabase/test/ setup = ${slapos-repository:location}/software/metabase/test/
[slapos.test.ors-amarisoft-setup]
<= setup-develop-egg
egg = slapos.test.ors-amarisoft
setup = ${slapos-repository:location}/software/ors-amarisoft/test/
[slapos.test.fluentd-setup] [slapos.test.fluentd-setup]
<= setup-develop-egg <= setup-develop-egg
egg = slapos.test.fluentd egg = slapos.test.fluentd
...@@ -281,6 +286,7 @@ extra-eggs = ...@@ -281,6 +286,7 @@ extra-eggs =
${slapos.test.kvm-setup:egg} ${slapos.test.kvm-setup:egg}
${slapos.test.matomo-setup:egg} ${slapos.test.matomo-setup:egg}
${slapos.test.metabase-setup:egg} ${slapos.test.metabase-setup:egg}
${slapos.test.ors-amarisoft-setup:egg}
${slapos.test.monitor-setup:egg} ${slapos.test.monitor-setup:egg}
${slapos.test.nextcloud-setup:egg} ${slapos.test.nextcloud-setup:egg}
${slapos.test.nginx-push-stream-setup:egg} ${slapos.test.nginx-push-stream-setup:egg}
...@@ -351,6 +357,7 @@ tests = ...@@ -351,6 +357,7 @@ tests =
erp5 ${slapos.test.erp5-setup:setup} erp5 ${slapos.test.erp5-setup:setup}
fluentd ${slapos.test.fluentd-setup:setup} fluentd ${slapos.test.fluentd-setup:setup}
metabase ${slapos.test.metabase-setup:setup} metabase ${slapos.test.metabase-setup:setup}
ors-amarisoft ${slapos.test.ors-amarisoft-setup:setup}
### ###
${:extra} ${:extra}
......
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