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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
864df49d
Commit
864df49d
authored
Nov 05, 2021
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ci): proper collection of logs for Core Network
Signed-off-by:
Raphael Defosseux
<
raphael.defosseux@eurecom.fr
>
parent
d818101c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
300 additions
and
261 deletions
+300
-261
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
+281
-244
ci-scripts/epc.py
ci-scripts/epc.py
+19
-17
No files found.
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
View file @
864df49d
...
@@ -269,26 +269,58 @@ pipeline {
...
@@ -269,26 +269,58 @@ pipeline {
}
}
}
}
stage
(
'Log Collection (CN)'
)
{
stage
(
'Log Collection (CN)'
)
{
// Bypassing this stage if EPC server is not defined
when
{
expression
{
params
.
EPC_IPAddress
!=
"none"
}
}
steps
{
steps
{
script
{
withCredentials
([
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.EPC_Credentials}"
,
usernameVariable:
'EPC_Username'
,
passwordVariable:
'EPC_Password'
]
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.EPC_Credentials}"
,
usernameVariable:
'EPC_Username'
,
passwordVariable:
'EPC_Password'
]
])
{
])
{
echo
'\u2705 \u001B[32mLog Transfer (CN)\u001B[0m'
echo
'\u2705 \u001B[32mLog Collection (HSS)\u001B[0m'
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/logs/oai-cn5g.log.zip ./oai-cn5g.log.${env.BUILD_ID}.zip || true"
sh
"python3 ci-scripts/main.py --mode=LogCollectHSS --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
if
(
params
.
EPC_Type
!=
'OAICN5G'
)
{
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/hss.log.zip ./hss.log.${env.BUILD_ID}.zip || true"
}
echo
'\u2705 \u001B[32mLog Collection (MME or AMF)\u001B[0m'
sh
"python3 ci-scripts/main.py --mode=LogCollectMME --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
if
(
params
.
EPC_Type
==
'OAICN5G'
)
{
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/mme.log.zip ./amf.log.${env.BUILD_ID}.zip || true"
}
else
{
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/mme.log.zip ./mme.log.${env.BUILD_ID}.zip || true"
}
}
script
{
echo
'\u2705 \u001B[32mLog Collection (SPGW or SMF/UPF)\u001B[0m'
if
(
fileExists
(
"oai-cn5g.log.${env.BUILD_ID}.zip"
))
{
sh
"python3 ci-scripts/main.py --mode=LogCollectSPGW --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
archiveArtifacts
"oai-cn5g.log.${env.BUILD_ID}.zip"
if
(
params
.
EPC_Type
==
'OAICN5G'
)
{
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/smf-upf.log.zip ./spgw.log.${env.BUILD_ID}.zip || true"
}
else
{
sh
"sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/spgw.log.zip ./spgw.log.${env.BUILD_ID}.zip || true"
}
}
if
(
fileExists
(
"ci-scripts/test_results.html"
))
{
sh
"mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
sh
"sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
archiveArtifacts
"test_results-${JOB_NAME}.html"
}
}
if
(
fileExists
(
"hss.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"hss.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"mme.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"mme.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"spgw.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"spgw.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"amf.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"amf.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"smf-upf.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"smf-upf.log.${env.BUILD_ID}.zip"
}
echo
'\u2705 \u001B[32mLog Collection for CoreNetwork Done!\u001B[0m'
}
}
}
}
}
}
stage
(
"SQL Collect"
){
stage
(
"SQL Collect"
){
when
{
expression
{
DataBaseHost
!=
"none"
}
}
agent
{
label
DataBaseHost
}
agent
{
label
DataBaseHost
}
steps
{
steps
{
script
{
script
{
...
@@ -304,6 +336,11 @@ pipeline {
...
@@ -304,6 +336,11 @@ pipeline {
post
{
post
{
always
{
always
{
script
{
script
{
if
(
fileExists
(
"ci-scripts/test_results.html"
))
{
sh
"mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
sh
"sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
archiveArtifacts
"test_results-${JOB_NAME}.html"
}
if
(
params
.
pipelineZipsConsoleLog
!=
null
)
{
if
(
params
.
pipelineZipsConsoleLog
!=
null
)
{
if
(
params
.
pipelineZipsConsoleLog
)
{
if
(
params
.
pipelineZipsConsoleLog
)
{
echo
"Archiving Jenkins console log"
echo
"Archiving Jenkins console log"
...
...
ci-scripts/epc.py
View file @
864df49d
...
@@ -475,10 +475,15 @@ class EPCManagement():
...
@@ -475,10 +475,15 @@ class EPCManagement():
time
.
sleep
(
1
)
time
.
sleep
(
1
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S screen -S simulated_5g_hss -X quit'
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S screen -S simulated_5g_hss -X quit'
,
'\$'
,
5
)
elif
re
.
match
(
'OAICN5G'
,
self
.
Type
,
re
.
IGNORECASE
):
elif
re
.
match
(
'OAICN5G'
,
self
.
Type
,
re
.
IGNORECASE
):
self
.
LogCollectOAICN5G
()
logging
.
debug
(
'OAI CN5G Collecting Log files to workspace'
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo rm -rf '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
mySSH
.
command
(
'mkdir '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
containers_list
=
[
'oai-smf'
,
'oai-spgwu'
,
'oai-amf'
,
'oai-nrf'
]
for
c
in
containers_list
:
mySSH
.
command
(
'docker logs '
+
c
+
' > '
+
self
.
SourceCodePath
+
'/logs/'
+
c
+
'.log'
,
'\$'
,
5
)
logging
.
debug
(
'Terminating OAI CN5G'
)
logging
.
debug
(
'Terminating OAI CN5G'
)
mySSH
.
command
(
'cd /opt/oai-cn5g-fed/docker-compose'
,
'\$'
,
5
)
mySSH
.
command
(
'cd /opt/oai-cn5g-fed/docker-compose'
,
'\$'
,
5
)
mySSH
.
command
(
'docker-compose down'
,
'\$'
,
5
)
mySSH
.
command
(
'./core-network.sh stop nrf spgwu'
,
'\$'
,
60
)
mySSH
.
command
(
'./core-network.sh stop nrf spgwu'
,
'\$'
,
60
)
else
:
else
:
logging
.
error
(
'This should not happen!'
)
logging
.
error
(
'This should not happen!'
)
...
@@ -693,6 +698,8 @@ class EPCManagement():
...
@@ -693,6 +698,8 @@ class EPCManagement():
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-hss:/openair-hss/hss_check_run.log .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-hss:/openair-hss/hss_check_run.log .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-hss:/tmp/hss_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-hss:/tmp/hss_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'zip hss.log.zip hss_check_run.*'
,
'\$'
,
60
)
mySSH
.
command
(
'zip hss.log.zip hss_check_run.*'
,
'\$'
,
60
)
elif
re
.
match
(
'OAICN5G'
,
self
.
Type
,
re
.
IGNORECASE
):
logging
.
debug
(
'LogCollect is bypassed for that variant'
)
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
mySSH
.
command
(
'zip hss.log.zip hss*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'zip hss.log.zip hss*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm hss*.log'
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm hss*.log'
,
'\$'
,
5
)
...
@@ -723,6 +730,11 @@ class EPCManagement():
...
@@ -723,6 +730,11 @@ class EPCManagement():
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-mme:/openair-mme/mme_check_run.log .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-mme:/openair-mme/mme_check_run.log .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-mme:/tmp/mme_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-mme:/tmp/mme_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'zip mme.log.zip mme_check_run.*'
,
'\$'
,
60
)
mySSH
.
command
(
'zip mme.log.zip mme_check_run.*'
,
'\$'
,
60
)
elif
re
.
match
(
'OAICN5G'
,
self
.
Type
,
re
.
IGNORECASE
):
mySSH
.
command
(
'cd '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
mySSH
.
command
(
'cp -f /tmp/oai-cn5g.pcap .'
,
'\$'
,
30
)
mySSH
.
command
(
'zip mme.log.zip oai-amf.log oai-nrf.log oai-cn5g.pcap'
,
'\$'
,
30
)
mySSH
.
command
(
'mv mme.log.zip '
+
self
.
SourceCodePath
+
'/scripts'
,
'\$'
,
30
)
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
mySSH
.
command
(
'zip mme.log.zip mme*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'zip mme.log.zip mme*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm mme*.log'
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm mme*.log'
,
'\$'
,
5
)
...
@@ -752,6 +764,10 @@ class EPCManagement():
...
@@ -752,6 +764,10 @@ class EPCManagement():
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-spgwc:/tmp/spgwc_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-spgwc:/tmp/spgwc_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'docker cp '
+
self
.
containerPrefix
+
'-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap .'
,
'\$'
,
60
)
mySSH
.
command
(
'zip spgw.log.zip spgw*_check_run.*'
,
'\$'
,
60
)
mySSH
.
command
(
'zip spgw.log.zip spgw*_check_run.*'
,
'\$'
,
60
)
elif
re
.
match
(
'OAICN5G'
,
self
.
Type
,
re
.
IGNORECASE
):
mySSH
.
command
(
'cd '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
mySSH
.
command
(
'zip spgw.log.zip oai-smf.log oai-spgwu.log'
,
'\$'
,
30
)
mySSH
.
command
(
'mv spgw.log.zip '
+
self
.
SourceCodePath
+
'/scripts'
,
'\$'
,
30
)
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
elif
re
.
match
(
'OAI'
,
self
.
Type
,
re
.
IGNORECASE
)
or
re
.
match
(
'OAI-Rel14-CUPS'
,
self
.
Type
,
re
.
IGNORECASE
):
mySSH
.
command
(
'zip spgw.log.zip spgw*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'zip spgw.log.zip spgw*.log'
,
'\$'
,
60
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm spgw*.log'
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo -S rm spgw*.log'
,
'\$'
,
5
)
...
@@ -761,17 +777,3 @@ class EPCManagement():
...
@@ -761,17 +777,3 @@ class EPCManagement():
else
:
else
:
logging
.
error
(
'This option should not occur!'
)
logging
.
error
(
'This option should not occur!'
)
mySSH
.
close
()
mySSH
.
close
()
def
LogCollectOAICN5G
(
self
):
mySSH
=
SSH
.
SSHConnection
()
mySSH
.
open
(
self
.
IPAddress
,
self
.
UserName
,
self
.
Password
)
logging
.
debug
(
'OAI CN5G Collecting Log files to workspace'
)
mySSH
.
command
(
'echo '
+
self
.
Password
+
' | sudo rm -rf '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
mySSH
.
command
(
'mkdir '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
containers_list
=
[
'oai-smf'
,
'oai-spgwu'
,
'oai-amf'
,
'oai-nrf'
]
for
c
in
containers_list
:
mySSH
.
command
(
'docker logs '
+
c
+
' > '
+
self
.
SourceCodePath
+
'/logs/'
+
c
+
'.log'
,
'\$'
,
5
)
mySSH
.
command
(
'cd '
+
self
.
SourceCodePath
+
'/logs'
,
'\$'
,
5
)
mySSH
.
command
(
'zip oai-cn5g.log.zip *.log'
,
'\$'
,
60
)
mySSH
.
close
()
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