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
c126cbab
Commit
c126cbab
authored
Apr 07, 2023
by
Raphael Defosseux
Committed by
Dhanuja Elizabeth Thomas
Apr 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ci): Changes for debugging ssh connection issues faced while iperf/ping operations
parent
98f4d038
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
ci-scripts/cls_cmd.py
ci-scripts/cls_cmd.py
+13
-2
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+1
-1
No files found.
ci-scripts/cls_cmd.py
View file @
c126cbab
...
...
@@ -31,6 +31,9 @@ import subprocess as sp
import
os
import
paramiko
import
uuid
import
sys
SSHTIMEOUT
=
7
# helper that returns either LocalCmd or RemoteCmd based on passed host name
def
getConnection
(
host
,
d
=
None
):
...
...
@@ -123,13 +126,21 @@ class LocalCmd(Cmd):
class
RemoteCmd
(
Cmd
):
def
__init__
(
self
,
hostname
,
d
=
None
):
cIdx
=
0
logging
.
getLogger
(
'paramiko'
).
setLevel
(
logging
.
ERROR
)
# prevent spamming through Paramiko
self
.
client
=
paramiko
.
SSHClient
()
self
.
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
cfg
=
RemoteCmd
.
_lookup_ssh_config
(
hostname
)
self
.
client
.
connect
(
**
cfg
)
self
.
cwd
=
d
self
.
cp
=
sp
.
CompletedProcess
(
args
=
''
,
returncode
=
0
,
stdout
=
''
)
while
cIdx
<
3
:
try
:
self
.
client
.
connect
(
**
cfg
)
return
except
:
logging
.
error
(
f'Could not connect to
{
hostname
}
, tried for
{
cIdx
}
time'
)
cIdx
+=
1
raise
Exception
(
"Error: max retries, did not connect to host"
)
def
_lookup_ssh_config
(
hostname
):
ssh_config
=
paramiko
.
SSHConfig
()
...
...
@@ -142,7 +153,7 @@ class RemoteCmd(Cmd):
ucfg
=
ssh_config
.
lookup
(
hostname
)
if
'identityfile'
not
in
ucfg
or
'user'
not
in
ucfg
:
raise
KeyError
(
f'no identityfile or user in SSH config for host
{
hostname
}
'
)
cfg
=
{
'hostname'
:
hostname
,
'username'
:
ucfg
[
'user'
],
'key_filename'
:
ucfg
[
'identityfile'
]}
cfg
=
{
'hostname'
:
hostname
,
'username'
:
ucfg
[
'user'
],
'key_filename'
:
ucfg
[
'identityfile'
]
,
'timeout'
:
SSHTIMEOUT
}
if
'hostname'
in
ucfg
:
cfg
[
'hostname'
]
=
ucfg
[
'hostname'
]
# override user-given hostname with what is in config
if
'port'
in
ucfg
:
...
...
ci-scripts/cls_oaicitest.py
View file @
c126cbab
...
...
@@ -1271,7 +1271,7 @@ class OaiCiTest():
logging
.
debug
(
"Iperf in UL requested"
)
cmd
=
cls_cmd
.
getConnection
(
EPC
.
IPAddress
)
cmd
.
run
(
f'rm
{
EPC
.
SourceCodePath
}
/
{
server_filename
}
'
)
cmd
.
run
(
f'
{
cn_iperf_prefix
}
iperf -s
{
udpSwitch
}
-
1 -
t
{
iperf_time
*
1.5
}
{
port
}
&>
{
EPC
.
SourceCodePath
}
/
{
server_filename
}
&'
)
cmd
.
run
(
f'
{
cn_iperf_prefix
}
iperf -s
{
udpSwitch
}
-t
{
iperf_time
*
1.5
}
{
port
}
&>
{
EPC
.
SourceCodePath
}
/
{
server_filename
}
&'
)
cmd
.
close
()
cmd
=
cls_cmd
.
getConnection
(
ue
.
getHost
())
...
...
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