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
3924f4bb
Commit
3924f4bb
authored
Apr 27, 2021
by
hardy
Committed by
Remi Hardy
Apr 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding features to UE mgt
parent
f5e7b934
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
36 deletions
+27
-36
ci-scripts/ci_ueinfra.yaml
ci-scripts/ci_ueinfra.yaml
+4
-1
ci-scripts/cls_module_ue.py
ci-scripts/cls_module_ue.py
+21
-33
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+2
-2
No files found.
ci-scripts/ci_ueinfra.yaml
View file @
3924f4bb
...
...
@@ -2,9 +2,12 @@ idefix:
ID
:
idefix
State
:
enabled
Kind
:
quectel
Process
:
quectel-CM
Process
:
Name
:
quectel-CM
Cmd
:
/home/oaicicd/quectel-CM/quectel-CM -s oai.ipv4 -4
WakeupScript
:
ci_ctl_qtel.py /dev/ttyUSB2 wup
DetachScript
:
ci_ctl_qtel.py /dev/ttyUSB2 detach
PLMN
:
22201
UENetwork
:
wwan0
HostIPAddress
:
192.168.18.188
HostUsername
:
oaicicd
...
...
ci-scripts/cls_module_ue.py
View file @
3924f4bb
...
...
@@ -66,39 +66,24 @@ class Module_UE:
#-----------------$
#this method checks if the specified Process is running on the server hosting the module
def
CheckIsModule
(
self
):
#if not it will be started
def
CheckCMProcess
(
self
):
HOST
=
self
.
HostIPAddress
COMMAND
=
"ps aux | grep "
+
self
.
Process
+
" | grep -v grep "
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
+
" process found"
)
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process found"
)
return
True
else
:
logging
.
debug
(
self
.
Process
+
" process NOT found"
)
logging
.
debug
(
self
.
Process
[
'Name'
]
+
" process NOT found"
)
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
#Wakeup/Detach can probably be improved with encapsulation of the command such def Command(self, command)
#this method wakes up the module by calling the specified python script
# def WakeUp(self):
# mySSH = sshconnection.SSHConnection()
# mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
# mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.WakeupScript + ' ','\$',5)
# time.sleep(5)
# logging.debug("Module wake-up")
# mySSH.close()
#this method detaches the module by calling the specified python script
# def Detach(self):
# mySSH = sshconnection.SSHConnection()
# mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
# mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.DetachScript + ' ','\$',5)
# time.sleep(5)
# logging.debug("Module detach")
# mySSH.close()
#tentative: generic command function
#Generic command function, using function pointers dictionary
def
Command
(
self
,
cmd
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
HostIPAddress
,
self
.
HostUsername
,
self
.
HostPassword
)
...
...
@@ -111,11 +96,18 @@ class Module_UE:
#this method retrieves the Module IP address (not the Host IP address)
def
GetModuleIPAddress
(
self
):
HOST
=
self
.
HostIPAddress
COMMAND
=
"ip a show dev "
+
self
.
UENetwork
+
" | grep inet | grep "
+
self
.
UENetwork
logging
.
debug
(
COMMAND
)
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
response
=
ssh
.
stdout
.
readlines
()
if
len
(
response
)
!=
0
:
response
=
[]
tentative
=
10
while
(
len
(
response
)
==
0
)
and
(
tentative
>
0
):
COMMAND
=
"ip a show dev "
+
self
.
UENetwork
+
" | grep inet | grep "
+
self
.
UENetwork
logging
.
debug
(
COMMAND
)
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
response
=
ssh
.
stdout
.
readlines
()
tentative
-=
1
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
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
:
...
...
@@ -123,10 +115,6 @@ class Module_UE:
logging
.
debug
(
'
\u001B
[1mUE Module IP Address is '
+
self
.
UEIPAddress
+
'
\u001B
[0m'
)
else
:
logging
.
debug
(
'
\u001B
[1;37;41m Module IP Address Not Found!
\u001B
[0m'
)
else
:
logging
.
debug
(
'
\u001B
[1;37;41m Module IP Address Not Found!
\u001B
[0m'
)
else
:
logging
.
debug
(
'
\u001B
[1;37;41m Module IP Address Not Found!
\u001B
[0m'
)
...
...
ci-scripts/cls_oaicitest.py
View file @
3924f4bb
...
...
@@ -386,7 +386,7 @@ class OaiCiTest():
else
:
#if an ID is specified, it is a module from the yaml infrastructure file
#RH
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
Check
IsModule
()
is_module
=
Module_UE
.
Check
CMProcess
()
if
is_module
:
#Module_UE.WakeUp()
Module_UE
.
Command
(
"wup"
)
...
...
@@ -1074,7 +1074,7 @@ class OaiCiTest():
cnt
+=
1
else
:
#if an ID is specified, it is a module from the yaml infrastructure file
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
Check
IsModule
()
is_module
=
Module_UE
.
Check
CMProcess
()
if
is_module
:
#Module_UE.Detach()
Module_UE
.
Command
(
"detach"
)
...
...
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