Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
spbro
OpenXG-RAN
Commits
7b895488
Commit
7b895488
authored
Sep 23, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consistently return success true/false from task steps
parent
e969ddb8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
125 additions
and
93 deletions
+125
-93
ci-scripts/cls_containerize.py
ci-scripts/cls_containerize.py
+12
-3
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+16
-3
ci-scripts/cls_physim.py
ci-scripts/cls_physim.py
+13
-23
ci-scripts/cls_physim1.py
ci-scripts/cls_physim1.py
+5
-4
ci-scripts/cls_static_code_analysis.py
ci-scripts/cls_static_code_analysis.py
+2
-2
ci-scripts/epc.py
ci-scripts/epc.py
+26
-7
ci-scripts/ran.py
ci-scripts/ran.py
+43
-45
ci-scripts/tests/deployment.py
ci-scripts/tests/deployment.py
+4
-4
ci-scripts/tests/ping-iperf.py
ci-scripts/tests/ping-iperf.py
+4
-2
No files found.
ci-scripts/cls_containerize.py
View file @
7b895488
...
...
@@ -85,6 +85,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
sshSession
.
command
(
'git log --oneline | head -n5'
,
'\$'
,
5
)
logging
.
error
(
f'problems during checkout, is at:
{
sshSession
.
getBefore
()
}
'
)
self
.
exitStatus
=
1
return
False
else
:
logging
.
debug
(
'successful checkout'
)
# if the branch is not develop, then it is a merge request and we need to do
...
...
@@ -94,6 +95,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
ranTargetBranch
=
'develop'
logging
.
debug
(
f'Merging with the target branch:
{
ranTargetBranch
}
'
)
sshSession
.
command
(
f'git merge --ff origin/
{
ranTargetBranch
}
-m "Temporary merge for CI"'
,
'\$'
,
30
)
return
True
def
ImageTagToUse
(
imageName
,
ranCommitID
,
ranBranch
,
ranAllowMerge
):
shortCommit
=
ranCommitID
[
0
:
8
]
...
...
@@ -969,8 +971,12 @@ class Containerize():
logging
.
info
(
f"Running on server
{
lIpAddr
}
"
)
sshSession
=
cls_cmd
.
getConnection
(
lIpAddr
)
CreateWorkspace
(
sshSession
,
lSourcePath
,
self
.
ranRepository
,
self
.
ranCommitID
,
self
.
ranTargetBranch
,
self
.
ranAllowMerge
)
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
success
=
CreateWorkspace
(
sshSession
,
lSourcePath
,
self
.
ranRepository
,
self
.
ranCommitID
,
self
.
ranTargetBranch
,
self
.
ranAllowMerge
)
if
success
:
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
else
:
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'KO'
,
[
"cannot create workspace"
])
return
success
def
DeployObject
(
self
,
HTML
):
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
=
GetCredentials
(
self
)
...
...
@@ -988,7 +994,7 @@ class Containerize():
self
.
exitStatus
=
1
logging
.
error
(
'Could not deploy'
)
HTML
.
CreateHtmlTestRow
(
'Could not deploy'
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
return
return
False
services_list
=
allServices
if
self
.
services
[
self
.
eNB_instance
].
split
()
==
[]
else
self
.
services
[
self
.
eNB_instance
].
split
()
status
=
True
imagesInfo
=
""
...
...
@@ -1011,6 +1017,7 @@ class Containerize():
self
.
exitStatus
=
1
imagesInfo
+=
(
"Unhealthy deployment! -- Check logs for reason!"
)
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'KO'
,
[(
imagesInfo
)])
return
status
def
UndeployObject
(
self
,
HTML
,
RAN
):
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
=
GetCredentials
(
self
)
...
...
@@ -1029,11 +1036,13 @@ class Containerize():
HTML
.
htmleNBFailureMsg
=
'Could not copy logfile(s) to analyze it!'
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
ENB_PROCESS_NOLOGFILE_TO_ANALYZE
)
self
.
exitStatus
=
1
return
False
else
:
log_results
=
[
CheckLogs
(
self
,
mySSH
,
self
.
yamlPath
[
0
].
split
(
'/'
),
service_name
,
HTML
,
RAN
)
for
service_name
,
_
in
services
]
self
.
exitStatus
=
1
if
any
(
log_results
)
else
0
logging
.
info
(
'
\u001B
[1m Undeploying OAI Object Pass
\u001B
[0m'
)
if
self
.
exitStatus
==
0
else
logging
.
error
(
'
\u001B
[1m Undeploying OAI Object Failed
\u001B
[0m'
)
mySSH
.
close
()
return
self
.
exitStatus
==
0
def
CheckAndAddRoute
(
self
,
svrName
,
ipAddr
,
userName
,
password
):
logging
.
debug
(
'Checking IP routing on '
+
svrName
)
...
...
ci-scripts/cls_oaicitest.py
View file @
7b895488
...
...
@@ -291,6 +291,7 @@ class OaiCiTest():
messages
.
append
(
f'
{
uename
}
: initialized'
if
f
.
result
()
else
f'
{
uename
}
: ERROR during Initialization'
)
[
f
.
result
()
for
f
in
futures
]
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'OK'
,
messages
)
return
True
def
AttachUE
(
self
,
HTML
,
RAN
,
EPC
,
CONTAINERS
):
ues
=
[
cls_module
.
Module_UE
(
ue_id
,
server_name
)
for
ue_id
,
server_name
in
zip
(
self
.
ue_ids
,
self
.
nodes
)]
...
...
@@ -300,12 +301,14 @@ class OaiCiTest():
futures
=
[
executor
.
submit
(
ue
.
checkMTU
)
for
ue
in
ues
]
mtus
=
[
f
.
result
()
for
f
in
futures
]
messages
=
[
f"UE
{
ue
.
getName
()
}
:
{
ue
.
getIP
()
}
"
for
ue
in
ues
]
if
all
(
attached
)
and
all
(
mtus
):
success
=
all
(
attached
)
and
all
(
mtus
)
if
success
:
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'OK'
,
messages
)
else
:
logging
.
error
(
f'error attaching or wrong MTU: attached
{
attached
}
, mtus
{
mtus
}
'
)
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'KO'
,
[
"Could not retrieve UE IP address(es) or MTU(s) wrong!"
])
self
.
AutoTerminateUEandeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
return
success
def
DetachUE
(
self
,
HTML
):
ues
=
[
cls_module
.
Module_UE
(
ue_id
,
server_name
)
for
ue_id
,
server_name
in
zip
(
self
.
ue_ids
,
self
.
nodes
)]
...
...
@@ -314,18 +317,21 @@ class OaiCiTest():
[
f
.
result
()
for
f
in
futures
]
messages
=
[
f"UE
{
ue
.
getName
()
}
: detached"
for
ue
in
ues
]
HTML
.
CreateHtmlTestRowQueue
(
'NA'
,
'OK'
,
messages
)
return
True
def
DataDisableUE
(
self
,
HTML
):
ues
=
[
cls_module
.
Module_UE
(
n
.
strip
())
for
n
in
self
.
ue_ids
]
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
64
)
as
executor
:
futures
=
[
executor
.
submit
(
ue
.
dataDisable
)
for
ue
in
ues
]
status
=
[
f
.
result
()
for
f
in
futures
]
if
all
(
status
):
success
=
all
(
status
)
if
success
:
messages
=
[
f"UE
{
ue
.
getName
()
}
: data disabled"
for
ue
in
ues
]
HTML
.
CreateHtmlTestRowQueue
(
'NA'
,
'OK'
,
messages
)
else
:
logging
.
error
(
f'error enabling data:
{
status
}
'
)
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'KO'
,
[
"Could not disable UE data!"
])
return
success
def
DataEnableUE
(
self
,
HTML
):
ues
=
[
cls_module
.
Module_UE
(
n
.
strip
())
for
n
in
self
.
ue_ids
]
...
...
@@ -333,12 +339,14 @@ class OaiCiTest():
with
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
64
)
as
executor
:
futures
=
[
executor
.
submit
(
ue
.
dataEnable
)
for
ue
in
ues
]
status
=
[
f
.
result
()
for
f
in
futures
]
if
all
(
status
):
success
=
all
(
status
)
if
success
:
messages
=
[
f"UE
{
ue
.
getName
()
}
: data enabled"
for
ue
in
ues
]
HTML
.
CreateHtmlTestRowQueue
(
'NA'
,
'OK'
,
messages
)
else
:
logging
.
error
(
f'error enabling data:
{
status
}
'
)
HTML
.
CreateHtmlTestRowQueue
(
'N/A'
,
'KO'
,
[
"Could not enable UE data!"
])
return
success
def
CheckStatusUE
(
self
,
HTML
):
ues
=
[
cls_module
.
Module_UE
(
n
.
strip
())
for
n
in
self
.
ue_ids
]
...
...
@@ -348,6 +356,7 @@ class OaiCiTest():
futures
=
[
executor
.
submit
(
ue
.
check
)
for
ue
in
ues
]
messages
=
[
f
.
result
()
for
f
in
futures
]
HTML
.
CreateHtmlTestRowQueue
(
'NA'
,
'OK'
,
messages
)
return
True
def
Ping_common
(
self
,
EPC
,
ue
,
RAN
,
logPath
):
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
...
...
@@ -455,6 +464,7 @@ class OaiCiTest():
else
:
HTML
.
CreateHtmlTestRowQueue
(
self
.
ping_args
,
'KO'
,
messages
)
self
.
AutoTerminateUEandeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
return
success
def
Iperf_Module
(
self
,
EPC
,
ue
,
svr
,
RAN
,
idx
,
ue_num
,
logPath
):
ueIP
=
ue
.
getIP
()
...
...
@@ -540,6 +550,7 @@ class OaiCiTest():
else
:
HTML
.
CreateHtmlTestRowQueue
(
self
.
iperf_args
,
'KO'
,
messages
)
self
.
AutoTerminateUEandeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
return
success
def
Iperf2_Unidir
(
self
,
HTML
,
RAN
,
EPC
,
CONTAINERS
):
if
self
.
ue_ids
==
[]
or
self
.
svr_id
==
None
or
len
(
self
.
ue_ids
)
!=
1
:
...
...
@@ -580,6 +591,7 @@ class OaiCiTest():
else
:
HTML
.
CreateHtmlTestRowQueue
(
self
.
iperf_args
,
'KO'
,
[
f'
{
ue_header
}
\n
{
msg
}
'
])
self
.
AutoTerminateUEandeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
return
success
def
AnalyzeLogFile_UE
(
self
,
UElogFile
,
HTML
,
RAN
):
if
(
not
os
.
path
.
isfile
(
f'
{
UElogFile
}
'
)):
...
...
@@ -860,6 +872,7 @@ class OaiCiTest():
archive_info
=
[
f'Log at:
{
a
}
'
if
a
else
'No log available'
for
a
in
archives
]
messages
=
[
f"UE
{
ue
.
getName
()
}
:
{
log
}
"
for
(
ue
,
log
)
in
zip
(
ues
,
archive_info
)]
HTML
.
CreateHtmlTestRowQueue
(
f'N/A'
,
'OK'
,
messages
)
return
True
def
AutoTerminateUEandeNB
(
self
,
HTML
,
RAN
,
EPC
,
CONTAINERS
):
if
(
RAN
.
Initialize_eNB_args
!=
''
):
...
...
ci-scripts/cls_physim.py
View file @
7b895488
...
...
@@ -84,7 +84,7 @@ class PhySim:
os
.
system
(
'mv '
+
self
.
__runLogFile
+
' '
+
self
.
__runLogPath
+
'/.'
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
runargs
,
'OK'
,
[
info
])
return
HTML
return
True
def
__CheckResults_LDPCt2Test
(
self
,
HTML
,
CONST
,
testcase_id
):
thrs_KO
=
int
(
self
.
timethrs
)
...
...
@@ -113,18 +113,19 @@ class PhySim:
HTML
.
CreateHtmlTestRowQueue
(
self
.
runargs
,
'KO'
,
[
'no statistics'
])
self
.
exitStatus
=
1
os
.
system
(
f'mv
{
self
.
__runLogFile
}
{
self
.
__runLogPath
}
/.'
)
return
HTML
return
False
#once parsed move the local logfile to its folder
os
.
system
(
f'mv
{
self
.
__runLogFile
}
{
self
.
__runLogPath
}
/.'
)
if
float
(
time
)
<
thrs_KO
:
success
=
float
(
time
)
<
thrs_KO
if
success
:
HTML
.
CreateHtmlTestRowQueue
(
self
.
runargs
,
'OK'
,
[
info
])
else
:
error_msg
=
f'Processing time exceeds a limit of
{
thrs_KO
}
us'
logging
.
error
(
error_msg
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
runargs
,
'KO'
,
[
info
+
'
\n
'
+
error_msg
])
self
.
exitStatus
=
1
return
HTML
return
success
def
__CheckResults_NRulsimTest
(
self
,
HTML
,
CONST
,
testcase_id
):
#retrieve run log file and store it locally
...
...
@@ -136,7 +137,7 @@ class PhySim:
logging
.
error
(
error_msg
)
HTML
.
CreateHtmlTestRowQueue
(
"could not recover results"
,
'KO'
,
[
error_msg
])
self
.
exitStatus
=
1
return
HTML
return
False
PUSCH_OK
=
False
with
open
(
self
.
__runLogFile
)
as
f
:
...
...
@@ -153,7 +154,7 @@ class PhySim:
logging
.
error
(
error_msg
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
runargs
,
'KO'
,
1
,
[
error_msg
])
self
.
exitStatus
=
1
return
HTML
return
PUSCH_OK
def
__CheckBuild_PhySim
(
self
,
HTML
,
CONST
):
self
.
__workSpacePath
=
self
.
eNBSourceCodePath
+
'/cmake_targets/'
...
...
@@ -169,13 +170,13 @@ class PhySim:
if
'BUILD SHOULD BE SUCCESSFUL'
in
f
.
read
():
HTML
.
CreateHtmlTestRow
(
self
.
buildargs
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
,
'PhySim'
)
self
.
exitStatus
=
0
return
HTML
return
True
logging
.
error
(
'
\u001B
[1m Building Physical Simulators Failed
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
buildargs
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
,
'LDPC'
)
HTML
.
CreateHtmlTabFooter
(
False
)
#exitStatus=1 will do a sys.exit in main
self
.
exitStatus
=
1
return
HTML
return
False
#-----------------$
...
...
@@ -226,10 +227,7 @@ class PhySim:
mySSH
.
command
(
f'./build_oai
{
self
.
buildargs
}
2>&1 | tee
{
self
.
__buildLogFile
}
'
,
'\$'
,
1500
)
mySSH
.
close
()
#check build status and update HTML object
lHTML
=
cls_oai_html
.
HTMLManagement
()
lHTML
=
self
.
__CheckBuild_PhySim
(
htmlObj
,
constObj
)
return
lHTML
return
__CheckBuild_PhySim
(
htmlObj
,
constObj
)
def
Run_CUDATest
(
self
,
htmlObj
,
constObj
,
testcase_id
):
...
...
@@ -245,10 +243,7 @@ class PhySim:
#run and redirect the results to a log file
mySSH
.
command
(
self
.
__workSpacePath
+
'ran_build/build/ldpctest '
+
self
.
runargs
+
' >> '
+
self
.
__runLogFile
,
'\$'
,
30
)
mySSH
.
close
()
#return updated HTML to main
lHTML
=
cls_oai_html
.
HTMLManagement
()
lHTML
=
self
.
__CheckResults_LDPCcudaTest
(
htmlObj
,
constObj
,
testcase_id
)
return
lHTML
return
self
.
__CheckResults_LDPCcudaTest
(
htmlObj
,
constObj
,
testcase_id
)
def
Run_T2Test
(
self
,
htmlObj
,
constObj
,
testcase_id
):
self
.
__workSpacePath
=
f'
{
self
.
eNBSourceCodePath
}
/cmake_targets/'
...
...
@@ -262,10 +257,7 @@ class PhySim:
#run and redirect the results to a log file
mySSH
.
run
(
f'sudo
{
self
.
__workSpacePath
}
ran_build/build/
{
self
.
runsim
}
{
self
.
runargs
}
>
{
self
.
__workSpacePath
}{
self
.
__runLogFile
}
2>&1'
)
mySSH
.
close
()
#return updated HTML to main
lHTML
=
cls_oai_html
.
HTMLManagement
()
lHTML
=
self
.
__CheckResults_LDPCt2Test
(
htmlObj
,
constObj
,
testcase_id
)
return
lHTML
return
self
.
__CheckResults_LDPCt2Test
(
htmlObj
,
constObj
,
testcase_id
)
def
Run_NRulsimTest
(
self
,
htmlObj
,
constObj
,
testcase_id
):
self
.
__workSpacePath
=
self
.
eNBSourceCodePath
+
'/cmake_targets/'
...
...
@@ -276,6 +268,4 @@ class PhySim:
mySSH
.
command
(
f'cd
{
self
.
__workSpacePath
}
'
,
'\$'
,
5
)
mySSH
.
command
(
f'sudo
{
self
.
__workSpacePath
}
ran_build/build/nr_ulsim
{
self
.
runargs
}
>
{
self
.
__runLogFile
}
2>&1'
,
'\$'
,
30
)
mySSH
.
close
()
#return updated HTML to main
lHTML
=
self
.
__CheckResults_NRulsimTest
(
htmlObj
,
constObj
,
testcase_id
)
return
lHTML
return
self
.
__CheckResults_NRulsimTest
(
htmlObj
,
constObj
,
testcase_id
)
ci-scripts/cls_physim1.py
View file @
7b895488
...
...
@@ -124,7 +124,7 @@ class PhySim:
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
OC_LOGIN_FAIL
)
RAN
.
prematureExit
=
True
return
return
False
else
:
logging
.
debug
(
'
\u001B
[1m Login to OC Cluster Successfully
\u001B
[0m'
)
mySSH
.
command
(
f'oc project
{
ocProjectName
}
'
,
'\$'
,
30
)
...
...
@@ -134,7 +134,7 @@ class PhySim:
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
OC_PROJECT_FAIL
)
RAN
.
prematureExit
=
True
return
return
False
else
:
logging
.
debug
(
f'
\u001B
[1m Now using project
{
ocProjectName
}
\u001B
[0m'
)
...
...
@@ -155,7 +155,7 @@ class PhySim:
mySSH
.
close
()
self
.
AnalyzeLogFile_phySim
()
RAN
.
prematureExit
=
True
return
return
False
else
:
logging
.
debug
(
'
\u001B
[1m Deployed PhySim Successfully using helm chart
\u001B
[0m'
)
isRunning
=
False
...
...
@@ -187,7 +187,7 @@ class PhySim:
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
OC_PHYSIM_DEPLOY_FAIL
)
HTML
.
CreateHtmlTestRowPhySimTestResult
(
self
.
testSummary
,
self
.
testResult
)
RAN
.
prematureExit
=
True
return
return
False
# Waiting to complete the running test
count
=
0
isFinished
=
False
...
...
@@ -255,6 +255,7 @@ class PhySim:
HTML
.
CreateHtmlTestRow
(
'Some test(s) timed-out!'
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRowPhySimTestResult
(
self
.
testSummary
,
self
.
testResult
)
logging
.
error
(
'
\u001B
[1m Physical Simulator Fail
\u001B
[0m'
)
return
self
.
testStatus
def
AnalyzeLogFile_phySim
(
self
):
mySSH
=
SSH
.
SSHConnection
()
...
...
ci-scripts/cls_static_code_analysis.py
View file @
7b895488
...
...
@@ -214,7 +214,7 @@ class StaticCodeAnalysis():
HTML
.
CreateHtmlTestRowCppCheckResults
(
CCR
)
logging
.
info
(
'
\u001B
[1m Static Code Analysis Pass
\u001B
[0m'
)
return
0
return
True
def
LicenceAndFormattingCheck
(
self
,
HTML
):
# Workspace is no longer recreated from scratch.
...
...
@@ -356,4 +356,4 @@ class StaticCodeAnalysis():
HTML
.
htmleNBFailureMsg
=
'Could not access oai-formatting-check.txt file'
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
ENB_PROCESS_NOLOGFILE_TO_ANALYZE
)
return
finalStatus
return
finalStatus
==
0
ci-scripts/epc.py
View file @
7b895488
...
...
@@ -135,6 +135,7 @@ class EPCManagement():
logging
.
error
(
'This option should not occur!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
InitializeMME
(
self
,
HTML
):
if
self
.
IPAddress
==
''
or
self
.
UserName
==
''
or
self
.
Password
==
''
or
self
.
SourceCodePath
==
''
or
self
.
Type
==
''
:
...
...
@@ -175,6 +176,7 @@ class EPCManagement():
logging
.
error
(
'This option should not occur!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
SetMmeIPAddress
(
self
):
# Not an error if we don't need an EPC
...
...
@@ -241,12 +243,14 @@ class EPCManagement():
logging
.
error
(
'This option should not occur!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
Initialize5GCN
(
self
,
HTML
):
if
self
.
IPAddress
==
''
or
self
.
UserName
==
''
or
self
.
Password
==
''
or
self
.
Type
==
''
:
HELP
.
GenericHelp
(
CONST
.
Version
)
HELP
.
EPCSrvHelp
(
self
.
IPAddress
,
self
.
UserName
,
self
.
Password
,
self
.
Type
)
sys
.
exit
(
'Insufficient EPC Parameters'
)
logging
.
error
(
'Insufficient EPC Parameters'
)
return
False
mySSH
=
cls_cmd
.
getConnection
(
self
.
IPAddress
)
html_cell
=
''
if
re
.
match
(
'ltebox'
,
self
.
Type
,
re
.
IGNORECASE
):
...
...
@@ -306,7 +310,8 @@ class EPCManagement():
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
report
)
HTML
.
CreateHtmlTabFooter
(
False
)
mySSH
.
close
()
sys
.
exit
(
"OC OAI CN5G: CN deployment failed!"
)
logging
.
error
(
"OC OAI CN5G: CN deployment failed!"
)
return
False
for
line
in
report
.
stdout
.
split
(
'
\n
'
)[
1
:]:
columns
=
line
.
strip
().
split
()
name
=
columns
[
0
]
...
...
@@ -317,6 +322,7 @@ class EPCManagement():
logging
.
error
(
'This option should not occur!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'OK'
,
[
html_cell
])
return
True
def
SetAmfIPAddress
(
self
):
# Not an error if we don't need an 5GCN
...
...
@@ -472,6 +478,7 @@ class EPCManagement():
logging
.
error
(
'This should not happen!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
TerminateMME
(
self
,
HTML
):
mySSH
=
SSH
.
SSHConnection
()
...
...
@@ -499,6 +506,7 @@ class EPCManagement():
logging
.
error
(
'This should not happen!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
TerminateSPGW
(
self
,
HTML
):
mySSH
=
SSH
.
SSHConnection
()
...
...
@@ -542,6 +550,7 @@ class EPCManagement():
logging
.
error
(
'This should not happen!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
True
def
Terminate5GCN
(
self
,
HTML
):
mySSH
=
cls_cmd
.
getConnection
(
self
.
IPAddress
)
...
...
@@ -583,25 +592,29 @@ class EPCManagement():
if
not
succeeded
:
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
report
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
"OC OAI CN5G: CN undeployment failed!"
)
logging
.
error
(
"OC OAI CN5G: CN undeployment failed!"
)
return
False
else
:
message
=
report
.
stdout
else
:
logging
.
error
(
'This should not happen!'
)
mySSH
.
close
()
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'OK'
,
[
message
])
return
True
def
DeployEpc
(
self
,
HTML
):
logging
.
debug
(
'Trying to deploy'
)
if
not
re
.
match
(
'OAI-Rel14-Docker'
,
self
.
Type
,
re
.
IGNORECASE
):
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'KO'
,
CONST
.
INVALID_PARAMETER
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
'Deploy not possible with this EPC type: '
+
self
.
Type
)
logging
.
error
(
'Deploy not possible with this EPC type: '
+
self
.
Type
)
return
False
if
self
.
IPAddress
==
''
or
self
.
UserName
==
''
or
self
.
Password
==
''
or
self
.
SourceCodePath
==
''
or
self
.
Type
==
''
:
HELP
.
GenericHelp
(
CONST
.
Version
)
HELP
.
EPCSrvHelp
(
self
.
IPAddress
,
self
.
UserName
,
self
.
Password
,
self
.
SourceCodePath
,
self
.
Type
)
sys
.
exit
(
'Insufficient EPC Parameters'
)
logging
.
error
(
'Insufficient EPC Parameters'
)
return
False
mySSH
=
SSH
.
SSHConnection
()
mySSH
.
open
(
self
.
IPAddress
,
self
.
UserName
,
self
.
Password
)
mySSH
.
command
(
'docker-compose --version'
,
'\$'
,
5
)
...
...
@@ -610,7 +623,8 @@ class EPCManagement():
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'KO'
,
CONST
.
INVALID_PARAMETER
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
'docker-compose not installed on '
+
self
.
IPAddress
)
logging
.
error
(
'docker-compose not installed on '
+
self
.
IPAddress
)
return
False
# Checking if it is a MAGMA deployment
self
.
isMagmaUsed
=
False
...
...
@@ -660,7 +674,8 @@ class EPCManagement():
if
not
db_init_status
:
HTML
.
CreateHtmlTestRow
(
self
.
Type
,
'KO'
,
CONST
.
INVALID_PARAMETER
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
'Cassandra DB deployment/configuration went wrong!'
)
logging
.
error
(
'Cassandra DB deployment/configuration went wrong!'
)
return
True
# deploying EPC cNFs
mySSH
.
command
(
'docker-compose up -d oai_spgwu'
,
'\$'
,
60
)
...
...
@@ -729,10 +744,12 @@ class EPCManagement():
mySSH
.
close
()
logging
.
debug
(
'Deployment OK'
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'OK'
,
[
html_cell
])
return
True
else
:
mySSH
.
close
()
logging
.
debug
(
'Deployment went wrong'
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'KO'
,
[
html_cell
])
return
False
def
UndeployEpc
(
self
,
HTML
):
logging
.
debug
(
'Trying to undeploy'
)
...
...
@@ -802,9 +819,11 @@ class EPCManagement():
if
noMoreContainerNb
==
nbContainers
and
noMoreNetworkNb
==
2
:
logging
.
debug
(
'Undeployment OK'
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'OK'
,
[
message
])
return
True
else
:
logging
.
debug
(
'Undeployment went wrong'
)
HTML
.
CreateHtmlTestRowQueue
(
self
.
Type
,
'KO'
,
[
message
])
return
False
def
LogCollectHSS
(
self
):
mySSH
=
SSH
.
SSHConnection
()
...
...
ci-scripts/ran.py
View file @
7b895488
...
...
@@ -189,7 +189,7 @@ class RANManagement():
if
not
mismatch
:
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Build_eNB_args
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
return
return
True
mySSH
.
command
(
'echo '
+
lPassWord
+
' | sudo -S git clean -x -d -ff'
,
'\$'
,
30
)
# if the commit ID is provided use it to point to it
...
...
@@ -219,10 +219,10 @@ class RANManagement():
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
self
.
Build_eNB_args
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
self
.
backgroundBuildTestId
[
int
(
self
.
eNB_instance
)]
=
self
.
testCase_id
return
return
True
mySSH
.
command
(
'stdbuf -o0 ./build_oai '
+
self
.
Build_eNB_args
+
' 2>&1 | stdbuf -o0 tee compile_oai_enb.log'
,
'BUILD SHOULD BE SUCCESSFUL|build have failed'
,
900
)
mySSH
.
close
()
self
.
checkBuildeNB
(
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
,
self
.
testCase_id
,
HTML
)
return
self
.
checkBuildeNB
(
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
,
self
.
testCase_id
,
HTML
)
def
checkBuildeNB
(
self
,
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
,
testcaseId
,
HTML
):
HTML
.
testCase_id
=
testcaseId
...
...
@@ -283,8 +283,7 @@ class RANManagement():
else
:
logging
.
error
(
'
\u001B
[1m Building OAI '
+
self
.
air_interface
[
self
.
eNB_instance
]
+
' Failed
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
Build_eNB_args
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
1
)
return
buildStatus
def
InitializeeNB
(
self
,
HTML
,
EPC
):
if
self
.
eNB_serverId
[
self
.
eNB_instance
]
==
'0'
:
...
...
@@ -453,8 +452,7 @@ class RANManagement():
copyin_res
=
mySSH
.
copyin
(
localEpcIpAddr
,
localEpcUserName
,
localEpcPassword
,
'/tmp/'
+
self
.
epcPcapFile
,
'.'
)
if
(
copyin_res
==
0
):
mySSH
.
copyout
(
lIpAddr
,
lUserName
,
lPassWord
,
self
.
epcPcapFile
,
lSourcePath
+
'/cmake_targets/.'
)
self
.
prematureExit
=
True
return
return
False
else
:
mySSH
.
command
(
'stdbuf -o0 cat enb_'
+
self
.
testCase_id
+
'.log | grep -E --text --color=never -i "wait|sync|Starting|Started"'
,
'\$'
,
4
)
if
rruCheck
:
...
...
@@ -492,45 +490,44 @@ class RANManagement():
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
f'
{
self
.
cmd_prefix
}
{
self
.
air_interface
[
self
.
eNB_instance
]
}
-O
{
config_file
}
{
extra_options
}
'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
logging
.
debug
(
'
\u001B
[1m Initialize eNB/gNB Completed
\u001B
[0m'
)
return
enbDidSync
def
CheckeNBProcess
(
self
,
status_queue
):
try
:
# At least the instance 0 SHALL be on!
if
self
.
eNBstatuses
[
0
]
==
0
:
lIpAddr
=
self
.
eNBIPAddress
lUserName
=
self
.
eNBUserName
lPassWord
=
self
.
eNBPassword
elif
self
.
eNBstatuses
[
0
]
==
1
:
lIpAddr
=
self
.
eNB1IPAddress
lUserName
=
self
.
eNB1UserName
lPassWord
=
self
.
eNB1Password
elif
self
.
eNBstatuses
[
0
]
==
2
:
lIpAddr
=
self
.
eNB2IPAddress
lUserName
=
self
.
eNB2UserName
lPassWord
=
self
.
eNB2Password
else
:
lIpAddr
=
self
.
eNBIPAddress
lUserName
=
self
.
eNBUserName
lPassWord
=
self
.
eNBPassword
mySSH
=
SSH
.
SSHConnection
()
mySSH
.
open
(
lIpAddr
,
lUserName
,
lPassWord
)
if
self
.
air_interface
[
self
.
eNB_instance
]
==
''
:
pattern
=
'softmodem'
else
:
pattern
=
self
.
air_interface
[
self
.
eNB_instance
]
mySSH
.
command
(
'stdbuf -o0 ps -aux | grep --color=never '
+
pattern
+
' | grep -v grep'
,
'\$'
,
5
)
result
=
re
.
search
(
pattern
,
mySSH
.
getBefore
())
if
result
is
None
:
logging
.
debug
(
'
\u001B
[1;37;41m eNB Process Not Found!
\u001B
[0m'
)
status_queue
.
put
(
CONST
.
ENB_PROCESS_FAILED
)
else
:
status_queue
.
put
(
CONST
.
ENB_PROCESS_OK
)
mySSH
.
close
()
except
:
os
.
kill
(
os
.
getppid
(),
signal
.
SIGUSR1
)
# At least the instance 0 SHALL be on!
if
self
.
eNBstatuses
[
0
]
==
0
:
lIpAddr
=
self
.
eNBIPAddress
lUserName
=
self
.
eNBUserName
lPassWord
=
self
.
eNBPassword
elif
self
.
eNBstatuses
[
0
]
==
1
:
lIpAddr
=
self
.
eNB1IPAddress
lUserName
=
self
.
eNB1UserName
lPassWord
=
self
.
eNB1Password
elif
self
.
eNBstatuses
[
0
]
==
2
:
lIpAddr
=
self
.
eNB2IPAddress
lUserName
=
self
.
eNB2UserName
lPassWord
=
self
.
eNB2Password
else
:
lIpAddr
=
self
.
eNBIPAddress
lUserName
=
self
.
eNBUserName
lPassWord
=
self
.
eNBPassword
mySSH
=
SSH
.
SSHConnection
()
mySSH
.
open
(
lIpAddr
,
lUserName
,
lPassWord
)
if
self
.
air_interface
[
self
.
eNB_instance
]
==
''
:
pattern
=
'softmodem'
else
:
pattern
=
self
.
air_interface
[
self
.
eNB_instance
]
mySSH
.
command
(
'stdbuf -o0 ps -aux | grep --color=never '
+
pattern
+
' | grep -v grep'
,
'\$'
,
5
)
result
=
re
.
search
(
pattern
,
mySSH
.
getBefore
())
success
=
result
is
not
None
if
not
success
:
logging
.
debug
(
'
\u001B
[1;37;41m eNB Process Not Found!
\u001B
[0m'
)
status_queue
.
put
(
CONST
.
ENB_PROCESS_FAILED
)
else
:
status_queue
.
put
(
CONST
.
ENB_PROCESS_OK
)
mySSH
.
close
()
return
success
def
TerminateeNB
(
self
,
HTML
,
EPC
):
if
self
.
eNB_serverId
[
self
.
eNB_instance
]
==
'0'
:
...
...
@@ -610,6 +607,7 @@ class RANManagement():
logStatus
=
self
.
AnalyzeLogFile_eNB
(
extracted_log_file
,
HTML
,
self
.
ran_checkers
)
HTML
.
CreateHtmlTestRow
(
self
.
runtime_stats
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
self
.
eNBLogFiles
[
int
(
self
.
eNB_instance
)]
=
''
return
True
else
:
analyzeFile
=
False
if
self
.
eNBLogFiles
[
int
(
self
.
eNB_instance
)]
!=
''
:
...
...
@@ -628,7 +626,7 @@ class RANManagement():
HTML
.
htmleNBFailureMsg
=
'Could not copy '
+
nodeB_prefix
+
'NB logfile to analyze it!'
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'KO'
,
CONST
.
ENB_PROCESS_NOLOGFILE_TO_ANALYZE
)
self
.
eNBmbmsEnables
[
int
(
self
.
eNB_instance
)]
=
False
return
return
False
if
self
.
eNB_serverId
[
self
.
eNB_instance
]
!=
'0'
:
#*stats.log files + pickle + png
...
...
@@ -646,9 +644,8 @@ class RANManagement():
#display rt stats for gNB only
if
len
(
self
.
datalog_rt_stats
)
!=
0
and
nodeB_prefix
==
'g'
:
HTML
.
CreateHtmlDataLogTable
(
self
.
datalog_rt_stats
)
self
.
prematureExit
=
True
self
.
eNBmbmsEnables
[
int
(
self
.
eNB_instance
)]
=
False
return
return
False
else
:
HTML
.
CreateHtmlTestRow
(
self
.
runtime_stats
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
else
:
...
...
@@ -658,6 +655,7 @@ class RANManagement():
HTML
.
CreateHtmlDataLogTable
(
self
.
datalog_rt_stats
)
self
.
eNBmbmsEnables
[
int
(
self
.
eNB_instance
)]
=
False
self
.
eNBstatuses
[
int
(
self
.
eNB_instance
)]
=
-
1
return
True
def
LogCollecteNB
(
self
):
mySSH
=
SSH
.
SSHConnection
()
...
...
ci-scripts/tests/deployment.py
View file @
7b895488
...
...
@@ -31,15 +31,15 @@ class TestDeploymentMethods(unittest.TestCase):
self
.
cont
.
eNBSourceCodePath
=
os
.
getcwd
()
def
test_deploy
(
self
):
self
.
cont
.
DeployObject
(
self
.
html
)
self
.
assert
Equal
(
self
.
cont
.
exitStatus
,
0
)
s
uccess
=
s
elf
.
cont
.
DeployObject
(
self
.
html
)
self
.
assert
True
(
success
)
self
.
cont
.
UndeployObject
(
self
.
html
,
self
.
ran
)
def
test_deployfails
(
self
):
old
=
self
.
cont
.
yamlPath
self
.
cont
.
yamlPath
[
0
]
=
'tests/simple-fail/'
self
.
cont
.
DeployObject
(
self
.
html
)
self
.
assert
Equal
(
self
.
cont
.
exitStatus
,
1
)
s
uccess
=
s
elf
.
cont
.
DeployObject
(
self
.
html
)
self
.
assert
False
(
success
)
self
.
cont
.
UndeployObject
(
self
.
html
,
self
.
ran
)
self
.
cont
.
yamlPath
=
old
...
...
ci-scripts/tests/ping-iperf.py
View file @
7b895488
...
...
@@ -36,7 +36,8 @@ class TestPingIperf(unittest.TestCase):
self
.
ci
.
ping_args
=
"-c3 127.0.0.1"
self
.
ci
.
ping_packetloss_threshold
=
"0"
# TODO Should need nothing but options and UE(s) to use
self
.
ci
.
Ping
(
self
.
html
,
self
.
ran
,
self
.
epc
,
self
.
cont
)
success
=
self
.
ci
.
Ping
(
self
.
html
,
self
.
ran
,
self
.
epc
,
self
.
cont
)
self
.
assertTrue
(
success
)
def
test_iperf
(
self
):
# note: needs to be five seconds because Iperf() adds -O 3, so if it is
...
...
@@ -49,7 +50,8 @@ class TestPingIperf(unittest.TestCase):
self
.
ci
.
iperf_bitrate_threshold
=
"0"
self
.
ci
.
iperf_profile
=
"balanced"
# TODO Should need nothing but options and UE(s) to use
self
.
ci
.
Iperf
(
self
.
html
,
self
.
ran
,
self
.
epc
,
self
.
cont
)
success
=
self
.
ci
.
Iperf
(
self
.
html
,
self
.
ran
,
self
.
epc
,
self
.
cont
)
self
.
assertTrue
(
success
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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