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
ZhouShuya
OpenXG-RAN
Commits
8b56606a
Commit
8b56606a
authored
Apr 27, 2021
by
Remi Hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes and improvements
parent
78f04b80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
ci-scripts/cls_module_ue.py
ci-scripts/cls_module_ue.py
+24
-7
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+1
-3
No files found.
ci-scripts/cls_module_ue.py
View file @
8b56606a
...
...
@@ -76,18 +76,32 @@ class Module_UE:
if
len
(
result
)
!=
0
:
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process found"
)
return
True
else
:
else
:
#start process and check again
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process NOT found"
)
#starting the process
logging
.
debug
(
'Starting '
+
self
.
Process
[
'Name'
])
logging
.
debug
(
self
.
Process
[
'Cmd'
])
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
self
.
Process
[
'Cmd'
]],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
return
False
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
HostIPAddress
,
self
.
HostUsername
,
self
.
HostPassword
)
mySSH
.
command
(
'echo '
+
self
.
HostPassword
+
' | sudo -S '
+
self
.
Process
[
'Cmd'
]
+
' &'
,
'\$'
,
5
)
mySSH
.
close
()
#checking the process
HOST
=
self
.
HostIPAddress
COMMAND
=
"ps aux | grep "
+
self
.
Process
[
'Name'
]
+
" | grep -v grep "
logging
.
debug
(
COMMAND
)
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
result
=
ssh
.
stdout
.
readlines
()
if
len
(
result
)
!=
0
:
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process found"
)
return
True
else
:
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process NOT found"
)
return
False
#Generic command function, using function pointers dictionary
def
Command
(
self
,
cmd
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
HostIPAddress
,
self
.
HostUsername
,
self
.
HostPassword
)
mySSH
.
command
(
'echo '
+
self
.
HostPassword
+
' | sudo -S python3 '
+
self
.
cmd_dict
[
cmd
]
+
' '
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
HostPassword
+
' | sudo -S python3 '
+
self
.
cmd_dict
[
cmd
],
'\$'
,
5
)
time
.
sleep
(
5
)
logging
.
debug
(
"Module "
+
cmd
)
mySSH
.
close
()
...
...
@@ -104,17 +118,20 @@ class Module_UE:
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
response
=
ssh
.
stdout
.
readlines
()
tentative
-=
1
sleep
(
10
)
time
.
sleep
(
10
)
if
(
tentative
==
0
)
and
(
len
(
response
)
==
0
):
logging
.
debug
(
'
\u001B
[1;37;41m Module IP Address Not Found! Time expired
\u001B
[0m'
)
else
#check response
return
-
1
else
:
#check response
result
=
re
.
search
(
'inet (?P<moduleipaddress>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'
,
response
[
0
].
decode
(
"utf-8"
)
)
if
result
is
not
None
:
if
result
.
group
(
'moduleipaddress'
)
is
not
None
:
self
.
UEIPAddress
=
result
.
group
(
'moduleipaddress'
)
logging
.
debug
(
'
\u001B
[1mUE Module IP Address is '
+
self
.
UEIPAddress
+
'
\u001B
[0m'
)
return
0
else
:
logging
.
debug
(
'
\u001B
[1;37;41m Module IP Address Not Found!
\u001B
[0m'
)
return
-
1
...
...
ci-scripts/cls_oaicitest.py
View file @
8b56606a
...
...
@@ -388,7 +388,6 @@ class OaiCiTest():
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
CheckCMProcess
()
if
is_module
:
#Module_UE.WakeUp()
Module_UE
.
Command
(
"wup"
)
Module_UE
.
GetModuleIPAddress
()
HTML
.
CreateHtmlTestRow
(
Module_UE
.
UEIPAddress
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
...
...
@@ -1040,7 +1039,7 @@ class OaiCiTest():
except
:
os
.
kill
(
os
.
getppid
(),
signal
.
SIGUSR1
)
def
DetachUE
(
self
,
HTML
,
RAN
,
EPC
,
COTS_UE
):
def
DetachUE
(
self
,
HTML
,
RAN
,
EPC
,
COTS_UE
,
InfraUE
):
if
self
.
ue_id
==
''
:
#no ID specified, then it is a COTS controlled by ADB
if
self
.
ADBIPAddress
==
''
or
self
.
ADBUserName
==
''
or
self
.
ADBPassword
==
''
:
HELP
.
GenericHelp
(
CONST
.
Version
)
...
...
@@ -1076,7 +1075,6 @@ class OaiCiTest():
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
CheckCMProcess
()
if
is_module
:
#Module_UE.Detach()
Module_UE
.
Command
(
"detach"
)
Module_UE
.
GetModuleIPAddress
()
HTML
.
CreateHtmlTestRow
(
Module_UE
.
UEIPAddress
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
...
...
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