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
eddf218d
Commit
eddf218d
authored
Aug 18, 2020
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating python to read ue commands dictionary
parent
05f052cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
39 deletions
+65
-39
ci-scripts/cls_cots_ue.py
ci-scripts/cls_cots_ue.py
+40
-32
ci-scripts/cots_ue_ctl.yaml
ci-scripts/cots_ue_ctl.yaml
+16
-0
ci-scripts/main.py
ci-scripts/main.py
+7
-6
ci-scripts/xml_files/fr1_toggle_cots_ue.xml
ci-scripts/xml_files/fr1_toggle_cots_ue.xml
+2
-1
No files found.
ci-scripts/cls_cots_ue.py
View file @
eddf218d
...
...
@@ -33,14 +33,16 @@ import logging
import
sshconnection
#time.sleep
import
time
#to load cots_ue dictionary
import
yaml
class
CotsUe
:
def
__init__
(
self
,
model
,
UEIPAddr
,
UEUserName
,
UE
PassWord
):
self
.
model
=
model
self
.
UEIPAddr
=
UE
IPAddr
self
.
UEUserName
=
UE
UserName
self
.
UEPassWord
=
UE
PassWord
self
.
runargs
=
''
#on of off to toggle airplane mode on/off
def
__init__
(
self
,
ADBIPAddr
,
ADBUserName
,
ADB
PassWord
):
self
.
cots_id
=
''
#cots id from yaml oppo, s10 etc...
self
.
ADBIPAddr
=
ADB
IPAddr
self
.
ADBUserName
=
ADB
UserName
self
.
ADBPassWord
=
ADB
PassWord
self
.
cots_run_mode
=
''
#on of off to toggle airplane mode on/off
self
.
__SetAirplaneRetry
=
3
#-----------------$
...
...
@@ -49,39 +51,45 @@ class CotsUe:
def
Check_Airplane
(
self
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
UEIPAddr
,
self
.
UEUserName
,
self
.
UE
PassWord
)
mySSH
.
open
(
self
.
ADBIPAddr
,
self
.
ADBUserName
,
self
.
ADB
PassWord
)
status
=
mySSH
.
cde_check_value
(
'sudo adb shell settings get global airplane_mode_on '
,
[
'0'
,
'1'
],
5
)
mySSH
.
close
()
return
status
def
Set_Airplane
(
self
,
target_state_str
):
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
UEIPAddr
,
self
.
UEUserName
,
self
.
UEPassWord
)
mySSH
.
command
(
'sudo adb start-server'
,
'$'
,
5
)
logging
.
info
(
"Toggling COTS UE Airplane mode to : "
+
target_state_str
)
current_state
=
self
.
Check_Airplane
()
if
target_state_str
.
lower
()
==
"on"
:
target_state
=
1
else
:
target_state
=
0
if
current_state
!=
target_state
:
#toggle state
retry
=
0
while
(
current_state
!=
target_state
)
and
(
retry
<
self
.
__SetAirplaneRetry
):
mySSH
.
command
(
'sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS'
,
'\$'
,
5
)
mySSH
.
command
(
'sudo adb shell input keyevent 20'
,
'\$'
,
5
)
mySSH
.
command
(
'sudo adb shell input tap 968 324'
,
'\$'
,
5
)
time
.
sleep
(
1
)
current_state
=
self
.
Check_Airplane
()
retry
+=
1
def
Set_Airplane
(
self
,
target_id
,
target_state_str
):
#load cots commands dictionary
with
open
(
'cots_ue_ctl.yaml'
,
'r'
)
as
file
:
cots_ue_ctl
=
yaml
.
load
(
file
,
Loader
=
yaml
.
FullLoader
)
if
target_id
in
cots_ue_ctl
:
mySSH
=
sshconnection
.
SSHConnection
()
mySSH
.
open
(
self
.
ADBIPAddr
,
self
.
ADBUserName
,
self
.
ADBPassWord
)
mySSH
.
command
(
'sudo adb start-server'
,
'$'
,
5
)
logging
.
info
(
"Toggling COTS UE Airplane mode to : "
+
target_state_str
)
current_state
=
self
.
Check_Airplane
()
if
target_state_str
.
lower
()
==
"on"
:
target_state
=
1
else
:
target_state
=
0
if
current_state
!=
target_state
:
logging
.
error
(
"ATTENTION : Could not toggle to : "
+
target_state_str
)
logging
.
error
(
"Current state is : "
+
str
(
current_state
))
#toggle state
retry
=
0
while
(
current_state
!=
target_state
)
and
(
retry
<
self
.
__SetAirplaneRetry
):
#loop over the command list from dictionary for the selected ue, to switch to required state
for
i
in
range
(
0
,
len
(
cots_ue_ctl
[
target_id
])):
mySSH
.
command
(
cots_ue_ctl
[
target_id
][
i
],
'\$'
,
5
)
time
.
sleep
(
1
)
current_state
=
self
.
Check_Airplane
()
retry
+=
1
if
current_state
!=
target_state
:
logging
.
error
(
"ATTENTION : Could not toggle to : "
+
target_state_str
)
logging
.
error
(
"Current state is : "
+
str
(
current_state
))
else
:
print
(
"Airplane mode is already "
+
target_state_str
)
mySSH
.
command
(
'sudo adb kill-server'
,
'$'
,
5
)
mySSH
.
close
()
else
:
print
(
"Airplane mode is already "
+
target_state_str
)
mySSH
.
command
(
'sudo adb kill-server'
,
'$'
,
5
)
mySSH
.
close
()
logging
.
error
(
"COTS UE Id from XML could not be found in UE YAML dictionary cots_ue_ctl.yaml)
...
...
ci-scripts/cots_ue_ctl.yaml
0 → 100644
View file @
eddf218d
oppo
:
-
sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
-
sudo adb shell input keyevent
20
-
sudo adb shell input tap 968
324
s10
:
-
sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
-
sudo adb shell input keyevent
20
-
sudo adb shell input tap 968
324
s20
:
-
sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
-
sudo adb shell input keyevent
20
-
sudo adb shell input tap 968
324
xperia
:
-
sudo adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
-
sudo adb shell input keyevent
20
-
sudo adb shell input tap 968
324
ci-scripts/main.py
View file @
eddf218d
...
...
@@ -3295,7 +3295,8 @@ def GetParametersFromXML(action):
ldpc
.
runargs
=
test
.
findtext
(
'physim_run_args'
)
if
action
==
'COTS_UE_Airplane'
:
COTS_UE
.
runargs
=
test
.
findtext
(
'cots_ue_airplane_args'
)
COTS_UE
.
cots_id
=
test
.
findtext
(
'cots_id'
)
COTS_UE
.
cots_run_mode
=
test
.
findtext
(
'cots_run_mode'
)
#check if given test is in list
#it is in list if one of the strings in 'list' is at the beginning of 'test'
...
...
@@ -3323,8 +3324,6 @@ import yaml
xml_class_list_file
=
''
if
(
os
.
path
.
isfile
(
'xml_class_list.yml'
)):
xml_class_list_file
=
'xml_class_list.yml'
if
(
os
.
path
.
isfile
(
'ci-scripts/xml_class_list.yml'
)):
xml_class_list_file
=
'ci-scripts/xml_class_list.yml'
with
open
(
xml_class_list_file
,
'r'
)
as
file
:
# The FullLoader parameter handles the conversion from YAML
# scalar values to Python the dictionary format
...
...
@@ -3375,8 +3374,9 @@ if py_param_file_present == True:
#-----------------------------------------------------------
# COTS UE instanciation
#-----------------------------------------------------------
#COTS_UE instanciation can only be done here for the moment, due to code architecture
COTS_UE
=
cls_cots_ue
.
CotsUe
(
'oppo'
,
CiTestObj
.
UEIPAddress
,
CiTestObj
.
UEUserName
,
CiTestObj
.
UEPassword
)
#COTS_UE instanciation and ADB server init
#ue id and ue mode are retrieved from xml
COTS_UE
=
cls_cots_ue
.
CotsUe
(
CiTestObj
.
ADBIPAddress
,
CiTestObj
.
ADBUserName
,
CiTestObj
.
ADBPassword
)
#-----------------------------------------------------------
...
...
@@ -3689,7 +3689,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif
action
==
'Run_PhySim'
:
HTML
=
ldpc
.
Run_PhySim
(
HTML
,
CONST
,
id
)
elif
action
==
'COTS_UE_Airplane'
:
COTS_UE
.
Set_Airplane
(
COTS_UE
.
runargs
)
#cots id and cots run mode were read from xml test file
COTS_UE
.
Set_Airplane
(
COTS_UE
.
cots_id
,
COTS_UE
.
cots_run_mode
)
else
:
sys
.
exit
(
'Invalid class (action) from xml'
)
CiTestObj
.
FailReportCnt
+=
1
...
...
ci-scripts/xml_files/fr1_toggle_cots_ue.xml
View file @
eddf218d
...
...
@@ -32,7 +32,8 @@
<testCase
id=
"010000"
>
<class>
COTS_UE_Airplane
</class>
<desc>
Toggle COTS Airplane mode ON
</desc>
<cots_ue_airplane_args>
ON
</cots_ue_airplane_args>
<cots_id>
oppo
</cots_id>
<cots_run_mode>
ON
</cots_run_mode>
</testCase>
...
...
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