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
lizhongxiao
OpenXG-RAN
Commits
4ae28aba
Commit
4ae28aba
authored
Mar 10, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom_Command: add option to fail if returncode is non-zero
parent
e3520f95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
ci-scripts/main.py
ci-scripts/main.py
+3
-0
ci-scripts/ran.py
ci-scripts/ran.py
+13
-9
No files found.
ci-scripts/main.py
View file @
4ae28aba
...
...
@@ -429,6 +429,7 @@ def GetParametersFromXML(action):
elif
action
==
'Custom_Command'
:
RAN
.
node
=
test
.
findtext
(
'node'
)
RAN
.
command
=
test
.
findtext
(
'command'
)
RAN
.
command_fail
=
test
.
findtext
(
'command_fail'
)
in
[
'True'
,
'true'
,
'Yes'
,
'yes'
]
else
:
logging
.
warning
(
f"unknown action
{
action
}
from option-parsing point-of-view"
)
...
...
@@ -752,6 +753,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif
action
==
'Custom_Command'
:
logging
.
info
(
f"Executing custom command"
)
RAN
.
CustomCommand
(
HTML
)
if
RAN
.
prematureExit
:
CiTestObj
.
AutoTerminateeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
elif
action
==
'Initialize_eNB'
:
RAN
.
InitializeeNB
(
HTML
,
EPC
)
if
RAN
.
prematureExit
:
...
...
ci-scripts/ran.py
View file @
4ae28aba
...
...
@@ -99,6 +99,7 @@ class RANManagement():
self
.
cmd_prefix
=
''
# prefix before {lte,nr}-softmodem
self
.
node
=
''
self
.
command
=
''
self
.
command_fail
=
False
#-----------------------------------------------------------
...
...
@@ -259,19 +260,22 @@ class RANManagement():
self
.
checkBuildeNB
(
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
,
self
.
backgroundBuildTestId
[
int
(
self
.
eNB_instance
)],
HTML
)
def
CustomCommand
(
self
,
HTML
):
if
self
.
node
==
''
or
self
.
node
==
"localhost"
:
cmd
=
cls_cmd
.
LocalCmd
()
else
:
cmd
=
cls_cmd
.
RemoteCmd
(
self
.
node
)
cmd
=
cls_cmd
.
getConnection
(
self
.
node
)
ret
=
cmd
.
run
(
self
.
command
)
cmd
.
close
()
logging
.
debug
(
f'CustomCommand:
{
self
.
command
}
returnCode:
{
ret
.
returncode
}
output:
{
ret
.
stdout
}
'
)
html_queue
=
SimpleQueue
()
logging
.
debug
(
f'CustomCommand:
{
self
.
command
}
returnCode:
{
ret
.
returncode
}
'
)
status
=
'OK'
if
ret
.
returncode
!=
0
:
html_queue
.
put
(
ret
.
stdout
)
message
=
''
if
ret
.
returncode
!=
0
and
not
self
.
command_fail
:
message
=
ret
.
stdout
logging
.
warning
(
f'CustomCommand output:
{
message
}
'
)
status
=
'Warning'
HTML
.
CreateHtmlTestRow
(
self
.
command
,
status
,
1
,
html_queue
)
if
ret
.
returncode
!=
0
and
self
.
command_fail
:
message
=
ret
.
stdout
logging
.
error
(
f'CustomCommand failed: output:
{
message
}
'
)
status
=
'KO'
self
.
prematureExit
=
True
HTML
.
CreateHtmlTestRowQueue
(
self
.
command
,
status
,
[
message
])
def
checkBuildeNB
(
self
,
lIpAddr
,
lUserName
,
lPassWord
,
lSourcePath
,
testcaseId
,
HTML
):
HTML
.
testCase_id
=
testcaseId
...
...
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