diff --git a/ci-scripts/cls_cots_ue.py b/ci-scripts/cls_cots_ue.py index 821d39fb6fb17915f942419319c0f92f8ef00f79..3e4c8179a86278857a38ed4b878c98c3b9df96ee 100644 --- a/ci-scripts/cls_cots_ue.py +++ b/ci-scripts/cls_cots_ue.py @@ -31,7 +31,8 @@ import logging #to create a SSH object locally in the methods import sshconnection - +#time.sleep +import time class CotsUe: def __init__(self,model,UEIPAddr,UEUserName,UEPassWord): @@ -47,9 +48,8 @@ class CotsUe: #-----------------$ def Check_Airplane(self): - mySSH = sshconnection.SSHConnection() + mySSH = sshconnection.SSHConnection() mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord) - 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) mySSH.close() @@ -57,7 +57,11 @@ class CotsUe: 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() if target_state_str.lower()=="on": target_state=1 @@ -65,11 +69,8 @@ class CotsUe: target_state=0 if current_state != target_state: #toggle state - mySSH = sshconnection.SSHConnection() - mySSH.open(self.UEIPAddr, self.UEUserName, self.UEPassWord) retry = 0 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 input keyevent 20', '\$', 5) mySSH.command('sudo ./adb shell input tap 968 324', '\$', 5) @@ -79,10 +80,10 @@ class CotsUe: if current_state != target_state: print("ATTENTION : Could not toggle to : "+target_state_str) print("Current state is : "+ str(current_state)) - mySSH.close() else: print("Airplane mode is already "+ target_state_str) - + mySSH.command('sudo ./adb kill-server','$',5) + mySSH.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index d1103be3f2a66af34d8492680ecf0bb12d901b0e..521cd3aa5127c3be73b81d4642e317942bd18c98 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -50,6 +50,7 @@ logging.basicConfig( format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s" ) +import cls_cots_ue #----------------------------------------------------------- # Class Declaration @@ -3063,7 +3064,7 @@ class OaiCiTest(): logging.debug('\u001B[1m----------------------------------------\u001B[0m') 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) return False return True @@ -3238,7 +3239,6 @@ def GetParametersFromXML(action): ldpc.runargs = test.findtext('physim_run_args') if action == 'COTS_UE_Airplane': - COTS_UE=CotsUe('oppo', self.UEIPAddress, self.UEUserName,UEPassword) COTS_UE.runargs = test.findtext('cots_ue_airplane_args') #check if given test is in list @@ -3278,7 +3278,6 @@ RAN.EpcObj=EPC 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 -import cls_cots_ue #class CotsUe argvs = sys.argv @@ -3450,6 +3449,12 @@ while len(argvs) > 1: HELP.GenericHelp(CONST.Version) 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 RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '': HELP.GenericHelp(CONST.Version) @@ -3754,6 +3759,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re if ldpc.exitStatus==1:sys.exit() elif action == 'Run_PhySim': HTML=ldpc.Run_PhySim(HTML,CONST,id) + elif action == 'COTS_UE_Airplane': + COTS_UE.Set_Airplane(COTS_UE.runargs) else: sys.exit('Invalid action') CiTestObj.FailReportCnt += 1 diff --git a/ci-scripts/xml_files/fr1_toggle_cots_ue.xml b/ci-scripts/xml_files/fr1_toggle_cots_ue.xml index 8271d333e23533511c03990f799e21400fbb1675..371063c791e9db8837a99233d6ed6782b640091d 100644 --- a/ci-scripts/xml_files/fr1_toggle_cots_ue.xml +++ b/ci-scripts/xml_files/fr1_toggle_cots_ue.xml @@ -31,7 +31,7 @@ <testCase id="010101"> <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> </testCase>