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
常顺宇
OpenXG-RAN
Commits
7bf4f8da
Commit
7bf4f8da
authored
Apr 13, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tentative to improve Module control encapsulation
parent
8def7528
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
ci-scripts/cls_module_ue.py
ci-scripts/cls_module_ue.py
+22
-11
ci-scripts/cls_oaicitest.py
ci-scripts/cls_oaicitest.py
+4
-2
No files found.
ci-scripts/cls_module_ue.py
View file @
7bf4f8da
...
...
@@ -56,7 +56,8 @@ class Module_UE:
for
k
,
v
in
Module
.
items
():
setattr
(
self
,
k
,
v
)
self
.
UEIPAddress
=
""
#dictionary linking command names and related module scripts
self
.
cmd_dict
=
{
"wup"
:
self
.
WakeupScript
,
"detach"
:
self
.
DetachScript
}
#dictionary of function scripts
...
...
@@ -80,23 +81,33 @@ class Module_UE:
#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
()
#
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
):
# 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
def
Command
(
self
,
cmd
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
HostIPAddress
,
self
.
HostUsername
,
self
.
HostPassword
)
mySSH
.
command
(
'echo '
+
self
.
HostPassword
+
' | sudo -S python3 '
+
self
.
DetachScript
+
' '
,
'\$'
,
5
)
mySSH
.
command
(
'echo '
+
self
.
HostPassword
+
' | sudo -S python3 '
+
self
.
cmd_dict
[
cmd
]
+
' '
,
'\$'
,
5
)
time
.
sleep
(
5
)
logging
.
debug
(
"Module
detach"
)
logging
.
debug
(
"Module
"
+
cmd
)
mySSH
.
close
()
#this method retrieves the Module IP address (not the Host IP address)
def
GetModuleIPAddress
(
self
):
HOST
=
self
.
HostIPAddress
...
...
ci-scripts/cls_oaicitest.py
View file @
7bf4f8da
...
...
@@ -388,7 +388,8 @@ class OaiCiTest():
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
CheckIsModule
()
if
is_module
:
Module_UE
.
WakeUp
()
#Module_UE.WakeUp()
Module_UE
.
Command
(
"wup"
)
Module_UE
.
GetModuleIPAddress
()
HTML
.
CreateHtmlTestRow
(
Module_UE
.
UEIPAddress
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
self
.
UEIPAddresses
.
append
(
Module_UE
.
UEIPAddress
)
...
...
@@ -1075,7 +1076,8 @@ class OaiCiTest():
Module_UE
=
cls_module_ue
.
Module_UE
(
InfraUE
.
ci_ue_infra
[
self
.
ue_id
])
is_module
=
Module_UE
.
CheckIsModule
()
if
is_module
:
Module_UE
.
Detach
()
#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