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
cef76f3d
Commit
cef76f3d
authored
Mar 06, 2024
by
Jaroslava Fiedlerova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put Iperf_ComputeModifiedBW and Iperf_ComputeTime outside the class
parent
08353293
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
32 deletions
+34
-32
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+34
-32
No files found.
ci-scripts/cls_oaicitest.py
View file @
cef76f3d
...
...
@@ -59,6 +59,40 @@ logging.getLogger("matplotlib").setLevel(logging.WARNING)
import
matplotlib.pyplot
as
plt
import
numpy
as
np
#-----------------------------------------------------------
# Helper functions used here and in other classes
#-----------------------------------------------------------
def
Iperf_ComputeModifiedBW
(
idx
,
ue_num
,
profile
,
args
):
result
=
re
.
search
(
'-b\s*(?P<iperf_bandwidth>[0-9\.]+)(?P<unit>[KMG])'
,
str
(
args
))
if
result
is
None
:
raise
Exception
(
'Iperf bandwidth not found or in incorrect format!'
)
iperf_bandwidth
=
result
.
group
(
'iperf_bandwidth'
)
if
profile
==
'balanced'
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
/
ue_num
if
profile
==
'single-ue'
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
if
profile
==
'unbalanced'
:
# residual is 2% of max bw
residualBW
=
float
(
iperf_bandwidth
)
/
50
if
idx
==
0
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
-
((
ue_num
-
1
)
*
residualBW
)
else
:
iperf_bandwidth_new
=
residualBW
iperf_bandwidth_str
=
result
.
group
(
0
)
iperf_bandwidth_unit
=
result
.
group
(
2
)
iperf_bandwidth_str_new
=
f"-b
{
'%.2f'
%
iperf_bandwidth_new
}{
iperf_bandwidth_unit
}
"
result
=
re
.
sub
(
iperf_bandwidth_str
,
iperf_bandwidth_str_new
,
str
(
args
))
if
result
is
None
:
raise
Exception
(
'Calculate Iperf bandwidth failed!'
)
return
result
def
Iperf_ComputeTime
(
args
):
result
=
re
.
search
(
'-t\s*(?P<iperf_time>\d+)'
,
str
(
args
))
if
result
is
None
:
raise
Exception
(
'Iperf time not found!'
)
return
int
(
result
.
group
(
'iperf_time'
))
#-----------------------------------------------------------
# OaiCiTest Class Definition
#-----------------------------------------------------------
...
...
@@ -605,38 +639,6 @@ class OaiCiTest():
HTML
.
CreateHtmlTestRowQueue
(
self
.
ping_args
,
'KO'
,
messages
)
self
.
AutoTerminateUEandeNB
(
HTML
,
RAN
,
EPC
,
CONTAINERS
)
def
Iperf_ComputeTime
(
self
):
result
=
re
.
search
(
'-t (?P<iperf_time>\d+)'
,
str
(
self
.
iperf_args
))
if
result
is
None
:
logging
.
debug
(
'
\u001B
[1;37;41m Iperf time Not Found!
\u001B
[0m'
)
sys
.
exit
(
1
)
return
result
.
group
(
'iperf_time'
)
def
Iperf_ComputeModifiedBW
(
self
,
idx
,
ue_num
):
result
=
re
.
search
(
'-b (?P<iperf_bandwidth>[0-9\.]+)[KMG]'
,
str
(
self
.
iperf_args
))
if
result
is
None
:
logging
.
error
(
'
\u001B
[1;37;41m Iperf bandwidth Not Found!
\u001B
[0m'
)
sys
.
exit
(
1
)
iperf_bandwidth
=
result
.
group
(
'iperf_bandwidth'
)
if
self
.
iperf_profile
==
'balanced'
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
/
ue_num
if
self
.
iperf_profile
==
'single-ue'
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
if
self
.
iperf_profile
==
'unbalanced'
:
# residual is 2% of max bw
residualBW
=
float
(
iperf_bandwidth
)
/
50
if
idx
==
0
:
iperf_bandwidth_new
=
float
(
iperf_bandwidth
)
-
((
ue_num
-
1
)
*
residualBW
)
else
:
iperf_bandwidth_new
=
residualBW
iperf_bandwidth_str
=
f'-b
{
iperf_bandwidth
}
'
iperf_bandwidth_str_new
=
f"-b
{
'%.2f'
%
iperf_bandwidth_new
}
"
result
=
re
.
sub
(
iperf_bandwidth_str
,
iperf_bandwidth_str_new
,
str
(
self
.
iperf_args
))
if
result
is
None
:
logging
.
error
(
'
\u001B
[1;37;41m Calculate Iperf bandwidth Failed!
\u001B
[0m'
)
sys
.
exit
(
1
)
return
result
def
Iperf_analyzeV2TCPOutput
(
self
,
SSH
,
filename
):
SSH
.
command
(
f'awk -f /tmp/tcp_iperf_stats.awk
{
filename
}
'
,
'\$'
,
5
)
...
...
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