Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tom Niget
slapos
Commits
ff1b2ca5
Commit
ff1b2ca5
authored
Jul 07, 2022
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ors-amarisoft: Add tests
parent
dddc13b0
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1681 additions
and
24 deletions
+1681
-24
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+9
-9
software/ors-amarisoft/config/enb.jinja2.cfg
software/ors-amarisoft/config/enb.jinja2.cfg
+1
-3
software/ors-amarisoft/config/mme.jinja2.cfg
software/ors-amarisoft/config/mme.jinja2.cfg
+6
-6
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+11
-1
software/ors-amarisoft/instance-gnb.jinja2.cfg
software/ors-amarisoft/instance-gnb.jinja2.cfg
+11
-1
software/ors-amarisoft/instance-mme.jinja2.cfg
software/ors-amarisoft/instance-mme.jinja2.cfg
+12
-3
software/ors-amarisoft/promise/check_interface_up.jinja2.py
software/ors-amarisoft/promise/check_interface_up.jinja2.py
+6
-1
software/ors-amarisoft/promise/check_sdr_busy.jinja2.py
software/ors-amarisoft/promise/check_sdr_busy.jinja2.py
+6
-0
software/ors-amarisoft/render-templates
software/ors-amarisoft/render-templates
+5
-0
software/ors-amarisoft/test/README.md
software/ors-amarisoft/test/README.md
+1
-0
software/ors-amarisoft/test/setup.py
software/ors-amarisoft/test/setup.py
+51
-0
software/ors-amarisoft/test/test.jinja2.py
software/ors-amarisoft/test/test.jinja2.py
+311
-0
software/ors-amarisoft/test/testTDD1900.py
software/ors-amarisoft/test/testTDD1900.py
+311
-0
software/ors-amarisoft/test/testTDD2600.py
software/ors-amarisoft/test/testTDD2600.py
+311
-0
software/ors-amarisoft/test/testTDD3500.py
software/ors-amarisoft/test/testTDD3500.py
+311
-0
software/ors-amarisoft/test/testTDD3700.py
software/ors-amarisoft/test/testTDD3700.py
+311
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+7
-0
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
ff1b2ca5
...
...
@@ -24,7 +24,7 @@ md5sum = b10c10a9408a934052fd0960f31a75fc
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = c
5a82279b6ada358c74a90c3b660bf55
md5sum = c
450b8c307d20738a98bcb4f6ffeee16
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
...
...
@@ -36,11 +36,11 @@ md5sum = 2cfe5679374559ab94478b987d646d83
[template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum =
eabbdb8ced563180f0bba8ca06e4bac4
md5sum =
9732653a0e2c7fe91d80da80762430d2
[template-lte-mme]
_update_hash_filename_ = instance-mme.jinja2.cfg
md5sum =
2c2d2dc4fd6b7a9100642e34812a5140
md5sum =
51b8762d4691f525d0228fa1f286e772
[ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg
...
...
@@ -48,7 +48,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum =
4b66551e04edff724b08d6bb90f7342c
md5sum =
faed74244d0c539dea53a0377ad0e103
[sib23.asn]
filename = config/sib23.asn
...
...
@@ -64,16 +64,16 @@ md5sum = 1ba2e065bdf14a6411e95e80db17dcfd
[mme.jinja2.cfg]
filename = config/mme.jinja2.cfg
md5sum =
a96c33a0a2a301f204cac8642267ad97
md5sum =
0c1e086de705f074654a794a2248cad0
[ims.jinja2.cfg]
filename = config/ims.jinja2.cfg
md5sum = 36281b03597252cf75169417d02fc28c
[sdr-busy-promise]
_update_hash_filename_ = promise/check_sdr_busy.py
md5sum =
f7436ff76fea58e37a401d4712275422
_update_hash_filename_ = promise/check_sdr_busy.
jinja2.
py
md5sum =
93dacb1da15310eb70d0815711a06cdf
[interface-up-promise]
_update_hash_filename_ = promise/check_interface_up.py
md5sum =
505efcbe04e717088924f2267b10c2b9
_update_hash_filename_ = promise/check_interface_up.
jinja2.
py
md5sum =
63d3bbac7b6f480ee0c510e80aa1ccf7
software/ors-amarisoft/config/enb.jinja2.cfg
View file @
ff1b2ca5
...
...
@@ -56,9 +56,7 @@
{%- endif %}
plmn: "{{ slapparameter_dict['plmn_list'][k]['plmn'] }}",
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]['attach_without_pdn']).lower() }},
{%- endif %}
attach_without_pdn: {{ str(slapparameter_dict['plmn_list'][k].get('attach_without_pdn', false)).lower() }},
}
{%- endfor -%}
{% else %}
...
...
software/ors-amarisoft/config/mme.jinja2.cfg
View file @
ff1b2ca5
...
...
@@ -51,15 +51,15 @@
pdn_list: [
{
pdn_type: "ipv4",
tun_ifname: "{{ slap_configuration
['tun-name']
}}",
tun_ifname: "{{ slap_configuration
.get('tun-name', '')
}}",
access_point_name: ["default", "internet", "ims", "sos"],
first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).first) + 2 }}",
last_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).last) - 1 }}",
{% if slap_configuration.get('tun-name', '') %}
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,
dns_addr: "8.8.8.8",
// TODO: enable this instead of Google's DNS above
// dns_addr: "{{ slap_configuration['tun-ipv4-addr'] }}",
p_cscf_addr: ["{{ slap_configuration['tun-ipv4-addr'] }}"],
p_cscf_addr: ["{{ slap_configuration.get('tun-ipv4-addr', '') }}"],
erabs: [
{
...
...
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
ff1b2ca5
...
...
@@ -73,8 +73,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
inline =
#!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true;
{{ enb }}/lteenb ${directory:etc}/enb.cfg >> ${directory:log}/enb-output.log 2>> ${directory:log}/enb-output.log
{% endif %}
### eNodeB (enb)
[lte-enb-service]
...
...
@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }}
password = {{ slapparameter_dict['monitor-password'] | string }}
{% 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
[sdr-busy-promise]
recipe = slapos.cookbook:promise.plugin
eggs = slapos.core
file =
{{ sdr_busy_promise }
}
file =
${sdr-busy-promise-template:output
}
output = ${directory:plugins}/check-sdr-busy.py
software/ors-amarisoft/instance-gnb.jinja2.cfg
View file @
ff1b2ca5
...
...
@@ -74,8 +74,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
inline =
#!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
sudo /opt/amarisoft/rm-tmp-lte | true;
{{ enb }}/lteenb ${directory:etc}/gnb.cfg >> ${directory:log}/gnb-output.log 2>> ${directory:log}/gnb-output.log
{% endif %}
### eNodeB (enb)
[lte-enb-service]
...
...
@@ -125,9 +127,17 @@ monitor-title = {{ slapparameter_dict['name'] | string }}
password = {{ slapparameter_dict['monitor-password'] | string }}
{% 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
[sdr-busy-promise]
recipe = slapos.cookbook:promise.plugin
eggs = slapos.core
file =
{{ sdr_busy_promise }
}
file =
${sdr-busy-promise-template:output
}
output = ${directory:plugins}/check-sdr-busy.py
software/ors-amarisoft/instance-mme.jinja2.cfg
View file @
ff1b2ca5
...
...
@@ -84,8 +84,10 @@ recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
inline =
#!/bin/sh
{% if not slapparameter_dict.get("testing", False) %}
rm -f ${directory:var}/lte_ue.db;
{{ mme }}/ltemme ${directory:etc}/mme.cfg >> ${directory:log}/mme-output.log 2>> ${directory:log}/mme-output.log
{% endif %}
### MME
[lte-mme-service]
...
...
@@ -152,10 +154,17 @@ recipe = slapos.cookbook:publish.serialised
epc-ipv6 = ${slap-configuration:ipv6-random}
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]
recipe = slapos.cookbook:promise.plugin
eggs = slapos.core
file =
{{ interface_up_promise }
}
file =
${tun-up-promise-template:output
}
output = ${directory:plugins}/check-tun-up.py
config-ifname = ${slap-configuration:tun-name}
software/ors-amarisoft/promise/check_interface_up.py
→
software/ors-amarisoft/promise/check_interface_up.
jinja2.
py
View file @
ff1b2ca5
...
...
@@ -27,7 +27,12 @@ class RunPromise(GenericPromise):
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'
)
if
f
.
read
()
==
'up
\
n
'
:
...
...
software/ors-amarisoft/promise/check_sdr_busy.py
→
software/ors-amarisoft/promise/check_sdr_busy.
jinja2.
py
View file @
ff1b2ca5
...
...
@@ -27,7 +27,13 @@ class RunPromise(GenericPromise):
In this case, check whether the file exists.
"""
testing
=
{{
slapparameter_dict
.
get
(
'testing'
,
False
)
}}
sdr_dev
=
'/dev/sdr0'
if
testing
:
self
.
logger
.
info
(
"skipping promise"
)
return
try
:
open
(
sdr_dev
,
'w'
).
close
()
self
.
logger
.
error
(
"eNB is not using %s"
,
sdr_dev
)
...
...
software/ors-amarisoft/render-templates
View file @
ff1b2ca5
...
...
@@ -108,11 +108,16 @@ with open('instance-gnb-input-schema.jinja2.json', 'r') as f:
instance_gnb_json_template
=
Template
(
f
.
read
())
with
open
(
'software.jinja2.cfg'
,
'r'
)
as
f
:
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
:
with
open
(
'software-{}.cfg.json'
.
format
(
rf_mode_context
[
'rf_mode'
]),
'w+'
)
as
f
:
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'
]),
'w+'
)
as
f
:
f
.
write
(
software_template
.
render
(
**
rf_mode_context
,
**
global_context
)
+
'
\
n
'
)
...
...
software/ors-amarisoft/test/README.md
0 → 100644
View file @
ff1b2ca5
Tests for ors-amarisoft software release
software/ors-amarisoft/test/setup.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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'
,
)
software/ors-amarisoft/test/test.jinja2.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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.
#
##############################################################################
import
os
import
yaml
import
json
import
glob
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
ORSTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software-{{ rf_mode }}.cfg'
)))
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'nssai'
:
{
'1'
:
{
'sd'
:
'1'
,
'sst'
:
'10'
},
'2'
:
{
'sd'
:
'2'
,
'sst'
:
'20'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
n
in
"sd sst"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'nssai'
][
p
[
'sd'
]][
n
])
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_nr_arfcn'
:
325320
,
'nr_band'
:
99
,
'nr_bandwidth'
:
50
,
'gnb_id'
:
"0x17"
,
'ssb_pos_bitmap'
:
"10"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'plmn'
:
'00101'
,
'ranac'
:
1
,
'reserved'
:
True
,
'tac'
:
1
},
'00102'
:
{
'plmn'
:
'00102'
,
'ranac'
:
2
,
'reserved'
:
False
,
'tac'
:
2
},
},
'amf_list'
:
{
'10.0.0.1'
:
{
'amf_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'amf_addr'
:
'2001:db8::1'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
self
.
param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
self
.
param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'dl_nr_arfcn'
],
self
.
param_dict
[
'dl_nr_arfcn'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'band'
],
self
.
param_dict
[
'nr_band'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'ssb_pos_bitmap'
],
self
.
param_dict
[
'ssb_pos_bitmap'
])
self
.
assertEqual
(
conf
[
'nr_cell_default'
][
'n_id_cell'
],
self
.
param_dict
[
'pci'
])
self
.
assertEqual
(
conf
[
'gnb_id'
],
int
(
self
.
param_dict
[
'gnb_id'
],
16
))
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
]:
for
n
in
"plmn ranac reserved tac"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'amf_list'
]:
self
.
assertEqual
(
p
[
'amf_addr'
],
self
.
param_dict
[
'amf_list'
][
p
[
'amf_addr'
]][
'amf_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define NR_BANDWIDTH'
):
self
.
assertIn
(
str
(
self
.
param_dict
[
'nr_bandwidth'
]),
l
)
enb_param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_earfcn'
:
325320
,
'n_rb_dl'
:
50
,
'enb_id'
:
"0x17"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'attach_without_pdn'
:
True
,
'plmn'
:
'00101'
,
'reserved'
:
True
},
'00102'
:
{
'attach_without_pdn'
:
False
,
'plmn'
:
'00102'
,
'reserved'
:
False
},
},
'mme_list'
:
{
'10.0.0.1'
:
{
'mme_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'mme_addr'
:
'2001:db8::1'
},
},
}
epc_param_dict
=
{
'testing'
:
True
,
'epc_plmn'
:
'00102'
,
}
def
test_enb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
enb_param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
enb_param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'dl_earfcn'
],
enb_param_dict
[
'dl_earfcn'
])
self
.
assertEqual
(
conf
[
'enb_id'
],
int
(
enb_param_dict
[
'enb_id'
],
16
))
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'n_id_cell'
],
enb_param_dict
[
'pci'
])
for
p
in
conf
[
'cell_list'
][
0
][
'plmn_list'
]:
for
n
in
"plmn attach_without_pdn reserved"
.
split
():
self
.
assertEqual
(
p
[
n
],
enb_param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'mme_list'
]:
self
.
assertEqual
(
p
[
'mme_addr'
],
enb_param_dict
[
'mme_list'
][
p
[
'mme_addr'
]][
'mme_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define N_RB_DL'
):
self
.
assertIn
(
str
(
enb_param_dict
[
'n_rb_dl'
]),
l
)
def
test_mme_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'plmn'
],
epc_param_dict
[
'epc_plmn'
])
class
TestENBParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
enb_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
class
TestEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
epc_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
class
TestENBEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
enb_param_dict
,
**
epc_param_dict
)),
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
sim_card_param_dict
=
{
"sim_algo"
:
"milenage"
,
"imsi"
:
"001010000000331"
,
"opc"
:
"000102030405060708090A0B0C0D0E0F"
,
"amf"
:
"0x9001"
,
"sqn"
:
"000000000000"
,
"k"
:
"00112233445566778899AABBCCDDEEFF"
,
"impu"
:
"impu331"
,
"impi"
:
"impi331@amarisoft.com"
,
}
def
test_ue_db
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'ue_db.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
sim_card_param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
sim_card_param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'amf'
],
int
(
sim_card_param_dict
[
'amf'
],
16
))
def
requestSlaveInstance
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
return
cls
.
slap
.
request
(
software_release
=
software_url
,
partition_reference
=
"SIM-CARD-EPC"
,
partition_parameter_kw
=
{
'_'
:
json
.
dumps
(
sim_card_param_dict
)},
shared
=
True
,
software_type
=
software_type
,
)
class
TestEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestENBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'enb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestGNBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'gnb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
software/ors-amarisoft/test/testTDD1900.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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.
#
##############################################################################
import
os
import
yaml
import
json
import
glob
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
ORSTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software-tdd1900.cfg'
)))
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'nssai'
:
{
'1'
:
{
'sd'
:
'1'
,
'sst'
:
'10'
},
'2'
:
{
'sd'
:
'2'
,
'sst'
:
'20'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
n
in
"sd sst"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'nssai'
][
p
[
'sd'
]][
n
])
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_nr_arfcn'
:
325320
,
'nr_band'
:
99
,
'nr_bandwidth'
:
50
,
'gnb_id'
:
"0x17"
,
'ssb_pos_bitmap'
:
"10"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'plmn'
:
'00101'
,
'ranac'
:
1
,
'reserved'
:
True
,
'tac'
:
1
},
'00102'
:
{
'plmn'
:
'00102'
,
'ranac'
:
2
,
'reserved'
:
False
,
'tac'
:
2
},
},
'amf_list'
:
{
'10.0.0.1'
:
{
'amf_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'amf_addr'
:
'2001:db8::1'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
self
.
param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
self
.
param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'dl_nr_arfcn'
],
self
.
param_dict
[
'dl_nr_arfcn'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'band'
],
self
.
param_dict
[
'nr_band'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'ssb_pos_bitmap'
],
self
.
param_dict
[
'ssb_pos_bitmap'
])
self
.
assertEqual
(
conf
[
'nr_cell_default'
][
'n_id_cell'
],
self
.
param_dict
[
'pci'
])
self
.
assertEqual
(
conf
[
'gnb_id'
],
int
(
self
.
param_dict
[
'gnb_id'
],
16
))
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
]:
for
n
in
"plmn ranac reserved tac"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'amf_list'
]:
self
.
assertEqual
(
p
[
'amf_addr'
],
self
.
param_dict
[
'amf_list'
][
p
[
'amf_addr'
]][
'amf_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define NR_BANDWIDTH'
):
self
.
assertIn
(
str
(
self
.
param_dict
[
'nr_bandwidth'
]),
l
)
enb_param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_earfcn'
:
325320
,
'n_rb_dl'
:
50
,
'enb_id'
:
"0x17"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'attach_without_pdn'
:
True
,
'plmn'
:
'00101'
,
'reserved'
:
True
},
'00102'
:
{
'attach_without_pdn'
:
False
,
'plmn'
:
'00102'
,
'reserved'
:
False
},
},
'mme_list'
:
{
'10.0.0.1'
:
{
'mme_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'mme_addr'
:
'2001:db8::1'
},
},
}
epc_param_dict
=
{
'testing'
:
True
,
'epc_plmn'
:
'00102'
,
}
def
test_enb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
enb_param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
enb_param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'dl_earfcn'
],
enb_param_dict
[
'dl_earfcn'
])
self
.
assertEqual
(
conf
[
'enb_id'
],
int
(
enb_param_dict
[
'enb_id'
],
16
))
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'n_id_cell'
],
enb_param_dict
[
'pci'
])
for
p
in
conf
[
'cell_list'
][
0
][
'plmn_list'
]:
for
n
in
"plmn attach_without_pdn reserved"
.
split
():
self
.
assertEqual
(
p
[
n
],
enb_param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'mme_list'
]:
self
.
assertEqual
(
p
[
'mme_addr'
],
enb_param_dict
[
'mme_list'
][
p
[
'mme_addr'
]][
'mme_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define N_RB_DL'
):
self
.
assertIn
(
str
(
enb_param_dict
[
'n_rb_dl'
]),
l
)
def
test_mme_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'plmn'
],
epc_param_dict
[
'epc_plmn'
])
class
TestENBParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
enb_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
class
TestEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
epc_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
class
TestENBEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
enb_param_dict
,
**
epc_param_dict
)),
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
sim_card_param_dict
=
{
"sim_algo"
:
"milenage"
,
"imsi"
:
"001010000000331"
,
"opc"
:
"000102030405060708090A0B0C0D0E0F"
,
"amf"
:
"0x9001"
,
"sqn"
:
"000000000000"
,
"k"
:
"00112233445566778899AABBCCDDEEFF"
,
"impu"
:
"impu331"
,
"impi"
:
"impi331@amarisoft.com"
,
}
def
test_ue_db
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'ue_db.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
sim_card_param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
sim_card_param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'amf'
],
int
(
sim_card_param_dict
[
'amf'
],
16
))
def
requestSlaveInstance
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
return
cls
.
slap
.
request
(
software_release
=
software_url
,
partition_reference
=
"SIM-CARD-EPC"
,
partition_parameter_kw
=
{
'_'
:
json
.
dumps
(
sim_card_param_dict
)},
shared
=
True
,
software_type
=
software_type
,
)
class
TestEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestENBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'enb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestGNBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'gnb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
software/ors-amarisoft/test/testTDD2600.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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.
#
##############################################################################
import
os
import
yaml
import
json
import
glob
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
ORSTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software-tdd2600.cfg'
)))
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'nssai'
:
{
'1'
:
{
'sd'
:
'1'
,
'sst'
:
'10'
},
'2'
:
{
'sd'
:
'2'
,
'sst'
:
'20'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
n
in
"sd sst"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'nssai'
][
p
[
'sd'
]][
n
])
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_nr_arfcn'
:
325320
,
'nr_band'
:
99
,
'nr_bandwidth'
:
50
,
'gnb_id'
:
"0x17"
,
'ssb_pos_bitmap'
:
"10"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'plmn'
:
'00101'
,
'ranac'
:
1
,
'reserved'
:
True
,
'tac'
:
1
},
'00102'
:
{
'plmn'
:
'00102'
,
'ranac'
:
2
,
'reserved'
:
False
,
'tac'
:
2
},
},
'amf_list'
:
{
'10.0.0.1'
:
{
'amf_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'amf_addr'
:
'2001:db8::1'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
self
.
param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
self
.
param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'dl_nr_arfcn'
],
self
.
param_dict
[
'dl_nr_arfcn'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'band'
],
self
.
param_dict
[
'nr_band'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'ssb_pos_bitmap'
],
self
.
param_dict
[
'ssb_pos_bitmap'
])
self
.
assertEqual
(
conf
[
'nr_cell_default'
][
'n_id_cell'
],
self
.
param_dict
[
'pci'
])
self
.
assertEqual
(
conf
[
'gnb_id'
],
int
(
self
.
param_dict
[
'gnb_id'
],
16
))
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
]:
for
n
in
"plmn ranac reserved tac"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'amf_list'
]:
self
.
assertEqual
(
p
[
'amf_addr'
],
self
.
param_dict
[
'amf_list'
][
p
[
'amf_addr'
]][
'amf_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define NR_BANDWIDTH'
):
self
.
assertIn
(
str
(
self
.
param_dict
[
'nr_bandwidth'
]),
l
)
enb_param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_earfcn'
:
325320
,
'n_rb_dl'
:
50
,
'enb_id'
:
"0x17"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'attach_without_pdn'
:
True
,
'plmn'
:
'00101'
,
'reserved'
:
True
},
'00102'
:
{
'attach_without_pdn'
:
False
,
'plmn'
:
'00102'
,
'reserved'
:
False
},
},
'mme_list'
:
{
'10.0.0.1'
:
{
'mme_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'mme_addr'
:
'2001:db8::1'
},
},
}
epc_param_dict
=
{
'testing'
:
True
,
'epc_plmn'
:
'00102'
,
}
def
test_enb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
enb_param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
enb_param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'dl_earfcn'
],
enb_param_dict
[
'dl_earfcn'
])
self
.
assertEqual
(
conf
[
'enb_id'
],
int
(
enb_param_dict
[
'enb_id'
],
16
))
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'n_id_cell'
],
enb_param_dict
[
'pci'
])
for
p
in
conf
[
'cell_list'
][
0
][
'plmn_list'
]:
for
n
in
"plmn attach_without_pdn reserved"
.
split
():
self
.
assertEqual
(
p
[
n
],
enb_param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'mme_list'
]:
self
.
assertEqual
(
p
[
'mme_addr'
],
enb_param_dict
[
'mme_list'
][
p
[
'mme_addr'
]][
'mme_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define N_RB_DL'
):
self
.
assertIn
(
str
(
enb_param_dict
[
'n_rb_dl'
]),
l
)
def
test_mme_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'plmn'
],
epc_param_dict
[
'epc_plmn'
])
class
TestENBParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
enb_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
class
TestEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
epc_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
class
TestENBEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
enb_param_dict
,
**
epc_param_dict
)),
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
sim_card_param_dict
=
{
"sim_algo"
:
"milenage"
,
"imsi"
:
"001010000000331"
,
"opc"
:
"000102030405060708090A0B0C0D0E0F"
,
"amf"
:
"0x9001"
,
"sqn"
:
"000000000000"
,
"k"
:
"00112233445566778899AABBCCDDEEFF"
,
"impu"
:
"impu331"
,
"impi"
:
"impi331@amarisoft.com"
,
}
def
test_ue_db
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'ue_db.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
sim_card_param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
sim_card_param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'amf'
],
int
(
sim_card_param_dict
[
'amf'
],
16
))
def
requestSlaveInstance
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
return
cls
.
slap
.
request
(
software_release
=
software_url
,
partition_reference
=
"SIM-CARD-EPC"
,
partition_parameter_kw
=
{
'_'
:
json
.
dumps
(
sim_card_param_dict
)},
shared
=
True
,
software_type
=
software_type
,
)
class
TestEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestENBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'enb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestGNBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'gnb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
software/ors-amarisoft/test/testTDD3500.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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.
#
##############################################################################
import
os
import
yaml
import
json
import
glob
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
ORSTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software-tdd3500.cfg'
)))
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'nssai'
:
{
'1'
:
{
'sd'
:
'1'
,
'sst'
:
'10'
},
'2'
:
{
'sd'
:
'2'
,
'sst'
:
'20'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
n
in
"sd sst"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'nssai'
][
p
[
'sd'
]][
n
])
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_nr_arfcn'
:
325320
,
'nr_band'
:
99
,
'nr_bandwidth'
:
50
,
'gnb_id'
:
"0x17"
,
'ssb_pos_bitmap'
:
"10"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'plmn'
:
'00101'
,
'ranac'
:
1
,
'reserved'
:
True
,
'tac'
:
1
},
'00102'
:
{
'plmn'
:
'00102'
,
'ranac'
:
2
,
'reserved'
:
False
,
'tac'
:
2
},
},
'amf_list'
:
{
'10.0.0.1'
:
{
'amf_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'amf_addr'
:
'2001:db8::1'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
self
.
param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
self
.
param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'dl_nr_arfcn'
],
self
.
param_dict
[
'dl_nr_arfcn'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'band'
],
self
.
param_dict
[
'nr_band'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'ssb_pos_bitmap'
],
self
.
param_dict
[
'ssb_pos_bitmap'
])
self
.
assertEqual
(
conf
[
'nr_cell_default'
][
'n_id_cell'
],
self
.
param_dict
[
'pci'
])
self
.
assertEqual
(
conf
[
'gnb_id'
],
int
(
self
.
param_dict
[
'gnb_id'
],
16
))
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
]:
for
n
in
"plmn ranac reserved tac"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'amf_list'
]:
self
.
assertEqual
(
p
[
'amf_addr'
],
self
.
param_dict
[
'amf_list'
][
p
[
'amf_addr'
]][
'amf_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define NR_BANDWIDTH'
):
self
.
assertIn
(
str
(
self
.
param_dict
[
'nr_bandwidth'
]),
l
)
enb_param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_earfcn'
:
325320
,
'n_rb_dl'
:
50
,
'enb_id'
:
"0x17"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'attach_without_pdn'
:
True
,
'plmn'
:
'00101'
,
'reserved'
:
True
},
'00102'
:
{
'attach_without_pdn'
:
False
,
'plmn'
:
'00102'
,
'reserved'
:
False
},
},
'mme_list'
:
{
'10.0.0.1'
:
{
'mme_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'mme_addr'
:
'2001:db8::1'
},
},
}
epc_param_dict
=
{
'testing'
:
True
,
'epc_plmn'
:
'00102'
,
}
def
test_enb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
enb_param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
enb_param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'dl_earfcn'
],
enb_param_dict
[
'dl_earfcn'
])
self
.
assertEqual
(
conf
[
'enb_id'
],
int
(
enb_param_dict
[
'enb_id'
],
16
))
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'n_id_cell'
],
enb_param_dict
[
'pci'
])
for
p
in
conf
[
'cell_list'
][
0
][
'plmn_list'
]:
for
n
in
"plmn attach_without_pdn reserved"
.
split
():
self
.
assertEqual
(
p
[
n
],
enb_param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'mme_list'
]:
self
.
assertEqual
(
p
[
'mme_addr'
],
enb_param_dict
[
'mme_list'
][
p
[
'mme_addr'
]][
'mme_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define N_RB_DL'
):
self
.
assertIn
(
str
(
enb_param_dict
[
'n_rb_dl'
]),
l
)
def
test_mme_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'plmn'
],
epc_param_dict
[
'epc_plmn'
])
class
TestENBParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
enb_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
class
TestEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
epc_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
class
TestENBEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
enb_param_dict
,
**
epc_param_dict
)),
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
sim_card_param_dict
=
{
"sim_algo"
:
"milenage"
,
"imsi"
:
"001010000000331"
,
"opc"
:
"000102030405060708090A0B0C0D0E0F"
,
"amf"
:
"0x9001"
,
"sqn"
:
"000000000000"
,
"k"
:
"00112233445566778899AABBCCDDEEFF"
,
"impu"
:
"impu331"
,
"impi"
:
"impi331@amarisoft.com"
,
}
def
test_ue_db
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'ue_db.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
sim_card_param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
sim_card_param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'amf'
],
int
(
sim_card_param_dict
[
'amf'
],
16
))
def
requestSlaveInstance
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
return
cls
.
slap
.
request
(
software_release
=
software_url
,
partition_reference
=
"SIM-CARD-EPC"
,
partition_parameter_kw
=
{
'_'
:
json
.
dumps
(
sim_card_param_dict
)},
shared
=
True
,
software_type
=
software_type
,
)
class
TestEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestENBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'enb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestGNBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'gnb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
software/ors-amarisoft/test/testTDD3700.py
0 → 100644
View file @
ff1b2ca5
##############################################################################
#
# 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.
#
##############################################################################
import
os
import
yaml
import
json
import
glob
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
ORSTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software-tdd3700.cfg'
)))
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'nssai'
:
{
'1'
:
{
'sd'
:
'1'
,
'sst'
:
'10'
},
'2'
:
{
'sd'
:
'2'
,
'sst'
:
'20'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
n
in
"sd sst"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'nssai'
][
p
[
'sd'
]][
n
])
class
TestGNBParameters
(
ORSTestCase
):
param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_nr_arfcn'
:
325320
,
'nr_band'
:
99
,
'nr_bandwidth'
:
50
,
'gnb_id'
:
"0x17"
,
'ssb_pos_bitmap'
:
"10"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'plmn'
:
'00101'
,
'ranac'
:
1
,
'reserved'
:
True
,
'tac'
:
1
},
'00102'
:
{
'plmn'
:
'00102'
,
'ranac'
:
2
,
'reserved'
:
False
,
'tac'
:
2
},
},
'amf_list'
:
{
'10.0.0.1'
:
{
'amf_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'amf_addr'
:
'2001:db8::1'
},
},
}
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
cls
.
param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb"
def
test_gnb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'gnb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
self
.
param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
self
.
param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'dl_nr_arfcn'
],
self
.
param_dict
[
'dl_nr_arfcn'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'band'
],
self
.
param_dict
[
'nr_band'
])
self
.
assertEqual
(
conf
[
'nr_cell_list'
][
0
][
'ssb_pos_bitmap'
],
self
.
param_dict
[
'ssb_pos_bitmap'
])
self
.
assertEqual
(
conf
[
'nr_cell_default'
][
'n_id_cell'
],
self
.
param_dict
[
'pci'
])
self
.
assertEqual
(
conf
[
'gnb_id'
],
int
(
self
.
param_dict
[
'gnb_id'
],
16
))
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
]:
for
n
in
"plmn ranac reserved tac"
.
split
():
self
.
assertEqual
(
p
[
n
],
self
.
param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'amf_list'
]:
self
.
assertEqual
(
p
[
'amf_addr'
],
self
.
param_dict
[
'amf_list'
][
p
[
'amf_addr'
]][
'amf_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define NR_BANDWIDTH'
):
self
.
assertIn
(
str
(
self
.
param_dict
[
'nr_bandwidth'
]),
l
)
enb_param_dict
=
{
'testing'
:
True
,
'tx_gain'
:
17
,
'rx_gain'
:
17
,
'dl_earfcn'
:
325320
,
'n_rb_dl'
:
50
,
'enb_id'
:
"0x17"
,
'pci'
:
250
,
'plmn_list'
:
{
'00101'
:
{
'attach_without_pdn'
:
True
,
'plmn'
:
'00101'
,
'reserved'
:
True
},
'00102'
:
{
'attach_without_pdn'
:
False
,
'plmn'
:
'00102'
,
'reserved'
:
False
},
},
'mme_list'
:
{
'10.0.0.1'
:
{
'mme_addr'
:
'10.0.0.1'
},
'2001:db8::1'
:
{
'mme_addr'
:
'2001:db8::1'
},
},
}
epc_param_dict
=
{
'testing'
:
True
,
'epc_plmn'
:
'00102'
,
}
def
test_enb_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
enb_param_dict
[
'tx_gain'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
enb_param_dict
[
'rx_gain'
])
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'dl_earfcn'
],
enb_param_dict
[
'dl_earfcn'
])
self
.
assertEqual
(
conf
[
'enb_id'
],
int
(
enb_param_dict
[
'enb_id'
],
16
))
self
.
assertEqual
(
conf
[
'cell_list'
][
0
][
'n_id_cell'
],
enb_param_dict
[
'pci'
])
for
p
in
conf
[
'cell_list'
][
0
][
'plmn_list'
]:
for
n
in
"plmn attach_without_pdn reserved"
.
split
():
self
.
assertEqual
(
p
[
n
],
enb_param_dict
[
'plmn_list'
][
p
[
'plmn'
]][
n
])
for
p
in
conf
[
'mme_list'
]:
self
.
assertEqual
(
p
[
'mme_addr'
],
enb_param_dict
[
'mme_list'
][
p
[
'mme_addr'
]][
'mme_addr'
])
with
open
(
conf_file
,
'r'
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
'#define N_RB_DL'
):
self
.
assertIn
(
str
(
enb_param_dict
[
'n_rb_dl'
]),
l
)
def
test_mme_conf
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
self
.
assertEqual
(
conf
[
'plmn'
],
epc_param_dict
[
'epc_plmn'
])
class
TestENBParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
enb_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
class
TestEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
epc_param_dict
)}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
class
TestENBEPCParameters
(
ORSTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
enb_param_dict
,
**
epc_param_dict
)),
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_enb_conf
(
self
):
test_enb_conf
(
self
)
def
test_mme_conf
(
self
):
test_mme_conf
(
self
)
sim_card_param_dict
=
{
"sim_algo"
:
"milenage"
,
"imsi"
:
"001010000000331"
,
"opc"
:
"000102030405060708090A0B0C0D0E0F"
,
"amf"
:
"0x9001"
,
"sqn"
:
"000000000000"
,
"k"
:
"00112233445566778899AABBCCDDEEFF"
,
"impu"
:
"impu331"
,
"impi"
:
"impi331@amarisoft.com"
,
}
def
test_ue_db
(
self
):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'ue_db.cfg'
))[
0
]
with
open
(
conf_file
,
'r'
)
as
f
:
conf
=
yaml
.
load
(
f
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
sim_card_param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
sim_card_param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'amf'
],
int
(
sim_card_param_dict
[
'amf'
],
16
))
def
requestSlaveInstance
(
cls
,
software_type
):
software_url
=
cls
.
getSoftwareURL
()
return
cls
.
slap
.
request
(
software_release
=
software_url
,
partition_reference
=
"SIM-CARD-EPC"
,
partition_parameter_kw
=
{
'_'
:
json
.
dumps
(
sim_card_param_dict
)},
shared
=
True
,
software_type
=
software_type
,
)
class
TestEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestENBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'enb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"enb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
class
TestGNBEPCSimCard
(
ORSTestCase
):
@
classmethod
def
requestDefaultInstance
(
cls
,
state
=
'started'
):
default_instance
=
super
(
ORSTestCase
,
cls
).
requestDefaultInstance
(
state
=
state
)
cls
.
requestSlaveInstance
()
return
default_instance
@
classmethod
def
requestSlaveInstance
(
cls
):
requestSlaveInstance
(
cls
,
'gnb-epc'
)
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'testing'
:
True
})
}
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
"gnb-epc"
def
test_sim_card
(
self
):
self
.
slap
.
waitForInstance
()
# Wait until publish is done
test_ue_db
(
self
)
software/slapos-sr-testing/software.cfg
View file @
ff1b2ca5
...
...
@@ -120,6 +120,11 @@ setup = ${slapos-repository:location}/software/slaprunner/test/
egg = slapos.test.metabase
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]
<= setup-develop-egg
egg = slapos.test.fluentd
...
...
@@ -281,6 +286,7 @@ extra-eggs =
${slapos.test.kvm-setup:egg}
${slapos.test.matomo-setup:egg}
${slapos.test.metabase-setup:egg}
${slapos.test.ors-amarisoft-setup:egg}
${slapos.test.monitor-setup:egg}
${slapos.test.nextcloud-setup:egg}
${slapos.test.nginx-push-stream-setup:egg}
...
...
@@ -351,6 +357,7 @@ tests =
erp5 ${slapos.test.erp5-setup:setup}
fluentd ${slapos.test.fluentd-setup:setup}
metabase ${slapos.test.metabase-setup:setup}
ors-amarisoft ${slapos.test.ors-amarisoft-setup:setup}
###
${:extra}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment