Commit dfe6278e authored by Remi Hardy's avatar Remi Hardy

fixing issues for CI integration

parent 87dccea4
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
import logging import logging
#to create a SSH object locally in the methods #to create a SSH object locally in the methods
import sshconnection import sshconnection
#time.sleep
import time
class CotsUe: class CotsUe:
def __init__(self,model,UEIPAddr,UEUserName,UEPassWord): def __init__(self,model,UEIPAddr,UEUserName,UEPassWord):
...@@ -49,7 +50,6 @@ class CotsUe: ...@@ -49,7 +50,6 @@ class CotsUe:
def Check_Airplane(self): def Check_Airplane(self):
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord) mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord)
mySSH.command('cd /home/oaici/remi/android-sdk-linux/platform-tools', '\$', 5) mySSH.command('cd /home/oaici/remi/android-sdk-linux/platform-tools', '\$', 5)
status=mySSH.cde_check_value('sudo ./adb shell settings get global airplane_mode_on ', ['0','1'],5) status=mySSH.cde_check_value('sudo ./adb shell settings get global airplane_mode_on ', ['0','1'],5)
mySSH.close() mySSH.close()
...@@ -57,7 +57,11 @@ class CotsUe: ...@@ -57,7 +57,11 @@ class CotsUe:
def Set_Airplane(self,target_state_str): def Set_Airplane(self,target_state_str):
print("toggling state to : "+target_state_str) mySSH = sshconnection.SSHConnection()
mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord)
mySSH.command('cd /home/oaici/remi/android-sdk-linux/platform-tools', '\$', 5)
mySSH.command('sudo ./adb start-server','$',5)
logging.info("Toggling COTS UE Airplane mode to : "+target_state_str)
current_state = self.Check_Airplane() current_state = self.Check_Airplane()
if target_state_str.lower()=="on": if target_state_str.lower()=="on":
target_state=1 target_state=1
...@@ -65,11 +69,8 @@ class CotsUe: ...@@ -65,11 +69,8 @@ class CotsUe:
target_state=0 target_state=0
if current_state != target_state: if current_state != target_state:
#toggle state #toggle state
mySSH = sshconnection.SSHConnection()
mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord)
retry = 0 retry = 0
while (current_state!=target_state) and (retry < self.__SetAirplaneRetry): while (current_state!=target_state) and (retry < self.__SetAirplaneRetry):
mySSH.command('cd /home/oaici/remi/android-sdk-linux/platform-tools', '\$', 5)
mySSH.command('sudo ./adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS', '\$', 5) 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 keyevent 20', '\$', 5)
mySSH.command('sudo ./adb shell input tap 968 324', '\$', 5) mySSH.command('sudo ./adb shell input tap 968 324', '\$', 5)
...@@ -79,10 +80,10 @@ class CotsUe: ...@@ -79,10 +80,10 @@ class CotsUe:
if current_state != target_state: if current_state != target_state:
print("ATTENTION : Could not toggle to : "+target_state_str) print("ATTENTION : Could not toggle to : "+target_state_str)
print("Current state is : "+ str(current_state)) print("Current state is : "+ str(current_state))
mySSH.close()
else: else:
print("Airplane mode is already "+ target_state_str) print("Airplane mode is already "+ target_state_str)
mySSH.command('sudo ./adb kill-server','$',5)
mySSH.close()
......
...@@ -50,6 +50,7 @@ logging.basicConfig( ...@@ -50,6 +50,7 @@ logging.basicConfig(
format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s" format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s"
) )
import cls_cots_ue
#----------------------------------------------------------- #-----------------------------------------------------------
# Class Declaration # Class Declaration
...@@ -3063,7 +3064,7 @@ class OaiCiTest(): ...@@ -3063,7 +3064,7 @@ class OaiCiTest():
logging.debug('\u001B[1m----------------------------------------\u001B[0m') logging.debug('\u001B[1m----------------------------------------\u001B[0m')
def CheckClassValidity(action,id): def CheckClassValidity(action,id):
if action!='Build_PhySim' and action!='Run_PhySim' and action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover': if action!='COTS_UE_Airplane' and action!='Build_PhySim' and action!='Run_PhySim' and action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover':
logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action) logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
return False return False
return True return True
...@@ -3238,7 +3239,6 @@ def GetParametersFromXML(action): ...@@ -3238,7 +3239,6 @@ def GetParametersFromXML(action):
ldpc.runargs = test.findtext('physim_run_args') ldpc.runargs = test.findtext('physim_run_args')
if action == 'COTS_UE_Airplane': if action == 'COTS_UE_Airplane':
COTS_UE=CotsUe('oppo', self.UEIPAddress, self.UEUserName,UEPassword)
COTS_UE.runargs = test.findtext('cots_ue_airplane_args') COTS_UE.runargs = test.findtext('cots_ue_airplane_args')
#check if given test is in list #check if given test is in list
...@@ -3278,7 +3278,6 @@ RAN.EpcObj=EPC ...@@ -3278,7 +3278,6 @@ RAN.EpcObj=EPC
import cls_physim #class PhySim for physical simulators build and test import cls_physim #class PhySim for physical simulators build and test
ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build
import cls_cots_ue #class CotsUe
argvs = sys.argv argvs = sys.argv
...@@ -3450,6 +3449,12 @@ while len(argvs) > 1: ...@@ -3450,6 +3449,12 @@ while len(argvs) > 1:
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Invalid Parameter: ' + myArgv) sys.exit('Invalid Parameter: ' + myArgv)
COTS_UE=cls_cots_ue.CotsUe('oppo', CiTestObj.UEIPAddress, CiTestObj.UEUserName,CiTestObj.UEPassword)
if re.match('^TerminateeNB$', mode, re.IGNORECASE): if re.match('^TerminateeNB$', mode, re.IGNORECASE):
if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '': if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
...@@ -3754,6 +3759,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -3754,6 +3759,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
if ldpc.exitStatus==1:sys.exit() if ldpc.exitStatus==1:sys.exit()
elif action == 'Run_PhySim': elif action == 'Run_PhySim':
HTML=ldpc.Run_PhySim(HTML,CONST,id) HTML=ldpc.Run_PhySim(HTML,CONST,id)
elif action == 'COTS_UE_Airplane':
COTS_UE.Set_Airplane(COTS_UE.runargs)
else: else:
sys.exit('Invalid action') sys.exit('Invalid action')
CiTestObj.FailReportCnt += 1 CiTestObj.FailReportCnt += 1
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<testCase id="010101"> <testCase id="010101">
<class>COTS_UE_Airplane</class> <class>COTS_UE_Airplane</class>
<desc>toggle on</desc> <desc>Toggle COTS Airplane mode ON</desc>
<cots_ue_airplane_args>ON</cots_ue_airplane_args> <cots_ue_airplane_args>ON</cots_ue_airplane_args>
</testCase> </testCase>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment