From cb650a1a6e23a324901113221df3900c961ca2cd Mon Sep 17 00:00:00 2001 From: Remi Hardy <remi.hardy@openairinterface.org> Date: Thu, 3 Sep 2020 11:54:18 +0200 Subject: [PATCH] v0.2 integrating the new cots control procedure into the existing framework --- ci-scripts/cls_cots_ue.py | 11 ++++ ci-scripts/cots_ue_ctl.yaml | 8 +-- ci-scripts/main.py | 78 ++++++++++++++++++------ ci-scripts/xml_files/fr1_ran_ue_proc.xml | 26 +++++++- 4 files changed, 97 insertions(+), 26 deletions(-) diff --git a/ci-scripts/cls_cots_ue.py b/ci-scripts/cls_cots_ue.py index 08f55e91ac..42bf84d466 100644 --- a/ci-scripts/cls_cots_ue.py +++ b/ci-scripts/cls_cots_ue.py @@ -57,6 +57,17 @@ class CotsUe: mySSH.close() return status + #simply check if the device id exists in the dictionary + #returns true if it exists, false otherwise + def Check_Exists(self,target_id): + #load cots commands dictionary + with open(self.__cots_cde_dict_file,'r') as file: + cots_ue_ctl = yaml.load(file,Loader=yaml.FullLoader) + #check if ue id is in the dictionary + if target_id in cots_ue_ctl: + return True + else: + return False def Set_Airplane(self, target_id, target_state_str): #load cots commands dictionary diff --git a/ci-scripts/cots_ue_ctl.yaml b/ci-scripts/cots_ue_ctl.yaml index 517030bd94..dda6e0f51b 100644 --- a/ci-scripts/cots_ue_ctl.yaml +++ b/ci-scripts/cots_ue_ctl.yaml @@ -1,20 +1,20 @@ -oppo: +9283sdfas7: #oppo - adb shell input keyevent KEYCODE_POWER - adb shell input swipe 300 700 300 0 - adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS - adb shell input keyevent 20 - adb shell input tap 968 324 -s10: +002: #s10 - adb shell input keyevent KEYCODE_POWER - adb shell input swipe 200 900 200 300 - adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS - adb shell input tap 968 324 -s20: +003: #s20 - adb shell input keyevent KEYCODE_POWER - adb shell input swipe 200 900 200 300 - adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS - adb shell input tap 968 324 -xperia: +004: #xperia - tbd - tbd - tbd diff --git a/ci-scripts/main.py b/ci-scripts/main.py index f237d2b0f5..ba1156e744 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -285,21 +285,29 @@ class OaiCiTest(): SSH.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) SSH.close() return - # enable data service - SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "svc data enable"', '\$', 60) - - # The following commands are deprecated since we no longer work on Android 7+ - # SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell settings put global airplane_mode_on 1', '\$', 10) - # SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true', '\$', 60) - # a dedicated script has to be installed inside the UE - # airplane mode on means call /data/local/tmp/off - if device_id == '84B7N16418004022': - SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) - else: - SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) - #airplane mode off means call /data/local/tmp/on - logging.debug('\u001B[1mUE (' + device_id + ') Initialize Completed\u001B[0m') - SSH.close() + + #RH quick add-on to integrate cots control defined by yaml + #if device_id exists in yaml dictionary, we execute the new procedure defined in cots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode ON (ie Radio OFF) + COTS_UE.Set_Airplane(device_id, 'ON') + else + # enable data service + SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "svc data enable"', '\$', 60) + + # The following commands are deprecated since we no longer work on Android 7+ + # SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell settings put global airplane_mode_on 1', '\$', 10) + # SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true', '\$', 60) + # a dedicated script has to be installed inside the UE + # airplane mode on means call /data/local/tmp/off + if device_id == '84B7N16418004022': + SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + else: + SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) + #airplane mode off means call /data/local/tmp/on + logging.debug('\u001B[1mUE (' + device_id + ') Initialize Completed\u001B[0m') + SSH.close() except: os.kill(os.getppid(),signal.SIGUSR1) @@ -790,7 +798,13 @@ class OaiCiTest(): try: SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) if self.ADBCentralized: - if device_id == '84B7N16418004022': + #RH quick add on to integrate cots control defined by yaml + #if device Id exists in yaml dictionary, we execute the new procedure defined in cots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode OFF (ie Radio ON) + COTS_UE.Set_Airplane(device_id, 'OFF') + elif device_id == '84B7N16418004022': SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) else: SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) @@ -827,7 +841,13 @@ class OaiCiTest(): if count == 15 or count == 30: logging.debug('\u001B[1;30;43m Retry UE (' + device_id + ') Flight Mode Off \u001B[0m') if self.ADBCentralized: - if device_id == '84B7N16418004022': + #RH quick add on to intgrate cots control defined by yaml + #if device id exists in yaml dictionary, we execute the new procedure defined in cots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode ON (ie Radio OFF) + COTS_UE.Set_Airplane(device_id, 'ON') + elif device_id == '84B7N16418004022': SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) else: SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) @@ -835,7 +855,13 @@ class OaiCiTest(): SSH.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) time.sleep(0.5) if self.ADBCentralized: - if device_id == '84B7N16418004022': + #RH quick add on to integrate cots control defined by yaml + #if device id exists in yaml dictionary, we execute the new procedre defined incots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode OFF (ie Radio ON) + COTS_UE.Set_Airplane(device_id, 'OFF') + elif device_id == '84B7N16418004022': SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) else: SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) @@ -918,7 +944,13 @@ class OaiCiTest(): try: SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) if self.ADBCentralized: - if device_id == '84B7N16418004022': + #RH quick add on to integrate cots control defined by yaml + #if device id exists in yaml dictionary, we execute the new procedure defined in cots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode ON (ie Radio OFF) + COTS_UE.Set_Airplane(device_id,'ON') + elif device_id == '84B7N16418004022': SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) else: SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) @@ -2697,7 +2729,13 @@ class OaiCiTest(): SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) # back in airplane mode on (ie radio off) if self.ADBCentralized: - if device_id == '84B7N16418004022': + #RH quick add on to intgrate cots control defined by yaml + #if device Id exists in yaml dictionary, we execute the new procedure defined in cots_ue class + #otherwise we use the legacy procedure + if COTS_UE.Check_Exists(device_id): + #switch device to Airplane mode ON (ie Radio OFF) + COTS_UE.Set_Airplane(device_id, 'ON') + elif device_id == '84B7N16418004022': SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) else: SSH.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) diff --git a/ci-scripts/xml_files/fr1_ran_ue_proc.xml b/ci-scripts/xml_files/fr1_ran_ue_proc.xml index 355bbe0698..53ca2c9853 100644 --- a/ci-scripts/xml_files/fr1_ran_ue_proc.xml +++ b/ci-scripts/xml_files/fr1_ran_ue_proc.xml @@ -28,15 +28,37 @@ 010000 030000 040000 - 020000 + 010001 000001 050000 070001 070000 - + 010002 + 010003 </TestCaseRequestedList> <TestCaseExclusionList></TestCaseExclusionList> + <testCase id="010000"> + <class>Initialize_UE</class> + <desc>Initialize UE</desc> + </testCase> + + <testCase id="010003"> + <class>Terminate_UE</class> + <desc>Terminate UE</desc> + </testCase> + + <testCase id="010001"> + <class>Attach_UE</class> + <desc>Attach UE</desc> + </testCase> + + <testCase id="010002"> + <class>Detach_UE</class> + <desc>Detach UE</desc> + </testCase> + + <testCase id="010000"> <class>COTS_UE_Airplane</class> <desc>Toggle COTS Airplane mode ON</desc> -- 2.26.2