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
canghaiwuhen
OpenXG-RAN
Commits
a9dbcf6b
Commit
a9dbcf6b
authored
Jun 19, 2020
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added in-code comments and changed attr to private
parent
dcadc24a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
16 deletions
+35
-16
ci-scripts/cls_physim.py
ci-scripts/cls_physim.py
+35
-16
No files found.
ci-scripts/cls_physim.py
View file @
a9dbcf6b
...
@@ -48,23 +48,32 @@ class PhySim:
...
@@ -48,23 +48,32 @@ class PhySim:
self
.
ranAllowMerge
=
""
self
.
ranAllowMerge
=
""
self
.
ranTargetBranch
=
""
self
.
ranTargetBranch
=
""
self
.
exitStatus
=
0
self
.
exitStatus
=
0
self
.
workSpacePath
=
''
#private attributes
self
.
buildLogFile
=
'compile_oai_enb.log'
self
.
__workSpacePath
=
''
self
.
runLogFile
=
'ldpctest_run_results.log'
self
.
__buildLogFile
=
'compile_oai_enb.log'
self
.
runResults
=
[]
self
.
__runLogFile
=
'ldpctest_run_results.log'
self
.
__runResults
=
[]
#-----------------
#PRIVATE Methods
#-----------------
def
__CheckResults_PhySim
(
self
,
HTML
,
CONST
):
def
__CheckResults_PhySim
(
self
,
HTML
,
CONST
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
#retrieve run log file locally$
#retrieve run log file
and store it
locally$
mySSH
.
copyin
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
,
self
.
workSpacePath
+
self
.
runLogFile
,
'.'
)
mySSH
.
copyin
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
,
self
.
__workSpacePath
+
self
.
__
runLogFile
,
'.'
)
mySSH
.
close
()
mySSH
.
close
()
with
open
(
self
.
runLogFile
)
as
f
:
#parse results looking for Encoding and Decoding mean values
with
open
(
self
.
__runLogFile
)
as
f
:
for
line
in
f
:
for
line
in
f
:
if
'mean'
in
line
:
if
'mean'
in
line
:
self
.
runResults
.
append
(
line
)
self
.
__runResults
.
append
(
line
)
info
=
self
.
runResults
[
-
1
]
+
self
.
runResults
[
-
2
]
#the value are appended for each test, so we take the last 2 values from the list
info
=
self
.
__runResults
[
-
1
]
+
self
.
__runResults
[
-
2
]
#updating the HTML with results
html_cell
=
'<pre style="background-color:white">'
+
info
+
'</pre>'
html_cell
=
'<pre style="background-color:white">'
+
info
+
'</pre>'
html_queue
=
SimpleQueue
()
html_queue
=
SimpleQueue
()
html_queue
.
put
(
html_cell
)
html_queue
.
put
(
html_cell
)
...
@@ -73,17 +82,18 @@ class PhySim:
...
@@ -73,17 +82,18 @@ class PhySim:
def
__CheckBuild_PhySim
(
self
,
HTML
,
CONST
):
def
__CheckBuild_PhySim
(
self
,
HTML
,
CONST
):
self
.
workSpacePath
=
self
.
eNBSourceCodePath
+
'/cmake_targets/'
self
.
__
workSpacePath
=
self
.
eNBSourceCodePath
+
'/cmake_targets/'
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
#retrieve compile log file locally
#retrieve compile log file
and store it
locally
mySSH
.
copyin
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
,
self
.
workSpacePath
+
self
.
buildLogFile
,
'.'
)
mySSH
.
copyin
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
,
self
.
__workSpacePath
+
self
.
__
buildLogFile
,
'.'
)
#delete older run log file
#delete older run log file
mySSH
.
command
(
'rm '
+
self
.
workSpacePath
+
self
.
runLogFile
,
'\$'
,
5
)
mySSH
.
command
(
'rm '
+
self
.
__workSpacePath
+
self
.
__
runLogFile
,
'\$'
,
5
)
mySSH
.
close
()
mySSH
.
close
()
#check build result from local compile log file
#check build result from local compile log file
buildStatus
=
False
buildStatus
=
False
with
open
(
self
.
buildLogFile
)
as
f
:
with
open
(
self
.
__buildLogFile
)
as
f
:
#nr_prachsim is the last compile step
if
'nr_prachsim compiled'
in
f
.
read
():
if
'nr_prachsim compiled'
in
f
.
read
():
buildStatus
=
True
buildStatus
=
True
#update HTML based on build status
#update HTML based on build status
...
@@ -94,9 +104,15 @@ class PhySim:
...
@@ -94,9 +104,15 @@ class PhySim:
logging
.
error
(
'
\u001B
[1m Building OAI UE Failed
\u001B
[0m'
)
logging
.
error
(
'
\u001B
[1m Building OAI UE Failed
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
buildargs
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
,
'LDPC'
)
HTML
.
CreateHtmlTestRow
(
self
.
buildargs
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
,
'LDPC'
)
HTML
.
CreateHtmlTabFooter
(
False
)
HTML
.
CreateHtmlTabFooter
(
False
)
#exitStatus=1 will do a sys.exit in main
self
.
exitStatus
=
1
self
.
exitStatus
=
1
return
HTML
return
HTML
#-----------------$
#PUBLIC Methods$
#-----------------$
def
Build_PhySim
(
self
,
htmlObj
,
constObj
):
def
Build_PhySim
(
self
,
htmlObj
,
constObj
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
...
@@ -145,11 +161,14 @@ class PhySim:
...
@@ -145,11 +161,14 @@ class PhySim:
def
Run_PhySim
(
self
,
htmlObj
,
constObj
):
def
Run_PhySim
(
self
,
htmlObj
,
constObj
):
#open a session for test run
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
mySSH
.
open
(
self
.
eNBIpAddr
,
self
.
eNBUserName
,
self
.
eNBPassWord
)
mySSH
.
command
(
'cd '
+
self
.
workSpacePath
,
'\$'
,
5
)
mySSH
.
command
(
'cd '
+
self
.
__workSpacePath
,
'\$'
,
5
)
mySSH
.
command
(
self
.
workSpacePath
+
'phy_simulators/build/ldpctest '
+
self
.
runargs
+
' >> '
+
self
.
runLogFile
,
'\$'
,
30
)
#run and redirect the results to a log file
mySSH
.
command
(
self
.
__workSpacePath
+
'phy_simulators/build/ldpctest '
+
self
.
runargs
+
' >> '
+
self
.
__runLogFile
,
'\$'
,
30
)
mySSH
.
close
()
mySSH
.
close
()
#return updated HTML to main
lHTML
=
html
.
HTMLManagement
()
lHTML
=
html
.
HTMLManagement
()
lHTML
=
self
.
__CheckResults_PhySim
(
htmlObj
,
constObj
)
lHTML
=
self
.
__CheckResults_PhySim
(
htmlObj
,
constObj
)
return
lHTML
return
lHTML
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