def tear_down(self):
        """
        Tear down function
        """
        UseCaseBase.tear_down(self)

        return Global.SUCCESS, "No errors"
Esempio n. 2
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call use case base tear_down function
        UseCaseBase.tear_down(self)

        try:
            # Activate the flight mode.
            self._networking_api.set_flight_mode("on")
        except:
            pass

        # Set cell off
        self._ns_cell_2g.set_cell_off()

        # Disconnect from equipment
        self._ns.release()

        # Clear old SMS (Non blocking for this test if function isn't
        # implemented on CDK)
        time.sleep(self._wait_btwn_cmd)
        self._messaging_api.delete_all_sms()

        return Global.SUCCESS, "No errors"
Esempio n. 3
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # restore default P2P configuration
        self._nfc_api.set_default_nfc_p2p_configuration()

        LabNfcBase.tear_down(self)

        # In case of failure, restore robot initial position
        self._robot_positioning("null", "null", self._antenna_up, "null")

        if self._direction == "SEND":
            # delete contact
            self._contacts_api.contact_delete(
                self._nfc_tool.CONTACT_EXPECTED_BY_EMULATOR)
            # check contact is removed
            contact_count = self._contacts_api.check_contact_in_list(
                self._nfc_tool.CONTACT_EXPECTED_BY_EMULATOR)

            if contact_count is not "0":
                self._logger.error("Contact has not been removed!")
                raise DeviceException(DeviceException.OPERATION_FAILED,
                                      "Error deleting contact")

        return Global.SUCCESS, "No errors"
Esempio n. 4
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # restore original wifi band
        if self._original_band_selection is not None:
            self._logger.info("Setting band back to %s" %
                              self._original_band_selection)
            self._networking_api.set_wifi_frequency_band(
                self._original_band_selection, False, self._dut_wlan_iface)

        # Turn Wifi interface ON
        self._networking_api.set_wifi_power("off")
        sleep(self._wait_btwn_cmd)

        # If Bt to be (de-)activated for FIT tests
        if self._bt_fit_used:

            bt_final_status = self._localconnectivity_api.get_bt_power_status()

            # if Bt is not at the initial value, set it to the correct one.
            if bt_final_status != self._bt_initial_state:
                # restore Bt in initial state
                self._localconnectivity_api.set_bt_power(
                    self._bt_initial_state)
                time.sleep(self._wait_btwn_cmd)

        return Global.SUCCESS, "No error"
Esempio n. 5
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # stop sniffing
        if self._sniffer:
            if self._capture:
                self._sniffer.stop_capture(self.test_ok)
            self._sniffer.release()

        # Reset the Frequency Band parameter to "auto"
        self._networking_api.set_wifi_frequency_band("auto", False,
                                                     self._dut_wlan_iface)
        self._networking_api.set_wifi_power("off")

        # Disable radio for all Wifi APs
        self._disable_all_radios()

        # If Bt to be (de-)activated for FIT tests
        if self._bt_fit_used:

            bt_final_status = self._localconnectivity_api.get_bt_power_status()

            # if Bt is not at the initial value, set it to the correct one.
            if bt_final_status != self._bt_initial_state:
                # restore Bt in initial state
                self._localconnectivity_api.set_bt_power(
                    self._bt_initial_state)
                time.sleep(self._wait_btwn_cmd)

        return Global.SUCCESS, "No errors"
