Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
ccd86787
Commit
ccd86787
authored
Jan 05, 2024
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b7a3f5d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
30 deletions
+26
-30
software/ors-amarisoft/test/test.py
software/ors-amarisoft/test/test.py
+20
-24
software/ors-amarisoft/test/test_ors.py
software/ors-amarisoft/test/test_ors.py
+6
-6
No files found.
software/ors-amarisoft/test/test.py
View file @
ccd86787
...
@@ -30,20 +30,6 @@ setUpModule, AmariTestCase = makeModuleSetUpAndTestCaseClass(
...
@@ -30,20 +30,6 @@ setUpModule, AmariTestCase = makeModuleSetUpAndTestCaseClass(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
# yload loads yaml config file after preprocessing it.
#
# preprocessing is needed to e.g. remove // and /* comments.
def
yload
(
path
):
with
open
(
path
,
'r'
)
as
f
:
data
=
f
.
read
()
# original input
p
=
pcpp
.
Preprocessor
()
p
.
parse
(
data
)
f
=
io
.
StringIO
()
p
.
write
(
f
)
data_
=
f
.
getvalue
()
# preprocessed input
return
yaml
.
load
(
data_
,
Loader
=
yaml
.
Loader
)
# ---- building blocks to construct cells + peers ----
# ---- building blocks to construct cells + peers ----
#
#
# - TDD/FDD are basic parameters to indicate TDD/FDD mode.
# - TDD/FDD are basic parameters to indicate TDD/FDD mode.
...
@@ -129,13 +115,6 @@ PEERCELL5 = NR(520000,38) | NR_PEER(0x77712,22, 75, 0x321)
...
@@ -129,13 +115,6 @@ PEERCELL5 = NR(520000,38) | NR_PEER(0x77712,22, 75, 0x321)
# XXX explain ENB does not support mixing SDR + CPRI
# XXX explain ENB does not support mixing SDR + CPRI
# # XXX explain CELL_xy ... XXX goes away
# CELL_4t = TDD | LTE(38050) | BW( 5) # 2600 MHz
# CELL_5t = TDD | NR(523020,41) | BW(10) # 2615.1 MHz
# CELL_4f = FDD | LTE(3350) | BW( 5) # 2680 MHz
# CELL_5f = FDD | NR(537200,7) | BW( 5) # 2686 MHz
# XXX doc
# XXX doc
class
ENBTestCase
(
AmariTestCase
):
class
ENBTestCase
(
AmariTestCase
):
maxDiff
=
None
# want to see full diff in test run log on an error
maxDiff
=
None
# want to see full diff in test run log on an error
...
@@ -199,7 +178,7 @@ class ENBTestCase(AmariTestCase):
...
@@ -199,7 +178,7 @@ class ENBTestCase(AmariTestCase):
return
'%s/%s'
%
(
self
.
computer_partition_root_path
,
path
)
return
'%s/%s'
%
(
self
.
computer_partition_root_path
,
path
)
def
test_enb_conf
(
self
):
def
test_enb_conf
(
self
):
conf
=
yload
(
self
.
ipath
(
'etc/enb.cfg'
))
conf
=
y
amlpp_
load
(
self
.
ipath
(
'etc/enb.cfg'
))
# XXX assert about enb_id/gnb_id, PEER, PEERCELL + HO(inter) ...
# XXX assert about enb_id/gnb_id, PEER, PEERCELL + HO(inter) ...
...
@@ -248,7 +227,7 @@ class TestENB_SDR(ENBTestCase):
...
@@ -248,7 +227,7 @@ class TestENB_SDR(ENBTestCase):
def
test_enb_conf
(
self
):
def
test_enb_conf
(
self
):
super
().
test_enb_conf
()
super
().
test_enb_conf
()
conf
=
yload
(
self
.
ipath
(
'etc/enb.cfg'
))
conf
=
y
amlpp_
load
(
self
.
ipath
(
'etc/enb.cfg'
))
rf_driver
=
conf
[
'rf_driver'
]
rf_driver
=
conf
[
'rf_driver'
]
self
.
assertEqual
(
rf_driver
[
'args'
],
self
.
assertEqual
(
rf_driver
[
'args'
],
...
@@ -419,7 +398,7 @@ class _TestENB_CPRI(ENBTestCase):
...
@@ -419,7 +398,7 @@ class _TestENB_CPRI(ENBTestCase):
def
test_enb_conf
(
self
):
def
test_enb_conf
(
self
):
super
().
test_enb_conf
()
super
().
test_enb_conf
()
conf
=
yload
(
'%s/etc/enb.cfg'
%
self
.
computer_partition_root_path
)
conf
=
y
amlpp_
load
(
'%s/etc/enb.cfg'
%
self
.
computer_partition_root_path
)
rf_driver
=
conf
[
'rf_driver'
]
rf_driver
=
conf
[
'rf_driver'
]
self
.
assertEqual
(
rf_driver
[
'args'
],
self
.
assertEqual
(
rf_driver
[
'args'
],
...
@@ -531,6 +510,23 @@ class TestUEMonitorGadgetUrl(ORSTestCase):
...
@@ -531,6 +510,23 @@ class TestUEMonitorGadgetUrl(ORSTestCase):
test_monitor_gadget_url(self)
test_monitor_gadget_url(self)
"""
"""
# ---- misc ----
# yamlpp_load loads yaml config file after preprocessing it.
#
# preprocessing is needed to e.g. remove // and /* comments.
def
yamlpp_load
(
path
):
with
open
(
path
,
'r'
)
as
f
:
data
=
f
.
read
()
# original input
p
=
pcpp
.
Preprocessor
()
p
.
parse
(
data
)
f
=
io
.
StringIO
()
p
.
write
(
f
)
data_
=
f
.
getvalue
()
# preprocessed input
return
yaml
.
load
(
data_
,
Loader
=
yaml
.
Loader
)
# assertMatch recursively matches data structure against specified pattern.
# assertMatch recursively matches data structure against specified pattern.
#
#
# - dict match by verifying v[k] == vok[k] for keys from the pattern.
# - dict match by verifying v[k] == vok[k] for keys from the pattern.
...
...
software/ors-amarisoft/test/test_ors.py
View file @
ccd86787
...
@@ -30,7 +30,7 @@ import json
...
@@ -30,7 +30,7 @@ import json
import
glob
import
glob
import
requests
import
requests
from
test
import
yload
from
test
import
y
amlpp_
load
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
...
@@ -142,7 +142,7 @@ def test_enb_conf(self):
...
@@ -142,7 +142,7 @@ def test_enb_conf(self):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
conf
=
yload
(
conf_file
)
conf
=
y
amlpp_
load
(
conf_file
)
if
'tx_gain'
in
conf
and
'rx_gain'
in
conf
:
if
'tx_gain'
in
conf
and
'rx_gain'
in
conf
:
self
.
assertEqual
(
conf
[
'tx_gain'
],
[
enb_param_dict
[
'tx_gain'
]]
*
enb_param_dict
[
'n_antenna_dl'
])
self
.
assertEqual
(
conf
[
'tx_gain'
],
[
enb_param_dict
[
'tx_gain'
]]
*
enb_param_dict
[
'n_antenna_dl'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
[
enb_param_dict
[
'rx_gain'
]]
*
enb_param_dict
[
'n_antenna_ul'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
[
enb_param_dict
[
'rx_gain'
]]
*
enb_param_dict
[
'n_antenna_ul'
])
...
@@ -180,7 +180,7 @@ def test_gnb_conf1(self):
...
@@ -180,7 +180,7 @@ def test_gnb_conf1(self):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
conf
=
yload
(
conf_file
)
conf
=
y
amlpp_
load
(
conf_file
)
self
.
assertEqual
(
conf
[
'tx_gain'
],
[
gnb_param_dict1
[
'tx_gain'
]]
*
gnb_param_dict1
[
'n_antenna_dl'
])
self
.
assertEqual
(
conf
[
'tx_gain'
],
[
gnb_param_dict1
[
'tx_gain'
]]
*
gnb_param_dict1
[
'n_antenna_dl'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
[
gnb_param_dict1
[
'rx_gain'
]]
*
gnb_param_dict1
[
'n_antenna_ul'
])
self
.
assertEqual
(
conf
[
'rx_gain'
],
[
gnb_param_dict1
[
'rx_gain'
]]
*
gnb_param_dict1
[
'n_antenna_ul'
])
self
.
assertEqual
(
len
(
conf
[
'cell_list'
]),
0
)
self
.
assertEqual
(
len
(
conf
[
'cell_list'
]),
0
)
...
@@ -227,7 +227,7 @@ def test_gnb_conf2(self):
...
@@ -227,7 +227,7 @@ def test_gnb_conf2(self):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'enb.cfg'
))[
0
]
conf
=
yload
(
conf_file
)
conf
=
y
amlpp_
load
(
conf_file
)
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
for
p
in
conf
[
'nr_cell_default'
][
'plmn_list'
][
0
][
'nssai'
]:
sd
=
hex
(
p
[
'sd'
])
sd
=
hex
(
p
[
'sd'
])
...
@@ -239,7 +239,7 @@ def test_mme_conf(self):
...
@@ -239,7 +239,7 @@ def test_mme_conf(self):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'mme.cfg'
))[
0
]
conf
=
yload
(
conf_file
)
conf
=
y
amlpp_
load
(
conf_file
)
self
.
assertEqual
(
conf
[
'plmn'
],
param_dict
[
'core_network_plmn'
])
self
.
assertEqual
(
conf
[
'plmn'
],
param_dict
[
'core_network_plmn'
])
def
test_sim_card
(
self
):
def
test_sim_card
(
self
):
...
@@ -247,7 +247,7 @@ def test_sim_card(self):
...
@@ -247,7 +247,7 @@ def test_sim_card(self):
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
conf_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'ue_db.cfg'
))[
0
]
self
.
slap
.
instance_directory
,
'*'
,
'etc'
,
'ue_db.cfg'
))[
0
]
conf
=
yload
(
conf_file
)
conf
=
y
amlpp_
load
(
conf_file
)
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
for
n
in
"sim_algo imsi opc sqn impu impi"
.
split
():
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
n
],
param_dict
[
n
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
param_dict
[
'k'
])
self
.
assertEqual
(
conf
[
'ue_db'
][
0
][
'K'
],
param_dict
[
'k'
])
...
...
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