Esempio n. 6
0
    def tear_down(self):
        """
        End and dispose the test
        """
        # Call UseCaseBase tear_down function
        UseCaseBase.tear_down(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()

        # Release any previous call (Robustness)
        self._voice_call_api.release()
        self._voice_call_api2.release()

        # Reset Voice Call Volume at 70%
        if self._system_api is not None:
            self._system_api.adjust_specified_stream_volume("VoiceCall", 70)
        if self._system_api2 is not None:
            self._system_api2.adjust_specified_stream_volume("VoiceCall", 70)

        return Global.SUCCESS, "No errors"
Esempio n. 7
0
    def tear_down(self):
        """
        Disposes this test.
        """
        # Run the inherited 'tear_down' method
        UseCaseBase.tear_down(self)

        #
        # Now configure the platform in order to dispose the test
        #

        # Remount the device's filesystem
        self.phone_wrapper.remount()

        # Push back the original configuration file on the target
        self._device.push(
            self._config_mmgr_file_backup,
            self._config_scalability_path + self._config_mmgr_file, 10)

        # Reboot the DUT if needed
        if self.phone_wrapper.is_reboot_advised:
            self.phone_wrapper.reboot()

        # Delete the local files
        self._logger.debug("Removing local files.")
        os.unlink(self.PLATFORM_CONF_FILE)
        os.unlink(self._platform_config_file)
        os.unlink(self._config_mmgr_file)
        os.unlink(self._config_mmgr_file_backup)

        # Return the verdict
        return Global.SUCCESS, "No error."
    def tear_down(self):
        """
        End and dispose the test
        """
        # call tear down after some operations
        UseCaseBase.tear_down(self)

        # stop camera
        self.camera_api.shutdown()
        time.sleep(self._wait_btwn_cmd)

        # set brightness mode to automatic
        self.phonesystem_api.set_brightness_mode("automatic")
        time.sleep(self._wait_btwn_cmd)

        # set initial sleep timeout
        self.phonesystem_api.set_screen_timeout(
            self._initial_seleep_timeout_value)
        time.sleep(self._wait_btwn_cmd)

        # lock the screen
        self.phonesystem_api.set_phone_lock(1)
        time.sleep(self._wait_btwn_cmd)

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        Disposes this test.
        """
        # Call the inherited tear_down method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            LiveLteImsReg.tear_down(self)
        else:
            UseCaseBase.tear_down(self)

        # Clear old SMS (Non blocking for this test if function isn't
        # implemented on CDK)
        time.sleep(self._wait_btwn_cmd)
        self._sms_api.delete_all_sms()

        # Delete remaining FTP transfered files from DUT
        self._delete_file_if_exists(self._absolute_path_on_dut)

        # Stop the ftp transfer if was not stopped succesfully
        self._ftp_api.stop_ftp(self._dl_id)

        # End of tear_down
        return (Global.SUCCESS, "No errors")
    def tear_down(self):
        """
        End and dispose the test
        """
        # Call use case base tear_down function
        UseCaseBase.tear_down(self)

        # Close the browser
        self._networking_api.close_web_browser(self._browser_type)
        time.sleep(self._wait_btwn_cmd)

        if self._save_directory_host != None:
            self._logger.info("Move screenrecord to save directory on host.")
            report_path = self._device.get_report_tree().get_report_path()
            shutil.move(os.path.join(report_path, self._save_folder),
                        self._save_directory_host)

        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Sets brightness to automatic mode")
        self._phone_system_api.set_brightness_mode("automatic")

        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Turn off the display")
        self._phone_system_api.display_off()

        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Lock the screen after image display...")
        self._phone_system_api.set_phone_lock(1)

        return (Global.SUCCESS, "No errors")
Esempio n. 11
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # Put display off.
        self._phone_system_api.display_off()

        # Set wifi power to off
        time.sleep(self._wait_btwn_cmd)
        self._networking_api.set_wifi_power("off")

        # Disable radio for all Wifi APs
        self._disable_all_radios()

        # If BT has to be (de-)activated for FIT tests
        if self._bt_fit_used:

            bt_final_status = self._localconnectivity_api.get_bt_power_status()

            # if Bt is not at the initial value, set it to the correct one.
            if bt_final_status != self._bt_initial_state:
                # restore Bt in initial state
                self._localconnectivity_api.set_bt_power(self._bt_initial_state)
                time.sleep(self._wait_btwn_cmd)

        return Global.SUCCESS, "No errors"
Esempio n. 12
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        output_message = "No errors"
        # Restore the current target sim
        self._device.set_target_sim(self._initial_target_sim)

        # Check whether we had to change the PDP context status
        # If initially deactivated, deactivate it
        if self._initial_pdp_context_status == "2":
            # Then deactivate PDP context status
            self._networking_api.deactivate_pdp_context()

        # If value as been set on tc parameters, restore initial data sim
        # in order to avoid disturbing next tests
        if self._restore_initial:
            self._logger.info("Restore default data sim as SIM%s " %
                              (str(self._initial_target_sim)))
            self._do_set_data_sim(self._initial_target_sim)
        else:
            # Otherwise the default data sim will stay one configured in this tc
            # even after reboot, this may not affect most of test, but should be
            # taken into account.
            self._logger.warning(
                "Will not restore initial data SIM, next tests"
                " will use SIM%s as default data SIM !" %
                (str(self._target_sim)))
            output_message = "SIM%s remain default data SIM" \
                % (str(self._target_sim))
        return Global.SUCCESS, output_message
Esempio n. 13
0
    def tear_down(self):
        """
        tear down is here to clean your test for next testcase
        put here final cleaning like:
        - equipment release
        - board charging

        """
        # Call the UseCaseBase tear down function
        UseCaseBase.tear_down(self)
        self.em_core_module.tear_down()

        # sink last measurement and reset meas_dict
        self._em_meas_verdict.compare_list(self._meas_list, self._em_targets,
                                           True)
        self._em_meas_verdict.judge()

        # feed awr secondary reports
        result = self._em_meas_verdict.get_local_result_v2()
        self._secondary_report.add_result_from_dict(result, self.get_name(),
                                                    self.tc_order)
        # feed TCR
        LiveReporting.instance().update_running_tc_info(test_info=result)

        if self.tc_module is not None and self.tc_module.is_default_test():
            self.tc_module.release_eq()

        return Global.SUCCESS, "No errors"
Esempio n. 14
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # Handle LOng LAsting test
        if self._lola_test:
            self.__disconnect()

        # Disable BT tethering
        self._nap_api.set_bt_tethering_power("0")

        # Bluetooth unpairing
        self._logger.info("Unpair both devices")
        self._bt_api.unpair_bt_device(self._phone2_addr)
        self._bt_api2.unpair_bt_device(self._phone1_addr)

        # Disconnect and clear WiFi networks
        if self._connection_to_share == "WIFI":
            self._wifi_api.wifi_remove_config("all")
            self._wifi_api.set_wifi_power("off")

        LiveDualPhoneBTBase.tear_down(self)

        return Global.SUCCESS, "No errors"
Esempio n. 15
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call UseCaseBase Tear down
        UseCaseBase.tear_down(self)

        # deactivate PDP context
        self._networking_api.clean_all_data_connections()

        try:
            # Avoid exception during tear down
            # Set Flight Mode On
            self._networking_api.set_flight_mode("on")
        except:
            pass

        # Set Cell OFF
        self._ns_cell_3g.set_cell_off()

        # Clear UE Info
        self._ns_cell_3g.clear_ue_info()

        # Disconnect Equipment
        self._ns.release()

        return Global.SUCCESS, "No errors"
Esempio n. 16
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call UseCaseBase Tear down
        UseCaseBase.tear_down(self)

        try:
            # Avoid exception during tear down
            # For instance on windows platforms set_flight_mode
            # use UI code, it can throw an exception if we are on the wrong window
            # Reset roaming flag
            if self._wanted_reg_state == "roaming":
                self._networking_api.set_roaming_mode("OFF")

            # Set Flight Mode On
            self._networking_api.set_flight_mode("on")
        except:
            pass

        # Disable IMS service if it was activated in the set_up
        if self._ims == "on":
            self._ns_cell_4g.set_ims_off()

        # Set cell off
        self._ns_cell_4g.set_cell_off()

        # Disconnect Equipment
        self._ns.release()

        return Global.SUCCESS, "No errors"
Esempio n. 17
0
    def tear_down(self):
        """
        Set the device to its original state :
        """
        # Run the inherited 'tear_down' method
        UseCaseBase.tear_down(self)

        # Disable SIM lock system if needed
        # check parameter self.__current_pin_code
        if self.__pin_code is None:
            raise DeviceException(
                       DeviceException.PROHIBITIVE_BEHAVIOR,
                       "Disable SIM lock system cancelled for preventing"
                       "SIM to be locked (PUK required)")

        # Disable SIM lock system if needed
        is_enabled = self.sim_card_api.get_sim_lock_state()
        if is_enabled:
            self.sim_card_api.disable_sim_lock_system(self.__pin_code)
            # Check that SIM lock system is disabled
            is_enabled = self.sim_card_api.get_sim_lock_state()
            if is_enabled:
                raise DeviceException(DeviceException.OPERATION_FAILED,
                            "Disabling SIM lock system has failed")

        # tear down has been successful
        return Global.SUCCESS, "No error"
    def tear_down(self):
        """
        End and dispose the test
        """
        # Call use case base tear_down function
        UseCaseBase.tear_down(self)

        # Stop Run Run 3d
        self._logger.info("Stopping Run Run 3D ...")
        self.__multimedia_api.stop_run_run_3d()
        time.sleep(self._wait_btwn_cmd)

        # Put the PDP_CONTEXT on its original state
        if self.__initial_pdp_context_status not in ("0", "2"):
            # Then activate PDP context status
            self.__networking_api.activate_pdp_context()
            time.sleep(self._wait_btwn_cmd)

        # Put wifi on its original state
        self.__networking_api.set_wifi_power(self.__initial_wifi_status)
        time.sleep(self._wait_btwn_cmd)

        # Remove video recorded
        self._logger.info("Removing : %s", self.__local_video_file)
        os.remove(self.__local_video_file)

        return Global.SUCCESS, "No errors"
Esempio n. 19
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call power measurement base tear_down function
        UseCaseBase.tear_down(self)

        # Call pc_audio_record_stop in tear_down, to make sure UC release system resource
        time.sleep(float(self._wait_btwn_cmd))
        self._logger.info("Stop recording on pc...")
        self._audio_recorder_api.pc_audio_record_stop()

        # Set cell off
        self._ns_cell_2g.set_cell_off()

        # DisConnect from equipment
        self._ns.release()

        # set the original silent mode and vibrate mode and audio output
        if (self._silent_enable not in (None, "none")) and \
                (self._vibra_mode not in (None, "none")):
            self._phonesystem_api.set_silent_vibrate(
                self._original_silent_vibrate.split('+')[0],
                self._original_silent_vibrate.split('+')[1])
        if self._audio_output not in (None, "none"):
            self._phonesystem_api.switch_audio_output(
                self._origianl_audio_output)

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        tear down
        """
        UseCaseBase.tear_down(self)
        #Set the orientation in final orientation
        self._display_api.set_display_orientation(self._final_orientation)

        if self._screenshot_state:
            #Delete screenshot on the host
            self._logger.info("Delete the screenshot on host.")
            os.remove(self._screenshot_path)

        # set initial sleep timeout
        self._phonesystem_api.set_screen_timeout(self._initial_sleep_timeout_value)
        time.sleep(self._wait_btwn_cmd)

        # Force home screen
        self._keyevent_api.back()
        self._keyevent_api.home()

        # lock the screen
        self._phonesystem_api.set_phone_lock(1)
        time.sleep(self._wait_btwn_cmd)
        self._keyevent_api.power_button()


        return Global.SUCCESS, "No errors"
Esempio n. 21
0
    def tear_down(self):
        """
        tear down
        """
        UseCaseBase.tear_down(self)

        # set initial sleep timeout
        self._phonesystem_api.set_screen_timeout(
            self._initial_sleep_timeout_value)
        time.sleep(self._wait_btwn_cmd)

        #Set the orientation in auto mode
        self._display_api.set_display_orientation("auto")

        # Force home screen
        self._keyevent_api.back()
        self._keyevent_api.back()
        self._keyevent_api.back()
        self._keyevent_api.home()

        # lock the screen
        self._phonesystem_api.set_phone_lock(1)
        time.sleep(self._wait_btwn_cmd)
        self._keyevent_api.power_button()

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # restore original flight mode
        time.sleep(self._wait_btwn_cmd)
        self._networking_api.set_flight_mode(self._original_flight_mode)

        # restore original wifi power status
        time.sleep(self._wait_btwn_cmd)
        self._networking_api.set_wifi_power(self._original_wifi_power_status)

        # If Bt to be (de-)activated for FIT tests
        if self._bt_fit_used:

            bt_final_status = self._localconnectivity_api.get_bt_power_status()

            # if Bt is not at the initial value, set it to the correct one.
            if bt_final_status != self._bt_initial_state:
                # restore Bt in initial state
                self._localconnectivity_api.set_bt_power(self._bt_initial_state)
                time.sleep(self._wait_btwn_cmd)

        return Global.SUCCESS, "No error"
Esempio n. 23
0
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        if self._isConnectionNeeded:
            # Clean AP's ACL list
            self._ns.init()
            time.sleep(self._wait_btwn_cmd)

            self._ns.del_mac_address_from_acl(str(self._expected_mac_address))
            time.sleep(self._wait_btwn_cmd)
            self._ns.disable_wireless()

            self._ns.release()

            # Clean DUT
            self._networking_api.wifi_remove_config(self._ssid)
            time.sleep(self._wait_btwn_cmd)

        self._networking_api.set_wifi_power("off")

        # Restore genuine mac_address.
        if self._start_mac_address:
            self._logger.info("Restoring genuine MAC address.")
            self._set_mac_addr(self._start_mac_address)
        else:
            self._logger.error("Genuine MAC address not stored. Can't restore.")

        # Disable radio for all Wifi APs
        self._disable_all_radios()

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        End and dispose the test
        """
        UseCaseBase.tear_down(self)

        # Close web browser
        self.__networking_api.close_web_browser(self.__browser_type)
        time.sleep(self._wait_btwn_cmd)

        # Release the call
        self.__voicecall_api.release()
        time.sleep(self._wait_btwn_cmd)

        # Put the PDP_CONTEXT on his original state
        if self.__initial_pdp_context_status in ("0", "2"):
            # Then desactivate PDP context status
            self.__networking_api.deactivate_pdp_context()
            time.sleep(self._wait_btwn_cmd)

        # Set initial network state if it has been updated
        if self.__network_type_updated:
            self.__networking_api.set_preferred_network_type(
                self.__initial_pref_network)
            time.sleep(self._wait_btwn_cmd)

        # Set the initial flight mode
        self.__networking_api.set_flight_mode(self.__initial_flight_mode_state)
        time.sleep(self._wait_btwn_cmd)

        return (Global.SUCCESS, "No errors")
    def tear_down(self):
        """
        End and dispose the test
        """

        # to have a log "We enter into the tear_down"
        UseCaseBase.tear_down(self)

        # Clean the notification list
        if self._receiver_api is not None:
            self._receiver_api.bt_opp_clean_notification_list()
        if self._sender_api is not None:
            self._sender_api.bt_opp_clean_notification_list()

        self._file_cleanup()

        # lock screen and set display OFF
        self._sender_phonesys_api.set_phone_lock(1)
        self._sender_phonesys_api.display_off()

        # Process the bidirectional transfer
        if self._is_bidirectional:
            self._receiver_phonesys_api.set_phone_lock(1)
            self._receiver_phonesys_api.display_off()

        # Switch OFF BT at the end
        LiveDualPhoneBTBase.tear_down(self)

        return Global.SUCCESS, "No errors"
Esempio n. 26
0
    def tear_down(self):
        """
        End and dispose the test
        """
        # pylint: disable=E1101
        UseCaseBase.tear_down(self)
        time.sleep(self._wait_btwn_cmd)

        # turn off bluetooth
        self._logger.info("Turn off Bluetooth adapters")
        self._bt_api.set_bt_power("off")
        time.sleep(self._wait_btwn_cmd)
        if self._bt_api.get_bt_power_status() != str(BT_STATE.STATE_OFF):
            msg = "set BT OFF failure"
            self._logger.error(msg)
            raise DeviceException(DeviceException.OPERATION_FAILED, msg)

        if self._prov_mode != "no_prov":
            self._logger.info("Restore default BD address")
            # 1. Write null addr into chaabi
            self._bt_api.set_mac_addr('bt', LocalConnectivityUtil.NULL_ADDRESS)
            # 2. reboot
            self._device.reboot()

        return Global.SUCCESS, "No errors"
Esempio n. 27
0
    def tear_down(self):
        """
        Disposes this test.
        """
        # Call the inherited tear_down method
        UseCaseBase.tear_down(self)

        # Initialize some local variables
        message = ""
        verdict = Global.SUCCESS
        #to reset the watcher list
        self.d.watchers.reset()
        # Log a message indicating that LIRwe are enter int the tear down step
        self._logger.info("Starting tear down operations")
        # Release the call for secondary DUT (Robustness only)
        try:
            self._voice_call_api2.release()
            self._voice_call_api.release()
        except DeviceException as device_ex:
            self._logger.warning("Error in tear down step: %s" % str(device_ex))

        # Supplementary Service de-activation
        try:
            (verdict, message) = self._deactivate_ss_feature()
        except DeviceException as device_ex:
            self._logger.warning("Error in tear down step: %s" % str(device_ex))

        # Return the test result
        return (verdict, message)
Esempio n. 28
0
    def tear_down(self):
        """
        End and dispose the test
        """

        UseCaseBase.tear_down(self)

        return Global.SUCCESS, "No errors"
Esempio n. 29
0
    def tear_down(self):
        UseCaseBase.tear_down(self)
        # Delete xml output file
        self._device.run_cmd("adb shell rm %s" % GTEST_OUTPUT,
                             ADB_RM_FILE_TIMEOUT,
                             silent_mode=True)

        return Global.SUCCESS, "No error"
Esempio n. 30
0
 def tear_down(self):
     """
     End and dispose the test
     """
     UseCaseBase.tear_down(self)
     # Release any previous call (Robustness)
     self._vc_api.release()
     return Global.SUCCESS, "No errors"